/* * @implemented */ ULONG NTAPI HalSetBusDataByOffset(IN BUS_DATA_TYPE BusDataType, IN ULONG BusNumber, IN ULONG SlotNumber, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length) { PBUS_HANDLER Handler; ULONG Status; /* Find the handler */ Handler = HaliReferenceHandlerForConfigSpace(BusDataType, BusNumber); if (!Handler) return 0; /* Do the assignment */ Status = Handler->SetBusData(Handler, Handler, SlotNumber, Buffer, Offset, Length); /* Dereference the handler and return */ HalDereferenceBusHandler(Handler); return Status; }
BOOLEAN NTAPI HaliTranslateBusAddress(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN PHYSICAL_ADDRESS BusAddress, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress) { PBUS_HANDLER Handler; BOOLEAN Status; /* Find the handler */ Handler = HalReferenceHandlerForBus(InterfaceType, BusNumber); if (!(Handler) || !(Handler->TranslateBusAddress)) { DPRINT1("No translator Interface: %x, Bus: %x, Handler: %p, BusAddress: %x!\n", InterfaceType, BusNumber, Handler, BusAddress); return FALSE; } /* Do the assignment */ Status = Handler->TranslateBusAddress(Handler, Handler, BusAddress, AddressSpace, TranslatedAddress); /* Dereference the handler and return */ HalDereferenceBusHandler(Handler); return Status; }
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) { PBUS_HANDLER Handler; NTSTATUS Status; PAGED_CODE(); DPRINT1("Slot assignment for %d on bus %u\n", BusType, BusNumber); /* Find the handler */ Handler = HalReferenceHandlerForBus(BusType, BusNumber); if (!Handler) return STATUS_NOT_FOUND; /* Do the assignment */ Status = Handler->AssignSlotResources(Handler, Handler, RegistryPath, DriverClassName, DriverObject, DeviceObject, SlotNumber, AllocatedResources); /* Dereference the handler and return */ HalDereferenceBusHandler(Handler); return Status; }
VOID PiUnload( IN PDRIVER_OBJECT DriverObject ) /*++ Routine Description: This routine cleans up all of the memory associated with any of the devices belonging to the driver. Arguments: DriverObject - Supplies a pointer to the driver object controling all of the devices. Return Value: None. --*/ { PVOID lockPtr; // // Lock the pageable code section // lockPtr = MmLockPagableCodeSection(PiUnload); ExAcquireFastMutex (&PipMutex); ObDereferenceObject(PipBusExtension->BusHandler->DeviceObject); // // Delete all the device info structures and card info structures // PipInvalidateCards(PipBusExtension); PipDeleteCards(PipBusExtension); // // Finally remove the bus handler reference. // HalDereferenceBusHandler (PipBusExtension->BusHandler); ExReleaseFastMutex (&PipMutex); // // Unlock pageable code section // MmUnlockPagableImageSection(lockPtr); }
/* * @implemented */ ULONG NTAPI HalGetInterruptVector(IN INTERFACE_TYPE InterfaceType, IN ULONG BusNumber, IN ULONG BusInterruptLevel, IN ULONG BusInterruptVector, OUT PKIRQL Irql, OUT PKAFFINITY Affinity) { PBUS_HANDLER Handler; ULONG Vector; PAGED_CODE(); /* Defaults */ *Irql = 0; *Affinity = 0; /* Find the handler */ Handler = HalReferenceHandlerForBus(InterfaceType, BusNumber); if (!Handler) return 0; /* Do the assignment */ Vector = Handler->GetInterruptVector(Handler, Handler, BusInterruptLevel, BusInterruptVector, Irql, Affinity); if ((Vector != IRQ2VECTOR(BusInterruptLevel)) || (*Irql != VECTOR2IRQL(IRQ2VECTOR(BusInterruptLevel)))) { DPRINT1("Returning IRQL %lx, Vector %lx for Level/Vector: %lx/%lx\n", *Irql, Vector, BusInterruptLevel, BusInterruptVector); DPRINT1("Old HAL would've returned IRQL %lx and Vector %lx\n", VECTOR2IRQL(IRQ2VECTOR(BusInterruptLevel)), IRQ2VECTOR(BusInterruptLevel)); } /* Dereference the handler and return */ HalDereferenceBusHandler(Handler); return Vector; }
/* * @implemented */ NTSTATUS NTAPI HalAdjustResourceList(IN PIO_RESOURCE_REQUIREMENTS_LIST *ResourceList) { PBUS_HANDLER Handler; ULONG Status; PAGED_CODE(); /* Find the handler */ Handler = HalReferenceHandlerForBus((*ResourceList)->InterfaceType, (*ResourceList)->BusNumber); if (!Handler) return STATUS_SUCCESS; /* Do the assignment */ Status = Handler->AdjustResourceList(Handler, Handler, ResourceList); /* Dereference the handler and return */ HalDereferenceBusHandler(Handler); return Status; }