X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Fhal%2Fhalx86%2Fgeneric%2Flegacy%2Fbus%2Fbushndlr.c;h=2ab551c610ea6595ff33a4cc45030c360e5a33e3;hp=a3a2390305548a662a8a4a381b97363834b6bfb5;hb=90d92560f434a907c0364686a6891a3b14ec30dc;hpb=cc500cbf5c35f21e3f3820be910f9d9ee561a95b diff --git a/reactos/hal/halx86/generic/legacy/bus/bushndlr.c b/reactos/hal/halx86/generic/legacy/bus/bushndlr.c index a3a23903055..2ab551c610e 100644 --- a/reactos/hal/halx86/generic/legacy/bus/bushndlr.c +++ b/reactos/hal/halx86/generic/legacy/bus/bushndlr.c @@ -201,6 +201,41 @@ HaliReferenceHandlerForConfigSpace(IN BUS_DATA_TYPE ConfigType, return HalpLookupHandler(HalpConfigTable, ConfigType, BusNumber, TRUE); } +PBUS_HANDLER +NTAPI +HalpContextToBusHandler(IN ULONG_PTR ContextValue) +{ + PLIST_ENTRY NextEntry; + PHAL_BUS_HANDLER BusHandler, ThisHandler; + + /* Start lookup */ + NextEntry = HalpAllBusHandlers.Flink; + ThisHandler = CONTAINING_RECORD(NextEntry, HAL_BUS_HANDLER, AllHandlers); + if (ContextValue) + { + /* If the list is empty, quit */ + if (IsListEmpty(&HalpAllBusHandlers)) return NULL; + + /* Otherwise, scan the list */ + BusHandler = CONTAINING_RECORD(ContextValue, HAL_BUS_HANDLER, Handler); + do + { + /* Check if we've reached the right one */ + ThisHandler = CONTAINING_RECORD(NextEntry, HAL_BUS_HANDLER, AllHandlers); + if (ThisHandler == BusHandler) break; + + /* Try the next one */ + NextEntry = NextEntry->Flink; + } while (NextEntry != &HalpAllBusHandlers); + } + + /* If we looped back to the end, we didn't find anything */ + if (NextEntry == &HalpAllBusHandlers) return NULL; + + /* Otherwise return the handler */ + return &ThisHandler->Handler; +} + #ifndef _MINIHAL_ NTSTATUS NTAPI @@ -407,15 +442,8 @@ HalpInitBusHandler(VOID) HalDereferenceBusHandler = HaliDereferenceBusHandler; #endif HalPciAssignSlotResources = HalpAssignSlotResources; - /* FIXME: Fix later */ -#if 0 - HalPciTranslateBusAddress = HaliTranslateBusAddress; + HalPciTranslateBusAddress = HaliTranslateBusAddress; /* PCI Driver can override */ if (!HalFindBusAddressTranslation) HalFindBusAddressTranslation = HaliFindBusAddressTranslation; -#else - /* These should be written by the PCI driver later, but we give defaults */ - HalPciTranslateBusAddress = HalpTranslateBusAddress; - HalFindBusAddressTranslation = HalpFindBusAddressTranslation; -#endif } /* EOF */