3 * Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * PROJECT: ReactOS kernel
22 * FILE: ntoskrnl/io/resource.c
23 * PURPOSE: Hardware resource managment
24 * PROGRAMMER: David Welch (welch@mcmail.com)
29 /* INCLUDES *****************************************************************/
31 #include <ddk/ntddk.h>
34 #include <internal/debug.h>
36 /* GLOBALS *******************************************************************/
38 static CONFIGURATION_INFORMATION
39 SystemConfigurationInformation = {0, 0, 0, 0, 0, 0, 0, FALSE, FALSE};
41 /* FUNCTIONS *****************************************************************/
46 PCONFIGURATION_INFORMATION STDCALL
47 IoGetConfigurationInformation(VOID)
49 return(&SystemConfigurationInformation);
56 IoReportResourceUsage(PUNICODE_STRING DriverClassName,
57 PDRIVER_OBJECT DriverObject,
58 PCM_RESOURCE_LIST DriverList,
60 PDEVICE_OBJECT DeviceObject,
61 PCM_RESOURCE_LIST DeviceList,
63 BOOLEAN OverrideConflict,
64 PBOOLEAN ConflictDetected)
66 * FUNCTION: Reports hardware resources in the
67 * \Registry\Machine\Hardware\ResourceMap tree, so that a subsequently
68 * loaded driver cannot attempt to use the same resources.
70 * DriverClassName - The class of driver under which the resource
71 * information should be stored.
72 * DriverObject - The driver object that was input to the
74 * DriverList - Resources that claimed for the driver rather than
76 * DriverListSize - Size in bytes of the DriverList.
77 * DeviceObject - The device object for which resources should be
79 * DeviceList - List of resources which should be claimed for the
81 * DeviceListSize - Size of the per-device resource list in bytes.
82 * OverrideConflict - True if the resources should be cliamed
83 * even if a conflict is found.
84 * ConflictDetected - Points to a variable that receives TRUE if
85 * a conflict is detected with another driver.
95 IoAssignResources(PUNICODE_STRING RegistryPath,
96 PUNICODE_STRING DriverClassName,
97 PDRIVER_OBJECT DriverObject,
98 PDEVICE_OBJECT DeviceObject,
99 PIO_RESOURCE_REQUIREMENTS_LIST RequestedResources,
100 PCM_RESOURCE_LIST* AllocatedResources)
109 IoQueryDeviceDescription(PINTERFACE_TYPE BusType,
111 PCONFIGURATION_TYPE ControllerType,
112 PULONG ControllerNumber,
113 PCONFIGURATION_TYPE PeripheralType,
114 PULONG PeripheralNumber,
115 PIO_QUERY_DEVICE_ROUTINE CalloutRoutine,
119 OBJECT_ATTRIBUTES ObjectAttributes;
122 L"\\Registry\\Machine\\Hardware\\MultifunctionAdapter\\0";
123 HANDLE BaseKeyHandle;
127 KEY_BASIC_INFORMATION BasicInfo;
131 BaseKeyName = L"\\Registry\\Machine\\Hardware\\MultifunctionAdapter";
132 InitializeObjectAttributes(&ObjectAttributes,
137 Status = ZwOpenKey(&BaseKeyHandle,
138 KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEY,
140 if (!NT_SUCCESS(Status))
148 Status = ZwEnumerateKey(BaseKeyHandle,
154 if (!NT_SUCCESS(Status))
162 return(STATUS_NOT_IMPLEMENTED);
169 IoReportHalResourceUsage(PUNICODE_STRING HalDescription,
170 PCM_RESOURCE_LIST RawList,
171 PCM_RESOURCE_LIST TranslatedList,
175 * Reports hardware resources of the HAL in the
176 * \Registry\Machine\Hardware\ResourceMap tree.
178 * HalDescription: Descriptive name of the HAL.
179 * RawList: List of raw (bus specific) resources which should be
180 * claimed for the HAL.
181 * TranslatedList: List of translated (system wide) resources which
182 * should be claimed for the HAL.
183 * ListSize: Size in bytes of the raw and translated resource lists.
184 * Both lists have the same size.
189 OBJECT_ATTRIBUTES ObjectAttributes;
193 HANDLE ResourcemapKey;
195 HANDLE DescriptionKey;
197 /* Open/Create 'RESOURCEMAP' key. */
198 RtlInitUnicodeStringFromLiteral(&Name,
199 L"\\Registry\\Machine\\HARDWARE\\RESOURCEMAP");
200 InitializeObjectAttributes(&ObjectAttributes,
202 OBJ_CASE_INSENSITIVE | OBJ_OPENIF,
205 Status = NtCreateKey(&ResourcemapKey,
212 if (!NT_SUCCESS(Status))
215 /* Open/Create 'Hardware Abstraction Layer' key */
216 RtlInitUnicodeStringFromLiteral(&Name,
217 L"Hardware Abstraction Layer");
218 InitializeObjectAttributes(&ObjectAttributes,
220 OBJ_CASE_INSENSITIVE | OBJ_OPENIF,
223 Status = NtCreateKey(&HalKey,
230 NtClose(ResourcemapKey);
231 if (!NT_SUCCESS(Status))
234 /* Create 'HalDescription' key */
235 InitializeObjectAttributes(&ObjectAttributes,
237 OBJ_CASE_INSENSITIVE,
240 Status = NtCreateKey(&DescriptionKey,
248 if (!NT_SUCCESS(Status))
251 /* Add '.Raw' value. */
252 RtlInitUnicodeStringFromLiteral(&Name,
254 Status = NtSetValueKey(DescriptionKey,
260 if (!NT_SUCCESS(Status))
262 NtClose(DescriptionKey);
266 /* Add '.Translated' value. */
267 RtlInitUnicodeStringFromLiteral(&Name,
269 Status = NtSetValueKey(DescriptionKey,
275 NtClose(DescriptionKey);