ReactOS 0.4.15-dev-7918-g2a2556c
halp.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _HAL_BIOS_FRAME
 
struct  _IDTUsageFlags
 
struct  IDTUsage
 
struct  _HalAddressUsage
 
struct  _HALP_ROLLOVER
 

Macros

#define HAL_BUILD_TYPE   ((DBG ? PRCB_BUILD_DEBUG : 0) | PRCB_BUILD_UNIPROCESSOR)
 
#define SYNCH_LEVEL   HalpIrqlSynchLevel
 
#define HAL_APC_REQUEST   0
 
#define HAL_DPC_REQUEST   1
 
#define HAL_PROFILING_INTERVAL   0
 
#define HAL_PROFILING_MULTIPLIER   1
 
#define IDT_REGISTERED   0x01
 
#define IDT_LATCHED   0x02
 
#define IDT_READ_ONLY   0x04
 
#define IDT_INTERNAL   0x11
 
#define IDT_DEVICE   0x21
 
#define HALP_LOW_STUB_SIZE_IN_PAGES   3
 
#define BCD_INT(bcd)    (((bcd & 0xF0) >> 4) * 10 + (bcd & 0x0F))
 
#define INT_BCD(int)    (UCHAR)(((int / 10) << 4) + (int % 10))
 
#define HALP_REVISION_FROM_HACK_FLAGS(x)   ((x) >> 24)
 
#define HALP_REVISION_HACK_FLAGS(x)   ((x) >> 12)
 
#define HALP_HACK_FLAGS(x)   ((x) & 0xFFF)
 
#define HALP_CARD_FEATURE_FULL_DECODE   0x0001
 
#define HALP_CHECK_CARD_REVISION_ID   0x10000
 
#define HALP_CHECK_CARD_SUBVENDOR_ID   0x20000
 
#define HALP_CHECK_CARD_SUBSYSTEM_ID   0x40000
 
#define HalAddressToPde(x)   (PHARDWARE_PTE)MiAddressToPde(x)
 
#define HalAddressToPte(x)   (PHARDWARE_PTE)MiAddressToPte(x)
 

Typedefs

typedef struct _HAL_BIOS_FRAME HAL_BIOS_FRAME
 
typedef struct _HAL_BIOS_FRAMEPHAL_BIOS_FRAME
 
typedef VOID(__cdeclPHAL_SW_INTERRUPT_HANDLER) (VOID)
 
typedef VOID(FASTCALLPHAL_SW_INTERRUPT_HANDLER_2ND_ENTRY) (IN PKTRAP_FRAME TrapFrame)
 
typedef BOOLEAN(NTAPIPHAL_DISMISS_INTERRUPT) (IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
 
typedef struct _IDTUsageFlags IDTUsageFlags
 
typedef struct _HalAddressUsage ADDRESS_USAGE
 
typedef struct _HalAddressUsagePADDRESS_USAGE
 
typedef struct _HALP_ROLLOVER HALP_ROLLOVER
 
typedef struct _HALP_ROLLOVERPHALP_ROLLOVER
 

Functions

BOOLEAN NTAPI HalpDismissIrqGeneric (IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
 
BOOLEAN NTAPI HalpDismissIrq15 (IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
 
BOOLEAN NTAPI HalpDismissIrq13 (IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
 
BOOLEAN NTAPI HalpDismissIrq07 (IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
 
BOOLEAN NTAPI HalpDismissIrqLevel (IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
 
BOOLEAN NTAPI HalpDismissIrq15Level (IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
 
BOOLEAN NTAPI HalpDismissIrq13Level (IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
 
BOOLEAN NTAPI HalpDismissIrq07Level (IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
 
VOID __cdecl HalpHardwareInterruptLevel (VOID)
 
PADAPTER_OBJECT NTAPI HalpAllocateAdapterEx (ULONG NumberOfMapRegisters, BOOLEAN IsMaster, BOOLEAN Dma32BitAddresses)
 
VOID NTAPI HalpRegisterVector (IN UCHAR Flags, IN ULONG BusVector, IN ULONG SystemVector, IN KIRQL Irql)
 
VOID NTAPI HalpEnableInterruptHandler (IN UCHAR Flags, IN ULONG BusVector, IN ULONG SystemVector, IN KIRQL Irql, IN PVOID Handler, IN KINTERRUPT_MODE Mode)
 
VOID NTAPI HalpInitializePICs (IN BOOLEAN EnableInterrupts)
 
VOID __cdecl HalpApcInterrupt (VOID)
 
VOID __cdecl HalpDispatchInterrupt (VOID)
 
PHAL_SW_INTERRUPT_HANDLER __cdecl HalpDispatchInterrupt2 (VOID)
 
DECLSPEC_NORETURN VOID FASTCALL HalpApcInterrupt2ndEntry (IN PKTRAP_FRAME TrapFrame)
 
DECLSPEC_NORETURN VOID FASTCALL HalpDispatchInterrupt2ndEntry (IN PKTRAP_FRAME TrapFrame)
 
 CODE_SEG ("INIT") VOID NTAPI HalpInitializeClock(VOID)
 
VOID __cdecl HalpClockInterrupt (VOID)
 
VOID __cdecl HalpClockIpi (VOID)
 
VOID __cdecl HalpProfileInterrupt (VOID)
 
VOID NTAPI HalpCalibrateStallExecution (VOID)
 
VOID HalpInitPciBus (VOID)
 
VOID HalpInitPhase0 (PLOADER_PARAMETER_BLOCK LoaderBlock)
 
VOID HalpInitPhase1 (VOID)
 
VOID NTAPI HalpFlushTLB (VOID)
 
VOID NTAPI HalpCheckPowerButton (VOID)
 
VOID NTAPI HalpRegisterKdSupportFunctions (VOID)
 
NTSTATUS NTAPI HalpSetupPciDeviceForDebugging (IN PVOID LoaderBlock, IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice)
 
NTSTATUS NTAPI HalpReleasePciDeviceForDebugging (IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice)
 
ULONG64 NTAPI HalpAllocPhysicalMemory (IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN ULONG64 MaxAddress, IN PFN_NUMBER PageCount, IN BOOLEAN Aligned)
 
PVOID NTAPI HalpMapPhysicalMemory64Vista (IN PHYSICAL_ADDRESS PhysicalAddress, IN PFN_COUNT PageCount, IN BOOLEAN FlushCurrentTLB)
 
VOID NTAPI HalpUnmapVirtualAddressVista (IN PVOID VirtualAddress, IN PFN_COUNT NumberPages, IN BOOLEAN FlushCurrentTLB)
 
PVOID NTAPI HalpMapPhysicalMemory64 (IN PHYSICAL_ADDRESS PhysicalAddress, IN PFN_COUNT PageCount)
 
VOID NTAPI HalpUnmapVirtualAddress (IN PVOID VirtualAddress, IN PFN_COUNT NumberPages)
 
NTSTATUS NTAPI HaliHandlePCIConfigSpaceAccess (_In_ BOOLEAN IsRead, _In_ ULONG Port, _In_ ULONG Length, _Inout_ PULONG Buffer)
 
NTSTATUS NTAPI HaliQuerySystemInformation (IN HAL_QUERY_INFORMATION_CLASS InformationClass, IN ULONG BufferSize, IN OUT PVOID Buffer, OUT PULONG ReturnedLength)
 
NTSTATUS NTAPI HaliSetSystemInformation (IN HAL_SET_INFORMATION_CLASS InformationClass, IN ULONG BufferSize, IN OUT PVOID Buffer)
 
BOOLEAN NTAPI HalpBiosDisplayReset (VOID)
 
VOID FASTCALL HalpExitToV86 (PKTRAP_FRAME TrapFrame)
 
VOID __cdecl HalpRealModeStart (VOID)
 
VOID NTAPI HaliHaltSystem (VOID)
 
VOID NTAPI HalpInitializeCmos (VOID)
 
 _Requires_lock_held_ (HalpSystemHardwareLock) UCHAR NTAPI HalpReadCmos(IN UCHAR Reg)
 
 _Acquires_lock_ (HalpSystemHardwareLock) VOID NTAPI HalpAcquireCmosSpinLock(VOID)
 
 _Releases_lock_ (HalpSystemHardwareLock) VOID NTAPI HalpReleaseCmosSpinLock(VOID)
 
VOID NTAPI HalpInitializeLegacyPICs (VOID)
 
NTSTATUS NTAPI HalpOpenRegistryKey (IN PHANDLE KeyHandle, IN HANDLE RootKey, IN PUNICODE_STRING KeyName, IN ACCESS_MASK DesiredAccess, IN BOOLEAN Create)
 
VOID NTAPI HalpGetNMICrashFlag (VOID)
 
BOOLEAN NTAPI HalpGetDebugPortTable (VOID)
 
VOID NTAPI HalpReportSerialNumber (VOID)
 
NTSTATUS NTAPI HalpMarkAcpiHal (VOID)
 
VOID NTAPI HalpBuildAddressMap (VOID)
 
VOID NTAPI HalpReportResourceUsage (IN PUNICODE_STRING HalName, IN INTERFACE_TYPE InterfaceType)
 
ULONG NTAPI HalpIs16BitPortDecodeSupported (VOID)
 
NTSTATUS NTAPI HalpQueryAcpiResourceRequirements (OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requirements)
 
VOID FASTCALL KeUpdateSystemTime (IN PKTRAP_FRAME TrapFrame, IN ULONG Increment, IN KIRQL OldIrql)
 
VOID NTAPI KeUpdateRunTime (_In_ PKTRAP_FRAME TrapFrame, _In_ KIRQL Irql)
 
VOID NTAPI HalpInitBusHandlers (VOID)
 
NTSTATUS NTAPI HaliInitPnpDriver (VOID)
 
VOID NTAPI HalpDebugPciDumpBus (IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER PciSlot, IN ULONG i, IN ULONG j, IN ULONG k, IN PPCI_COMMON_CONFIG PciData)
 
VOID NTAPI HalpInitProcessor (IN ULONG ProcessorNumber, IN PLOADER_PARAMETER_BLOCK LoaderBlock)
 
VOID NTAPI HalInitializeBios (_In_ ULONG Phase, _In_ PLOADER_PARAMETER_BLOCK LoaderBlock)
 

Variables

KIRQL HalpIrqlSynchLevel
 
BOOLEAN HalpProfilingStopped
 
IN UCHAR Value
 
BOOLEAN HalpNMIInProgress
 
ADDRESS_USAGE HalpDefaultIoSpace
 
KSPIN_LOCK HalpSystemHardwareLock
 
PADDRESS_USAGE HalpAddressUsageList
 
LARGE_INTEGER HalpPerfCounter
 
KAFFINITY HalpActiveProcessors
 
BOOLEAN HalDisableFirmwareMapper
 
PWCHAR HalHardwareIdString
 
PWCHAR HalName
 
KAFFINITY HalpDefaultInterruptAffinity
 
IDTUsageFlags HalpIDTUsageFlags [MAXIMUM_IDTVECTOR+1]
 
const USHORT HalpBuildType
 

Macro Definition Documentation

◆ BCD_INT

#define BCD_INT (   bcd)     (((bcd & 0xF0) >> 4) * 10 + (bcd & 0x0F))

Definition at line 71 of file halp.h.

◆ HAL_APC_REQUEST

#define HAL_APC_REQUEST   0

Definition at line 50 of file halp.h.

◆ HAL_BUILD_TYPE

#define HAL_BUILD_TYPE   ((DBG ? PRCB_BUILD_DEBUG : 0) | PRCB_BUILD_UNIPROCESSOR)

Definition at line 10 of file halp.h.

◆ HAL_DPC_REQUEST

#define HAL_DPC_REQUEST   1

Definition at line 51 of file halp.h.

◆ HAL_PROFILING_INTERVAL

#define HAL_PROFILING_INTERVAL   0

Definition at line 54 of file halp.h.

◆ HAL_PROFILING_MULTIPLIER

#define HAL_PROFILING_MULTIPLIER   1

Definition at line 55 of file halp.h.

◆ HalAddressToPde

#define HalAddressToPde (   x)    (PHARDWARE_PTE)MiAddressToPde(x)

Definition at line 176 of file halp.h.

◆ HalAddressToPte

#define HalAddressToPte (   x)    (PHARDWARE_PTE)MiAddressToPte(x)

Definition at line 177 of file halp.h.

◆ HALP_CARD_FEATURE_FULL_DECODE

#define HALP_CARD_FEATURE_FULL_DECODE   0x0001

Definition at line 164 of file halp.h.

◆ HALP_CHECK_CARD_REVISION_ID

#define HALP_CHECK_CARD_REVISION_ID   0x10000

Definition at line 169 of file halp.h.

◆ HALP_CHECK_CARD_SUBSYSTEM_ID

#define HALP_CHECK_CARD_SUBSYSTEM_ID   0x40000

Definition at line 171 of file halp.h.

◆ HALP_CHECK_CARD_SUBVENDOR_ID

#define HALP_CHECK_CARD_SUBVENDOR_ID   0x20000

Definition at line 170 of file halp.h.

◆ HALP_HACK_FLAGS

#define HALP_HACK_FLAGS (   x)    ((x) & 0xFFF)

Definition at line 159 of file halp.h.

◆ HALP_LOW_STUB_SIZE_IN_PAGES

#define HALP_LOW_STUB_SIZE_IN_PAGES   3

Definition at line 67 of file halp.h.

◆ HALP_REVISION_FROM_HACK_FLAGS

#define HALP_REVISION_FROM_HACK_FLAGS (   x)    ((x) >> 24)

Definition at line 157 of file halp.h.

◆ HALP_REVISION_HACK_FLAGS

#define HALP_REVISION_HACK_FLAGS (   x)    ((x) >> 12)

Definition at line 158 of file halp.h.

◆ IDT_DEVICE

#define IDT_DEVICE   0x21

Definition at line 62 of file halp.h.

◆ IDT_INTERNAL

#define IDT_INTERNAL   0x11

Definition at line 61 of file halp.h.

◆ IDT_LATCHED

#define IDT_LATCHED   0x02

Definition at line 59 of file halp.h.

◆ IDT_READ_ONLY

#define IDT_READ_ONLY   0x04

Definition at line 60 of file halp.h.

◆ IDT_REGISTERED

#define IDT_REGISTERED   0x01

Definition at line 58 of file halp.h.

◆ INT_BCD

#define INT_BCD (   int)     (UCHAR)(((int / 10) << 4) + (int % 10))

Definition at line 73 of file halp.h.

◆ SYNCH_LEVEL

#define SYNCH_LEVEL   HalpIrqlSynchLevel

Definition at line 18 of file halp.h.

Typedef Documentation

◆ ADDRESS_USAGE

◆ HAL_BIOS_FRAME

◆ HALP_ROLLOVER

◆ IDTUsageFlags

◆ PADDRESS_USAGE

◆ PHAL_BIOS_FRAME

◆ PHAL_DISMISS_INTERRUPT

typedef BOOLEAN(NTAPI * PHAL_DISMISS_INTERRUPT) (IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)

Definition at line 77 of file halp.h.

◆ PHAL_SW_INTERRUPT_HANDLER

typedef VOID(__cdecl * PHAL_SW_INTERRUPT_HANDLER) (VOID)

Definition at line 39 of file halp.h.

◆ PHAL_SW_INTERRUPT_HANDLER_2ND_ENTRY

typedef VOID(FASTCALL * PHAL_SW_INTERRUPT_HANDLER_2ND_ENTRY) (IN PKTRAP_FRAME TrapFrame)

Definition at line 45 of file halp.h.

◆ PHALP_ROLLOVER

Function Documentation

◆ _Acquires_lock_()

_Acquires_lock_ ( HalpSystemHardwareLock  )

◆ _Releases_lock_()

_Releases_lock_ ( HalpSystemHardwareLock  )

◆ _Requires_lock_held_()

_Requires_lock_held_ ( HalpSystemHardwareLock  )

◆ CODE_SEG()

CODE_SEG ( "INIT"  )

Definition at line 1810 of file Interface.c.

1817{
1818 UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\FileSystem\\Filters\\"DRIVER_NAME);
1819 PDEVICE_OBJECT RawDeviceObject;
1821 PFILE_OBJECT RawFileObject;
1823 UNICODE_STRING SymLink;
1824
1826
1829
1830 /* Save the registry key for this driver */
1834 RegistryPath->MaximumLength,
1838
1839 /* Do some initialization */
1841
1842 /* Create the main filter manager device object */
1844 0,
1845 &DeviceName,
1848 FALSE,
1849 &DeviceObject);
1850 if (!NT_SUCCESS(Status))
1851 {
1852 DPRINT1("fltmgr IoCreateDevice failed. Status = %X\n", Status);
1853 goto Cleanup;
1854 }
1855
1856 /* Store a global reference so we can access from callbacks */
1858
1859 /* Generate the symbolic link name */
1860 RtlInitUnicodeString(&SymLink, L"\\??\\"DRIVER_NAME);
1862 if (!NT_SUCCESS(Status)) goto Cleanup;
1863
1864 /* Create the callbacks for the dispatch table, FastIo and FS callbacks */
1866 if (!NT_SUCCESS(Status)) goto Cleanup;
1867
1868 /* Initialize the comms objects */
1870 if (!NT_SUCCESS(Status)) goto Cleanup;
1871
1872 /* Register for notifications when a new file system is loaded. This also enumerates any existing file systems */
1874 FLT_ASSERT(Status != STATUS_DEVICE_ALREADY_ATTACHED); // Windows checks for this, I'm not sure how it can happen. Needs investigation??
1875 if (!NT_SUCCESS(Status)) goto Cleanup;
1876
1879
1880 /* IoRegisterFsRegistrationChange isn't notified about the raw file systems, so we attach to them manually */
1881 RtlInitUnicodeString(&ObjectName, L"\\Device\\RawDisk");
1884 &RawFileObject,
1885 &RawDeviceObject);
1886 if (NT_SUCCESS(Status))
1887 {
1888 FltpFsNotification(RawDeviceObject, TRUE);
1889 ObDereferenceObject(RawFileObject);
1890 }
1891
1892 RtlInitUnicodeString(&ObjectName, L"\\Device\\RawCdRom");
1895 &RawFileObject,
1896 &RawDeviceObject);
1897 if (NT_SUCCESS(Status))
1898 {
1899 FltpFsNotification(RawDeviceObject, TRUE);
1900 ObDereferenceObject(RawFileObject);
1901 }
1902
1903 /* We're done, clear the initializing flag */
1906
1907Cleanup:
1908
1909 if (!NT_SUCCESS(Status))
1910 {
1912 {
1913 DriverObject->FastIoDispatch = NULL;
1915 }
1916
1917 IoDeleteSymbolicLink(&SymLink);
1918
1919 if (DeviceObject)
1921
1924 }
1925
1926 return Status;
1927}
LIST_ENTRY FilterList
Definition: Filter.c:24
DRIVER_FS_NOTIFICATION FltpFsNotification
Definition: Interface.c:1699
ERESOURCE FilterListLock
Definition: Filter.c:25
static NTSTATUS SetupDispatchAndCallbacksTables(_In_ PDRIVER_OBJECT DriverObject)
Definition: Interface.c:1739
DRIVER_DATA DriverData
Definition: Interface.c:35
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR Cleanup[]
Definition: register.c:80
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSTATUS ExInitializeResourceLite(PULONG res)
Definition: env_spec_w32.h:641
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define NonPagedPool
Definition: env_spec_w32.h:307
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define ClearFlag(_F, _SF)
Definition: ext2fs.h:191
#define DRIVER_NAME
Definition: ext2fs.h:136
#define FLT_ASSERT(_e)
Definition: fltkernel.h:49
#define FM_TAG_REGISTRY_DATA
Definition: fltmgr.h:18
#define FM_TAG_DISPATCH_TABLE
Definition: fltmgr.h:17
NTSTATUS FltpSetupCommunicationObjects(_In_ PDRIVER_OBJECT DriverObject)
Definition: Messaging.c:377
Status
Definition: gdiplustypes.h:25
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1435
NTSTATUS NTAPI IoRegisterFsRegistrationChange(IN PDRIVER_OBJECT DriverObject, IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine)
Definition: volume.c:1089
#define STATUS_DEVICE_ALREADY_ATTACHED
Definition: ntstatus.h:292
#define L(x)
Definition: ntvdm.h:50
#define FILE_DEVICE_DISK_FILE_SYSTEM
Definition: winioctl.h:114
#define STATUS_SUCCESS
Definition: shellext.h:65
PDRIVER_OBJECT DriverObject
Definition: fltmgr.h:31
UNICODE_STRING ServiceKey
Definition: fltmgr.h:33
PFAST_IO_DISPATCH FastIoDispatch
Definition: fltmgr.h:37
FAST_MUTEX FilterAttachLock
Definition: fltmgr.h:39
PDEVICE_OBJECT DeviceObject
Definition: fltmgr.h:32
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint16_t * PWCHAR
Definition: typedefs.h:56
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
_Must_inspect_result_ _In_ PDRIVER_OBJECT _In_ PCUNICODE_STRING RegistryPath
Definition: wdfdriver.h:215
_Must_inspect_result_ _In_ PDRIVER_OBJECT DriverObject
Definition: wdfdriver.h:213
_In_ PVOID _Out_opt_ PULONG_PTR _Outptr_opt_ PCUNICODE_STRING * ObjectName
Definition: cmfuncs.h:64
FORCEINLINE VOID ExInitializeFastMutex(_Out_ PFAST_MUTEX FastMutex)
Definition: exfuncs.h:274
* PFILE_OBJECT
Definition: iotypes.h:1998
#define ObDereferenceObject
Definition: obfuncs.h:203

◆ HaliHaltSystem()

VOID NTAPI HaliHaltSystem ( VOID  )

Definition at line 21 of file processor.c.

22{
23 /* Disable interrupts and halt the CPU */
24 _disable();
25 __halt();
26}
void __cdecl _disable(void)
Definition: intrin_arm.h:365
__INTRIN_INLINE void __halt(void)
Definition: intrin_x86.h:1714

Referenced by HalInitSystem().

◆ HaliHandlePCIConfigSpaceAccess()

NTSTATUS NTAPI HaliHandlePCIConfigSpaceAccess ( _In_ BOOLEAN  IsRead,
_In_ ULONG  Port,
_In_ ULONG  Length,
_Inout_ PULONG  Buffer 
)

Definition at line 43 of file sysinfo.c.

47{
48 DPRINT1("HaliHandlePCIConfigSpaceAccess: IsRead %X, Port 0x%X, Length %u, Buffer %p\n", IsRead, Port, Length, Buffer);
49 //ASSERT(FALSE);
51}
Definition: bufpool.h:45
CPPORT Port[4]
Definition: headless.c:35
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239

◆ HaliInitPnpDriver()

NTSTATUS NTAPI HaliInitPnpDriver ( VOID  )

Definition at line 906 of file halpnpdd.c.

907{
909 UNICODE_STRING DriverString;
910 PAGED_CODE();
911
912 /* Create the driver */
913 RtlInitUnicodeString(&DriverString, L"\\Driver\\ACPI_HAL");
914 Status = IoCreateDriver(&DriverString, HalpDriverEntry);
915
916 /* Return status */
917 return Status;
918}
#define PAGED_CODE()
NTSTATUS NTAPI HalpDriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
Definition: halpnpdd.c:859
NTSTATUS NTAPI IoCreateDriver(_In_opt_ PUNICODE_STRING DriverName, _In_ PDRIVER_INITIALIZE InitializationFunction)
Definition: driver.c:1576

Referenced by HalInitSystem().

◆ HalInitializeBios()

VOID NTAPI HalInitializeBios ( _In_ ULONG  Phase,
_In_ PLOADER_PARAMETER_BLOCK  LoaderBlock 
)

Definition at line 48 of file x86bios.c.

51{
52 PPFN_NUMBER PfnArray;
53 PFN_NUMBER Pfn, Last;
55 PLIST_ENTRY ListEntry;
56 PMDL Mdl;
58
59 if (Phase == 0)
60 {
61 /* Allocate one page for a fallback mapping */
63 0x100000,
64 1,
65 FALSE);
66 if (PhysicalAddress == 0)
67 {
69 }
70
73
74 /* Allocate a page for the buffer allocation */
76 0x100000,
77 1,
78 FALSE);
79 if (x86BiosBufferPhysical == 0)
80 {
82 }
83 }
84 else
85 {
86
87 /* Allocate an MDL for 1MB */
88 Mdl = IoAllocateMdl(NULL, 0x100000, FALSE, FALSE, NULL);
89 if (!Mdl)
90 {
92 }
93
94 /* Get pointer to the pfn array */
95 PfnArray = MmGetMdlPfnArray(Mdl);
96
97 /* Fill the array with the fallback page */
98 for (Pfn = 0; Pfn < 0x100; Pfn++)
99 {
100 PfnArray[Pfn] = x86BiosFallbackPfn;
101 }
102
103 /* Loop the memory descriptors */
104 for (ListEntry = LoaderBlock->MemoryDescriptorListHead.Flink;
105 ListEntry != &LoaderBlock->MemoryDescriptorListHead;
106 ListEntry = ListEntry->Flink)
107 {
108 /* Get the memory descriptor */
109 Descriptor = CONTAINING_RECORD(ListEntry,
111 ListEntry);
112
113 /* Check if the memory is in the low 1 MB range */
114 if (Descriptor->BasePage < 0x100)
115 {
116 /* Check if the memory type is firmware */
117 if ((Descriptor->MemoryType == LoaderFirmwarePermanent) ||
118 (Descriptor->MemoryType == LoaderSpecialMemory))
119 {
120 /* It's firmware, so map it! */
121 Last = min(Descriptor->BasePage + Descriptor->PageCount, 0x100);
122 for (Pfn = Descriptor->BasePage; Pfn < Last; Pfn++)
123 {
124 /* Set each physical page in the MDL */
125 PfnArray[Pfn] = Pfn;
126 }
127 }
128 }
129 }
130
131 /* Map this page proper, too */
133 PfnArray[Pfn] = Pfn;
134
135 Mdl->MdlFlags = MDL_PAGES_LOCKED;
136
137 /* Map the MDL to system space */
140
141 DPRINT1("*x86BiosMemoryMapping: %p, %p\n",
143 //DbgDumpPage(x86BiosMemoryMapping, 0xc351);
144
146 }
147}
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define IoAllocateMdl
Definition: fxmdl.h:88
ULONG64 NTAPI HalpAllocPhysicalMemory(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN ULONG64 MaxAddress, IN PFN_NUMBER PageCount, IN BOOLEAN Aligned)
Definition: memory.c:29
#define ASSERT(a)
Definition: mode.c:44
unsigned __int64 ULONG64
Definition: imports.h:198
@ HighPagePriority
Definition: imports.h:57
#define min(a, b)
Definition: monoChain.cc:55
@ LoaderFirmwarePermanent
Definition: arc.h:180
@ LoaderSpecialMemory
Definition: arc.h:196
ULONG * PPFN_NUMBER
Definition: ke.h:9
ULONG PFN_NUMBER
Definition: ke.h:9
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342
BOOLEAN x86BiosIsInitialized
Definition: x86bios.c:22
PUCHAR x86BiosMemoryMapping
Definition: x86bios.c:24
ULONG64 x86BiosBufferPhysical
Definition: x86bios.c:27
PFN_NUMBER x86BiosFallbackPfn
Definition: x86bios.c:20
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1098
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
#define MmGetMdlPfnArray(_Mdl)
#define MDL_PAGES_LOCKED
Definition: mmtypes.h:19

Referenced by HalInitSystem().

◆ HaliQuerySystemInformation()

NTSTATUS NTAPI HaliQuerySystemInformation ( IN HAL_QUERY_INFORMATION_CLASS  InformationClass,
IN ULONG  BufferSize,
IN OUT PVOID  Buffer,
OUT PULONG  ReturnedLength 
)

Definition at line 19 of file sysinfo.c.

23{
25 while (TRUE);
27}
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by HalInitSystem().

◆ HaliSetSystemInformation()

NTSTATUS NTAPI HaliSetSystemInformation ( IN HAL_SET_INFORMATION_CLASS  InformationClass,
IN ULONG  BufferSize,
IN OUT PVOID  Buffer 
)

Definition at line 31 of file sysinfo.c.

34{
36 while (TRUE);
38}

Referenced by HalInitSystem().

◆ HalpAllocateAdapterEx()

PADAPTER_OBJECT NTAPI HalpAllocateAdapterEx ( ULONG  NumberOfMapRegisters,
BOOLEAN  IsMaster,
BOOLEAN  Dma32BitAddresses 
)

◆ HalpAllocPhysicalMemory()

ULONG64 NTAPI HalpAllocPhysicalMemory ( IN PLOADER_PARAMETER_BLOCK  LoaderBlock,
IN ULONG64  MaxAddress,
IN PFN_NUMBER  PageCount,
IN BOOLEAN  Aligned 
)

Definition at line 29 of file memory.c.

33{
34 ULONG UsedDescriptors;
36 PFN_NUMBER MaxPage, BasePage, Alignment;
37 PLIST_ENTRY NextEntry;
38 PMEMORY_ALLOCATION_DESCRIPTOR MdBlock, NewBlock, FreeBlock;
39
40 /* Highest page we'll go */
41 MaxPage = MaxAddress >> PAGE_SHIFT;
42
43 /* We need at least two blocks */
44 if ((HalpUsedAllocDescriptors + 2) > 64) return 0;
45
46 /* Remember how many we have now */
47 UsedDescriptors = HalpUsedAllocDescriptors;
48
49 /* Loop the loader block memory descriptors */
50 NextEntry = LoaderBlock->MemoryDescriptorListHead.Flink;
51 while (NextEntry != &LoaderBlock->MemoryDescriptorListHead)
52 {
53 /* Get the block */
54 MdBlock = CONTAINING_RECORD(NextEntry,
56 ListEntry);
57
58 /* No alignment by default */
59 Alignment = 0;
60
61 /* Unless requested, in which case we use a 64KB block alignment */
62 if (Aligned) Alignment = ((MdBlock->BasePage + 0x0F) & ~0x0F) - MdBlock->BasePage;
63
64 /* Search for free memory */
65 if ((MdBlock->MemoryType == LoaderFree) ||
67 {
68 /* Make sure the page is within bounds, including alignment */
69 BasePage = MdBlock->BasePage;
70 if ((BasePage) &&
71 (MdBlock->PageCount >= PageCount + Alignment) &&
72 (BasePage + PageCount + Alignment < MaxPage))
73 {
74 /* We found an address */
76 break;
77 }
78 }
79
80 /* Keep trying */
81 NextEntry = NextEntry->Flink;
82 }
83
84 /* If we didn't find anything, get out of here */
85 if (NextEntry == &LoaderBlock->MemoryDescriptorListHead) return 0;
86
87 /* Okay, now get a descriptor */
89 NewBlock->PageCount = (ULONG)PageCount;
90 NewBlock->BasePage = MdBlock->BasePage + Alignment;
92
93 /* Update count */
94 UsedDescriptors++;
95 HalpUsedAllocDescriptors = UsedDescriptors;
96
97 /* Check if we had any alignment */
98 if (Alignment)
99 {
100 /* Check if we had leftovers */
101 if (MdBlock->PageCount > (PageCount + Alignment))
102 {
103 /* Get the next descriptor */
104 FreeBlock = &HalpAllocationDescriptorArray[UsedDescriptors];
105 FreeBlock->PageCount = MdBlock->PageCount - Alignment - (ULONG)PageCount;
106 FreeBlock->BasePage = MdBlock->BasePage + Alignment + (ULONG)PageCount;
107
108 /* One more */
110
111 /* Insert it into the list */
112 InsertHeadList(&MdBlock->ListEntry, &FreeBlock->ListEntry);
113 }
114
115 /* Trim the original block to the alignment only */
116 MdBlock->PageCount = Alignment;
117
118 /* Insert the descriptor after the original one */
119 InsertHeadList(&MdBlock->ListEntry, &NewBlock->ListEntry);
120 }
121 else
122 {
123 /* Consume memory from this block */
124 MdBlock->BasePage += (ULONG)PageCount;
125 MdBlock->PageCount -= (ULONG)PageCount;
126
127 /* Insert the descriptor before the original one */
128 InsertTailList(&MdBlock->ListEntry, &NewBlock->ListEntry);
129
130 /* Remove the entry if the whole block was allocated */
131 if (MdBlock->PageCount == 0) RemoveEntryList(&MdBlock->ListEntry);
132 }
133
134 /* Return the address */
135 return PhysicalAddress;
136}
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define InsertTailList(ListHead, Entry)
#define InsertHeadList(ListHead, Entry)
#define PAGE_SHIFT
Definition: env_spec_w32.h:45
union Alignment_ Alignment
MEMORY_ALLOCATION_DESCRIPTOR HalpAllocationDescriptorArray[64]
Definition: memory.c:21
ULONG HalpUsedAllocDescriptors
Definition: memory.c:20
@ LoaderFree
Definition: arc.h:176
@ LoaderFirmwareTemporary
Definition: arc.h:179
@ LoaderHALCachedMemory
Definition: arc.h:200
TYPE_OF_MEMORY MemoryType
Definition: arc.h:240
uint32_t ULONG
Definition: typedefs.h:59

Referenced by HalInitializeBios(), HalpAcpiCopyBiosTable(), HalpAcpiFindRsdtPhase0(), HalpSetupAcpiPhase0(), and HalpSetupPciDeviceForDebugging().

◆ HalpApcInterrupt()

VOID __cdecl HalpApcInterrupt ( VOID  )

Referenced by HalpInitializePICs().

◆ HalpApcInterrupt2ndEntry()

DECLSPEC_NORETURN VOID FASTCALL HalpApcInterrupt2ndEntry ( IN PKTRAP_FRAME  TrapFrame)

Definition at line 1134 of file pic.c.

1135{
1136 /* Do the work */
1137 _HalpApcInterruptHandler(TrapFrame);
1138}
FORCEINLINE DECLSPEC_NORETURN VOID _HalpApcInterruptHandler(IN PKTRAP_FRAME TrapFrame)
Definition: pic.c:1104

◆ HalpBiosDisplayReset()

BOOLEAN NTAPI HalpBiosDisplayReset ( VOID  )

Definition at line 642 of file bios.c.

643{
644#if defined(SARCH_XBOX) || defined(SARCH_PC98)
645 /* There is no VGA BIOS on these machine types */
646 return FALSE;
647#else
648 ULONG Flags;
649 PHARDWARE_PTE IdtPte;
650 BOOLEAN RestoreWriteProtection = FALSE;
651
652 //
653 // Disable interrupts
654 //
656 _disable();
657
658 //
659 // Map memory available to the V8086 real-mode code
660 //
662
663 //
664 // On P5, the first 7 entries of the IDT are write protected to work around
665 // the cmpxchg8b lock errata. Unprotect them here so we can set our custom
666 // invalid op-code handler.
667 //
668 IdtPte = HalAddressToPte(KeGetPcr()->IDT);
669 RestoreWriteProtection = IdtPte->Write != 0;
670 IdtPte->Write = 1;
671
672 //
673 // Use special invalid opcode and GPF trap handlers
674 //
676
677 //
678 // Configure the IOPM and TSS
679 //
681
682 //
683 // Now jump to real mode
684 //
685 HalpBiosCall();
686
687 //
688 // Restore kernel trap handlers
689 //
691
692 //
693 // Restore write permission
694 //
695 IdtPte->Write = RestoreWriteProtection;
696
697 //
698 // Restore TSS and IOPM
699 //
701
702 //
703 // Restore low memory mapping
704 //
706
707 //
708 // Restore interrupts if they were previously enabled
709 //
711 return TRUE;
712#endif
713}
unsigned char BOOLEAN
VOID NTAPI HalpBiosCall(VOID)
Definition: bios.c:250
VOID NTAPI HalpRestoreTrapHandlers(VOID)
Definition: bios.c:561
VOID NTAPI HalpRestoreIoPermissionsAndTask(VOID)
Definition: bios.c:582
VOID NTAPI HalpSwitchToRealModeTrapHandlers(VOID)
Definition: bios.c:513
VOID NTAPI HalpMapRealModeMemory(VOID)
Definition: bios.c:446
VOID NTAPI HalpUnmapRealModeMemory(VOID)
Definition: bios.c:607
VOID NTAPI HalpSetupRealModeIoPermissionsAndTask(VOID)
Definition: bios.c:534
#define HalAddressToPte(x)
Definition: halp.h:177
__INTRIN_INLINE void __writeeflags(uintptr_t Value)
Definition: intrin_x86.h:1669
__INTRIN_INLINE uintptr_t __readeflags(void)
Definition: intrin_x86.h:1674
#define KeGetPcr()
Definition: ketypes.h:81
ULONG64 Write
Definition: mmtypes.h:67
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by HalInitSystem().

◆ HalpBuildAddressMap()

VOID NTAPI HalpBuildAddressMap ( VOID  )

Definition at line 944 of file halacpi.c.

945{
946 /* ACPI is magic baby */
947}

Referenced by HalpReportResourceUsage().

◆ HalpCalibrateStallExecution()

VOID NTAPI HalpCalibrateStallExecution ( VOID  )

Definition at line 105 of file pchw.c.

106{
107 ULONG i;
108 ULONG calib_bit;
109 ULONG CurCount;
110
111 /* Initialise timer interrupt with MILLISECOND ms interval */
112 WRITE_PORT_UCHAR((PUCHAR)0x43, 0x34); /* binary, mode 2, LSB/MSB, ch 0 */
113 WRITE_PORT_UCHAR((PUCHAR)0x40, LATCH & 0xff); /* LSB */
114 WRITE_PORT_UCHAR((PUCHAR)0x40, LATCH >> 8); /* MSB */
115
116 /* Stage 1: Coarse calibration */
117
118 delay_count = 1;
119
120 do
121 {
122 /* Next delay count to try */
123 delay_count <<= 1;
124
126
127 /* Do the delay */
129
130 CurCount = Read8254Timer();
131 }
132 while (CurCount > LATCH / 2);
133
134 /* Get bottom value for delay */
135 delay_count >>= 1;
136
137 /* Stage 2: Fine calibration */
138
139 /* Which bit are we going to test */
140 calib_bit = delay_count;
141
142 for (i = 0; i < PRECISION; i++)
143 {
144 /* Next bit to calibrate */
145 calib_bit >>= 1;
146
147 /* If we have done all bits, stop */
148 if (!calib_bit) break;
149
150 /* Set the bit in delay_count */
151 delay_count |= calib_bit;
152
154
155 /* Do the delay */
157
158 CurCount = Read8254Timer();
159 /* If a tick has passed, turn the calibrated bit back off */
160 if (CurCount <= LATCH / 2)
161 delay_count &= ~calib_bit;
162 }
163
164 /* We're finished: Do the finishing touches */
165
166 /* Calculate delay_count for 1ms */
167 delay_count /= (MILLISEC / 2);
168}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
#define MILLISEC
Definition: pchw.c:27
static VOID WaitFor8254Wraparound(VOID)
Definition: pchw.c:81
static VOID __StallExecutionProcessor(ULONG Loops)
Definition: pchw.c:54
#define PRECISION
Definition: pchw.c:28
#define LATCH
Definition: pchw.c:37
static unsigned int delay_count
Definition: pchw.c:39
static ULONG Read8254Timer(VOID)
Definition: pchw.c:68
unsigned char * PUCHAR
Definition: typedefs.h:53

Referenced by HalInitSystem(), and MachInit().

◆ HalpCheckPowerButton()

VOID NTAPI HalpCheckPowerButton ( VOID  )

Definition at line 146 of file misc.c.

147{
148 //
149 // Nothing to do on non-ACPI
150 //
151 return;
152}

Referenced by HalpRegisterKdSupportFunctions().

◆ HalpClockInterrupt()

VOID __cdecl HalpClockInterrupt ( VOID  )

Definition at line 30 of file timer.c.

31{
32 /* Clear the interrupt */
35
36 /* FIXME: Update HAL Perf counters */
37
38 /* FIXME: Check if someone changed the clockrate */
39
40 /* Call the kernel */
44}
#define WRITE_REGISTER_ULONG(r, v)
Definition: arm.h:27
#define CLOCK2_LEVEL
Definition: env_spec_w32.h:700
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
VOID FASTCALL KeUpdateSystemTime(IN PKTRAP_FRAME TrapFrame, IN ULONG Increment, IN KIRQL OldIrql)
Definition: time.c:64
ULONG HalpCurrentTimeIncrement
Definition: timer.c:25
#define KeGetCurrentThread
Definition: hal.h:55
#define TIMER0_INT_CLEAR
Definition: sp804.h:18

Referenced by HalInitSystem(), HalpInitializePICs(), HalpInitPhase0(), and HalpInitPhase1().

◆ HalpClockIpi()

VOID __cdecl HalpClockIpi ( VOID  )

Referenced by HalpInitializePICs().

◆ HalpDebugPciDumpBus()

VOID NTAPI HalpDebugPciDumpBus ( IN PBUS_HANDLER  BusHandler,
IN PCI_SLOT_NUMBER  PciSlot,
IN ULONG  i,
IN ULONG  j,
IN ULONG  k,
IN PPCI_COMMON_CONFIG  PciData 
)

Definition at line 794 of file bussupp.c.

800{
801 PCHAR p, ClassName, Boundary, SubClassName, VendorName, ProductName, SubVendorName;
802 UCHAR HeaderType;
804 CHAR LookupString[16] = "";
805 CHAR bSubClassName[64] = "Unknown";
806 CHAR bVendorName[64] = "";
807 CHAR bProductName[128] = "Unknown device";
808 CHAR bSubVendorName[128] = "Unknown";
809 ULONG Size, Mem, b;
810
811 HeaderType = (PciData->HeaderType & ~PCI_MULTIFUNCTION);
812
813 /* Isolate the class name */
814 sprintf(LookupString, "C %02x ", PciData->BaseClass);
815 ClassName = strstr((PCHAR)ClassTable, LookupString);
816 if (ClassName)
817 {
818 /* Isolate the subclass name */
819 ClassName += strlen("C 00 ");
820 Boundary = strstr(ClassName, NEWLINE "C ");
821 sprintf(LookupString, NEWLINE "\t%02x ", PciData->SubClass);
822 SubClassName = strstr(ClassName, LookupString);
823 if (Boundary && SubClassName > Boundary)
824 {
825 SubClassName = NULL;
826 }
827 if (!SubClassName)
828 {
829 SubClassName = ClassName;
830 }
831 else
832 {
833 SubClassName += strlen(NEWLINE "\t00 ");
834 }
835 /* Copy the subclass into our buffer */
836 p = strpbrk(SubClassName, NEWLINE);
837 Length = p - SubClassName;
838 Length = min(Length, sizeof(bSubClassName) - 1);
839 strncpy(bSubClassName, SubClassName, Length);
840 bSubClassName[Length] = '\0';
841 }
842
843 /* Isolate the vendor name */
844 sprintf(LookupString, NEWLINE "%04x ", PciData->VendorID);
845 VendorName = strstr((PCHAR)VendorTable, LookupString);
846 if (VendorName)
847 {
848 /* Copy the vendor name into our buffer */
849 VendorName += strlen(NEWLINE "0000 ");
851 Length = p - VendorName;
852 Length = min(Length, sizeof(bVendorName) - 1);
853 strncpy(bVendorName, VendorName, Length);
854 bVendorName[Length] = '\0';
855 p += strlen(NEWLINE);
856 while (*p == '\t' || *p == '#')
857 {
858 p = strpbrk(p, NEWLINE);
859 p += strlen(NEWLINE);
860 }
861 Boundary = p;
862
863 /* Isolate the product name */
864 sprintf(LookupString, "\t%04x ", PciData->DeviceID);
865 ProductName = strstr(VendorName, LookupString);
866 if (Boundary && ProductName >= Boundary)
867 {
868 ProductName = NULL;
869 }
870 if (ProductName)
871 {
872 /* Copy the product name into our buffer */
873 ProductName += strlen("\t0000 ");
874 p = strpbrk(ProductName, NEWLINE);
875 Length = p - ProductName;
876 Length = min(Length, sizeof(bProductName) - 1);
877 strncpy(bProductName, ProductName, Length);
878 bProductName[Length] = '\0';
879 p += strlen(NEWLINE);
880 while ((*p == '\t' && *(p + 1) == '\t') || *p == '#')
881 {
882 p = strpbrk(p, NEWLINE);
883 p += strlen(NEWLINE);
884 }
885 Boundary = p;
886 SubVendorName = NULL;
887
888 if (HeaderType == PCI_DEVICE_TYPE)
889 {
890 /* Isolate the subvendor and subsystem name */
891 sprintf(LookupString,
892 "\t\t%04x %04x ",
893 PciData->u.type0.SubVendorID,
894 PciData->u.type0.SubSystemID);
895 SubVendorName = strstr(ProductName, LookupString);
896 if (Boundary && SubVendorName >= Boundary)
897 {
898 SubVendorName = NULL;
899 }
900 }
901 if (SubVendorName)
902 {
903 /* Copy the subvendor name into our buffer */
904 SubVendorName += strlen("\t\t0000 0000 ");
905 p = strpbrk(SubVendorName, NEWLINE);
906 Length = p - SubVendorName;
907 Length = min(Length, sizeof(bSubVendorName) - 1);
908 strncpy(bSubVendorName, SubVendorName, Length);
909 bSubVendorName[Length] = '\0';
910 }
911 }
912 }
913
914 /* Print out the data */
915 DbgPrint("%02x:%02x.%x %s [%02x%02x]: %s %s [%04x:%04x] (rev %02x)\n",
916 i,
917 j,
918 k,
919 bSubClassName,
920 PciData->BaseClass,
921 PciData->SubClass,
922 bVendorName,
923 bProductName,
924 PciData->VendorID,
925 PciData->DeviceID,
926 PciData->RevisionID);
927
928 if (HeaderType == PCI_DEVICE_TYPE)
929 {
930 DbgPrint("\tSubsystem: %s [%04x:%04x]\n",
931 bSubVendorName,
932 PciData->u.type0.SubVendorID,
933 PciData->u.type0.SubSystemID);
934 }
935
936 /* Print out and decode flags */
937 DbgPrint("\tFlags:");
938 if (PciData->Command & PCI_ENABLE_BUS_MASTER) DbgPrint(" bus master,");
939 if (PciData->Status & PCI_STATUS_66MHZ_CAPABLE) DbgPrint(" 66MHz,");
940 if ((PciData->Status & PCI_STATUS_DEVSEL) == 0x000) DbgPrint(" fast devsel,");
941 if ((PciData->Status & PCI_STATUS_DEVSEL) == 0x200) DbgPrint(" medium devsel,");
942 if ((PciData->Status & PCI_STATUS_DEVSEL) == 0x400) DbgPrint(" slow devsel,");
943 if ((PciData->Status & PCI_STATUS_DEVSEL) == 0x600) DbgPrint(" unknown devsel,");
944 DbgPrint(" latency %d", PciData->LatencyTimer);
945 if (PciData->u.type0.InterruptPin != 0 &&
946 PciData->u.type0.InterruptLine != 0 &&
947 PciData->u.type0.InterruptLine != 0xFF) DbgPrint(", IRQ %02d", PciData->u.type0.InterruptLine);
948 else if (PciData->u.type0.InterruptPin != 0) DbgPrint(", IRQ assignment required");
949 DbgPrint("\n");
950
951 if (HeaderType == PCI_BRIDGE_TYPE)
952 {
953 DbgPrint("\tBridge:");
954 DbgPrint(" primary bus %d,", PciData->u.type1.PrimaryBus);
955 DbgPrint(" secondary bus %d,", PciData->u.type1.SecondaryBus);
956 DbgPrint(" subordinate bus %d,", PciData->u.type1.SubordinateBus);
957 DbgPrint(" secondary latency %d", PciData->u.type1.SecondaryLatency);
958 DbgPrint("\n");
959 }
960
961 /* Scan addresses */
962 Size = 0;
963 for (b = 0; b < (HeaderType == PCI_DEVICE_TYPE ? PCI_TYPE0_ADDRESSES : PCI_TYPE1_ADDRESSES); b++)
964 {
965 /* Check for a BAR */
966 if (HeaderType != PCI_CARDBUS_BRIDGE_TYPE)
967 Mem = PciData->u.type0.BaseAddresses[b];
968 else
969 Mem = 0;
970 if (Mem)
971 {
972 ULONG PciBar = 0xFFFFFFFF;
973
974 HalpWritePCIConfig(BusHandler,
975 PciSlot,
976 &PciBar,
977 FIELD_OFFSET(PCI_COMMON_HEADER, u.type0.BaseAddresses[b]),
978 sizeof(ULONG));
979 HalpReadPCIConfig(BusHandler,
980 PciSlot,
981 &PciBar,
982 FIELD_OFFSET(PCI_COMMON_HEADER, u.type0.BaseAddresses[b]),
983 sizeof(ULONG));
984 HalpWritePCIConfig(BusHandler,
985 PciSlot,
986 &Mem,
987 FIELD_OFFSET(PCI_COMMON_HEADER, u.type0.BaseAddresses[b]),
988 sizeof(ULONG));
989
990 /* Decode the address type */
991 if (PciBar & PCI_ADDRESS_IO_SPACE)
992 {
993 /* Guess the size */
994 Size = 1 << 2;
995 while (!(PciBar & Size) && (Size)) Size <<= 1;
996
997 /* Print it out */
998 DbgPrint("\tI/O ports at %04lx", Mem & PCI_ADDRESS_IO_ADDRESS_MASK);
999 ShowSize(Size);
1000 }
1001 else
1002 {
1003 /* Guess the size */
1004 Size = 1 << 4;
1005 while (!(PciBar & Size) && (Size)) Size <<= 1;
1006
1007 /* Print it out */
1008 DbgPrint("\tMemory at %08lx (%d-bit, %sprefetchable)",
1010 (Mem & PCI_ADDRESS_MEMORY_TYPE_MASK) == PCI_TYPE_32BIT ? 32 : 64,
1011 (Mem & PCI_ADDRESS_MEMORY_PREFETCHABLE) ? "" : "non-");
1012 ShowSize(Size);
1013 }
1014 DbgPrint("\n");
1015 }
1016 }
1017}
static const char VendorName[]
Definition: ParaNdis-Oid.c:36
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
char * strpbrk(const char *String, const char *Delimiters)
Definition: utclib.c:302
VOID NTAPI HalpWritePCIConfig(IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: pcibus.c:283
VOID NTAPI HalpReadPCIConfig(IN PBUS_HANDLER BusHandler, IN PCI_SLOT_NUMBER Slot, IN PVOID Buffer, IN ULONG Offset, IN ULONG Length)
Definition: pcibus.c:257
#define NEWLINE
Definition: bussupp.c:788
VOID NTAPI ShowSize(IN ULONG Size)
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLfloat GLfloat p
Definition: glext.h:8902
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define DbgPrint
Definition: hal.h:12
#define b
Definition: ke_i.h:79
#define sprintf(buf, format,...)
Definition: sprintf.c:55
int k
Definition: mpi.c:3369
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
char * PCHAR
Definition: typedefs.h:51
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
#define PCI_TYPE_32BIT
Definition: iotypes.h:4237
#define PCI_ADDRESS_IO_ADDRESS_MASK
Definition: iotypes.h:4233
#define PCI_ENABLE_BUS_MASTER
Definition: iotypes.h:3618
#define PCI_TYPE0_ADDRESSES
Definition: iotypes.h:3500
#define PCI_ADDRESS_IO_SPACE
Definition: iotypes.h:4230
#define PCI_TYPE1_ADDRESSES
Definition: iotypes.h:3501
#define PCI_STATUS_66MHZ_CAPABLE
Definition: iotypes.h:3631
#define PCI_BRIDGE_TYPE
Definition: iotypes.h:3606
#define PCI_STATUS_DEVSEL
Definition: iotypes.h:3635
#define PCI_ADDRESS_MEMORY_ADDRESS_MASK
Definition: iotypes.h:4234
#define PCI_ADDRESS_MEMORY_PREFETCHABLE
Definition: iotypes.h:4232
#define PCI_ADDRESS_MEMORY_TYPE_MASK
Definition: iotypes.h:4231
#define PCI_DEVICE_TYPE
Definition: iotypes.h:3605
#define PCI_CARDBUS_BRIDGE_TYPE
Definition: iotypes.h:3607
unsigned char UCHAR
Definition: xmlstorage.h:181
char CHAR
Definition: xmlstorage.h:175

Referenced by HalpInitializePciBus().

◆ HalpDismissIrq07()

BOOLEAN NTAPI HalpDismissIrq07 ( IN KIRQL  Irql,
IN ULONG  Irq,
OUT PKIRQL  OldIrql 
)

Definition at line 708 of file pic.c.

711{
712 I8259_OCW3 Ocw3;
714
715 /* Request the ISR */
716 Ocw3.Bits = 0;
717 Ocw3.Sbo = 1;
718 Ocw3.ReadRequest = ReadIsr;
720
721 /* Read the ISR */
723
724 /* Is IRQ 7 really active? If it isn't, this is spurious so fail */
725 if (Isr.Irq7 == FALSE) return FALSE;
726
727 /* Do normal interrupt dismiss */
728 return _HalpDismissIrqGeneric(Irql, Irq, OldIrql);
729}
_Out_ PKIRQL Irql
Definition: csq.h:179
static BOOLEAN NTAPI Isr(PKINTERRUPT Interrupt, PVOID ServiceContext)
Definition: floppy.c:581
FORCEINLINE BOOLEAN _HalpDismissIrqGeneric(IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
Definition: pic.c:553
@ ReadIsr
Definition: halhw.h:205
PPC_QUAL unsigned char __inbyte(const unsigned long Port)
Definition: intrin_ppc.h:539
PPC_QUAL void __outbyte(unsigned long const Port, const unsigned char Data)
Definition: intrin_ppc.h:605
#define PIC1_CONTROL_PORT
Definition: machpc.c:53
UCHAR Sbo
Definition: halhw.h:301
UCHAR ReadRequest
Definition: halhw.h:299
UCHAR Bits
Definition: halhw.h:306
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778

◆ HalpDismissIrq07Level()

BOOLEAN NTAPI HalpDismissIrq07Level ( IN KIRQL  Irql,
IN ULONG  Irq,
OUT PKIRQL  OldIrql 
)

Definition at line 890 of file pic.c.

893{
894 I8259_OCW3 Ocw3;
896
897 /* Request the ISR */
898 Ocw3.Bits = 0;
899 Ocw3.Sbo = 1;
900 Ocw3.ReadRequest = ReadIsr;
902
903 /* Read the ISR */
905
906 /* Is IRQ 7 really active? If it isn't, this is spurious so fail */
907 if (Isr.Irq7 == FALSE) return FALSE;
908
909 /* Do normal interrupt dismiss */
910 return _HalpDismissIrqLevel(Irql, Irq, OldIrql);
911}
FORCEINLINE BOOLEAN _HalpDismissIrqLevel(IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
Definition: pic.c:735

◆ HalpDismissIrq13()

BOOLEAN NTAPI HalpDismissIrq13 ( IN KIRQL  Irql,
IN ULONG  Irq,
OUT PKIRQL  OldIrql 
)

Definition at line 679 of file pic.c.

682{
683 /* Clear the FPU busy latch */
684 __outbyte(0xF0, 0);
685
686 /* Do normal interrupt dismiss */
687 return _HalpDismissIrqGeneric(Irql, Irq, OldIrql);
688}

◆ HalpDismissIrq13Level()

BOOLEAN NTAPI HalpDismissIrq13Level ( IN KIRQL  Irql,
IN ULONG  Irq,
OUT PKIRQL  OldIrql 
)

Definition at line 861 of file pic.c.

864{
865 /* Clear the FPU busy latch */
866 __outbyte(0xF0, 0);
867
868 /* Do normal interrupt dismiss */
869 return _HalpDismissIrqLevel(Irql, Irq, OldIrql);
870}

◆ HalpDismissIrq15()

BOOLEAN NTAPI HalpDismissIrq15 ( IN KIRQL  Irql,
IN ULONG  Irq,
OUT PKIRQL  OldIrql 
)

Definition at line 644 of file pic.c.

647{
648 I8259_OCW3 Ocw3;
649 I8259_OCW2 Ocw2;
651
652 /* Request the ISR */
653 Ocw3.Bits = 0;
654 Ocw3.Sbo = 1; /* This encodes an OCW3 vs. an OCW2 */
655 Ocw3.ReadRequest = ReadIsr;
657
658 /* Read the ISR */
660
661 /* Is IRQ15 really active (this is IR7) */
662 if (Isr.Irq7 == FALSE)
663 {
664 /* It isn't, so we have to EOI cascade IRQ */
665 Ocw2.Bits = 0;
666 Ocw2.EoiMode = SpecificEoi;
668
669 /* And now fail since this was spurious */
670 return FALSE;
671 }
672
673 /* Do normal interrupt dismiss */
674 return _HalpDismissIrqGeneric(Irql, Irq, OldIrql);
675}
#define PIC_CASCADE_IRQ
Definition: halhw.h:156
@ SpecificEoi
Definition: halhw.h:213
#define PIC2_CONTROL_PORT
Definition: machpc.c:55
UCHAR EoiMode
Definition: halhw.h:290
UCHAR Bits
Definition: halhw.h:292

◆ HalpDismissIrq15Level()

BOOLEAN NTAPI HalpDismissIrq15Level ( IN KIRQL  Irql,
IN ULONG  Irq,
OUT PKIRQL  OldIrql 
)

Definition at line 826 of file pic.c.

829{
830 I8259_OCW3 Ocw3;
831 I8259_OCW2 Ocw2;
833
834 /* Request the ISR */
835 Ocw3.Bits = 0;
836 Ocw3.Sbo = 1; /* This encodes an OCW3 vs. an OCW2 */
837 Ocw3.ReadRequest = ReadIsr;
839
840 /* Read the ISR */
842
843 /* Is IRQ15 really active (this is IR7) */
844 if (Isr.Irq7 == FALSE)
845 {
846 /* It isn't, so we have to EOI cascade IRQ */
847 Ocw2.Bits = 0;
848 Ocw2.EoiMode = SpecificEoi;
850
851 /* And now fail since this was spurious */
852 return FALSE;
853 }
854
855 /* Do normal interrupt dismiss */
856 return _HalpDismissIrqLevel(Irql, Irq, OldIrql);
857}

◆ HalpDismissIrqGeneric()

BOOLEAN NTAPI HalpDismissIrqGeneric ( IN KIRQL  Irql,
IN ULONG  Irq,
OUT PKIRQL  OldIrql 
)

Definition at line 634 of file pic.c.

637{
638 /* Run the inline code */
639 return _HalpDismissIrqGeneric(Irql, Irq, OldIrql);
640}

◆ HalpDismissIrqLevel()

BOOLEAN NTAPI HalpDismissIrqLevel ( IN KIRQL  Irql,
IN ULONG  Irq,
OUT PKIRQL  OldIrql 
)

Definition at line 816 of file pic.c.

819{
820 /* Run the inline code */
821 return _HalpDismissIrqLevel(Irql, Irq, OldIrql);
822}

◆ HalpDispatchInterrupt()

VOID __cdecl HalpDispatchInterrupt ( VOID  )

Referenced by HalpInitializePICs().

◆ HalpDispatchInterrupt2()

PHAL_SW_INTERRUPT_HANDLER __cdecl HalpDispatchInterrupt2 ( VOID  )

Definition at line 1199 of file pic.c.

1200{
1201 ULONG PendingIrqlMask, PendingIrql;
1202 KIRQL OldIrql;
1203 PIC_MASK Mask;
1204 PKPCR Pcr = KeGetPcr();
1205
1206 /* Do the work */
1208
1209 /* Restore IRQL */
1210 Pcr->Irql = OldIrql;
1211
1212 /* Check for pending software interrupts and compare with current IRQL */
1213 PendingIrqlMask = Pcr->IRR & FindHigherIrqlMask[OldIrql];
1214 if (PendingIrqlMask)
1215 {
1216 /* Check if pending IRQL affects hardware state */
1217 BitScanReverse(&PendingIrql, PendingIrqlMask);
1218 if (PendingIrql > DISPATCH_LEVEL)
1219 {
1220 /* Set new PIC mask */
1221 Mask.Both = Pcr->IDR & 0xFFFF;
1222 __outbyte(PIC1_DATA_PORT, Mask.Master);
1224
1225 /* Clear IRR bit */
1226 Pcr->IRR ^= (1 << PendingIrql);
1227 }
1228
1229 /* Now handle pending interrupt */
1230 return SWInterruptHandlerTable[PendingIrql];
1231 }
1232
1233 return NULL;
1234}
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
unsigned int Mask
Definition: fpcontrol.c:82
FORCEINLINE KIRQL _HalpDispatchInterruptHandler(VOID)
Definition: pic.c:1159
ULONG FindHigherIrqlMask[32]
Definition: irql.c:70
PHAL_SW_INTERRUPT_HANDLER SWInterruptHandlerTable[20]
Definition: pic.c:182
#define BitScanReverse
Definition: interlocked.h:6
#define PIC1_DATA_PORT
Definition: machpc.c:54
#define PIC2_DATA_PORT
Definition: machpc.c:56
Definition: ke.h:294
ULONG IDR
Definition: ke.h:23
ULONG IRR
Definition: ke.h:22
KIRQL Irql
Definition: ke.h:311

◆ HalpDispatchInterrupt2ndEntry()

DECLSPEC_NORETURN VOID FASTCALL HalpDispatchInterrupt2ndEntry ( IN PKTRAP_FRAME  TrapFrame)

Definition at line 1183 of file pic.c.

1184{
1185 KIRQL CurrentIrql;
1186
1187 /* Do the work */
1188 CurrentIrql = _HalpDispatchInterruptHandler();
1189
1190 /* End the interrupt */
1191 HalpEndSoftwareInterrupt(CurrentIrql, TrapFrame);
1192
1193 /* Exit the interrupt */
1194 KiEoiHelper(TrapFrame);
1195}
VOID NTAPI HalpEndSoftwareInterrupt(IN KIRQL OldIrql, IN PKTRAP_FRAME TrapFrame)
DECLSPEC_NORETURN VOID FASTCALL KiEoiHelper(IN PKTRAP_FRAME TrapFrame)
Definition: traphdlr.c:126

◆ HalpEnableInterruptHandler()

VOID NTAPI HalpEnableInterruptHandler ( IN UCHAR  Flags,
IN ULONG  BusVector,
IN ULONG  SystemVector,
IN KIRQL  Irql,
IN PVOID  Handler,
IN KINTERRUPT_MODE  Mode 
)

Definition at line 49 of file usage.c.

55{
56 /* Register the routine */
57 KeGetPcr()->InterruptRoutine[Irql] = Handler;
58}
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

Referenced by HalInitSystem(), HalpInitPhase0(), and HalpInitPhase1().

◆ HalpExitToV86()

VOID FASTCALL HalpExitToV86 ( PKTRAP_FRAME  TrapFrame)

Referenced by HalpBiosCall().

◆ HalpFlushTLB()

VOID NTAPI HalpFlushTLB ( VOID  )

Definition at line 156 of file misc.c.

157{
158 ULONG_PTR Flags, Cr4;
159 INT CpuInfo[4];
160 ULONG_PTR PageDirectory;
161
162 //
163 // Disable interrupts
164 //
166 _disable();
167
168 //
169 // Get page table directory base
170 //
171 PageDirectory = __readcr3();
172
173 //
174 // Check for CPUID support
175 //
176 if (KeGetCurrentPrcb()->CpuID)
177 {
178 //
179 // Check for global bit in CPU features
180 //
181 __cpuid(CpuInfo, 1);
182 if (CpuInfo[3] & 0x2000)
183 {
184 //
185 // Get current CR4 value
186 //
187 Cr4 = __readcr4();
188
189 //
190 // Disable global bit
191 //
192 __writecr4(Cr4 & ~CR4_PGE);
193
194 //
195 // Flush TLB and re-enable global bit
196 //
197 __writecr3(PageDirectory);
198 __writecr4(Cr4);
199
200 //
201 // Restore interrupts
202 //
204 return;
205 }
206 }
207
208 //
209 // Legacy: just flush TLB
210 //
211 __writecr3(PageDirectory);
213}
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
Definition: intrin_ppc.h:682
__INTRIN_INLINE unsigned long __readcr3(void)
Definition: intrin_x86.h:1818
__INTRIN_INLINE unsigned long __readcr4(void)
Definition: intrin_x86.h:1825
__INTRIN_INLINE void __writecr3(unsigned int Data)
Definition: intrin_x86.h:1794
__INTRIN_INLINE void __writecr4(unsigned int Data)
Definition: intrin_x86.h:1799
#define CR4_PGE
Definition: ketypes.h:152
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1146
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65

Referenced by HalpMapPhysicalMemory64Vista(), HalpMapRealModeMemory(), HalpUnmapRealModeMemory(), and HalpUnmapVirtualAddressVista().

◆ HalpGetDebugPortTable()

BOOLEAN NTAPI HalpGetDebugPortTable ( VOID  )

Definition at line 952 of file halacpi.c.

953{
954 return ((HalpDebugPortTable) &&
956}
PDEBUG_PORT_TABLE HalpDebugPortTable
Definition: halacpi.c:24
GEN_ADDR BaseAddress
Definition: acpi.h:209
UCHAR AddressSpaceID
Definition: acpi.h:70

Referenced by HalpReportResourceUsage().

◆ HalpGetNMICrashFlag()

VOID NTAPI HalpGetNMICrashFlag ( VOID  )

Definition at line 595 of file usage.c.

596{
598 UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\CrashControl");
603 KEY_VALUE_PARTIAL_INFORMATION KeyValueInformation;
604
605 /* Set default */
606 HalpNMIDumpFlag = 0;
607
608 /* Initialize attributes */
610 &KeyName,
612 NULL,
613 NULL);
614
615 /* Open crash key */
616 Status = ZwOpenKey(&Handle, KEY_READ, &ObjectAttributes);
617 if (NT_SUCCESS(Status))
618 {
619 /* Query key value */
620 RtlInitUnicodeString(&ValueName, L"NMICrashDump");
621 Status = ZwQueryValueKey(Handle,
622 &ValueName,
624 &KeyValueInformation,
625 sizeof(KeyValueInformation),
626 &ResultLength);
627 if (NT_SUCCESS(Status))
628 {
629 /* Check for valid data */
631 {
632 /* Read the flag */
633 HalpNMIDumpFlag = KeyValueInformation.Data[0];
634 }
635 }
636
637 /* We're done */
639 }
640}
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
ULONG Handle
Definition: gdb_input.c:15
BOOLEAN HalpNMIDumpFlag
Definition: usage.c:18
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
@ KeyValuePartialInformation
Definition: nt_native.h:1182
#define KEY_READ
Definition: nt_native.h:1023
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243

Referenced by HalpInitializePciBus().

◆ HalpHardwareInterruptLevel()

VOID __cdecl HalpHardwareInterruptLevel ( VOID  )

◆ HalpInitBusHandlers()

VOID NTAPI HalpInitBusHandlers ( VOID  )

Definition at line 935 of file halacpi.c.

936{
937 /* On ACPI, we only have a fake PCI bus to worry about */
939}
VOID NTAPI HalpInitNonBusHandler(VOID)
Definition: halacpi.c:924

Referenced by HalInitSystem().

◆ HalpInitializeCmos()

VOID NTAPI HalpInitializeCmos ( VOID  )

Definition at line 160 of file cmos.c.

161{
162 /* Set default century offset byte */
164
165 /* No support for EISA or MCA */
167}
ULONG HalpBusType
Definition: pcibus.c:18
UCHAR HalpCmosCenturyOffset
Definition: cmos.c:18
#define MACHINE_TYPE_ISA
Definition: ketypes.h:113

Referenced by HalInitSystem().

◆ HalpInitializeLegacyPICs()

VOID NTAPI HalpInitializeLegacyPICs ( VOID  )

Definition at line 18 of file pic.c.

19{
20 I8259_ICW1 Icw1;
21 I8259_ICW2 Icw2;
22 I8259_ICW3 Icw3;
23 I8259_ICW4 Icw4;
24
26
27 /* Initialize ICW1 for master, interval 8, edge-triggered mode with ICW4 */
28 Icw1.NeedIcw4 = TRUE;
30 Icw1.Interval = Interval8;
32 Icw1.Init = TRUE;
35
36 /* ICW2 - interrupt vector offset */
39
40 /* Connect slave to IRQ 2 */
41 Icw3.Bits = 0;
42 Icw3.SlaveIrq2 = TRUE;
44
45 /* Enable 8086 mode, non-automatic EOI, non-buffered mode, non special fully nested mode */
47 Icw4.EoiMode = NormalEoi;
50 Icw4.Reserved = 0;
52
53 /* Mask all interrupts */
55
56 /* Initialize ICW1 for slave, interval 8, edge-triggered mode with ICW4 */
57 Icw1.NeedIcw4 = TRUE;
60 Icw1.Interval = Interval8;
61 Icw1.Init = TRUE;
62 Icw1.InterruptVectorAddress = 0; /* This is only used in MCS80/85 mode */
64
65 /* Set interrupt vector base */
66 Icw2.Bits = PRIMARY_VECTOR_BASE + 8;
68
69 /* Slave ID */
70 Icw3.Bits = 0;
71 Icw3.SlaveId = 2;
73
74 /* Enable 8086 mode, non-automatic EOI, non-buffered mode, non special fully nested mode */
76 Icw4.EoiMode = NormalEoi;
79 Icw4.Reserved = 0;
81
82 /* Mask all interrupts */
84}
#define EFLAGS_INTERRUPT_MASK
Definition: SystemCall.c:11
#define PRIMARY_VECTOR_BASE
Definition: halp.h:16
@ NonBuffered
Definition: halhw.h:194
@ NormalEoi
Definition: halhw.h:188
@ Cascade
Definition: halhw.h:164
@ New8086Mode
Definition: halhw.h:183
@ EdgeTriggered
Definition: halhw.h:170
@ Interval8
Definition: halhw.h:176
UCHAR Init
Definition: halhw.h:231
UCHAR OperatingMode
Definition: halhw.h:228
UCHAR Bits
Definition: halhw.h:234
UCHAR NeedIcw4
Definition: halhw.h:227
UCHAR Interval
Definition: halhw.h:229
UCHAR InterruptVectorAddress
Definition: halhw.h:232
UCHAR InterruptMode
Definition: halhw.h:230
UCHAR Bits
Definition: halhw.h:244
UCHAR SlaveId
Definition: halhw.h:264
UCHAR SlaveIrq2
Definition: halhw.h:255
UCHAR Bits
Definition: halhw.h:268
UCHAR SystemMode
Definition: halhw.h:275
UCHAR BufferedMode
Definition: halhw.h:277
UCHAR SpecialFullyNestedMode
Definition: halhw.h:278
UCHAR Reserved
Definition: halhw.h:279
UCHAR Bits
Definition: halhw.h:281
UCHAR EoiMode
Definition: halhw.h:276

Referenced by HalpInitializePICs().

◆ HalpInitializePICs()

VOID NTAPI HalpInitializePICs ( IN BOOLEAN  EnableInterrupts)

Definition at line 513 of file apic.c.

514{
515 ULONG_PTR EFlags;
516
517 /* Save EFlags and disable interrupts */
518 EFlags = __readeflags();
519 _disable();
520
521 /* Initialize and mask the PIC */
523
524 /* Initialize the I/O APIC */
526
527 /* Manually reserve some vectors */
533
534 /* Set interrupt handlers in the IDT */
537#ifndef _M_AMD64
540#endif
541
542 /* Register the vectors for APC and dispatch interrupts */
545
546 /* Restore interrupt state */
548 __writeeflags(EFlags);
549}
UCHAR HalpVectorToIndex[256]
Definition: apic.c:28
VOID NTAPI ApicInitializeIOApic(VOID)
Definition: apic.c:459
#define CLOCK_IPI_VECTOR
Definition: apicp.h:46
#define APC_VECTOR
Definition: apicp.h:41
#define APIC_CLOCK_VECTOR
Definition: apicp.h:44
#define APIC_SPURIOUS_VECTOR
Definition: apicp.h:40
#define DISPATCH_VECTOR
Definition: apicp.h:42
#define APIC_RESERVED_VECTOR
Definition: apicp.h:61
static NTSTATUS EnableInterrupts(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR FlagsToDisable, IN UCHAR FlagsToEnable)
Definition: pnp.c:380
#define APC_LEVEL
Definition: env_spec_w32.h:695
VOID HalpClockInterrupt(VOID)
Definition: timer.c:30
VOID NTAPI HalpRegisterVector(IN UCHAR Flags, IN ULONG BusVector, IN ULONG SystemVector, IN KIRQL Irql)
Definition: usage.c:34
VOID NTAPI HalpInitializeLegacyPICs(VOID)
Definition: pic.c:18
#define IDT_INTERNAL
Definition: halp.h:21
VOID __cdecl HalpDispatchInterrupt(VOID)
VOID __cdecl HalpApcInterrupt(VOID)
VOID __cdecl HalpClockIpi(VOID)
FORCEINLINE VOID KeRegisterInterruptHandler(IN ULONG Vector, IN PVOID Handler)
Definition: ke.h:301

Referenced by HalInitSystem().

◆ HalpInitPciBus()

VOID HalpInitPciBus ( VOID  )

◆ HalpInitPhase0()

VOID HalpInitPhase0 ( PLOADER_PARAMETER_BLOCK  LoaderBlock)

Definition at line 30 of file halinit_mp.c.

32{
33 static BOOLEAN MPSInitialized = FALSE;
34
35
36 /* Only initialize MP system once. Once called the first time,
37 each subsequent call is part of the initialization sequence
38 for an application processor. */
39
40 DPRINT("HalpInitPhase0()\n");
41
42
43 if (MPSInitialized)
44 {
46 }
47
48 MPSInitialized = TRUE;
49
50 if (!HaliFindSmpConfig())
51 {
53 }
54
55 /* store the kernel base for later use */
56 KernelBase = (ULONG_PTR)CONTAINING_RECORD(LoaderBlock->LoadOrderListHead.Flink, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks)->DllBase;
57
58}
#define ULONG_PTR
Definition: config.h:101
BOOLEAN HaliFindSmpConfig(VOID)
Definition: mpconfig.c:605
ULONG_PTR KernelBase
Definition: halinit_mp.c:20
#define DPRINT
Definition: sndvol32.h:71
Definition: btrfs_drv.h:1876
LIST_ENTRY LoadOrderListHead
Definition: arc.h:540

◆ HalpInitPhase1()

VOID HalpInitPhase1 ( VOID  )

Definition at line 26 of file halinit_up.c.

27{
28
29}

◆ HalpInitProcessor()

VOID NTAPI HalpInitProcessor ( IN ULONG  ProcessorNumber,
IN PLOADER_PARAMETER_BLOCK  LoaderBlock 
)

Definition at line 24 of file halinit.c.

27{
28 if (ProcessorNumber == 0)
29 {
30 HalpParseApicTables(LoaderBlock);
31 }
32
33 HalpSetupProcessorsTable(ProcessorNumber);
34
35 /* Initialize the local APIC for this cpu */
36 ApicInitializeLocalApic(ProcessorNumber);
37
38 /* Initialize profiling data (but don't start it) */
40
41 /* Initialize the timer */
42 //ApicInitializeTimer(ProcessorNumber);
43}
VOID NTAPI HalInitializeProfiling(VOID)
Definition: apictimer.c:76
VOID NTAPI ApicInitializeLocalApic(ULONG Cpu)
Definition: apic.c:291
VOID HalpParseApicTables(_In_ PLOADER_PARAMETER_BLOCK LoaderBlock)
Definition: madt.c:30
VOID HalpSetupProcessorsTable(_In_ UINT32 NTProcessorNumber)
Definition: up.c:37

Referenced by HalInitializeProcessor().

◆ HalpIs16BitPortDecodeSupported()

ULONG NTAPI HalpIs16BitPortDecodeSupported ( VOID  )

Definition at line 961 of file halacpi.c.

962{
963 /* All ACPI systems are at least "EISA" so they support this */
965}
#define CM_RESOURCE_PORT_16_BIT_DECODE
Definition: cmtypes.h:112

Referenced by HalpBuildPartialFromAddress().

◆ HalpMapPhysicalMemory64()

PVOID NTAPI HalpMapPhysicalMemory64 ( IN PHYSICAL_ADDRESS  PhysicalAddress,
IN PFN_COUNT  PageCount 
)

Definition at line 140 of file memory.c.

142{
144}
PVOID NTAPI HalpMapPhysicalMemory64Vista(IN PHYSICAL_ADDRESS PhysicalAddress, IN PFN_COUNT PageCount, IN BOOLEAN FlushCurrentTLB)
Definition: memory.c:156

Referenced by HalpAcpiCopyBiosTable(), HalpAcpiFindRsdtPhase0(), HalpAcpiGetTableFromBios(), HalpAcpiTableCacheInit(), HalpConfigureDebuggingDevice(), HalpInitializeCmos(), HalpReboot(), HalpRegisterKdSupportFunctions(), HalpSetupAcpiPhase0(), and HalpSetupPciDeviceForDebugging().

◆ HalpMapPhysicalMemory64Vista()

PVOID NTAPI HalpMapPhysicalMemory64Vista ( IN PHYSICAL_ADDRESS  PhysicalAddress,
IN PFN_COUNT  PageCount,
IN BOOLEAN  FlushCurrentTLB 
)

Definition at line 156 of file memory.c.

159{
160 PHARDWARE_PTE PointerPte;
161 PFN_NUMBER UsedPages = 0;
163
164 /* Start at the current HAL heap base */
167
168 /* Loop until we have all the pages required */
169 while (UsedPages < PageCount)
170 {
171 /* If this overflows past the HAL heap, it means there's no space */
172 if (VirtualAddress == NULL) return NULL;
173
174 /* Get the PTE for this address */
175 PointerPte = HalAddressToPte(VirtualAddress);
176
177 /* Go to the next page */
179
180 /* Check if the page is available */
181 if (PointerPte->Valid)
182 {
183 /* PTE has data, skip it and start with a new base address */
185 UsedPages = 0;
186 continue;
187 }
188
189 /* PTE is available, keep going on this run */
190 UsedPages++;
191 }
192
193 /* Take the base address of the page plus the actual offset in the address */
196
197 /* If we are starting at the heap, move the heap */
199 {
200 /* Past this allocation */
201 HalpHeapStart = (PVOID)((ULONG_PTR)BaseAddress + (PageCount * PAGE_SIZE));
202 }
203
204 /* Loop pages that can be mapped */
205 while (UsedPages--)
206 {
207 /* Fill out the PTE */
208 PointerPte = HalAddressToPte(BaseAddress);
210 PointerPte->Valid = 1;
211 PointerPte->Write = 1;
212
213 /* Move to the next address */
216 }
217
218 /* Flush the TLB and return the address */
219 if (FlushCurrentTLB)
220 HalpFlushTLB();
221
222 return VirtualAddress;
223}
PVOID HalpHeapStart
Definition: memory.c:22
VOID NTAPI HalpFlushTLB(VOID)
Definition: misc.c:156
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
ULONG64 PageFrameNumber
Definition: mmtypes.h:78
ULONG64 Valid
Definition: mmtypes.h:66
void * PVOID
Definition: typedefs.h:50
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG LowPart
Definition: typedefs.h:106
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress
#define BYTE_OFFSET(Va)

Referenced by HalpMapPhysicalMemory64(), and HalpRegisterKdSupportFunctions().

◆ HalpMarkAcpiHal()

NTSTATUS NTAPI HalpMarkAcpiHal ( VOID  )

Definition at line 57 of file misc.c.

58{
60 UNICODE_STRING KeyString;
64
65 /* Open the control set key */
66 RtlInitUnicodeString(&KeyString,
67 L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET");
69 if (NT_SUCCESS(Status))
70 {
71 /* Open the PNP key */
72 RtlInitUnicodeString(&KeyString, L"Control\\Pnp");
74 Handle,
75 &KeyString,
77 TRUE);
78 /* Close root key */
80
81 /* Check if PNP BIOS key exists */
82 if (NT_SUCCESS(Status))
83 {
84 /* Set the disable value to false -- we need the mapper */
85 RtlInitUnicodeString(&KeyString, L"DisableFirmwareMapper");
86 Status = ZwSetValueKey(KeyHandle,
87 &KeyString,
88 0,
90 &Value,
91 sizeof(Value));
92
93 /* Close subkey */
95 }
96 }
97
98 /* Return status */
99 return Status;
100}
NTSTATUS NTAPI HalpOpenRegistryKey(IN PHANDLE KeyHandle, IN HANDLE RootKey, IN PUNICODE_STRING KeyName, IN ACCESS_MASK DesiredAccess, IN BOOLEAN Create)
Definition: misc.c:104
BOOLEAN HalDisableFirmwareMapper
Definition: halacpi.c:43
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4715
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define REG_DWORD
Definition: sdbapi.c:596
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by HalpReportResourceUsage().

◆ HalpOpenRegistryKey()

NTSTATUS NTAPI HalpOpenRegistryKey ( IN PHANDLE  KeyHandle,
IN HANDLE  RootKey,
IN PUNICODE_STRING  KeyName,
IN ACCESS_MASK  DesiredAccess,
IN BOOLEAN  Create 
)

Definition at line 104 of file misc.c.

109{
113
114 /* Setup the attributes we received */
116 KeyName,
118 RootKey,
119 NULL);
120
121 /* What to do? */
122 if ( Create )
123 {
124 /* Create the key */
125 Status = ZwCreateKey(KeyHandle,
128 0,
129 NULL,
131 &Disposition);
132 }
133 else
134 {
135 /* Open the key */
137 }
138
139 /* We're done */
140 return Status;
141}
@ Create
Definition: registry.c:563
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:56
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060
static PMEMKEY RootKey
Definition: registry.c:55
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK DesiredAccess
Definition: wdfdevice.h:2658

Referenced by HalpMarkAcpiHal(), HalpMarkChipsetDecode(), HalpRegisterPciDebuggingDeviceInfo(), and HalpReportSerialNumber().

◆ HalpProfileInterrupt()

VOID __cdecl HalpProfileInterrupt ( VOID  )

◆ HalpQueryAcpiResourceRequirements()

NTSTATUS NTAPI HalpQueryAcpiResourceRequirements ( OUT PIO_RESOURCE_REQUIREMENTS_LIST Requirements)

Definition at line 1016 of file halacpi.c.

1017{
1019 ULONG Count, ListSize;
1021
1022 PAGED_CODE();
1023
1024 /* Get ACPI resources */
1026 DPRINT("Resource count: %lu\n", Count);
1027
1028 /* Compute size of the list and allocate it */
1029 ListSize = FIELD_OFFSET(IO_RESOURCE_REQUIREMENTS_LIST, List[0].Descriptors) +
1030 (Count * sizeof(IO_RESOURCE_DESCRIPTOR));
1031 DPRINT("Resource list size: %lu\n", ListSize);
1033 if (RequirementsList)
1034 {
1035 /* Initialize it */
1037 RequirementsList->ListSize = ListSize;
1038
1039 /* Build it */
1041 if (NT_SUCCESS(Status))
1042 {
1043 /* It worked, return it */
1044 *Requirements = RequirementsList;
1045
1046 /* Validate the list */
1047 ASSERT(RequirementsList->List[0].Count == Count);
1048 }
1049 else
1050 {
1051 /* Fail */
1054 }
1055 }
1056 else
1057 {
1058 /* Not enough memory */
1060 }
1061
1062 /* Return the status */
1063 return Status;
1064}
struct _IO_RESOURCE_DESCRIPTOR IO_RESOURCE_DESCRIPTOR
#define PagedPool
Definition: env_spec_w32.h:308
#define TAG_HAL
Definition: hal.h:61
NTSTATUS NTAPI HalpBuildAcpiResourceList(IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceList)
Definition: halacpi.c:979
VOID NTAPI HalpAcpiDetectResourceListSize(OUT PULONG ListSize)
Definition: halacpi.c:969
int Count
Definition: noreturn.cpp:7
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
_In_ WDFIORESREQLIST RequirementsList
Definition: wdfresource.h:65
_Must_inspect_result_ _In_ WDFCMRESLIST List
Definition: wdfresource.h:550

Referenced by HalpQueryResourceRequirements(), and HalpQueryResources().

◆ HalpRealModeStart()

VOID __cdecl HalpRealModeStart ( VOID  )

◆ HalpRegisterKdSupportFunctions()

VOID NTAPI HalpRegisterKdSupportFunctions ( VOID  )

Definition at line 22 of file busemul.c.

23{
24 /* Register PCI Device Functions */
27
28 /* Register memory functions */
29#ifndef _MINIHAL_
30#if (NTDDI_VERSION >= NTDDI_VISTA)
33#else
36#endif
37#endif
38
39 /* Register ACPI stub */
41}
VOID NTAPI HalpUnmapVirtualAddress(IN PVOID VirtualAddress, IN PFN_COUNT PageCount)
Definition: memory.c:148
VOID NTAPI HalpUnmapVirtualAddressVista(IN PVOID VirtualAddress, IN PFN_COUNT PageCount, IN BOOLEAN FlushCurrentTLB)
Definition: memory.c:227
PVOID NTAPI HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress, IN PFN_COUNT PageCount)
Definition: memory.c:140
VOID NTAPI HalpCheckPowerButton(VOID)
Definition: misc.c:146
NTSTATUS NTAPI HalpReleasePciDeviceForDebugging(_Inout_ PDEBUG_DEVICE_DESCRIPTOR PciDevice)
Releases the PCI device MMIO mappings previously allocated with HalpSetupPciDeviceForDebugging().
Definition: kdpci.c:421
NTSTATUS NTAPI HalpSetupPciDeviceForDebugging(_In_opt_ PVOID LoaderBlock, _Inout_ PDEBUG_DEVICE_DESCRIPTOR PciDevice)
Finds and fully initializes the PCI device associated with the supplied debug device descriptor.
Definition: kdpci.c:483
#define KdUnmapVirtualAddress
Definition: halfuncs.h:53
#define KdMapPhysicalMemory64
Definition: halfuncs.h:52
#define KdSetupPciDeviceForDebugging
Definition: halfuncs.h:47
#define KdReleasePciDeviceforDebugging
Definition: halfuncs.h:48
#define KdCheckPowerButton
Definition: halfuncs.h:50

Referenced by HalInitializeProcessor().

◆ HalpRegisterVector()

VOID NTAPI HalpRegisterVector ( IN UCHAR  Flags,
IN ULONG  BusVector,
IN ULONG  SystemVector,
IN KIRQL  Irql 
)

Definition at line 34 of file usage.c.

38{
39 /* Save the vector flags */
40 HalpIDTUsageFlags[SystemVector].Flags = Flags;
41
42 /* Save the vector data */
43 HalpIDTUsage[SystemVector].Irql = Irql;
44 HalpIDTUsage[SystemVector].BusReleativeVector = BusVector;
45}
IDTUsageFlags HalpIDTUsageFlags[256]
Definition: usage.c:19
IDTUsage HalpIDTUsage[256]
Definition: usage.c:20
UCHAR BusReleativeVector
Definition: halp.h:32
KIRQL Irql
Definition: halp.h:31
UCHAR Flags
Definition: halp.h:26

Referenced by HalpEnableInterruptHandler(), HalpInitializePICs(), and HalpReportResourceUsage().

◆ HalpReleasePciDeviceForDebugging()

NTSTATUS NTAPI HalpReleasePciDeviceForDebugging ( IN OUT PDEBUG_DEVICE_DESCRIPTOR  PciDevice)

◆ HalpReportResourceUsage()

VOID NTAPI HalpReportResourceUsage ( IN PUNICODE_STRING  HalName,
IN INTERFACE_TYPE  InterfaceType 
)

Definition at line 26 of file usage.c.

28{
29 DbgPrint("%wZ has been initialized\n", HalName);
30}
PWCHAR HalName
Definition: halacpi.c:45

Referenced by HalReportResourceUsage().

◆ HalpReportSerialNumber()

VOID NTAPI HalpReportSerialNumber ( VOID  )

Definition at line 26 of file misc.c.

27{
29 UNICODE_STRING KeyString;
31
32 /* Make sure there is a serial number */
33 if (!HalpSerialLen) return;
34
35 /* Open the system key */
36 RtlInitUnicodeString(&KeyString, L"\\Registry\\Machine\\Hardware\\Description\\System");
38 if (NT_SUCCESS(Status))
39 {
40 /* Add the serial number */
41 RtlInitUnicodeString(&KeyString, L"Serial Number");
42 ZwSetValueKey(Handle,
43 &KeyString,
44 0,
48
49 /* Close the handle */
51 }
52}
CHAR HalpSerialNumber[31]
Definition: misc.c:18
UCHAR HalpSerialLen
Definition: misc.c:17
#define REG_BINARY
Definition: nt_native.h:1496

Referenced by HalpReportResourceUsage().

◆ HalpSetupPciDeviceForDebugging()

NTSTATUS NTAPI HalpSetupPciDeviceForDebugging ( IN PVOID  LoaderBlock,
IN OUT PDEBUG_DEVICE_DESCRIPTOR  PciDevice 
)

◆ HalpUnmapVirtualAddress()

VOID NTAPI HalpUnmapVirtualAddress ( IN PVOID  VirtualAddress,
IN PFN_COUNT  NumberPages 
)

◆ HalpUnmapVirtualAddressVista()

VOID NTAPI HalpUnmapVirtualAddressVista ( IN PVOID  VirtualAddress,
IN PFN_COUNT  NumberPages,
IN BOOLEAN  FlushCurrentTLB 
)

Definition at line 227 of file memory.c.

230{
231 PHARDWARE_PTE PointerPte;
232 ULONG i;
233
234 /* Only accept valid addresses */
235 if (VirtualAddress < (PVOID)MM_HAL_VA_START) return;
236
237 /* Align it down to page size */
239
240 /* Loop PTEs */
241 PointerPte = HalAddressToPte(VirtualAddress);
242 for (i = 0; i < PageCount; i++)
243 {
244 *(PULONG)PointerPte = 0;
245 PointerPte++;
246 }
247
248 /* Flush the TLB */
249 if (FlushCurrentTLB)
250 HalpFlushTLB();
251
252 /* Put the heap back */
254}
#define MM_HAL_VA_START
Definition: ketypes.h:322
uint32_t * PULONG
Definition: typedefs.h:59

Referenced by HalpRegisterKdSupportFunctions(), and HalpUnmapVirtualAddress().

◆ KeUpdateRunTime()

VOID NTAPI KeUpdateRunTime ( _In_ PKTRAP_FRAME  TrapFrame,
_In_ KIRQL  Irql 
)

Referenced by HalpClockIpiHandler().

◆ KeUpdateSystemTime()

VOID FASTCALL KeUpdateSystemTime ( IN PKTRAP_FRAME  TrapFrame,
IN ULONG  Increment,
IN KIRQL  OldIrql 
)

Definition at line 64 of file time.c.

67{
68 PKPRCB Prcb = KeGetCurrentPrcb();
69 ULARGE_INTEGER CurrentTime, InterruptTime;
70 LONG OldTickOffset;
71
72 /* Check if this tick is being skipped */
73 if (Prcb->SkipTick)
74 {
75 /* Handle it next time */
76 Prcb->SkipTick = FALSE;
77
78 /* Increase interrupt count and end the interrupt */
79 Prcb->InterruptCount++;
80 KiEndInterrupt(Irql, TrapFrame);
81
82 /* Note: non-x86 return back to the caller! */
83 return;
84 }
85
86 /* Add the increment time to the shared data */
87 InterruptTime.QuadPart = *(ULONGLONG*)&SharedUserData->InterruptTime;
88 InterruptTime.QuadPart += Increment;
89 KiWriteSystemTime(&SharedUserData->InterruptTime, InterruptTime);
90
91 /* Check for timer expiration */
92 KiCheckForTimerExpiration(Prcb, TrapFrame, InterruptTime);
93
94 /* Update the tick offset */
96
97 /* If the debugger is enabled, check for break-in request */
99 {
100 /* Break-in requested! */
102 }
103
104 /* Check for full tick */
105 if (OldTickOffset <= (LONG)Increment)
106 {
107 /* Update the system time */
108 CurrentTime.QuadPart = *(ULONGLONG*)&SharedUserData->SystemTime;
109 CurrentTime.QuadPart += KeTimeAdjustment;
110 KiWriteSystemTime(&SharedUserData->SystemTime, CurrentTime);
111
112 /* Update the tick count */
113 CurrentTime.QuadPart = (*(ULONGLONG*)&KeTickCount) + 1;
114 KiWriteSystemTime(&KeTickCount, CurrentTime);
115
116 /* Update it in the shared user data */
117 KiWriteSystemTime(&SharedUserData->TickCount, CurrentTime);
118
119 /* Check for expiration with the new tick count as well */
120 KiCheckForTimerExpiration(Prcb, TrapFrame, InterruptTime);
121
122 /* Reset the tick offset */
124
125 /* Update processor/thread runtime */
126 KeUpdateRunTime(TrapFrame, Irql);
127 }
128 else
129 {
130 /* Increase interrupt count only */
131 Prcb->InterruptCount++;
132 }
133
134 /* Disable interrupts and end the interrupt */
135 KiEndInterrupt(Irql, TrapFrame);
136}
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG Increment
Definition: CrNtStubs.h:46
#define InterlockedExchangeAdd
Definition: interlocked.h:181
BOOLEAN KdDebuggerEnabled
Definition: kddata.c:83
BOOLEAN NTAPI KdPollBreakIn(VOID)
Definition: kdlock.c:75
#define DBG_STATUS_CONTROL_C
Definition: kdtypes.h:39
NTKERNELAPI volatile KSYSTEM_TIME KeTickCount
Definition: clock.c:19
#define KiEndInterrupt(x, y)
Definition: ke.h:175
ULONG KeMaximumIncrement
Definition: clock.c:20
LONG KiTickOffset
Definition: time.c:17
ULONG KeTimeAdjustment
Definition: time.c:18
FORCEINLINE VOID KiCheckForTimerExpiration(PKPRCB Prcb, PKTRAP_FRAME TrapFrame, ULARGE_INTEGER InterruptTime)
Definition: time.c:40
FORCEINLINE VOID KiWriteSystemTime(volatile KSYSTEM_TIME *SystemTime, ULARGE_INTEGER NewTime)
Definition: time.c:25
VOID NTAPI KeUpdateRunTime(IN PKTRAP_FRAME TrapFrame, IN KIRQL Irql)
Definition: time.c:140
long LONG
Definition: pedump.c:60
#define SharedUserData
ULONG InterruptCount
Definition: ketypes.h:801
UCHAR SkipTick
Definition: ketypes.h:807
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
uint64_t ULONGLONG
Definition: typedefs.h:67
__analysis_noreturn NTSYSAPI VOID NTAPI DbgBreakPointWithStatus(_In_ ULONG Status)

Variable Documentation

◆ HalDisableFirmwareMapper

BOOLEAN HalDisableFirmwareMapper
extern

Definition at line 43 of file halacpi.c.

Referenced by HalpMarkAcpiHal().

◆ HalHardwareIdString

PWCHAR HalHardwareIdString
extern

Definition at line 44 of file halacpi.c.

Referenced by HalpQueryIdFdo().

◆ HalName

◆ HalpActiveProcessors

KAFFINITY HalpActiveProcessors
extern

◆ HalpAddressUsageList

PADDRESS_USAGE HalpAddressUsageList
extern

Definition at line 20 of file usage.c.

Referenced by HalInitSystem(), and HalpReportResourceUsage().

◆ HalpBuildType

const USHORT HalpBuildType
extern

Definition at line 14 of file buildtype.c.

Referenced by HalInitSystem(), and HalpInitPhase0().

◆ HalpDefaultInterruptAffinity

KAFFINITY HalpDefaultInterruptAffinity
extern

Definition at line 18 of file processor.c.

Referenced by HalInitializeProcessor(), and HalpGetRootInterruptVector().

◆ HalpDefaultIoSpace

ADDRESS_USAGE HalpDefaultIoSpace
extern

Definition at line 42 of file usage.c.

Referenced by HalInitSystem().

◆ HalpIDTUsageFlags

◆ HalpIrqlSynchLevel

KIRQL HalpIrqlSynchLevel
extern

Definition at line 19 of file buildtype.c.

◆ HalpNMIInProgress

BOOLEAN HalpNMIInProgress
extern

Definition at line 18 of file nmi.c.

Referenced by HalHandleNMI(), and HalpRestoreTrapHandlers().

◆ HalpPerfCounter

LARGE_INTEGER HalpPerfCounter
extern

Definition at line 23 of file timer.c.

Referenced by KeQueryPerformanceCounter().

◆ HalpProfilingStopped

BOOLEAN HalpProfilingStopped
extern

◆ HalpSystemHardwareLock

KSPIN_LOCK HalpSystemHardwareLock
extern

Definition at line 25 of file spinlock.c.

Referenced by HalInitSystem(), HalpAcquireCmosSpinLock(), and HalpReleaseCmosSpinLock().

◆ Value

Definition at line 417 of file halp.h.