ReactOS 0.4.15-dev-8413-gc1c91f2
bushndlr.c File Reference
#include <hal.h>
#include <debug.h>
Include dependency graph for bushndlr.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

PARRAY NTAPI HalpAllocateArray (IN ULONG ArraySize)
 
VOID NTAPI HalpGrowArray (IN PARRAY *CurrentArray, IN PARRAY *NewArray)
 
PBUS_HANDLER FASTCALL HalpLookupHandler (IN PARRAY Array, IN ULONG Type, IN ULONG Number, IN BOOLEAN AddReference)
 
ULONG NTAPI HalpNoBusData (_In_ PBUS_HANDLER BusHandler, _In_ PBUS_HANDLER RootHandler, _In_ ULONG SlotNumber, _In_ PVOID Buffer, _In_ ULONG Offset, _In_ ULONG Length)
 Handler for buses without configuration space.
 
NTSTATUS NTAPI HalpNoAdjustResourceList (_In_ PBUS_HANDLER BusHandler, _In_ PBUS_HANDLER RootHandler, _Inout_ PIO_RESOURCE_REQUIREMENTS_LIST *pResourceList)
 Handler for buses without configuration space.
 
NTSTATUS NTAPI HalpNoAssignSlotResources (_In_ PBUS_HANDLER BusHandler, _In_ PBUS_HANDLER RootHandler, _In_ PUNICODE_STRING RegistryPath, _In_opt_ PUNICODE_STRING DriverClassName, _In_ PDRIVER_OBJECT DriverObject, _In_opt_ PDEVICE_OBJECT DeviceObject, _In_ ULONG SlotNumber, _Inout_ PCM_RESOURCE_LIST *AllocatedResources)
 Handler for buses without configuration space.
 
VOID FASTCALL HaliReferenceBusHandler (IN PBUS_HANDLER Handler)
 
VOID FASTCALL HaliDereferenceBusHandler (IN PBUS_HANDLER Handler)
 
PBUS_HANDLER FASTCALL HaliHandlerForBus (IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber)
 
PBUS_HANDLER FASTCALL HaliHandlerForConfigSpace (IN BUS_DATA_TYPE ConfigType, IN ULONG BusNumber)
 
PBUS_HANDLER FASTCALL HaliReferenceHandlerForBus (IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber)
 
PBUS_HANDLER FASTCALL HaliReferenceHandlerForConfigSpace (IN BUS_DATA_TYPE ConfigType, IN ULONG BusNumber)
 
PBUS_HANDLER NTAPI HalpContextToBusHandler (IN ULONG_PTR ContextValue)
 
NTSTATUS NTAPI HaliRegisterBusHandler (IN INTERFACE_TYPE InterfaceType, IN BUS_DATA_TYPE ConfigType, IN ULONG BusNumber, IN INTERFACE_TYPE ParentBusType, IN ULONG ParentBusNumber, IN ULONG ExtraData, IN PINSTALL_BUS_HANDLER InstallCallback, OUT PBUS_HANDLER *ReturnedBusHandler)
 
VOID NTAPI HalpInitBusHandler (VOID)
 

Variables

KSPIN_LOCK HalpBusDatabaseSpinLock
 
KEVENT HalpBusDatabaseEvent
 
LIST_ENTRY HalpAllBusHandlers
 
PARRAY HalpBusTable
 
PARRAY HalpConfigTable
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file bushndlr.c.

Function Documentation

◆ HaliDereferenceBusHandler()

VOID FASTCALL HaliDereferenceBusHandler ( IN PBUS_HANDLER  Handler)

Definition at line 182 of file bushndlr.c.

183{
185
186 /* Find and dereference the bus handler */
188 Bus->ReferenceCount--;
189 ASSERT(Bus->ReferenceCount != 0);
190}
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
Definition: acpixf.h:672
#define ASSERT(a)
Definition: mode.c:44
ULONG ReferenceCount
Definition: bus.h:270
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by HalpInitBusHandler().

◆ HaliHandlerForBus()

PBUS_HANDLER FASTCALL HaliHandlerForBus ( IN INTERFACE_TYPE  InterfaceType,
IN ULONG  BusNumber 
)

Definition at line 194 of file bushndlr.c.

196{
197 /* Lookup the interface in the bus table */
199}
PBUS_HANDLER FASTCALL HalpLookupHandler(IN PARRAY Array, IN ULONG Type, IN ULONG Number, IN BOOLEAN AddReference)
Definition: bushndlr.c:76
PARRAY HalpBusTable
Definition: bushndlr.c:20
#define FALSE
Definition: types.h:117
_Must_inspect_result_ _In_ WDFDEVICE _In_ LPCGUID InterfaceType
Definition: wdffdo.h:463
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160

Referenced by HaliRegisterBusHandler(), and HalpInitBusHandler().

◆ HaliHandlerForConfigSpace()

PBUS_HANDLER FASTCALL HaliHandlerForConfigSpace ( IN BUS_DATA_TYPE  ConfigType,
IN ULONG  BusNumber 
)

Definition at line 203 of file bushndlr.c.

205{
206 /* Lookup the configuration in the configuration table */
207 return HalpLookupHandler(HalpConfigTable, ConfigType, BusNumber, FALSE);
208}
PARRAY HalpConfigTable
Definition: bushndlr.c:21

Referenced by HalpInitBusHandler().

◆ HaliReferenceBusHandler()

VOID FASTCALL HaliReferenceBusHandler ( IN PBUS_HANDLER  Handler)

Definition at line 171 of file bushndlr.c.

172{
174
175 /* Find and reference the bus handler */
177 Bus->ReferenceCount++;
178}

Referenced by HalpInitBusHandler().

◆ HaliReferenceHandlerForBus()

PBUS_HANDLER FASTCALL HaliReferenceHandlerForBus ( IN INTERFACE_TYPE  InterfaceType,
IN ULONG  BusNumber 
)

Definition at line 212 of file bushndlr.c.

214{
215 /* Lookup the interface in the bus table, and reference the handler */
217}
#define TRUE
Definition: types.h:120

Referenced by HaliRegisterBusHandler(), and HalpInitBusHandler().

◆ HaliReferenceHandlerForConfigSpace()

PBUS_HANDLER FASTCALL HaliReferenceHandlerForConfigSpace ( IN BUS_DATA_TYPE  ConfigType,
IN ULONG  BusNumber 
)

Definition at line 221 of file bushndlr.c.

223{
224 /* Lookup the configuration in the configuration table and add a reference */
225 return HalpLookupHandler(HalpConfigTable, ConfigType, BusNumber, TRUE);
226}

Referenced by HalGetBusDataByOffset(), and HalSetBusDataByOffset().

◆ HaliRegisterBusHandler()

NTSTATUS NTAPI HaliRegisterBusHandler ( IN INTERFACE_TYPE  InterfaceType,
IN BUS_DATA_TYPE  ConfigType,
IN ULONG  BusNumber,
IN INTERFACE_TYPE  ParentBusType,
IN ULONG  ParentBusNumber,
IN ULONG  ExtraData,
IN PINSTALL_BUS_HANDLER  InstallCallback,
OUT PBUS_HANDLER ReturnedBusHandler 
)

Definition at line 266 of file bushndlr.c.

274{
275 PHAL_BUS_HANDLER Bus, OldHandler = NULL;
276 PHAL_BUS_HANDLER* BusEntry;
277 //PVOID CodeHandle;
278 PARRAY InterfaceArray, InterfaceBusNumberArray, ConfigArray, ConfigBusNumberArray;
279 PBUS_HANDLER ParentHandler;
282
283 /* Make sure we have a valid handler */
285 (ConfigType != ConfigurationSpaceUndefined));
286
287 /* Allocate the bus handler */
289 sizeof(HAL_BUS_HANDLER) + ExtraData,
291 if (!Bus) return STATUS_INSUFFICIENT_RESOURCES;
292
293 /* Return the handler */
294 *ReturnedBusHandler = &Bus->Handler;
295
296 /* FIXME: Fix the kernel first. Don't page us out */
297 //CodeHandle = MmLockPagableDataSection(&HaliRegisterBusHandler);
298
299 /* Synchronize with anyone else */
303 FALSE,
304 NULL);
305
306 /* Check for unknown/root bus */
307 if (BusNumber == -1)
308 {
309 /* We must have an interface */
311
312 /* Find the right bus */
313 BusNumber = 0;
315 }
316
317 /* Allocate arrays for the handler */
318 InterfaceArray = HalpAllocateArray(InterfaceType);
319 InterfaceBusNumberArray = HalpAllocateArray(BusNumber);
320 ConfigArray = HalpAllocateArray(ConfigType);
321 ConfigBusNumberArray = HalpAllocateArray(BusNumber);
322
323 /* Only proceed if all allocations succeeded */
324 if ((InterfaceArray) && (InterfaceBusNumberArray) && (ConfigArray) && (ConfigBusNumberArray))
325 {
326 /* Find the parent handler if any */
327 ParentHandler = HaliReferenceHandlerForBus(ParentBusType, ParentBusNumber);
328
329 /* Initialize the handler */
330 RtlZeroMemory(Bus, sizeof(HAL_BUS_HANDLER) + ExtraData);
331 Bus->ReferenceCount = 1;
332
333 /* Fill out bus data */
336 Bus->Handler.ConfigurationType = ConfigType;
337 Bus->Handler.ParentHandler = ParentHandler;
338
339 /* Fill out dummy handlers */
344
345 /* Make space for extra data */
346 if (ExtraData) Bus->Handler.BusData = Bus + 1;
347
348 /* Check for a parent handler */
349 if (ParentHandler)
350 {
351 /* Inherit the parent routines */
352 Bus->Handler.GetBusData = ParentHandler->GetBusData;
353 Bus->Handler.SetBusData = ParentHandler->SetBusData;
354 Bus->Handler.AdjustResourceList = ParentHandler->AdjustResourceList;
355 Bus->Handler.AssignSlotResources = ParentHandler->AssignSlotResources;
356 Bus->Handler.TranslateBusAddress = ParentHandler->TranslateBusAddress;
357 Bus->Handler.GetInterruptVector = ParentHandler->GetInterruptVector;
358 }
359
360 /* We don't support this yet */
362
363 /* Lock the buses */
365
366 /* Make space for the interface */
367 HalpGrowArray(&HalpBusTable, &InterfaceArray);
368
369 /* Check if we really have an interface */
371 {
372 /* Make space for the association */
374 &InterfaceBusNumberArray);
375
376 /* Get the bus handler pointer */
378
379 /* Check if there was already a handler there, and set the new one */
380 if (*BusEntry) OldHandler = *BusEntry;
381 *BusEntry = Bus;
382 }
383
384 /* Now add a space for the configuration space */
385 HalpGrowArray(&HalpConfigTable, &ConfigArray);
386
387 /* Check if we really have one */
388 if (ConfigType != ConfigurationSpaceUndefined)
389 {
390 /* Make space for this association */
392 &ConfigBusNumberArray);
393
394 /* Get the bus handler pointer */
395 BusEntry = (PHAL_BUS_HANDLER*)&((PARRAY)HalpConfigTable->Element[ConfigType])->Element[BusNumber];
396 if (*BusEntry)
397 {
398 /* Get the old entry, but make sure it's the same we had before */
399 ASSERT((OldHandler == NULL) || (OldHandler == *BusEntry));
400 OldHandler = *BusEntry;
401 }
402
403 /* Set the new entry */
404 *BusEntry = Bus;
405 }
406
407 /* Link the adapter */
409
410 /* Remove the old linkage */
411 Bus = OldHandler;
412 if (Bus) RemoveEntryList(&Bus->AllHandlers);
413
414 /* Release the lock */
417 }
418 else
419 {
420 /* Fail */
422 }
423
424 /* Signal the event */
426
427 /* FIXME: Fix the kernel first. Re-page the function */
428 //MmUnlockPagableImageSection(CodeHandle);
429
430 /* Free all allocations */
431 if (Bus) ExFreePoolWithTag(Bus, TAG_BUS_HANDLER);
432 if (InterfaceArray) ExFreePoolWithTag(InterfaceArray, TAG_BUS_HANDLER);
433 if (InterfaceBusNumberArray) ExFreePoolWithTag(InterfaceBusNumberArray, TAG_BUS_HANDLER);
434 if (ConfigArray) ExFreePoolWithTag(ConfigArray, TAG_BUS_HANDLER);
435 if (ConfigBusNumberArray) ExFreePoolWithTag(ConfigBusNumberArray, TAG_BUS_HANDLER);
436
437 /* And we're done */
438 return Status;
439}
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI HalpNoAdjustResourceList(_In_ PBUS_HANDLER BusHandler, _In_ PBUS_HANDLER RootHandler, _Inout_ PIO_RESOURCE_REQUIREMENTS_LIST *pResourceList)
Handler for buses without configuration space.
Definition: bushndlr.c:133
PBUS_HANDLER FASTCALL HaliReferenceHandlerForBus(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber)
Definition: bushndlr.c:212
PBUS_HANDLER FASTCALL HaliHandlerForBus(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber)
Definition: bushndlr.c:194
KSPIN_LOCK HalpBusDatabaseSpinLock
Definition: bushndlr.c:17
VOID NTAPI HalpGrowArray(IN PARRAY *CurrentArray, IN PARRAY *NewArray)
Definition: bushndlr.c:50
PARRAY NTAPI HalpAllocateArray(IN ULONG ArraySize)
Definition: bushndlr.c:27
ULONG NTAPI HalpNoBusData(_In_ PBUS_HANDLER BusHandler, _In_ PBUS_HANDLER RootHandler, _In_ ULONG SlotNumber, _In_ PVOID Buffer, _In_ ULONG Offset, _In_ ULONG Length)
Handler for buses without configuration space.
Definition: bushndlr.c:111
NTSTATUS NTAPI HalpNoAssignSlotResources(_In_ PBUS_HANDLER BusHandler, _In_ PBUS_HANDLER RootHandler, _In_ PUNICODE_STRING RegistryPath, _In_opt_ PUNICODE_STRING DriverClassName, _In_ PDRIVER_OBJECT DriverObject, _In_opt_ PDEVICE_OBJECT DeviceObject, _In_ ULONG SlotNumber, _Inout_ PCM_RESOURCE_LIST *AllocatedResources)
Handler for buses without configuration space.
Definition: bushndlr.c:151
KEVENT HalpBusDatabaseEvent
Definition: bushndlr.c:18
LIST_ENTRY HalpAllBusHandlers
Definition: bushndlr.c:19
#define NULL
Definition: types.h:112
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define NonPagedPool
Definition: env_spec_w32.h:307
Status
Definition: gdiplustypes.h:25
#define TAG_BUS_HANDLER
Definition: hal.h:62
@ InterfaceTypeUndefined
Definition: hwresource.cpp:136
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define KernelMode
Definition: asm.h:34
@ ConfigurationSpaceUndefined
Definition: miniport.h:88
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: shimeng.h:16
PVOID Element[ANYSIZE_ARRAY]
Definition: bus.h:264
PGETINTERRUPTVECTOR GetInterruptVector
Definition: haltypes.h:248
PGETSETBUSDATA GetBusData
Definition: haltypes.h:244
ULONG BusNumber
Definition: haltypes.h:237
PTRANSLATEBUSADDRESS TranslateBusAddress
Definition: haltypes.h:249
PASSIGNSLOTRESOURCES AssignSlotResources
Definition: haltypes.h:247
BUS_DATA_TYPE ConfigurationType
Definition: haltypes.h:236
struct _BUS_HANDLER * ParentHandler
Definition: haltypes.h:239
PGETSETBUSDATA SetBusData
Definition: haltypes.h:245
INTERFACE_TYPE InterfaceType
Definition: haltypes.h:235
PADJUSTRESOURCELIST AdjustResourceList
Definition: haltypes.h:246
PVOID BusData
Definition: haltypes.h:240
BUS_HANDLER Handler
Definition: bus.h:271
LIST_ENTRY AllHandlers
Definition: bus.h:269
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
@ WrExecutive
Definition: ketypes.h:422

Referenced by HalpInitBusHandler().

◆ HalpAllocateArray()

PARRAY NTAPI HalpAllocateArray ( IN ULONG  ArraySize)

Definition at line 27 of file bushndlr.c.

28{
29 PARRAY Array;
30 ULONG Size;
31
32 /* Compute array size */
33 if (ArraySize == MAXULONG) ArraySize = 0;
34 Size = ArraySize * sizeof(PARRAY) + sizeof(ARRAY);
35
36 /* Allocate the array */
38 Size,
40 if (!Array) KeBugCheckEx(HAL_MEMORY_ALLOCATION, Size, 0, (ULONG_PTR)__FILE__, __LINE__);
41
42 /* Initialize it */
43 Array->ArraySize = ArraySize;
44 RtlZeroMemory(Array->Element, sizeof(PVOID) * (ArraySize + 1));
45 return Array;
46}
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:108
struct _ARRAY * PARRAY
ULONG ArraySize
Definition: bus.h:263
#define MAXULONG
Definition: typedefs.h:251
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

Referenced by HaliRegisterBusHandler(), and HalpInitBusHandler().

◆ HalpContextToBusHandler()

PBUS_HANDLER NTAPI HalpContextToBusHandler ( IN ULONG_PTR  ContextValue)

Definition at line 230 of file bushndlr.c.

231{
232 PLIST_ENTRY NextEntry;
233 PHAL_BUS_HANDLER BusHandler, ThisHandler;
234
235 /* Start lookup */
236 NextEntry = HalpAllBusHandlers.Flink;
237 ThisHandler = CONTAINING_RECORD(NextEntry, HAL_BUS_HANDLER, AllHandlers);
238 if (ContextValue)
239 {
240 /* If the list is empty, quit */
241 if (IsListEmpty(&HalpAllBusHandlers)) return NULL;
242
243 /* Otherwise, scan the list */
244 BusHandler = CONTAINING_RECORD(ContextValue, HAL_BUS_HANDLER, Handler);
245 do
246 {
247 /* Check if we've reached the right one */
248 ThisHandler = CONTAINING_RECORD(NextEntry, HAL_BUS_HANDLER, AllHandlers);
249 if (ThisHandler == BusHandler) break;
250
251 /* Try the next one */
252 NextEntry = NextEntry->Flink;
253 } while (NextEntry != &HalpAllBusHandlers);
254 }
255
256 /* If we looped back to the end, we didn't find anything */
257 if (NextEntry == &HalpAllBusHandlers) return NULL;
258
259 /* Otherwise return the handler */
260 return &ThisHandler->Handler;
261}
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121

Referenced by HaliFindBusAddressTranslation().

◆ HalpGrowArray()

VOID NTAPI HalpGrowArray ( IN PARRAY CurrentArray,
IN PARRAY NewArray 
)

Definition at line 50 of file bushndlr.c.

52{
53 PVOID Tmp;
54
55 /* Check if the current array doesn't exist yet, or if it's smaller than the new one */
56 if (!(*CurrentArray) || ((*NewArray)->ArraySize > (*CurrentArray)->ArraySize))
57 {
58 /* Does it exist (and can it fit?) */
59 if (*CurrentArray)
60 {
61 /* Copy the current array into the new one */
62 RtlCopyMemory(&(*NewArray)->Element,
63 &(*CurrentArray)->Element,
64 sizeof(PVOID) * ((*CurrentArray)->ArraySize + 1));
65 }
66
67 /* Swap the pointers (XOR swap would be more l33t) */
68 Tmp = *CurrentArray;
69 *CurrentArray = *NewArray;
70 *NewArray = Tmp;
71 }
72}
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263

Referenced by HaliRegisterBusHandler().

◆ HalpInitBusHandler()

VOID NTAPI HalpInitBusHandler ( VOID  )

Definition at line 444 of file bushndlr.c.

445{
446 /* Setup the bus lock */
448
449 /* Setup the bus event */
451
452 /* Setup the bus configuration and bus table */
455
456 /* Setup the bus list */
458
459 /* Setup the HAL Dispatch routines */
460#ifndef _MINIHAL_
467#endif
469 HalPciTranslateBusAddress = HaliTranslateBusAddress; /* PCI Driver can override */
471}
BOOLEAN NTAPI HaliFindBusAddressTranslation(IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress, IN OUT PULONG_PTR Context, IN BOOLEAN NextBus)
Definition: bussupp.c:1331
BOOLEAN NTAPI HaliTranslateBusAddress(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress)
Definition: bussupp.c:1413
NTSTATUS NTAPI HalpAssignSlotResources(IN PUNICODE_STRING RegistryPath, IN PUNICODE_STRING DriverClassName, IN PDRIVER_OBJECT DriverObject, IN PDEVICE_OBJECT DeviceObject, IN INTERFACE_TYPE BusType, IN ULONG BusNumber, IN ULONG SlotNumber, IN OUT PCM_RESOURCE_LIST *AllocatedResources)
Definition: busemul.c:45
VOID FASTCALL HaliReferenceBusHandler(IN PBUS_HANDLER Handler)
Definition: bushndlr.c:171
PBUS_HANDLER FASTCALL HaliHandlerForConfigSpace(IN BUS_DATA_TYPE ConfigType, IN ULONG BusNumber)
Definition: bushndlr.c:203
VOID FASTCALL HaliDereferenceBusHandler(IN PBUS_HANDLER Handler)
Definition: bushndlr.c:182
NTSTATUS NTAPI HaliRegisterBusHandler(IN INTERFACE_TYPE InterfaceType, IN BUS_DATA_TYPE ConfigType, IN ULONG BusNumber, IN INTERFACE_TYPE ParentBusType, IN ULONG ParentBusNumber, IN ULONG ExtraData, IN PINSTALL_BUS_HANDLER InstallCallback, OUT PBUS_HANDLER *ReturnedBusHandler)
Definition: bushndlr.c:266
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
#define HalFindBusAddressTranslation
Definition: halfuncs.h:44
#define HalHandlerForBus
Definition: halfuncs.h:35
#define HalRegisterBusHandler
Definition: halfuncs.h:38
#define HalHandlerForConfigSpace
Definition: halfuncs.h:36
#define HalPciTranslateBusAddress
Definition: halfuncs.h:41
#define HalPciAssignSlotResources
Definition: halfuncs.h:42
@ SynchronizationEvent
#define HalDereferenceBusHandler
Definition: haltypes.h:299
#define HalReferenceBusHandler
Definition: haltypes.h:298
#define HalReferenceHandlerForBus
Definition: haltypes.h:297

Referenced by HalpRegisterInternalBusHandlers(), and LoadBootDeviceDriver().

◆ HalpLookupHandler()

PBUS_HANDLER FASTCALL HalpLookupHandler ( IN PARRAY  Array,
IN ULONG  Type,
IN ULONG  Number,
IN BOOLEAN  AddReference 
)

Definition at line 76 of file bushndlr.c.

80{
83
84 /* Make sure the entry exists */
85 if (Array->ArraySize >= Type)
86 {
87 /* Retrieve it */
88 Array = Array->Element[Type];
89
90 /* Make sure the entry array exists */
91 if ((Array) && (Array->ArraySize >= Number))
92 {
93 /* Retrieve the bus and its handler */
94 Bus = Array->Element[Number];
95 Handler = &Bus->Handler;
96
97 /* Reference the handler if needed */
98 if (AddReference) Bus->ReferenceCount++;
99 }
100 }
101
102 /* Return the handler */
103 return Handler;
104}
Type
Definition: Type.h:7
_In_opt_ PENTER_STATE_SYSTEM_HANDLER _In_opt_ PVOID _In_ LONG _In_opt_ LONG volatile * Number
Definition: ntpoapi.h:207

Referenced by HaliHandlerForBus(), HaliHandlerForConfigSpace(), HaliReferenceHandlerForBus(), and HaliReferenceHandlerForConfigSpace().

◆ HalpNoAdjustResourceList()

NTSTATUS NTAPI HalpNoAdjustResourceList ( _In_ PBUS_HANDLER  BusHandler,
_In_ PBUS_HANDLER  RootHandler,
_Inout_ PIO_RESOURCE_REQUIREMENTS_LIST pResourceList 
)

Handler for buses without configuration space.

Definition at line 133 of file bushndlr.c.

137{
138 DPRINT1("STUB Adjustment(Bus %x:%x.%x)\n",
139 BusHandler->InterfaceType,
140 BusHandler->ConfigurationType,
141 BusHandler->BusNumber);
142
143 return STATUS_UNSUCCESSFUL;
144}
#define DPRINT1
Definition: precomp.h:8
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132

Referenced by HaliRegisterBusHandler().

◆ HalpNoAssignSlotResources()

NTSTATUS NTAPI HalpNoAssignSlotResources ( _In_ PBUS_HANDLER  BusHandler,
_In_ PBUS_HANDLER  RootHandler,
_In_ PUNICODE_STRING  RegistryPath,
_In_opt_ PUNICODE_STRING  DriverClassName,
_In_ PDRIVER_OBJECT  DriverObject,
_In_opt_ PDEVICE_OBJECT  DeviceObject,
_In_ ULONG  SlotNumber,
_Inout_ PCM_RESOURCE_LIST AllocatedResources 
)

Handler for buses without configuration space.

Definition at line 151 of file bushndlr.c.

160{
161 DPRINT1("STUB Assignment(Bus %x:%x.%x)\n",
162 BusHandler->InterfaceType,
163 BusHandler->ConfigurationType,
164 BusHandler->BusNumber);
165
167}
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:423

Referenced by HaliRegisterBusHandler().

◆ HalpNoBusData()

ULONG NTAPI HalpNoBusData ( _In_ PBUS_HANDLER  BusHandler,
_In_ PBUS_HANDLER  RootHandler,
_In_ ULONG  SlotNumber,
_In_ PVOID  Buffer,
_In_ ULONG  Offset,
_In_ ULONG  Length 
)

Handler for buses without configuration space.

Definition at line 111 of file bushndlr.c.

118{
119 DPRINT1("STUB GetSetBusData(Bus %x:%x.%x)\n",
120 BusHandler->InterfaceType,
121 BusHandler->ConfigurationType,
122 BusHandler->BusNumber);
123
124 /* Just return a dummy value */
125 return 0;
126}

Referenced by HaliRegisterBusHandler(), and HalpRegisterInternalBusHandlers().

Variable Documentation

◆ HalpAllBusHandlers

◆ HalpBusDatabaseEvent

KEVENT HalpBusDatabaseEvent

Definition at line 18 of file bushndlr.c.

Referenced by HaliRegisterBusHandler(), and HalpInitBusHandler().

◆ HalpBusDatabaseSpinLock

KSPIN_LOCK HalpBusDatabaseSpinLock

Definition at line 17 of file bushndlr.c.

Referenced by HaliRegisterBusHandler(), and HalpInitBusHandler().

◆ HalpBusTable

◆ HalpConfigTable