ReactOS  0.4.14-dev-77-gd9e7c48
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
 
union  _TIMER_CONTROL_PORT_REGISTER
 
union  _SYSTEM_CONTROL_PORT_B_REGISTER
 
union  _I8259_ICW1
 
union  _I8259_ICW2
 
union  _I8259_ICW3
 
union  _I8259_ICW4
 
union  _I8259_OCW2
 
union  _I8259_OCW3
 
union  _I8259_ISR
 
union  _EISA_ELCR
 
struct  _PIC_MASK
 
struct  _IDTUsageFlags
 
struct  IDTUsage
 
struct  _HalAddressUsage
 

Macros

#define HAL_BUILD_TYPE   ((DBG ? PRCB_BUILD_DEBUG : 0) | PRCB_BUILD_UNIPROCESSOR)
 
#define HAL_APC_REQUEST   0
 
#define HAL_DPC_REQUEST   1
 
#define HAL_PROFILING_INTERVAL   0
 
#define HAL_PROFILING_MULTIPLIER   1
 
#define CMOS_CONTROL_PORT   (PUCHAR)0x70
 
#define CMOS_DATA_PORT   (PUCHAR)0x71
 
#define RTC_REGISTER_A   0x0A
 
#define RTC_REG_A_UIP   0x80
 
#define RTC_REGISTER_B   0x0B
 
#define RTC_REG_B_PI   0x40
 
#define RTC_REGISTER_C   0x0C
 
#define RTC_REG_C_IRQ   0x80
 
#define RTC_REGISTER_D   0x0D
 
#define RTC_REGISTER_CENTURY   0x32
 
#define IDT_REGISTERED   0x01
 
#define IDT_LATCHED   0x02
 
#define IDT_READ_ONLY   0x04
 
#define IDT_INTERNAL   0x11
 
#define IDT_DEVICE   0x21
 
#define BCD_INT(bcd)   (((bcd & 0xF0) >> 4) * 10 + (bcd & 0x0F))
 
#define INT_BCD(int)   (UCHAR)(((int / 10) << 4) + (int % 10))
 
#define VIDEO_SERVICES   0x10
 
#define SET_VIDEO_MODE   0x00
 
#define GRAPHICS_MODE_12   0x12 /* 80x30 8x16 640x480 16/256K */
 
#define PIT_FREQUENCY   1193182
 
#define TIMER_CHANNEL0_DATA_PORT   0x40
 
#define TIMER_CHANNEL1_DATA_PORT   0x41
 
#define TIMER_CHANNEL2_DATA_PORT   0x42
 
#define TIMER_CONTROL_PORT   0x43
 
#define SYSTEM_CONTROL_PORT_A   0x92
 
#define SYSTEM_CONTROL_PORT_B   0x61
 
#define PIC1_CONTROL_PORT   0x20
 
#define PIC1_DATA_PORT   0x21
 
#define PIC2_CONTROL_PORT   0xA0
 
#define PIC2_DATA_PORT   0xA1
 
#define EISA_ELCR_MASTER   0x4D0
 
#define EISA_ELCR_SLAVE   0x4D1
 
#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 enum _TIMER_OPERATING_MODES TIMER_OPERATING_MODES
 
typedef enum _TIMER_ACCESS_MODES TIMER_ACCESS_MODES
 
typedef enum _TIMER_CHANNELS TIMER_CHANNELS
 
typedef union _TIMER_CONTROL_PORT_REGISTER TIMER_CONTROL_PORT_REGISTER
 
typedef union _TIMER_CONTROL_PORT_REGISTERPTIMER_CONTROL_PORT_REGISTER
 
typedef union _SYSTEM_CONTROL_PORT_B_REGISTER SYSTEM_CONTROL_PORT_B_REGISTER
 
typedef union _SYSTEM_CONTROL_PORT_B_REGISTERPSYSTEM_CONTROL_PORT_B_REGISTER
 
typedef enum _I8259_ICW1_OPERATING_MODE I8259_ICW1_OPERATING_MODE
 
typedef enum _I8259_ICW1_INTERRUPT_MODE I8259_ICW1_INTERRUPT_MODE
 
typedef enum _I8259_ICW1_INTERVAL I8259_ICW1_INTERVAL
 
typedef enum _I8259_ICW4_SYSTEM_MODE I8259_ICW4_SYSTEM_MODE
 
typedef enum _I8259_ICW4_EOI_MODE I8259_ICW4_EOI_MODE
 
typedef enum _I8259_ICW4_BUFFERED_MODE I8259_ICW4_BUFFERED_MODE
 
typedef enum _I8259_READ_REQUEST I8259_READ_REQUEST
 
typedef enum _I8259_EOI_MODE I8259_EOI_MODE
 
typedef union _I8259_ICW1 I8259_ICW1
 
typedef union _I8259_ICW1PI8259_ICW1
 
typedef union _I8259_ICW2 I8259_ICW2
 
typedef union _I8259_ICW2PI8259_ICW2
 
typedef union _I8259_ICW3 I8259_ICW3
 
typedef union _I8259_ICW3PI8259_ICW3
 
typedef union _I8259_ICW4 I8259_ICW4
 
typedef union _I8259_ICW4PI8259_ICW4
 
typedef union _I8259_OCW2 I8259_OCW2
 
typedef union _I8259_OCW2PI8259_OCW2
 
typedef union _I8259_OCW3 I8259_OCW3
 
typedef union _I8259_OCW3PI8259_OCW3
 
typedef union _I8259_ISR I8259_ISR
 
typedef union _I8259_ISRPI8259_ISR
 
typedef I8259_ISR I8259_IDR
 
typedef I8259_ISRPI8259_IDR
 
typedef union _EISA_ELCR EISA_ELCR
 
typedef union _EISA_ELCRPEISA_ELCR
 
typedef struct _PIC_MASK PIC_MASK
 
typedef struct _PIC_MASKPPIC_MASK
 
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
 

Enumerations

enum  _TIMER_OPERATING_MODES {
  PitOperatingMode0, PitOperatingMode1, PitOperatingMode2, PitOperatingMode3,
  PitOperatingMode4, PitOperatingMode5, PitOperatingMode2Reserved, PitOperatingMode5Reserved
}
 
enum  _TIMER_ACCESS_MODES { PitAccessModeCounterLatch, PitAccessModeLow, PitAccessModeHigh, PitAccessModeLowHigh }
 
enum  _TIMER_CHANNELS { PitChannel0, PitChannel1, PitChannel2, PitReadBack }
 
enum  _I8259_ICW1_OPERATING_MODE { Cascade, Single }
 
enum  _I8259_ICW1_INTERRUPT_MODE { EdgeTriggered, LevelTriggered }
 
enum  _I8259_ICW1_INTERVAL { Interval8, Interval4 }
 
enum  _I8259_ICW4_SYSTEM_MODE { Mcs8085Mode, New8086Mode }
 
enum  _I8259_ICW4_EOI_MODE { NormalEoi, AutomaticEoi }
 
enum  _I8259_ICW4_BUFFERED_MODE { NonBuffered, NonBuffered2, BufferedSlave, BufferedMaster }
 
enum  _I8259_READ_REQUEST { InvalidRequest, InvalidRequest2, ReadIdr, ReadIsr }
 
enum  _I8259_EOI_MODE {
  RotateAutoEoiClear, NonSpecificEoi, InvalidEoiMode, SpecificEoi,
  RotateAutoEoiSet, RotateNonSpecific, SetPriority, RotateSpecific
}
 

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)
 
INIT_FUNCTION VOID NTAPI HalpRegisterVector (IN UCHAR Flags, IN ULONG BusVector, IN ULONG SystemVector, IN KIRQL Irql)
 
INIT_FUNCTION 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)
 
INIT_FUNCTION VOID NTAPI HalpInitializeClock (VOID)
 
VOID __cdecl HalpClockInterrupt (VOID)
 
VOID __cdecl HalpProfileInterrupt (VOID)
 
VOID NTAPI HalpCalibrateStallExecution (VOID)
 
VOID HalpInitPciBus (VOID)
 
INIT_FUNCTION VOID HalpInitDma (VOID)
 
VOID HalpInitPhase0 (PLOADER_PARAMETER_BLOCK LoaderBlock)
 
VOID HalpInitPhase1 (VOID)
 
VOID NTAPI HalpFlushTLB (VOID)
 
VOID NTAPI HalpCheckPowerButton (VOID)
 
INIT_FUNCTION VOID NTAPI HalpRegisterKdSupportFunctions (VOID)
 
INIT_FUNCTION NTSTATUS NTAPI HalpSetupPciDeviceForDebugging (IN PVOID LoaderBlock, IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice)
 
INIT_FUNCTION 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 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)
 
INIT_FUNCTION VOID NTAPI HalpInitializeCmos (VOID)
 
UCHAR NTAPI HalpReadCmos (IN UCHAR Reg)
 
VOID NTAPI HalpWriteCmos (IN UCHAR Reg, IN UCHAR Value)
 
VOID NTAPI HalpAcquireCmosSpinLock (VOID)
 
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)
 
INIT_FUNCTION VOID NTAPI HalpGetNMICrashFlag (VOID)
 
INIT_FUNCTION BOOLEAN NTAPI HalpGetDebugPortTable (VOID)
 
INIT_FUNCTION VOID NTAPI HalpReportSerialNumber (VOID)
 
INIT_FUNCTION NTSTATUS NTAPI HalpMarkAcpiHal (VOID)
 
INIT_FUNCTION VOID NTAPI HalpBuildAddressMap (VOID)
 
INIT_FUNCTION VOID NTAPI HalpReportResourceUsage (IN PUNICODE_STRING HalName, IN INTERFACE_TYPE InterfaceType)
 
INIT_FUNCTION 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)
 
INIT_FUNCTION VOID NTAPI HalpInitBusHandlers (VOID)
 
NTSTATUS NTAPI HaliInitPnpDriver (VOID)
 
INIT_FUNCTION VOID NTAPI HalpDebugPciDumpBus (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)
 

Variables

BOOLEAN HalpProfilingStopped
 
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 69 of file halp.h.

◆ CMOS_CONTROL_PORT

#define CMOS_CONTROL_PORT   (PUCHAR)0x70

Definition at line 50 of file halp.h.

◆ CMOS_DATA_PORT

#define CMOS_DATA_PORT   (PUCHAR)0x71

Definition at line 51 of file halp.h.

◆ EISA_ELCR_MASTER

#define EISA_ELCR_MASTER   0x4D0

Definition at line 376 of file halp.h.

◆ EISA_ELCR_SLAVE

#define EISA_ELCR_SLAVE   0x4D1

Definition at line 377 of file halp.h.

◆ GRAPHICS_MODE_12

#define GRAPHICS_MODE_12   0x12 /* 80x30 8x16 640x480 16/256K */

Definition at line 87 of file halp.h.

◆ HAL_APC_REQUEST

#define HAL_APC_REQUEST   0

Definition at line 42 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 43 of file halp.h.

◆ HAL_PROFILING_INTERVAL

#define HAL_PROFILING_INTERVAL   0

Definition at line 46 of file halp.h.

◆ HAL_PROFILING_MULTIPLIER

#define HAL_PROFILING_MULTIPLIER   1

Definition at line 47 of file halp.h.

◆ HalAddressToPde

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

Definition at line 522 of file halp.h.

◆ HalAddressToPte

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

Definition at line 523 of file halp.h.

◆ HALP_CARD_FEATURE_FULL_DECODE

#define HALP_CARD_FEATURE_FULL_DECODE   0x0001

Definition at line 510 of file halp.h.

◆ HALP_CHECK_CARD_REVISION_ID

#define HALP_CHECK_CARD_REVISION_ID   0x10000

Definition at line 515 of file halp.h.

◆ HALP_CHECK_CARD_SUBSYSTEM_ID

#define HALP_CHECK_CARD_SUBSYSTEM_ID   0x40000

Definition at line 517 of file halp.h.

◆ HALP_CHECK_CARD_SUBVENDOR_ID

#define HALP_CHECK_CARD_SUBVENDOR_ID   0x20000

Definition at line 516 of file halp.h.

◆ HALP_HACK_FLAGS

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

Definition at line 505 of file halp.h.

◆ HALP_REVISION_FROM_HACK_FLAGS

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

Definition at line 503 of file halp.h.

◆ HALP_REVISION_HACK_FLAGS

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

Definition at line 504 of file halp.h.

◆ IDT_DEVICE

#define IDT_DEVICE   0x21

Definition at line 66 of file halp.h.

◆ IDT_INTERNAL

#define IDT_INTERNAL   0x11

Definition at line 65 of file halp.h.

◆ IDT_LATCHED

#define IDT_LATCHED   0x02

Definition at line 63 of file halp.h.

◆ IDT_READ_ONLY

#define IDT_READ_ONLY   0x04

Definition at line 64 of file halp.h.

◆ IDT_REGISTERED

#define IDT_REGISTERED   0x01

Definition at line 62 of file halp.h.

◆ INT_BCD

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

Definition at line 71 of file halp.h.

◆ PIC1_CONTROL_PORT

#define PIC1_CONTROL_PORT   0x20

Definition at line 194 of file halp.h.

◆ PIC1_DATA_PORT

#define PIC1_DATA_PORT   0x21

Definition at line 195 of file halp.h.

◆ PIC2_CONTROL_PORT

#define PIC2_CONTROL_PORT   0xA0

Definition at line 196 of file halp.h.

◆ PIC2_DATA_PORT

#define PIC2_DATA_PORT   0xA1

Definition at line 197 of file halp.h.

◆ PIT_FREQUENCY

#define PIT_FREQUENCY   1193182

Definition at line 106 of file halp.h.

◆ RTC_REG_A_UIP

#define RTC_REG_A_UIP   0x80

Definition at line 53 of file halp.h.

◆ RTC_REG_B_PI

#define RTC_REG_B_PI   0x40

Definition at line 55 of file halp.h.

◆ RTC_REG_C_IRQ

#define RTC_REG_C_IRQ   0x80

Definition at line 57 of file halp.h.

◆ RTC_REGISTER_A

#define RTC_REGISTER_A   0x0A

Definition at line 52 of file halp.h.

◆ RTC_REGISTER_B

#define RTC_REGISTER_B   0x0B

Definition at line 54 of file halp.h.

◆ RTC_REGISTER_C

#define RTC_REGISTER_C   0x0C

Definition at line 56 of file halp.h.

◆ RTC_REGISTER_CENTURY

#define RTC_REGISTER_CENTURY   0x32

Definition at line 59 of file halp.h.

◆ RTC_REGISTER_D

#define RTC_REGISTER_D   0x0D

Definition at line 58 of file halp.h.

◆ SET_VIDEO_MODE

#define SET_VIDEO_MODE   0x00

Definition at line 82 of file halp.h.

◆ SYSTEM_CONTROL_PORT_A

#define SYSTEM_CONTROL_PORT_A   0x92

Definition at line 170 of file halp.h.

◆ SYSTEM_CONTROL_PORT_B

#define SYSTEM_CONTROL_PORT_B   0x61

Definition at line 171 of file halp.h.

◆ TIMER_CHANNEL0_DATA_PORT

#define TIMER_CHANNEL0_DATA_PORT   0x40

Definition at line 111 of file halp.h.

◆ TIMER_CHANNEL1_DATA_PORT

#define TIMER_CHANNEL1_DATA_PORT   0x41

Definition at line 112 of file halp.h.

◆ TIMER_CHANNEL2_DATA_PORT

#define TIMER_CHANNEL2_DATA_PORT   0x42

Definition at line 113 of file halp.h.

◆ TIMER_CONTROL_PORT

#define TIMER_CONTROL_PORT   0x43

Definition at line 114 of file halp.h.

◆ VIDEO_SERVICES

#define VIDEO_SERVICES   0x10

Definition at line 77 of file halp.h.

Typedef Documentation

◆ ADDRESS_USAGE

◆ EISA_ELCR

typedef union _EISA_ELCR EISA_ELCR

◆ HAL_BIOS_FRAME

◆ I8259_EOI_MODE

◆ I8259_ICW1

typedef union _I8259_ICW1 I8259_ICW1

◆ I8259_ICW1_INTERRUPT_MODE

◆ I8259_ICW1_INTERVAL

◆ I8259_ICW1_OPERATING_MODE

◆ I8259_ICW2

typedef union _I8259_ICW2 I8259_ICW2

◆ I8259_ICW3

typedef union _I8259_ICW3 I8259_ICW3

◆ I8259_ICW4

typedef union _I8259_ICW4 I8259_ICW4

◆ I8259_ICW4_BUFFERED_MODE

◆ I8259_ICW4_EOI_MODE

◆ I8259_ICW4_SYSTEM_MODE

◆ I8259_IDR

Definition at line 368 of file halp.h.

◆ I8259_ISR

typedef union _I8259_ISR I8259_ISR

◆ I8259_OCW2

typedef union _I8259_OCW2 I8259_OCW2

◆ I8259_OCW3

typedef union _I8259_OCW3 I8259_OCW3

◆ I8259_READ_REQUEST

◆ IDTUsageFlags

◆ PADDRESS_USAGE

◆ PEISA_ELCR

typedef union _EISA_ELCR * PEISA_ELCR

◆ PHAL_BIOS_FRAME

◆ PHAL_DISMISS_INTERRUPT

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

Definition at line 424 of file halp.h.

◆ PHAL_SW_INTERRUPT_HANDLER

typedef VOID(__cdecl * PHAL_SW_INTERRUPT_HANDLER) (VOID)

Definition at line 32 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 38 of file halp.h.

◆ PI8259_ICW1

typedef union _I8259_ICW1 * PI8259_ICW1

◆ PI8259_ICW2

typedef union _I8259_ICW2 * PI8259_ICW2

◆ PI8259_ICW3

typedef union _I8259_ICW3 * PI8259_ICW3

◆ PI8259_ICW4

typedef union _I8259_ICW4 * PI8259_ICW4

◆ PI8259_IDR

typedef I8259_ISR * PI8259_IDR

Definition at line 368 of file halp.h.

◆ PI8259_ISR

typedef union _I8259_ISR * PI8259_ISR

◆ PI8259_OCW2

typedef union _I8259_OCW2 * PI8259_OCW2

◆ PI8259_OCW3

typedef union _I8259_OCW3 * PI8259_OCW3

◆ PIC_MASK

◆ PPIC_MASK

◆ PSYSTEM_CONTROL_PORT_B_REGISTER

◆ PTIMER_CONTROL_PORT_REGISTER

◆ SYSTEM_CONTROL_PORT_B_REGISTER

◆ TIMER_ACCESS_MODES

◆ TIMER_CHANNELS

◆ TIMER_CONTROL_PORT_REGISTER

◆ TIMER_OPERATING_MODES

Enumeration Type Documentation

◆ _I8259_EOI_MODE

Enumerator
RotateAutoEoiClear 
NonSpecificEoi 
InvalidEoiMode 
SpecificEoi 
RotateAutoEoiSet 
RotateNonSpecific 
SetPriority 
RotateSpecific 

Definition at line 248 of file halp.h.

◆ _I8259_ICW1_INTERRUPT_MODE

Enumerator
EdgeTriggered 
LevelTriggered 

Definition at line 208 of file halp.h.

209 {
enum _I8259_ICW1_INTERRUPT_MODE I8259_ICW1_INTERRUPT_MODE

◆ _I8259_ICW1_INTERVAL

Enumerator
Interval8 
Interval4 

Definition at line 214 of file halp.h.

215 {
216  Interval8,
217  Interval4
enum _I8259_ICW1_INTERVAL I8259_ICW1_INTERVAL

◆ _I8259_ICW1_OPERATING_MODE

Enumerator
Cascade 
Single 

Definition at line 202 of file halp.h.

203 {
204  Cascade,
205  Single
Definition: halp.h:205
enum _I8259_ICW1_OPERATING_MODE I8259_ICW1_OPERATING_MODE
Definition: halp.h:204

◆ _I8259_ICW4_BUFFERED_MODE

Enumerator
NonBuffered 
NonBuffered2 
BufferedSlave 
BufferedMaster 

Definition at line 232 of file halp.h.

233 {
234  NonBuffered,
235  NonBuffered2,
enum _I8259_ICW4_BUFFERED_MODE I8259_ICW4_BUFFERED_MODE

◆ _I8259_ICW4_EOI_MODE

Enumerator
NormalEoi 
AutomaticEoi 

Definition at line 226 of file halp.h.

227 {
228  NormalEoi,
enum _I8259_ICW4_EOI_MODE I8259_ICW4_EOI_MODE

◆ _I8259_ICW4_SYSTEM_MODE

Enumerator
Mcs8085Mode 
New8086Mode 

Definition at line 220 of file halp.h.

221 {
222  Mcs8085Mode,
enum _I8259_ICW4_SYSTEM_MODE I8259_ICW4_SYSTEM_MODE

◆ _I8259_READ_REQUEST

Enumerator
InvalidRequest 
InvalidRequest2 
ReadIdr 
ReadIsr 

Definition at line 240 of file halp.h.

241 {
244  ReadIdr,
245  ReadIsr
enum _I8259_READ_REQUEST I8259_READ_REQUEST
Definition: halp.h:244
Definition: halp.h:245

◆ _TIMER_ACCESS_MODES

Enumerator
PitAccessModeCounterLatch 
PitAccessModeLow 
PitAccessModeHigh 
PitAccessModeLowHigh 

Definition at line 136 of file halp.h.

◆ _TIMER_CHANNELS

Enumerator
PitChannel0 
PitChannel1 
PitChannel2 
PitReadBack 

Definition at line 144 of file halp.h.

145 {
146  PitChannel0,
147  PitChannel1,
148  PitChannel2,
enum _TIMER_CHANNELS TIMER_CHANNELS

◆ _TIMER_OPERATING_MODES

Enumerator
PitOperatingMode0 
PitOperatingMode1 
PitOperatingMode2 
PitOperatingMode3 
PitOperatingMode4 
PitOperatingMode5 
PitOperatingMode2Reserved 
PitOperatingMode5Reserved 

Definition at line 124 of file halp.h.

Function Documentation

◆ HaliHaltSystem()

VOID NTAPI HaliHaltSystem ( VOID  )

Definition at line 22 of file processor.c.

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

Referenced by HalInitSystem().

◆ HaliInitPnpDriver()

NTSTATUS NTAPI HaliInitPnpDriver ( VOID  )

Definition at line 902 of file halpnpdd.c.

903 {
905  UNICODE_STRING DriverString;
906  PAGED_CODE();
907 
908  /* Create the driver */
909  RtlInitUnicodeString(&DriverString, L"\\Driver\\ACPI_HAL");
910  Status = IoCreateDriver(&DriverString, HalpDriverEntry);
911 
912  /* Return status */
913  return Status;
914 }
LONG NTSTATUS
Definition: precomp.h:26
#define PAGED_CODE()
Definition: video.h:57
NTSTATUS NTAPI HalpDriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath)
Definition: halpnpdd.c:846
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI IoCreateDriver(IN PUNICODE_STRING DriverName OPTIONAL, IN PDRIVER_INITIALIZE InitializationFunction)
Definition: driver.c:1683
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

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 TRUE
Definition: types.h:120
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

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 }
#define TRUE
Definition: types.h:120
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by HalInitSystem().

◆ HalpAcquireCmosSpinLock()

VOID NTAPI HalpAcquireCmosSpinLock ( VOID  )

Definition at line 227 of file spinlock.c.

228 {
230 
231  /* Get flags and disable interrupts */
232  Flags = __readeflags();
233  _disable();
234 
235  /* Acquire the lock */
237 
238  /* We have the lock, save the flags now */
240 }
uint32_t ULONG_PTR
Definition: typedefs.h:63
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
__INTRIN_INLINE uintptr_t __readeflags(void)
Definition: intrin_x86.h:1555
FORCEINLINE VOID KxAcquireSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.h:20
ULONG_PTR HalpSystemHardwareFlags
Definition: spinlock.c:24
KSPIN_LOCK HalpSystemHardwareLock
Definition: spinlock.c:25
void __cdecl _disable(void)
Definition: intrin_arm.h:365

Referenced by HalGetEnvironmentVariable(), HalMakeBeep(), HalpGetCmosData(), HalpInitializeClock(), HalpReboot(), HalpSetCmosData(), HalQueryRealTimeClock(), HalSetEnvironmentVariable(), HalSetRealTimeClock(), HalStartProfileInterrupt(), HalStopProfileInterrupt(), and RtcSetClockRate().

◆ 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) ||
66  (MdBlock->MemoryType == LoaderFirmwareTemporary))
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 */
75  PhysicalAddress = ((ULONG64)BasePage + Alignment) << PAGE_SHIFT;
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 PAGE_SHIFT
Definition: env_spec_w32.h:45
ULONG HalpUsedAllocDescriptors
Definition: memory.c:20
FORCEINLINE VOID InsertHeadList(_Inout_ PLIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PLIST_ENTRY Entry)
Definition: rtlfuncs.h:201
#define InsertTailList(ListHead, Entry)
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
TYPE_OF_MEMORY MemoryType
Definition: arc.h:193
ULONG PFN_NUMBER
Definition: ke.h:8
union Alignment_ Alignment
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
unsigned __int64 ULONG64
Definition: imports.h:198
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1061
Definition: typedefs.h:117
unsigned int ULONG
Definition: retypes.h:1
MEMORY_ALLOCATION_DESCRIPTOR HalpAllocationDescriptorArray[64]
Definition: memory.c:21

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

◆ HalpApcInterrupt()

VOID __cdecl HalpApcInterrupt ( VOID  )

Referenced by HalpInitializePICs().

◆ HalpApcInterrupt2ndEntry()

DECLSPEC_NORETURN VOID FASTCALL HalpApcInterrupt2ndEntry ( IN PKTRAP_FRAME  TrapFrame)

Definition at line 1239 of file pic.c.

1240 {
1241  /* Do the work */
1242  _HalpApcInterruptHandler(TrapFrame);
1243 }
FORCEINLINE DECLSPEC_NORETURN VOID _HalpApcInterruptHandler(IN PKTRAP_FRAME TrapFrame)
Definition: pic.c:1209

◆ HalpBiosDisplayReset()

BOOLEAN NTAPI HalpBiosDisplayReset ( VOID  )

Definition at line 455 of file x86bios.c.

456 {
457 #if 0
458  X86_BIOS_REGISTERS Registers;
459  ULONG OldEflags;
460 
461  /* Save flags and disable interrupts */
462  OldEflags = __readeflags();
463  _disable();
464 
465  /* Set AH = 0 (Set video mode), AL = 0x12 (640x480x16 vga) */
466  Registers.Eax = 0x12;
467 
468  /* Call INT 0x10 */
469  x86BiosCall(0x10, &Registers);
470 
471  // FIXME: check result
472 
473  /* Restore previous flags */
474  __writeeflags(OldEflags);
475 #endif
476  return TRUE;
477 }
#define TRUE
Definition: types.h:120
__INTRIN_INLINE uintptr_t __readeflags(void)
Definition: intrin_x86.h:1555
__INTRIN_INLINE void __writeeflags(uintptr_t Value)
Definition: intrin_x86.h:1550
void __cdecl _disable(void)
Definition: intrin_arm.h:365
unsigned int ULONG
Definition: retypes.h:1
BOOLEAN NTAPI x86BiosCall(_In_ ULONG InterruptNumber, _Inout_ PX86_BIOS_REGISTERS Registers)
Definition: x86bios.c:367

Referenced by HalInitializeBios(), and HalInitSystem().

◆ HalpBuildAddressMap()

INIT_FUNCTION 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 100 of file hardware.c.

101 {
102  ULONG i;
103  ULONG calib_bit;
104  ULONG CurCount;
105 
106  /* Initialise timer interrupt with MILLISECOND ms interval */
107  WRITE_PORT_UCHAR((PUCHAR)0x43, 0x34); /* binary, mode 2, LSB/MSB, ch 0 */
108  WRITE_PORT_UCHAR((PUCHAR)0x40, LATCH & 0xff); /* LSB */
109  WRITE_PORT_UCHAR((PUCHAR)0x40, LATCH >> 8); /* MSB */
110 
111  /* Stage 1: Coarse calibration */
112 
113  delay_count = 1;
114 
115  do
116  {
117  /* Next delay count to try */
118  delay_count <<= 1;
119 
121 
122  /* Do the delay */
124 
125  CurCount = Read8254Timer();
126  }
127  while (CurCount > LATCH / 2);
128 
129  /* Get bottom value for delay */
130  delay_count >>= 1;
131 
132  /* Stage 2: Fine calibration */
133 
134  /* Which bit are we going to test */
135  calib_bit = delay_count;
136 
137  for (i = 0; i < PRECISION; i++)
138  {
139  /* Next bit to calibrate */
140  calib_bit >>= 1;
141 
142  /* If we have done all bits, stop */
143  if (!calib_bit) break;
144 
145  /* Set the bit in delay_count */
146  delay_count |= calib_bit;
147 
149 
150  /* Do the delay */
152 
153  CurCount = Read8254Timer();
154  /* If a tick has passed, turn the calibrated bit back off */
155  if (CurCount <= LATCH / 2)
156  delay_count &= ~calib_bit;
157  }
158 
159  /* We're finished: Do the finishing touches */
160 
161  /* Calculate delay_count for 1ms */
162  delay_count /= (MILLISEC / 2);
163 }
static VOID __StallExecutionProcessor(ULONG Loops)
Definition: hardware.c:49
unsigned char * PUCHAR
Definition: retypes.h:3
static VOID WaitFor8254Wraparound(VOID)
Definition: hardware.c:76
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 PRECISION
Definition: hardware.c:28
#define MILLISEC
Definition: hardware.c:27
static unsigned int delay_count
Definition: hardware.c:34
static ULONG Read8254Timer(VOID)
Definition: hardware.c:63
#define LATCH
Definition: hardware.c:32
unsigned int ULONG
Definition: retypes.h:1
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532

Referenced by HalInitSystem(), and MachInit().

◆ HalpCheckPowerButton()

VOID NTAPI HalpCheckPowerButton ( VOID  )

Definition at line 20 of file misc.c.

21 {
22  /* Nothing to do on non-ACPI */
23  return;
24 }

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 */
43  CLOCK2_LEVEL);
44 }
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
NTKERNELAPI VOID NTAPI WRITE_REGISTER_ULONG(IN PULONG Register, IN ULONG Value)
VOID FASTCALL KeUpdateSystemTime(IN PKTRAP_FRAME TrapFrame, IN ULONG Increment, IN KIRQL OldIrql)
Definition: time.c:64
#define TIMER0_INT_CLEAR
Definition: sp804.h:18
#define CLOCK2_LEVEL
Definition: env_spec_w32.h:700
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ULONG HalpCurrentTimeIncrement
Definition: timer.c:25
#define KeGetCurrentThread
Definition: hal.h:44

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

◆ HalpDebugPciDumpBus()

INIT_FUNCTION VOID NTAPI HalpDebugPciDumpBus ( IN ULONG  i,
IN ULONG  j,
IN ULONG  k,
IN PPCI_COMMON_CONFIG  PciData 
)

Definition at line 807 of file bussupp.c.

811 {
812  PCHAR p, ClassName, Boundary, SubClassName, VendorName, ProductName, SubVendorName;
813  ULONG Length;
814  CHAR LookupString[16] = "";
815  CHAR bSubClassName[64] = "Unknown";
816  CHAR bVendorName[64] = "";
817  CHAR bProductName[128] = "Unknown device";
818  CHAR bSubVendorName[128] = "Unknown";
819  ULONG Size, Mem, b;
820 
821  /* Isolate the class name */
822  sprintf(LookupString, "C %02x ", PciData->BaseClass);
823  ClassName = strstr((PCHAR)ClassTable, LookupString);
824  if (ClassName)
825  {
826  /* Isolate the subclass name */
827  ClassName += strlen("C 00 ");
828  Boundary = strstr(ClassName, "\nC ");
829  sprintf(LookupString, "\n\t%02x ", PciData->SubClass);
830  SubClassName = strstr(ClassName, LookupString);
831  if (Boundary && SubClassName > Boundary)
832  {
833  SubClassName = NULL;
834  }
835  if (!SubClassName)
836  {
837  SubClassName = ClassName;
838  }
839  else
840  {
841  SubClassName += strlen("\n\t00 ");
842  }
843  /* Copy the subclass into our buffer */
844  p = strpbrk(SubClassName, "\r\n");
845  Length = p - SubClassName;
846  if (Length >= sizeof(bSubClassName)) Length = sizeof(bSubClassName) - 1;
847  strncpy(bSubClassName, SubClassName, Length);
848  bSubClassName[Length] = '\0';
849  }
850 
851  /* Isolate the vendor name */
852  sprintf(LookupString, "\r\n%04x ", PciData->VendorID);
853  VendorName = strstr((PCHAR)VendorTable, LookupString);
854  if (VendorName)
855  {
856  /* Copy the vendor name into our buffer */
857  VendorName += strlen("\r\n0000 ");
858  p = strpbrk(VendorName, "\r\n");
859  Length = p - VendorName;
860  if (Length >= sizeof(bVendorName)) Length = sizeof(bVendorName) - 1;
861  strncpy(bVendorName, VendorName, Length);
862  bVendorName[Length] = '\0';
863  p += strlen("\r\n");
864  while (*p == '\t' || *p == '#')
865  {
866  p = strpbrk(p, "\r\n");
867  p += strlen("\r\n");
868  }
869  Boundary = p;
870 
871  /* Isolate the product name */
872  sprintf(LookupString, "\t%04x ", PciData->DeviceID);
873  ProductName = strstr(VendorName, LookupString);
874  if (Boundary && ProductName >= Boundary)
875  {
876  ProductName = NULL;
877  }
878  if (ProductName)
879  {
880  /* Copy the product name into our buffer */
881  ProductName += strlen("\t0000 ");
882  p = strpbrk(ProductName, "\r\n");
883  Length = p - ProductName;
884  if (Length >= sizeof(bProductName)) Length = sizeof(bProductName) - 1;
885  strncpy(bProductName, ProductName, Length);
886  bProductName[Length] = '\0';
887  p += strlen("\r\n");
888  while ((*p == '\t' && *(p + 1) == '\t') || *p == '#')
889  {
890  p = strpbrk(p, "\r\n");
891  p += strlen("\r\n");
892  }
893  Boundary = p;
894 
895  /* Isolate the subvendor and subsystem name */
896  sprintf(LookupString,
897  "\t\t%04x %04x ",
898  PciData->u.type0.SubVendorID,
899  PciData->u.type0.SubSystemID);
900  SubVendorName = strstr(ProductName, LookupString);
901  if (Boundary && SubVendorName >= Boundary)
902  {
903  SubVendorName = NULL;
904  }
905  if (SubVendorName)
906  {
907  /* Copy the subvendor name into our buffer */
908  SubVendorName += strlen("\t\t0000 0000 ");
909  p = strpbrk(SubVendorName, "\r\n");
910  Length = p - SubVendorName;
911  if (Length >= sizeof(bSubVendorName)) Length = sizeof(bSubVendorName) - 1;
912  strncpy(bSubVendorName, SubVendorName, Length);
913  bSubVendorName[Length] = '\0';
914  }
915  }
916  }
917 
918  /* Print out the data */
919  DbgPrint("%02x:%02x.%x %s [%02x%02x]: %s %s [%04x:%04x] (rev %02x)\n"
920  "\tSubsystem: %s [%04x:%04x]\n",
921  i,
922  j,
923  k,
924  bSubClassName,
925  PciData->BaseClass,
926  PciData->SubClass,
927  bVendorName,
928  bProductName,
929  PciData->VendorID,
930  PciData->DeviceID,
931  PciData->RevisionID,
932  bSubVendorName,
933  PciData->u.type0.SubVendorID,
934  PciData->u.type0.SubSystemID);
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  /* Scan addresses */
952  Size = 0;
953  for (b = 0; b < PCI_TYPE0_ADDRESSES; b++)
954  {
955  /* Check for a BAR */
956  Mem = PciData->u.type0.BaseAddresses[b];
957  if (Mem)
958  {
959  /* Decode the address type */
960  if (Mem & PCI_ADDRESS_IO_SPACE)
961  {
962  /* Guess the size */
963  Size = 1 << 2;
964  while (!(Mem & Size) && (Size)) Size <<= 1;
965 
966  /* Print it out */
967  DbgPrint("\tI/O ports at %04lx", Mem & PCI_ADDRESS_IO_ADDRESS_MASK);
968  ShowSize(Size);
969  }
970  else
971  {
972  /* Guess the size */
973  Size = 1 << 8;
974  while (!(Mem & Size) && (Size)) Size <<= 1;
975 
976  /* Print it out */
977  DbgPrint("\tMemory at %08lx (%d-bit, %sprefetchable)",
979  (Mem & PCI_ADDRESS_MEMORY_TYPE_MASK) == PCI_TYPE_32BIT ? 32 : 64,
980  (Mem & PCI_ADDRESS_MEMORY_PREFETCHABLE) ? "" : "non-");
981  ShowSize(Size);
982  }
983  }
984  }
985 }
signed char * PCHAR
Definition: retypes.h:7
#define PCI_TYPE0_ADDRESSES
Definition: iotypes.h:3144
INIT_FUNCTION VOID NTAPI ShowSize(IN ULONG Size)
#define PCI_ADDRESS_IO_ADDRESS_MASK
Definition: iotypes.h:3877
#define DbgPrint
Definition: loader.c:25
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strpbrk(const char *String, const char *Delimiters)
Definition: utclib.c:302
char * strstr(char *String1, char *String2)
Definition: utclib.c:653
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
char CHAR
Definition: xmlstorage.h:175
#define PCI_ADDRESS_MEMORY_TYPE_MASK
Definition: iotypes.h:3875
#define PCI_TYPE_32BIT
Definition: iotypes.h:3881
#define sprintf(buf, format,...)
Definition: sprintf.c:55
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 PCI_STATUS_DEVSEL
Definition: iotypes.h:3279
#define PCI_ADDRESS_MEMORY_ADDRESS_MASK
Definition: iotypes.h:3878
smooth NULL
Definition: ftsmooth.c:416
#define b
Definition: ke_i.h:79
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
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define PCI_ENABLE_BUS_MASTER
Definition: iotypes.h:3262
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define PCI_STATUS_66MHZ_CAPABLE
Definition: iotypes.h:3275
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define PCI_ADDRESS_MEMORY_PREFETCHABLE
Definition: iotypes.h:3876
unsigned int ULONG
Definition: retypes.h:1
GLfloat GLfloat p
Definition: glext.h:8902
#define PCI_ADDRESS_IO_SPACE
Definition: iotypes.h:3874
int k
Definition: mpi.c:3369

Referenced by HalpInitializePciBus().

◆ HalpDismissIrq07()

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

Definition at line 853 of file pic.c.

856 {
857  I8259_OCW3 Ocw3;
858  I8259_ISR Isr;
859 
860  /* Request the ISR */
861  Ocw3.Bits = 0;
862  Ocw3.Sbo = 1;
863  Ocw3.ReadRequest = ReadIsr;
865 
866  /* Read the ISR */
868 
869  /* Is IRQ 7 really active? If it isn't, this is spurious so fail */
870  if (Isr.Irq7 == FALSE) return FALSE;
871 
872  /* Do normal interrupt dismiss */
873  return _HalpDismissIrqGeneric(Irql, Irq, OldIrql);
874 }
#define PIC1_CONTROL_PORT
Definition: halp.h:194
PPC_QUAL void __outbyte(unsigned long const Port, const unsigned char Data)
Definition: intrin_ppc.h:605
_Out_ PKIRQL Irql
Definition: csq.h:179
FORCEINLINE BOOLEAN _HalpDismissIrqGeneric(IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
Definition: pic.c:737
UCHAR ReadRequest
Definition: halp.h:339
UCHAR Sbo
Definition: halp.h:341
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
Definition: halp.h:245
UCHAR Bits
Definition: halp.h:346
static BOOLEAN NTAPI Isr(PKINTERRUPT Interrupt, PVOID ServiceContext)
Definition: floppy.c:584
PPC_QUAL unsigned char __inbyte(const unsigned long Port)
Definition: intrin_ppc.h:539

◆ HalpDismissIrq07Level()

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

Definition at line 995 of file pic.c.

998 {
999  I8259_OCW3 Ocw3;
1000  I8259_ISR Isr;
1001 
1002  /* Request the ISR */
1003  Ocw3.Bits = 0;
1004  Ocw3.Sbo = 1;
1005  Ocw3.ReadRequest = ReadIsr;
1007 
1008  /* Read the ISR */
1009  Isr.Bits = __inbyte(PIC1_CONTROL_PORT);
1010 
1011  /* Is IRQ 7 really active? If it isn't, this is spurious so fail */
1012  if (Isr.Irq7 == FALSE) return FALSE;
1013 
1014  /* Do normal interrupt dismiss */
1015  return _HalpDismissIrqLevel(Irql, Irq, OldIrql);
1016 }
#define PIC1_CONTROL_PORT
Definition: halp.h:194
PPC_QUAL void __outbyte(unsigned long const Port, const unsigned char Data)
Definition: intrin_ppc.h:605
_Out_ PKIRQL Irql
Definition: csq.h:179
FORCEINLINE BOOLEAN _HalpDismissIrqLevel(IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
Definition: pic.c:880
UCHAR ReadRequest
Definition: halp.h:339
UCHAR Sbo
Definition: halp.h:341
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
Definition: halp.h:245
UCHAR Bits
Definition: halp.h:346
static BOOLEAN NTAPI Isr(PKINTERRUPT Interrupt, PVOID ServiceContext)
Definition: floppy.c:584
PPC_QUAL unsigned char __inbyte(const unsigned long Port)
Definition: intrin_ppc.h:539

◆ HalpDismissIrq13()

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

Definition at line 840 of file pic.c.

843 {
844  /* Clear the FPU busy latch */
845  __outbyte(0xF0, 0);
846 
847  /* Do normal interrupt dismiss */
848  return _HalpDismissIrqGeneric(Irql, Irq, OldIrql);
849 }
PPC_QUAL void __outbyte(unsigned long const Port, const unsigned char Data)
Definition: intrin_ppc.h:605
_Out_ PKIRQL Irql
Definition: csq.h:179
FORCEINLINE BOOLEAN _HalpDismissIrqGeneric(IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
Definition: pic.c:737
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803

◆ HalpDismissIrq13Level()

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

Definition at line 982 of file pic.c.

985 {
986  /* Clear the FPU busy latch */
987  __outbyte(0xF0, 0);
988 
989  /* Do normal interrupt dismiss */
990  return _HalpDismissIrqLevel(Irql, Irq, OldIrql);
991 }
PPC_QUAL void __outbyte(unsigned long const Port, const unsigned char Data)
Definition: intrin_ppc.h:605
_Out_ PKIRQL Irql
Definition: csq.h:179
FORCEINLINE BOOLEAN _HalpDismissIrqLevel(IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
Definition: pic.c:880
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803

◆ HalpDismissIrq15()

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

Definition at line 804 of file pic.c.

807 {
808  I8259_OCW3 Ocw3;
809  I8259_OCW2 Ocw2;
810  I8259_ISR Isr;
811 
812  /* Request the ISR */
813  Ocw3.Bits = 0;
814  Ocw3.Sbo = 1; /* This encodes an OCW3 vs. an OCW2 */
815  Ocw3.ReadRequest = ReadIsr;
817 
818  /* Read the ISR */
820 
821  /* Is IRQ15 really active (this is IR7) */
822  if (Isr.Irq7 == FALSE)
823  {
824  /* It isn't, so we have to EOI IRQ2 because this was cascaded */
825  Ocw2.Bits = 0;
826  Ocw2.EoiMode = SpecificEoi;
827  __outbyte(PIC1_CONTROL_PORT, Ocw2.Bits | 2);
828 
829  /* And now fail since this was spurious */
830  return FALSE;
831  }
832 
833  /* Do normal interrupt dismiss */
834  return _HalpDismissIrqGeneric(Irql, Irq, OldIrql);
835 }
UCHAR EoiMode
Definition: halp.h:330
#define PIC1_CONTROL_PORT
Definition: halp.h:194
PPC_QUAL void __outbyte(unsigned long const Port, const unsigned char Data)
Definition: intrin_ppc.h:605
_Out_ PKIRQL Irql
Definition: csq.h:179
FORCEINLINE BOOLEAN _HalpDismissIrqGeneric(IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
Definition: pic.c:737
UCHAR ReadRequest
Definition: halp.h:339
UCHAR Sbo
Definition: halp.h:341
#define PIC2_CONTROL_PORT
Definition: halp.h:196
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
Definition: halp.h:245
UCHAR Bits
Definition: halp.h:332
UCHAR Bits
Definition: halp.h:346
static BOOLEAN NTAPI Isr(PKINTERRUPT Interrupt, PVOID ServiceContext)
Definition: floppy.c:584
PPC_QUAL unsigned char __inbyte(const unsigned long Port)
Definition: intrin_ppc.h:539

◆ HalpDismissIrq15Level()

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

Definition at line 947 of file pic.c.

950 {
951  I8259_OCW3 Ocw3;
952  I8259_OCW2 Ocw2;
953  I8259_ISR Isr;
954 
955  /* Request the ISR */
956  Ocw3.Bits = 0;
957  Ocw3.Sbo = 1; /* This encodes an OCW3 vs. an OCW2 */
958  Ocw3.ReadRequest = ReadIsr;
960 
961  /* Read the ISR */
963 
964  /* Is IRQ15 really active (this is IR7) */
965  if (Isr.Irq7 == FALSE)
966  {
967  /* It isn't, so we have to EOI IRQ2 because this was cascaded */
968  Ocw2.Bits = 0;
969  Ocw2.EoiMode = SpecificEoi;
970  __outbyte(PIC1_CONTROL_PORT, Ocw2.Bits | 2);
971 
972  /* And now fail since this was spurious */
973  return FALSE;
974  }
975 
976  /* Do normal interrupt dismiss */
977  return _HalpDismissIrqLevel(Irql, Irq, OldIrql);
978 }
UCHAR EoiMode
Definition: halp.h:330
#define PIC1_CONTROL_PORT
Definition: halp.h:194
PPC_QUAL void __outbyte(unsigned long const Port, const unsigned char Data)
Definition: intrin_ppc.h:605
_Out_ PKIRQL Irql
Definition: csq.h:179
FORCEINLINE BOOLEAN _HalpDismissIrqLevel(IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
Definition: pic.c:880
UCHAR ReadRequest
Definition: halp.h:339
UCHAR Sbo
Definition: halp.h:341
#define PIC2_CONTROL_PORT
Definition: halp.h:196
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
Definition: halp.h:245
UCHAR Bits
Definition: halp.h:332
UCHAR Bits
Definition: halp.h:346
static BOOLEAN NTAPI Isr(PKINTERRUPT Interrupt, PVOID ServiceContext)
Definition: floppy.c:584
PPC_QUAL unsigned char __inbyte(const unsigned long Port)
Definition: intrin_ppc.h:539

◆ HalpDismissIrqGeneric()

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

Definition at line 794 of file pic.c.

797 {
798  /* Run the inline code */
799  return _HalpDismissIrqGeneric(Irql, Irq, OldIrql);
800 }
_Out_ PKIRQL Irql
Definition: csq.h:179
FORCEINLINE BOOLEAN _HalpDismissIrqGeneric(IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
Definition: pic.c:737
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803

◆ HalpDismissIrqLevel()

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

Definition at line 937 of file pic.c.

940 {
941  /* Run the inline code */
942  return _HalpDismissIrqLevel(Irql, Irq, OldIrql);
943 }
_Out_ PKIRQL Irql
Definition: csq.h:179
FORCEINLINE BOOLEAN _HalpDismissIrqLevel(IN KIRQL Irql, IN ULONG Irq, OUT PKIRQL OldIrql)
Definition: pic.c:880
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803

◆ HalpDispatchInterrupt()

VOID __cdecl HalpDispatchInterrupt ( VOID  )

Referenced by HalpInitializePICs().

◆ HalpDispatchInterrupt2()

PHAL_SW_INTERRUPT_HANDLER __cdecl HalpDispatchInterrupt2 ( VOID  )

Definition at line 1304 of file pic.c.

1305 {
1306  ULONG PendingIrqlMask, PendingIrql;
1307  KIRQL OldIrql;
1308  PIC_MASK Mask;
1309  PKPCR Pcr = KeGetPcr();
1310 
1311  /* Do the work */
1313 
1314  /* Restore IRQL */
1315  Pcr->Irql = OldIrql;
1316 
1317  /* Check for pending software interrupts and compare with current IRQL */
1318  PendingIrqlMask = Pcr->IRR & FindHigherIrqlMask[OldIrql];
1319  if (PendingIrqlMask)
1320  {
1321  /* Check if pending IRQL affects hardware state */
1322  BitScanReverse(&PendingIrql, PendingIrqlMask);
1323  if (PendingIrql > DISPATCH_LEVEL)
1324  {
1325  /* Set new PIC mask */
1326  Mask.Both = Pcr->IDR & 0xFFFF;
1327  __outbyte(PIC1_DATA_PORT, Mask.Master);
1328  __outbyte(PIC2_DATA_PORT, Mask.Slave);
1329 
1330  /* Clear IRR bit */
1331  Pcr->IRR ^= (1 << PendingIrql);
1332  }
1333 
1334  /* Now handle pending interrupt */
1335  return SWInterruptHandlerTable[PendingIrql];
1336  }
1337 
1338  return NULL;
1339 }
KIRQL Irql
Definition: ke.h:298
ULONG IDR
Definition: ke.h:22
ULONG FindHigherIrqlMask[32]
Definition: pic.c:216
PPC_QUAL void __outbyte(unsigned long const Port, const unsigned char Data)
Definition: intrin_ppc.h:605
Definition: ke.h:280
#define KeGetPcr()
Definition: ke.h:25
UCHAR KIRQL
Definition: env_spec_w32.h:591
PHAL_SW_INTERRUPT_HANDLER SWInterruptHandlerTable[20]
Definition: pic.c:381
smooth NULL
Definition: ftsmooth.c:416
#define PIC2_DATA_PORT
Definition: halp.h:197
Definition: irql.c:21
#define PIC1_DATA_PORT
Definition: halp.h:195
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define BitScanReverse
Definition: interlocked.h:6
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
FORCEINLINE KIRQL _HalpDispatchInterruptHandler(VOID)
Definition: pic.c:1264
unsigned int ULONG
Definition: retypes.h:1
ULONG IRR
Definition: ke.h:21

◆ HalpDispatchInterrupt2ndEntry()

DECLSPEC_NORETURN VOID FASTCALL HalpDispatchInterrupt2ndEntry ( IN PKTRAP_FRAME  TrapFrame)

Definition at line 1288 of file pic.c.

1289 {
1290  KIRQL CurrentIrql;
1291 
1292  /* Do the work */
1293  CurrentIrql = _HalpDispatchInterruptHandler();
1294 
1295  /* End the interrupt */
1296  HalpEndSoftwareInterrupt(CurrentIrql, TrapFrame);
1297 
1298  /* Exit the interrupt */
1299  KiEoiHelper(TrapFrame);
1300 }
DECLSPEC_NORETURN VOID FASTCALL KiEoiHelper(IN PKTRAP_FRAME TrapFrame)
Definition: traphdlr.c:126
UCHAR KIRQL
Definition: env_spec_w32.h:591
VOID NTAPI HalpEndSoftwareInterrupt(IN KIRQL OldIrql, IN PKTRAP_FRAME TrapFrame)
FORCEINLINE KIRQL _HalpDispatchInterruptHandler(VOID)
Definition: pic.c:1264

◆ HalpEnableInterruptHandler()

INIT_FUNCTION 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 */
58 }
static const BYTE InterruptRoutine[]
Definition: device.c:34
struct _KIPCR * PKIPCR
_Out_ PKIRQL Irql
Definition: csq.h:179
#define KeGetPcr()
Definition: ke.h:25
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical 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:662

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

◆ HalpExitToV86()

VOID FASTCALL HalpExitToV86 ( PKTRAP_FRAME  TrapFrame)

Referenced by HalpBiosCall().

◆ HalpFlushTLB()

VOID NTAPI HalpFlushTLB ( VOID  )

Definition at line 163 of file misc.c.

164 {
165  ULONG_PTR Flags, Cr4;
166  INT CpuInfo[4];
167  ULONG_PTR PageDirectory;
168 
169  //
170  // Disable interrupts
171  //
172  Flags = __readeflags();
173  _disable();
174 
175  //
176  // Get page table directory base
177  //
178  PageDirectory = __readcr3();
179 
180  //
181  // Check for CPUID support
182  //
183  if (KeGetCurrentPrcb()->CpuID)
184  {
185  //
186  // Check for global bit in CPU features
187  //
188  __cpuid(CpuInfo, 1);
189  if (CpuInfo[3] & 0x2000)
190  {
191  //
192  // Get current CR4 value
193  //
194  Cr4 = __readcr4();
195 
196  //
197  // Disable global bit
198  //
199  __writecr4(Cr4 & ~CR4_PGE);
200 
201  //
202  // Flush TLB and re-enable global bit
203  //
204  __writecr3(PageDirectory);
205  __writecr4(Cr4);
206 
207  //
208  // Restore interrupts
209  //
211  return;
212  }
213  }
214 
215  //
216  // Legacy: just flush TLB
217  //
218  __writecr3(PageDirectory);
220 }
__INTRIN_INLINE void __writecr4(unsigned int Data)
Definition: intrin_x86.h:1680
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1062
__INTRIN_INLINE unsigned long __readcr3(void)
Definition: intrin_x86.h:1706
int32_t INT
Definition: typedefs.h:56
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define CR4_PGE
Definition: ketypes.h:91
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
__INTRIN_INLINE void __writecr3(unsigned int Data)
Definition: intrin_x86.h:1675
__INTRIN_INLINE uintptr_t __readeflags(void)
Definition: intrin_x86.h:1555
__INTRIN_INLINE void __writeeflags(uintptr_t Value)
Definition: intrin_x86.h:1550
__INTRIN_INLINE unsigned long __readcr4(void)
Definition: intrin_x86.h:1713
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
Definition: intrin_ppc.h:682
void __cdecl _disable(void)
Definition: intrin_arm.h:365

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

◆ HalpGetDebugPortTable()

INIT_FUNCTION 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
UCHAR AddressSpaceID
Definition: acpi.h:69
GEN_ADDR BaseAddress
Definition: acpi.h:209

Referenced by HalpReportResourceUsage().

◆ HalpGetNMICrashFlag()

INIT_FUNCTION VOID NTAPI HalpGetNMICrashFlag ( VOID  )

Definition at line 571 of file usage.c.

572 {
574  UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\CrashControl");
577  HANDLE Handle;
579  KEY_VALUE_PARTIAL_INFORMATION KeyValueInformation;
580 
581  /* Set default */
582  HalpNMIDumpFlag = 0;
583 
584  /* Initialize attributes */
586  &KeyName,
588  NULL,
589  NULL);
590 
591  /* Open crash key */
592  Status = ZwOpenKey(&Handle, KEY_READ, &ObjectAttributes);
593  if (NT_SUCCESS(Status))
594  {
595  /* Query key value */
596  RtlInitUnicodeString(&ValueName, L"NMICrashDump");
597  Status = ZwQueryValueKey(Handle,
598  &ValueName,
600  &KeyValueInformation,
601  sizeof(KeyValueInformation),
602  &ResultLength);
603  if (NT_SUCCESS(Status))
604  {
605  /* Check for valid data */
607  {
608  /* Read the flag */
609  HalpNMIDumpFlag = KeyValueInformation.Data[0];
610  }
611  }
612 
613  /* We're done */
614  ZwClose(Handle);
615  }
616 }
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
#define KEY_READ
Definition: nt_native.h:1023
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
LONG NTSTATUS
Definition: precomp.h:26
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
smooth NULL
Definition: ftsmooth.c:416
BOOLEAN HalpNMIDumpFlag
Definition: usage.c:57
_In_ HANDLE Handle
Definition: extypes.h:390
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by HalpInitializePciBus().

◆ HalpHardwareInterruptLevel()

VOID __cdecl HalpHardwareInterruptLevel ( VOID  )

◆ HalpInitBusHandlers()

INIT_FUNCTION 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().

◆ HalpInitDma()

INIT_FUNCTION VOID HalpInitDma ( VOID  )

Definition at line 121 of file dma.c.

122 {
123  /*
124  * Initialize the DMA Operation table
125  */
131 
132  /*
133  * Check if Extended DMA is available. We're just going to do a random
134  * read and write.
135  */
136 
137  WRITE_PORT_UCHAR((PUCHAR)FIELD_OFFSET(EISA_CONTROL, DmaController2Pages.Channel2), 0x2A);
138  if (READ_PORT_UCHAR((PUCHAR)FIELD_OFFSET(EISA_CONTROL, DmaController2Pages.Channel2)) == 0x2A)
139  HalpEisaDma = TRUE;
140 
141  /*
142  * Intialize all the global variables and allocate master adapter with
143  * first map buffers.
144  */
145 
148 
150 
151  /*
152  * Setup the HalDispatchTable callback for creating PnP DMA adapters. It's
153  * used by IoGetDmaAdapter in the kernel.
154  */
155 
157 }
static LIST_ENTRY HalpDmaAdapterList
Definition: dma.c:78
#define HalGetDmaAdapter
Definition: haltypes.h:291
#define TRUE
Definition: types.h:120
PHYSICAL_ADDRESS NTAPI IoMapTransfer(IN PADAPTER_OBJECT AdapterObject, IN PMDL Mdl, IN PVOID MapRegisterBase, IN PVOID CurrentVa, IN OUT PULONG Length, IN BOOLEAN WriteToDevice)
Definition: dma.c:144
PFREE_MAP_REGISTERS FreeMapRegisters
Definition: iotypes.h:2317
unsigned char * PUCHAR
Definition: retypes.h:3
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
static DMA_OPERATIONS HalpDmaOperations
Definition: dma.c:94
BOOLEAN(NTAPI * PFLUSH_ADAPTER_BUFFERS)(_In_ PDMA_ADAPTER DmaAdapter, _In_ PMDL Mdl, _In_ PVOID MapRegisterBase, _In_ PVOID CurrentVa, _In_ ULONG Length, _In_ BOOLEAN WriteToDevice)
Definition: iotypes.h:2218
VOID NTAPI IoFreeMapRegisters(IN PADAPTER_OBJECT AdapterObject, IN PVOID MapRegisterBase, IN ULONG NumberOfMapRegisters)
Definition: dma.c:114
VOID(NTAPI * PFREE_ADAPTER_CHANNEL)(_In_ PDMA_ADAPTER DmaAdapter)
Definition: iotypes.h:2227
NTSTATUS(NTAPI * PALLOCATE_ADAPTER_CHANNEL)(_In_ PDMA_ADAPTER DmaAdapter, _In_ PDEVICE_OBJECT DeviceObject, _In_ ULONG NumberOfMapRegisters, _In_ PDRIVER_CONTROL ExecutionRoutine, _In_ PVOID Context)
Definition: iotypes.h:2210
PMAP_TRANSFER MapTransfer
Definition: iotypes.h:2318
static BOOLEAN HalpEisaDma
Definition: dma.c:80
VOID NTAPI IoFreeAdapterChannel(IN PADAPTER_OBJECT AdapterObject)
Definition: dma.c:103
PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers
Definition: iotypes.h:2315
PHYSICAL_ADDRESS(NTAPI * PMAP_TRANSFER)(_In_ PDMA_ADAPTER DmaAdapter, _In_ PMDL Mdl, _In_ PVOID MapRegisterBase, _In_ PVOID CurrentVa, _Inout_ PULONG Length, _In_ BOOLEAN WriteToDevice)
Definition: iotypes.h:2237
NTSTATUS NTAPI IoAllocateAdapterChannel(IN PADAPTER_OBJECT AdapterObject, IN PDEVICE_OBJECT DeviceObject, IN ULONG NumberOfMapRegisters, IN PDRIVER_CONTROL ExecutionRoutine, IN PVOID Context)
Definition: adapter.c:30
PFREE_ADAPTER_CHANNEL FreeAdapterChannel
Definition: iotypes.h:2316
BOOLEAN NTAPI IoFlushAdapterBuffers(IN PADAPTER_OBJECT AdapterObject, IN PMDL Mdl, IN PVOID MapRegisterBase, IN PVOID CurrentVa, IN ULONG Length, IN BOOLEAN WriteToDevice)
Definition: dma.c:127
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel
Definition: iotypes.h:2314
PDMA_ADAPTER NTAPI HalpGetDmaAdapter(IN PVOID Context, IN PDEVICE_DESCRIPTION DeviceDescription, OUT PULONG NumberOfMapRegisters)
Definition: dma.c:790
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
static KEVENT HalpDmaLock
Definition: dma.c:77
VOID(NTAPI * PFREE_MAP_REGISTERS)(_In_ PDMA_ADAPTER DmaAdapter, PVOID MapRegisterBase, ULONG NumberOfMapRegisters)
Definition: iotypes.h:2231
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532
static PADAPTER_OBJECT HalpMasterAdapter
Definition: dma.c:81
PADAPTER_OBJECT NTAPI HalpDmaAllocateMasterAdapter(VOID)
Definition: dma.c:332

Referenced by HalInitSystem(), and HalpInitPhase1().

◆ HalpInitializeClock()

INIT_FUNCTION VOID NTAPI HalpInitializeClock ( VOID  )

Definition at line 54 of file timer.c.

55 {
56  PKIPCR Pcr = (PKIPCR)KeGetPcr();
57  ULONG ClockInterval;
58  SP804_CONTROL_REGISTER ControlRegister;
59 
60  /* Setup the clock and profile interrupt */
62 
63  /*
64  * Configure the interval to 10ms
65  * (INTERVAL (10ms) * TIMCLKfreq (1MHz))
66  * --------------------------------------- == 10^4
67  * (TIMCLKENXdiv (1) * PRESCALEdiv (1))
68  */
69  ClockInterval = 0x2710;
70 
71  /* Configure the timer */
72  ControlRegister.AsUlong = 0;
73  ControlRegister.Wide = TRUE;
74  ControlRegister.Periodic = TRUE;
75  ControlRegister.Interrupt = TRUE;
76  ControlRegister.Enabled = TRUE;
77 
78  /* Enable the timer */
79  WRITE_REGISTER_ULONG(TIMER0_LOAD, ClockInterval);
81 }
VOID HalpStallInterrupt(VOID)
Definition: timer.c:47
NTKERNELAPI VOID NTAPI WRITE_REGISTER_ULONG(IN PULONG Register, IN ULONG Value)
#define TRUE
Definition: types.h:120
#define TIMER0_LOAD
Definition: sp804.h:15
struct _KIPCR * PKIPCR
#define KeGetPcr()
Definition: ke.h:25
#define CLOCK2_LEVEL
Definition: env_spec_w32.h:700
#define TIMER0_CONTROL
Definition: sp804.h:17
unsigned int ULONG
Definition: retypes.h:1
PKINTERRUPT_ROUTINE InterruptRoutine[MAXIMUM_VECTOR]
Definition: ketypes.h:510

Referenced by HalInitSystem().

◆ HalpInitializeCmos()

INIT_FUNCTION 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: bus.c:17
#define MACHINE_TYPE_ISA
Definition: ketypes.h:52
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
UCHAR HalpCmosCenturyOffset
Definition: cmos.c:22

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;
29  Icw1.OperatingMode = Cascade;
30  Icw1.Interval = Interval8;
32  Icw1.Init = TRUE;
33  Icw1.InterruptVectorAddress = 0;
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 */
46  Icw4.SystemMode = New8086Mode;
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;
59  Icw1.OperatingMode = Cascade;
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 */
75  Icw4.SystemMode = New8086Mode;
76  Icw4.EoiMode = NormalEoi;
79  Icw4.Reserved = 0;
81 
82  /* Mask all interrupts */
84 }
UCHAR Interval
Definition: halp.h:269
#define TRUE
Definition: types.h:120
UCHAR InterruptMode
Definition: halp.h:270
#define PRIMARY_VECTOR_BASE
Definition: halp.h:16
#define PIC1_CONTROL_PORT
Definition: halp.h:194
PPC_QUAL void __outbyte(unsigned long const Port, const unsigned char Data)
Definition: intrin_ppc.h:605
UCHAR SlaveIrq2
Definition: halp.h:295
UCHAR Bits
Definition: halp.h:284
UCHAR Bits
Definition: halp.h:308
__INTRIN_INLINE uintptr_t __readeflags(void)
Definition: intrin_x86.h:1555
UCHAR SpecialFullyNestedMode
Definition: halp.h:318
UCHAR Reserved
Definition: halp.h:319
UCHAR Bits
Definition: halp.h:274
#define PIC2_DATA_PORT
Definition: halp.h:197
UCHAR SystemMode
Definition: halp.h:315
UCHAR OperatingMode
Definition: halp.h:268
UCHAR BufferedMode
Definition: halp.h:317
UCHAR NeedIcw4
Definition: halp.h:267
#define PIC2_CONTROL_PORT
Definition: halp.h:196
UCHAR EoiMode
Definition: halp.h:316
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define PIC1_DATA_PORT
Definition: halp.h:195
UCHAR Bits
Definition: halp.h:321
UCHAR InterruptVectorAddress
Definition: halp.h:272
UCHAR Init
Definition: halp.h:271
Definition: halp.h:204
UCHAR SlaveId
Definition: halp.h:304
#define EFLAGS_INTERRUPT_MASK
Definition: ketypes.h:126

Referenced by HalpInitializePICs().

◆ HalpInitializePICs()

VOID NTAPI HalpInitializePICs ( IN BOOLEAN  EnableInterrupts)

Definition at line 445 of file apic.c.

446 {
447  ULONG_PTR EFlags;
448 
449  /* Save EFlags and disable interrupts */
450  EFlags = __readeflags();
451  _disable();
452 
453  /* Initialize and mask the PIC */
455 
456  /* Initialize the I/O APIC */
458 
459  /* Manually reserve some vectors */
463 
464  /* Set interrupt handlers in the IDT */
466 #ifndef _M_AMD64
469 #endif
470 
471  /* Register the vectors for APC and dispatch interrupts */
474 
475  /* Restore interrupt state */
477  __writeeflags(EFlags);
478 }
static NTSTATUS EnableInterrupts(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR FlagsToDisable, IN UCHAR FlagsToEnable)
Definition: pnp.c:380
VOID NTAPI HalpRegisterVector(IN UCHAR Flags, IN ULONG BusVector, IN ULONG SystemVector, IN KIRQL Irql)
Definition: usage.c:34
uint32_t ULONG_PTR
Definition: typedefs.h:63
__INTRIN_INLINE uintptr_t __readeflags(void)
Definition: intrin_x86.h:1555
VOID __cdecl HalpDispatchInterrupt(VOID)
VOID NTAPI ApicInitializeIOApic(VOID)
Definition: apic.c:383
UCHAR HalpVectorToIndex[256]
Definition: apic.c:28
#define DISPATCH_VECTOR
Definition: apic.h:27
#define IDT_INTERNAL
Definition: halp.h:21
VOID __cdecl HalpApcInterrupt(VOID)
__INTRIN_INLINE void __writeeflags(uintptr_t Value)
Definition: intrin_x86.h:1550
VOID HalpClockInterrupt(VOID)
Definition: timer.c:30
FORCEINLINE VOID KeRegisterInterruptHandler(IN ULONG Vector, IN PVOID Handler)
Definition: ke.h:242
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
void __cdecl _disable(void)
Definition: intrin_arm.h:365
#define APC_LEVEL
Definition: env_spec_w32.h:695
#define APIC_CLOCK_VECTOR
Definition: apic.h:29
VOID NTAPI HalpInitializeLegacyPICs(VOID)
Definition: pic.c:18
#define APC_VECTOR
Definition: apic.h:26
#define EFLAGS_INTERRUPT_MASK
Definition: ketypes.h:126

Referenced by HalInitSystem().

◆ HalpInitPciBus()

VOID HalpInitPciBus ( VOID  )

◆ HalpInitPhase0()

VOID HalpInitPhase0 ( PLOADER_PARAMETER_BLOCK  LoaderBlock)

Definition at line 31 of file halinit_mp.c.

33 {
34  static BOOLEAN MPSInitialized = FALSE;
35 
36 
37  /* Only initialize MP system once. Once called the first time,
38  each subsequent call is part of the initialization sequence
39  for an application processor. */
40 
41  DPRINT("HalpInitPhase0()\n");
42 
43 
44  if (MPSInitialized)
45  {
46  ASSERT(FALSE);
47  }
48 
49  MPSInitialized = TRUE;
50 
51  if (!HaliFindSmpConfig())
52  {
53  ASSERT(FALSE);
54  }
55 
56  /* store the kernel base for later use */
57  KernelBase = (ULONG_PTR)CONTAINING_RECORD(LoaderBlock->LoadOrderListHead.Flink, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks)->DllBase;
58 
59 }
#define TRUE
Definition: types.h:120
unsigned char BOOLEAN
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
BOOLEAN HaliFindSmpConfig(VOID)
Definition: mpconfig.c:605
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
ULONG_PTR KernelBase
Definition: halinit_mp.c:21
Definition: btrfs_drv.h:1780
LIST_ENTRY LoadOrderListHead
Definition: arc.h:493
#define ULONG_PTR
Definition: config.h:101

◆ 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 28 of file halinit_apic.c.

31 {
32  /* Initialize the local APIC for this cpu */
33  ApicInitializeLocalApic(ProcessorNumber);
34 
35  /* Initialize profiling data (but don't start it) */
37 
38  /* Initialize the timer */
39  //ApicInitializeTimer(ProcessorNumber);
40 
41 }
VOID NTAPI ApicInitializeLocalApic(ULONG Cpu)
Definition: apic.c:259
VOID NTAPI HalInitializeProfiling(VOID)
Definition: apictimer.c:70

Referenced by HalInitializeProcessor().

◆ HalpIs16BitPortDecodeSupported()

INIT_FUNCTION 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 28 of file misc.c.

30 {
31  /* Use kernel memory manager I/O map facilities */
33  NumberPage << PAGE_SHIFT,
34  MmNonCached);
35 }
#define PAGE_SHIFT
Definition: env_spec_w32.h:45
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
Definition: iosup.c:47
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1061

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

◆ 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 */
198  if (BaseAddress == HalpHeapStart)
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 }
ULONG64 Valid
Definition: mmtypes.h:66
#define PAGE_SHIFT
Definition: env_spec_w32.h:45
VOID NTAPI HalpFlushTLB(VOID)
Definition: misc.c:163
#define HalAddressToPte(x)
Definition: halp.h:523
uint32_t ULONG_PTR
Definition: typedefs.h:63
ULONG PFN_NUMBER
Definition: ke.h:8
smooth NULL
Definition: ftsmooth.c:416
void * PVOID
Definition: retypes.h:9
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1061
ULONG64 PageFrameNumber
Definition: mmtypes.h:78
ULONG LowPart
Definition: typedefs.h:104
#define PAGE_SIZE
Definition: env_spec_w32.h:49
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3791
PVOID HalpHeapStart
Definition: memory.c:22
ULONG64 Write
Definition: mmtypes.h:67
#define BYTE_OFFSET(Va)
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by HalpMapPhysicalMemory64(), and HalpRegisterKdSupportFunctions().

◆ HalpMarkAcpiHal()

INIT_FUNCTION NTSTATUS NTAPI HalpMarkAcpiHal ( VOID  )

Definition at line 64 of file misc.c.

65 {
67  UNICODE_STRING KeyString;
69  HANDLE Handle;
71 
72  /* Open the control set key */
73  RtlInitUnicodeString(&KeyString,
74  L"\\REGISTRY\\MACHINE\\SYSTEM\\CURRENTCONTROLSET");
76  if (NT_SUCCESS(Status))
77  {
78  /* Open the PNP key */
79  RtlInitUnicodeString(&KeyString, L"Control\\Pnp");
81  Handle,
82  &KeyString,
84  TRUE);
85  /* Close root key */
86  ZwClose(Handle);
87 
88  /* Check if PNP BIOS key exists */
89  if (NT_SUCCESS(Status))
90  {
91  /* Set the disable value to false -- we need the mapper */
92  RtlInitUnicodeString(&KeyString, L"DisableFirmwareMapper");
93  Status = ZwSetValueKey(KeyHandle,
94  &KeyString,
95  0,
96  REG_DWORD,
97  &Value,
98  sizeof(Value));
99 
100  /* Close subkey */
102  }
103  }
104 
105  /* Return status */
106  return Status;
107 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define TRUE
Definition: types.h:120
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI HalpOpenRegistryKey(IN PHANDLE KeyHandle, IN HANDLE RootKey, IN PUNICODE_STRING KeyName, IN ACCESS_MASK DesiredAccess, IN BOOLEAN Create)
Definition: misc.c:111
_In_ HANDLE Handle
Definition: extypes.h:390
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
BOOLEAN HalDisableFirmwareMapper
Definition: halacpi.c:43
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define REG_DWORD
Definition: sdbapi.c:596

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 111 of file misc.c.

116 {
120 
121  /* Setup the attributes we received */
123  KeyName,
125  RootKey,
126  NULL);
127 
128  /* What to do? */
129  if ( Create )
130  {
131  /* Create the key */
132  Status = ZwCreateKey(KeyHandle,
135  0,
136  NULL,
138  &Disposition);
139  }
140  else
141  {
142  /* Open the key */
144  }
145 
146  /* We're done */
147  return Status;
148 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING KeyName
Definition: ndis.h:4711
static PMEMKEY RootKey
Definition: registry.c:55
_Must_inspect_result_ _Out_ PNDIS_STATUS _In_ NDIS_HANDLE _In_ ULONG _Out_ PNDIS_STRING _Out_ PNDIS_HANDLE KeyHandle
Definition: ndis.h:4711
_In_ BOOLEAN Create
Definition: pstypes.h:511
LONG NTSTATUS
Definition: precomp.h:26
_In_ ACCESS_MASK _In_ POBJECT_ATTRIBUTES _Reserved_ ULONG _In_opt_ PUNICODE_STRING _In_ ULONG _Out_opt_ PULONG Disposition
Definition: cmfuncs.h:50
smooth NULL
Definition: ftsmooth.c:416
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
Status
Definition: gdiplustypes.h:24
_In_ PIO_STACK_LOCATION _Inout_ PFILE_OBJECT _Inout_ PVCB _Outptr_result_maybenull_ PDCB _In_ PDCB _In_ PDIRENT _In_ ULONG _In_ ULONG _In_ PUNICODE_STRING _In_ PACCESS_MASK DesiredAccess
Definition: create.c:4157
unsigned int ULONG
Definition: retypes.h:1
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define REG_OPTION_VOLATILE
Definition: nt_native.h:1060

Referenced by HalpMarkAcpiHal(), HalpMarkChipsetDecode(), 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 {
1018  PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList;
1019  ULONG Count = 0, ListSize;
1020  NTSTATUS Status;
1021  PAGED_CODE();
1022 
1023  /* Get ACPI resources */
1025  DPRINT("Resource count: %d\n", Count);
1026 
1027  /* Compute size of the list and allocate it */
1028  ListSize = FIELD_OFFSET(IO_RESOURCE_REQUIREMENTS_LIST, List[0].Descriptors) +
1029  (Count * sizeof(IO_RESOURCE_DESCRIPTOR));
1030  DPRINT("Resource list size: %d\n", ListSize);
1031  RequirementsList = ExAllocatePoolWithTag(PagedPool, ListSize, TAG_HAL);
1032  if (RequirementsList)
1033  {
1034  /* Initialize it */
1035  RtlZeroMemory(RequirementsList, ListSize);
1036  RequirementsList->ListSize = ListSize;
1037 
1038  /* Build it */
1039  Status = HalpBuildAcpiResourceList(RequirementsList);
1040  if (NT_SUCCESS(Status))
1041  {
1042  /* It worked, return it */
1043  *Requirements = RequirementsList;
1044 
1045  /* Validate the list */
1046  ASSERT(RequirementsList->List[0].Count == Count);
1047  }
1048  else
1049  {
1050  /* Fail */
1051  ExFreePoolWithTag(RequirementsList, TAG_HAL);
1053  }
1054  }
1055  else
1056  {
1057  /* Not enough memory */
1059  }
1060 
1061  /* Return the status */
1062  return Status;
1063 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
VOID NTAPI HalpAcpiDetectResourceListSize(OUT PULONG ListSize)
Definition: halacpi.c:969
NTSTATUS NTAPI HalpBuildAcpiResourceList(IN PIO_RESOURCE_REQUIREMENTS_LIST ResourceList)
Definition: halacpi.c:979
LONG NTSTATUS
Definition: precomp.h:26
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define PAGED_CODE()
Definition: video.h:57
void DPRINT(...)
Definition: polytest.cpp:61
LIST_ENTRY List
Definition: psmgr.c:57
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_SUCH_DEVICE
Definition: udferr_usr.h:136
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
IO_RESOURCE_LIST List[1]
Definition: iotypes.h:2393
#define TAG_HAL
Definition: hal.h:55
Status
Definition: gdiplustypes.h:24
struct _IO_RESOURCE_DESCRIPTOR IO_RESOURCE_DESCRIPTOR
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

Referenced by HalpQueryResourceRequirements(), and HalpQueryResources().

◆ HalpReadCmos()

UCHAR NTAPI HalpReadCmos ( IN UCHAR  Reg)

Definition at line 24 of file cmos.c.

25 {
26  /* Select the register */
28 
29  /* Query the value */
31 }
#define CMOS_CONTROL_PORT
Definition: halp.h:14
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
#define CMOS_DATA_PORT
Definition: halp.h:15
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532

Referenced by HalGetEnvironmentVariable(), HalpClockInterruptHandler(), HalpGetCmosData(), HalpInitializeClock(), HalpInitializeTsc(), HalQueryRealTimeClock(), HalSetEnvironmentVariable(), HalSetRealTimeClock(), HalStartProfileInterrupt(), HalStopProfileInterrupt(), and RtcSetClockRate().

◆ HalpRealModeStart()

VOID __cdecl HalpRealModeStart ( VOID  )

◆ HalpRegisterKdSupportFunctions()

INIT_FUNCTION VOID NTAPI HalpRegisterKdSupportFunctions ( VOID  )

Definition at line 23 of file bus.c.

24 {
25  /* Register PCI Device Functions */
28 
29  /* Register memory functions */
32 
33  /* Register ACPI stub */
35 }
VOID NTAPI HalpCheckPowerButton(VOID)
Definition: misc.c:20
#define KdUnmapVirtualAddress
Definition: halfuncs.h:53
NTSTATUS NTAPI HalpSetupPciDeviceForDebugging(IN PVOID LoaderBlock, IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice)
Definition: pci.c:473
PVOID NTAPI HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress, IN ULONG NumberPage)
Definition: misc.c:28
#define KdMapPhysicalMemory64
Definition: halfuncs.h:52
VOID NTAPI HalpUnmapVirtualAddress(IN PVOID VirtualAddress, IN ULONG NumberPages)
Definition: misc.c:39
#define KdSetupPciDeviceForDebugging
Definition: halfuncs.h:47
NTSTATUS NTAPI HalpReleasePciDeviceForDebugging(IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice)
Definition: pci.c:482
#define KdCheckPowerButton
Definition: halfuncs.h:50
#define KdReleasePciDeviceforDebugging
Definition: halfuncs.h:48

Referenced by HalInitializeProcessor().

◆ HalpRegisterVector()

INIT_FUNCTION 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 }
IDTUsage HalpIDTUsage[256]
Definition: usage.c:20
IDTUsageFlags HalpIDTUsageFlags[256]
Definition: usage.c:19
_Out_ PKIRQL Irql
Definition: csq.h:179
UCHAR BusReleativeVector
Definition: halp.h:32
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
UCHAR Flags
Definition: halp.h:26
KIRQL Irql
Definition: halp.h:31

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

◆ HalpReleaseCmosSpinLock()

VOID NTAPI HalpReleaseCmosSpinLock ( VOID  )

Definition at line 244 of file spinlock.c.

245 {
247 
248  /* Get the flags */
250 
251  /* Release the lock */
253 
254  /* Restore the flags */
256 }
FORCEINLINE VOID KxReleaseSpinLock(IN PKSPIN_LOCK SpinLock)
Definition: spinlock.h:35
uint32_t ULONG_PTR
Definition: typedefs.h:63
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
ULONG_PTR HalpSystemHardwareFlags
Definition: spinlock.c:24
KSPIN_LOCK HalpSystemHardwareLock
Definition: spinlock.c:25
__INTRIN_INLINE void __writeeflags(uintptr_t Value)
Definition: intrin_x86.h:1550

Referenced by HalGetEnvironmentVariable(), HalMakeBeep(), HalpGetCmosData(), HalpInitializeClock(), HalpSetCmosData(), HalQueryRealTimeClock(), HalSetEnvironmentVariable(), HalSetRealTimeClock(), HalStartProfileInterrupt(), HalStopProfileInterrupt(), and RtcSetClockRate().

◆ HalpReleasePciDeviceForDebugging()

INIT_FUNCTION NTSTATUS NTAPI HalpReleasePciDeviceForDebugging ( IN OUT PDEBUG_DEVICE_DESCRIPTOR  PciDevice)

Definition at line 482 of file pci.c.

483 {
484  DPRINT1("Unimplemented!\n");
485  return STATUS_NOT_IMPLEMENTED;
486 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

Referenced by HalpRegisterKdSupportFunctions().

◆ HalpReportResourceUsage()

INIT_FUNCTION 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 }
#define DbgPrint
Definition: loader.c:25
PWCHAR HalName
Definition: halacpi.c:45

Referenced by HalReportResourceUsage().

◆ HalpReportSerialNumber()

INIT_FUNCTION VOID NTAPI HalpReportSerialNumber ( VOID  )

Definition at line 33 of file misc.c.

34 {
36  UNICODE_STRING KeyString;
37  HANDLE Handle;
38 
39  /* Make sure there is a serial number */
40  if (!HalpSerialLen) return;
41 
42  /* Open the system key */
43  RtlInitUnicodeString(&KeyString, L"\\Registry\\Machine\\Hardware\\Description\\System");
45  if (NT_SUCCESS(Status))
46  {
47  /* Add the serial number */
48  RtlInitUnicodeString(&KeyString, L"Serial Number");
49  ZwSetValueKey(Handle,
50  &KeyString,
51  0,
52  REG_BINARY,
55 
56  /* Close the handle */
57  ZwClose(Handle);
58  }
59 }
#define REG_BINARY
Definition: nt_native.h:1496
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI HalpOpenRegistryKey(IN PHANDLE KeyHandle, IN HANDLE RootKey, IN PUNICODE_STRING KeyName, IN ACCESS_MASK DesiredAccess, IN BOOLEAN Create)
Definition: misc.c:111
_In_ HANDLE Handle
Definition: extypes.h:390
UCHAR HalpSerialLen
Definition: misc.c:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
CHAR HalpSerialNumber[31]
Definition: misc.c:25
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)

Referenced by HalpReportResourceUsage().

◆ HalpSetupPciDeviceForDebugging()

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

Definition at line 473 of file pci.c.

475 {
476  DPRINT1("Unimplemented!\n");
477  return STATUS_NOT_IMPLEMENTED;
478 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

Referenced by HalpRegisterKdSupportFunctions().

◆ HalpUnmapVirtualAddress()

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

Definition at line 39 of file misc.c.

41 {
42  /* Use kernel memory manager I/O map facilities */
43  MmUnmapIoSpace(VirtualAddress, NumberPages << PAGE_SHIFT);
44 }
#define PAGE_SHIFT
Definition: env_spec_w32.h:45
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3791
VOID NTAPI MmUnmapIoSpace(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
Definition: iosup.c:193

Referenced by HalpAcpiGetTable(), HalpAcpiGetTableFromBios(), HalpAcpiTableCacheInit(), and HalpRegisterKdSupportFunctions().

◆ 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:256
VOID NTAPI HalpFlushTLB(VOID)
Definition: misc.c:163
#define HalAddressToPte(x)
Definition: halp.h:523
uint32_t ULONG_PTR
Definition: typedefs.h:63
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
void * PVOID
Definition: retypes.h:9
#define PAGE_SIZE
Definition: env_spec_w32.h:49
_In_ ULONG _In_ BOOLEAN _Must_inspect_result_ PVOID * VirtualAddress
Definition: ndis.h:3791
PVOID HalpHeapStart
Definition: memory.c:22
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1

Referenced by HalpRegisterKdSupportFunctions(), and HalpUnmapVirtualAddress().

◆ HalpWriteCmos()

VOID NTAPI HalpWriteCmos ( IN UCHAR  Reg,
IN UCHAR  Value 
)

Definition at line 35 of file cmos.c.

37 {
38  /* Select the register */
40 
41  /* Write the value */
43 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
#define CMOS_CONTROL_PORT
Definition: halp.h:14
#define CMOS_DATA_PORT
Definition: halp.h:15
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532

Referenced by HalpInitializeClock(), HalpInitializeTsc(), HalpSetCmosData(), HalSetEnvironmentVariable(), HalSetRealTimeClock(), HalStartProfileInterrupt(), HalStopProfileInterrupt(), and RtcSetClockRate().

◆ 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 }
ULONG KeMaximumIncrement
Definition: clock.c:20
FORCEINLINE VOID KiWriteSystemTime(volatile KSYSTEM_TIME *SystemTime, ULARGE_INTEGER NewTime)
Definition: time.c:25
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1062
_Out_ PKIRQL Irql
Definition: csq.h:179
ULONG KeTimeAdjustment
Definition: time.c:18
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
long LONG
Definition: pedump.c:60
BOOLEAN NTAPI KdPollBreakIn(VOID)
Definition: kdmain.c:352
#define KiEndInterrupt(x, y)
Definition: ke.h:175
UCHAR SkipTick
Definition: ketypes.h:738
BOOLEAN KdDebuggerEnabled
Definition: kdmain.c:16
LONG KiTickOffset
Definition: time.c:17
#define InterlockedExchangeAdd
Definition: interlocked.h:181
ULONG InterruptCount
Definition: ketypes.h:732
FORCEINLINE VOID KiCheckForTimerExpiration(PKPRCB Prcb, PKTRAP_FRAME TrapFrame, ULARGE_INTEGER InterruptTime)
Definition: time.c:40
uint64_t ULONGLONG
Definition: typedefs.h:65
#define SharedUserData
NTKERNELAPI volatile KSYSTEM_TIME KeTickCount
Definition: clock.c:19
VOID NTAPI KeUpdateRunTime(IN PKTRAP_FRAME TrapFrame, IN KIRQL Irql)
Definition: time.c:140
#define DBG_STATUS_CONTROL_C
Definition: kdtypes.h:39
__analysis_noreturn NTSYSAPI VOID NTAPI DbgBreakPointWithStatus(_In_ ULONG Status)
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG Increment
Definition: CrNtStubs.h:42

Variable Documentation

◆ HalDisableFirmwareMapper

BOOLEAN HalDisableFirmwareMapper

Definition at line 43 of file halacpi.c.

Referenced by HalpMarkAcpiHal().

◆ HalHardwareIdString

PWCHAR HalHardwareIdString

Definition at line 44 of file halacpi.c.

Referenced by HalpQueryIdFdo().

◆ HalName

◆ HalpActiveProcessors

KAFFINITY HalpActiveProcessors

Definition at line 17 of file processor.c.

Referenced by HalInitializeProcessor(), and HalpBuildPartialFromIdt().

◆ HalpAddressUsageList

PADDRESS_USAGE HalpAddressUsageList

Definition at line 59 of file usage.c.

Referenced by HalInitSystem(), and HalpReportResourceUsage().

◆ HalpBuildType

const USHORT HalpBuildType

Definition at line 22 of file halinit_apic.c.

Referenced by HalInitSystem().

◆ HalpDefaultInterruptAffinity

KAFFINITY HalpDefaultInterruptAffinity

Definition at line 18 of file processor.c.

Referenced by HalInitializeProcessor(), and HalpGetRootInterruptVector().

◆ HalpDefaultIoSpace

ADDRESS_USAGE HalpDefaultIoSpace

Definition at line 81 of file usage.c.

Referenced by HalInitSystem().

◆ HalpIDTUsageFlags

◆ HalpNMIInProgress

BOOLEAN HalpNMIInProgress

Definition at line 22 of file misc.c.

Referenced by HalHandleNMI(), and HalpRestoreTrapHandlers().

◆ HalpPerfCounter

LARGE_INTEGER HalpPerfCounter

Definition at line 25 of file timer.c.

Referenced by KeQueryPerformanceCounter().

◆ HalpProfilingStopped

BOOLEAN HalpProfilingStopped

◆ HalpSystemHardwareLock

KSPIN_LOCK HalpSystemHardwareLock

Definition at line 18 of file cmos.c.

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