2005-06-18 14:30:09 +00:00
|
|
|
/*
|
2007-10-19 23:21:45 +00:00
|
|
|
*
|
2005-06-18 14:30:09 +00:00
|
|
|
*/
|
|
|
|
|
2010-02-26 11:43:19 +00:00
|
|
|
#pragma once
|
2005-06-18 14:30:09 +00:00
|
|
|
|
2015-09-05 19:50:14 +00:00
|
|
|
#if defined(__GNUC__) && !defined(_MINIHAL_)
|
2015-09-05 18:33:38 +00:00
|
|
|
#define INIT_SECTION __attribute__((section ("INIT")))
|
2010-11-04 01:28:09 +00:00
|
|
|
#else
|
2015-09-05 18:33:38 +00:00
|
|
|
#define INIT_SECTION /* Done via alloc_text for MSC */
|
2010-11-04 01:28:09 +00:00
|
|
|
#endif
|
2010-08-01 16:27:48 +00:00
|
|
|
|
2015-09-03 17:52:13 +00:00
|
|
|
|
2011-09-07 18:25:43 +00:00
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
#define HAL_BUILD_TYPE (DBG ? PRCB_BUILD_DEBUG : 0)
|
|
|
|
#else
|
|
|
|
#define HAL_BUILD_TYPE ((DBG ? PRCB_BUILD_DEBUG : 0) | PRCB_BUILD_UNIPROCESSOR)
|
|
|
|
#endif
|
|
|
|
|
2010-01-26 19:41:31 +00:00
|
|
|
typedef struct _HAL_BIOS_FRAME
|
|
|
|
{
|
|
|
|
ULONG SegSs;
|
|
|
|
ULONG Esp;
|
|
|
|
ULONG EFlags;
|
|
|
|
ULONG SegCs;
|
|
|
|
ULONG Eip;
|
|
|
|
PKTRAP_FRAME TrapFrame;
|
|
|
|
ULONG CsLimit;
|
|
|
|
ULONG CsBase;
|
|
|
|
ULONG CsFlags;
|
|
|
|
ULONG SsLimit;
|
|
|
|
ULONG SsBase;
|
|
|
|
ULONG SsFlags;
|
|
|
|
ULONG Prefix;
|
|
|
|
} HAL_BIOS_FRAME, *PHAL_BIOS_FRAME;
|
|
|
|
|
2010-01-28 20:45:45 +00:00
|
|
|
typedef
|
|
|
|
VOID
|
2015-09-15 10:35:49 +00:00
|
|
|
(__cdecl *PHAL_SW_INTERRUPT_HANDLER)(
|
2010-01-28 20:45:45 +00:00
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
typedef
|
|
|
|
VOID
|
2010-07-26 21:32:38 +00:00
|
|
|
(FASTCALL *PHAL_SW_INTERRUPT_HANDLER_2ND_ENTRY)(
|
2010-01-28 20:45:45 +00:00
|
|
|
IN PKTRAP_FRAME TrapFrame
|
|
|
|
);
|
|
|
|
|
2006-11-29 22:12:50 +00:00
|
|
|
#define HAL_APC_REQUEST 0
|
|
|
|
#define HAL_DPC_REQUEST 1
|
2005-06-18 14:30:09 +00:00
|
|
|
|
2017-11-06 18:40:21 +00:00
|
|
|
/* HAL profiling offsets in KeGetPcr()->HalReserved[] */
|
|
|
|
#define HAL_PROFILING_INTERVAL 0
|
|
|
|
#define HAL_PROFILING_MULTIPLIER 1
|
|
|
|
|
2006-11-27 19:26:31 +00:00
|
|
|
/* CMOS Registers and Ports */
|
|
|
|
#define CMOS_CONTROL_PORT (PUCHAR)0x70
|
|
|
|
#define CMOS_DATA_PORT (PUCHAR)0x71
|
|
|
|
#define RTC_REGISTER_A 0x0A
|
2010-09-25 07:22:40 +00:00
|
|
|
#define RTC_REG_A_UIP 0x80
|
2006-11-27 19:26:31 +00:00
|
|
|
#define RTC_REGISTER_B 0x0B
|
2010-09-25 07:22:40 +00:00
|
|
|
#define RTC_REG_B_PI 0x40
|
|
|
|
#define RTC_REGISTER_C 0x0C
|
2015-08-29 16:45:00 +00:00
|
|
|
#define RTC_REG_C_IRQ 0x80
|
2010-09-25 07:22:40 +00:00
|
|
|
#define RTC_REGISTER_D 0x0D
|
2006-11-27 19:26:31 +00:00
|
|
|
#define RTC_REGISTER_CENTURY 0x32
|
|
|
|
|
2009-10-29 19:58:41 +00:00
|
|
|
/* Usage flags */
|
|
|
|
#define IDT_REGISTERED 0x01
|
|
|
|
#define IDT_LATCHED 0x02
|
2010-04-01 20:46:55 +00:00
|
|
|
#define IDT_READ_ONLY 0x04
|
2009-10-29 19:58:41 +00:00
|
|
|
#define IDT_INTERNAL 0x11
|
|
|
|
#define IDT_DEVICE 0x21
|
|
|
|
|
2006-11-27 19:26:31 +00:00
|
|
|
/* Conversion functions */
|
|
|
|
#define BCD_INT(bcd) \
|
|
|
|
(((bcd & 0xF0) >> 4) * 10 + (bcd & 0x0F))
|
|
|
|
#define INT_BCD(int) \
|
|
|
|
(UCHAR)(((int / 10) << 4) + (int % 10))
|
2010-01-08 04:31:19 +00:00
|
|
|
|
2010-01-26 19:41:31 +00:00
|
|
|
//
|
|
|
|
// BIOS Interrupts
|
|
|
|
//
|
|
|
|
#define VIDEO_SERVICES 0x10
|
|
|
|
|
|
|
|
//
|
|
|
|
// Operations for INT 10h (in AH)
|
|
|
|
//
|
|
|
|
#define SET_VIDEO_MODE 0x00
|
|
|
|
|
|
|
|
//
|
|
|
|
// Video Modes for INT10h AH=00 (in AL)
|
|
|
|
//
|
|
|
|
#define GRAPHICS_MODE_12 0x12 /* 80x30 8x16 640x480 16/256K */
|
|
|
|
|
2010-01-08 04:31:19 +00:00
|
|
|
//
|
|
|
|
// Commonly stated as being 1.19318MHz
|
|
|
|
//
|
|
|
|
// See ISA System Architecture 3rd Edition (Tom Shanley, Don Anderson, John Swindle)
|
|
|
|
// P. 471
|
|
|
|
//
|
|
|
|
// However, the true value is closer to 1.19318181[...]81MHz since this is 1/3rd
|
|
|
|
// of the NTSC color subcarrier frequency which runs at 3.57954545[...]45MHz.
|
|
|
|
//
|
|
|
|
// Note that Windows uses 1.193167MHz which seems to have no basis. However, if
|
|
|
|
// one takes the NTSC color subcarrier frequency as being 3.579545 (trimming the
|
|
|
|
// infinite series) and divides it by three, one obtains 1.19318167.
|
|
|
|
//
|
|
|
|
// It may be that the original NT HAL source code introduced a typo and turned
|
|
|
|
// 119318167 into 1193167 by ommitting the "18". This is very plausible as the
|
|
|
|
// number is quite long.
|
|
|
|
//
|
|
|
|
#define PIT_FREQUENCY 1193182
|
|
|
|
|
|
|
|
//
|
|
|
|
// These ports are controlled by the i8254 Programmable Interrupt Timer (PIT)
|
|
|
|
//
|
|
|
|
#define TIMER_CHANNEL0_DATA_PORT 0x40
|
|
|
|
#define TIMER_CHANNEL1_DATA_PORT 0x41
|
|
|
|
#define TIMER_CHANNEL2_DATA_PORT 0x42
|
|
|
|
#define TIMER_CONTROL_PORT 0x43
|
|
|
|
|
|
|
|
//
|
|
|
|
// Mode 0 - Interrupt On Terminal Count
|
|
|
|
// Mode 1 - Hardware Re-triggerable One-Shot
|
|
|
|
// Mode 2 - Rate Generator
|
|
|
|
// Mode 3 - Square Wave Generator
|
|
|
|
// Mode 4 - Software Triggered Strobe
|
|
|
|
// Mode 5 - Hardware Triggered Strobe
|
|
|
|
//
|
|
|
|
typedef enum _TIMER_OPERATING_MODES
|
|
|
|
{
|
|
|
|
PitOperatingMode0,
|
|
|
|
PitOperatingMode1,
|
|
|
|
PitOperatingMode2,
|
|
|
|
PitOperatingMode3,
|
|
|
|
PitOperatingMode4,
|
|
|
|
PitOperatingMode5,
|
|
|
|
PitOperatingMode2Reserved,
|
|
|
|
PitOperatingMode5Reserved
|
|
|
|
} TIMER_OPERATING_MODES;
|
|
|
|
|
|
|
|
typedef enum _TIMER_ACCESS_MODES
|
|
|
|
{
|
|
|
|
PitAccessModeCounterLatch,
|
|
|
|
PitAccessModeLow,
|
|
|
|
PitAccessModeHigh,
|
|
|
|
PitAccessModeLowHigh
|
|
|
|
} TIMER_ACCESS_MODES;
|
|
|
|
|
|
|
|
typedef enum _TIMER_CHANNELS
|
|
|
|
{
|
|
|
|
PitChannel0,
|
|
|
|
PitChannel1,
|
|
|
|
PitChannel2,
|
|
|
|
PitReadBack
|
|
|
|
} TIMER_CHANNELS;
|
|
|
|
|
|
|
|
typedef union _TIMER_CONTROL_PORT_REGISTER
|
|
|
|
{
|
2011-06-24 23:04:13 +00:00
|
|
|
struct
|
2010-01-08 04:31:19 +00:00
|
|
|
{
|
|
|
|
UCHAR BcdMode:1;
|
2011-09-01 18:32:13 +00:00
|
|
|
UCHAR OperatingMode:3;
|
|
|
|
UCHAR AccessMode:2;
|
|
|
|
UCHAR Channel:2;
|
2010-01-08 04:31:19 +00:00
|
|
|
};
|
|
|
|
UCHAR Bits;
|
|
|
|
} TIMER_CONTROL_PORT_REGISTER, *PTIMER_CONTROL_PORT_REGISTER;
|
|
|
|
|
|
|
|
//
|
|
|
|
// See ISA System Architecture 3rd Edition (Tom Shanley, Don Anderson, John Swindle)
|
|
|
|
// P. 400
|
|
|
|
//
|
|
|
|
// This port is controled by the i8255 Programmable Peripheral Interface (PPI)
|
|
|
|
//
|
|
|
|
#define SYSTEM_CONTROL_PORT_A 0x92
|
|
|
|
#define SYSTEM_CONTROL_PORT_B 0x61
|
|
|
|
typedef union _SYSTEM_CONTROL_PORT_B_REGISTER
|
|
|
|
{
|
2011-06-24 23:04:13 +00:00
|
|
|
struct
|
2010-01-08 04:31:19 +00:00
|
|
|
{
|
|
|
|
UCHAR Timer2GateToSpeaker:1;
|
|
|
|
UCHAR SpeakerDataEnable:1;
|
|
|
|
UCHAR ParityCheckEnable:1;
|
|
|
|
UCHAR ChannelCheckEnable:1;
|
|
|
|
UCHAR RefreshRequest:1;
|
|
|
|
UCHAR Timer2Output:1;
|
|
|
|
UCHAR ChannelCheck:1;
|
|
|
|
UCHAR ParityCheck:1;
|
|
|
|
};
|
|
|
|
UCHAR Bits;
|
|
|
|
} SYSTEM_CONTROL_PORT_B_REGISTER, *PSYSTEM_CONTROL_PORT_B_REGISTER;
|
|
|
|
|
2010-01-21 12:51:13 +00:00
|
|
|
//
|
|
|
|
// See ISA System Architecture 3rd Edition (Tom Shanley, Don Anderson, John Swindle)
|
|
|
|
// P. 396, 397
|
|
|
|
//
|
|
|
|
// These ports are controlled by the i8259 Programmable Interrupt Controller (PIC)
|
|
|
|
//
|
|
|
|
#define PIC1_CONTROL_PORT 0x20
|
|
|
|
#define PIC1_DATA_PORT 0x21
|
|
|
|
#define PIC2_CONTROL_PORT 0xA0
|
|
|
|
#define PIC2_DATA_PORT 0xA1
|
|
|
|
|
|
|
|
//
|
|
|
|
// Definitions for ICW/OCW Bits
|
|
|
|
//
|
|
|
|
typedef enum _I8259_ICW1_OPERATING_MODE
|
|
|
|
{
|
|
|
|
Cascade,
|
|
|
|
Single
|
|
|
|
} I8259_ICW1_OPERATING_MODE;
|
|
|
|
|
|
|
|
typedef enum _I8259_ICW1_INTERRUPT_MODE
|
|
|
|
{
|
|
|
|
EdgeTriggered,
|
|
|
|
LevelTriggered
|
|
|
|
} I8259_ICW1_INTERRUPT_MODE;
|
|
|
|
|
|
|
|
typedef enum _I8259_ICW1_INTERVAL
|
|
|
|
{
|
|
|
|
Interval8,
|
|
|
|
Interval4
|
|
|
|
} I8259_ICW1_INTERVAL;
|
|
|
|
|
|
|
|
typedef enum _I8259_ICW4_SYSTEM_MODE
|
|
|
|
{
|
|
|
|
Mcs8085Mode,
|
|
|
|
New8086Mode
|
|
|
|
} I8259_ICW4_SYSTEM_MODE;
|
|
|
|
|
|
|
|
typedef enum _I8259_ICW4_EOI_MODE
|
|
|
|
{
|
|
|
|
NormalEoi,
|
|
|
|
AutomaticEoi
|
|
|
|
} I8259_ICW4_EOI_MODE;
|
|
|
|
|
|
|
|
typedef enum _I8259_ICW4_BUFFERED_MODE
|
|
|
|
{
|
|
|
|
NonBuffered,
|
|
|
|
NonBuffered2,
|
|
|
|
BufferedSlave,
|
|
|
|
BufferedMaster
|
|
|
|
} I8259_ICW4_BUFFERED_MODE;
|
|
|
|
|
2010-01-24 23:30:43 +00:00
|
|
|
typedef enum _I8259_READ_REQUEST
|
|
|
|
{
|
|
|
|
InvalidRequest,
|
|
|
|
InvalidRequest2,
|
|
|
|
ReadIdr,
|
|
|
|
ReadIsr
|
|
|
|
} I8259_READ_REQUEST;
|
|
|
|
|
|
|
|
typedef enum _I8259_EOI_MODE
|
|
|
|
{
|
|
|
|
RotateAutoEoiClear,
|
|
|
|
NonSpecificEoi,
|
|
|
|
InvalidEoiMode,
|
|
|
|
SpecificEoi,
|
|
|
|
RotateAutoEoiSet,
|
|
|
|
RotateNonSpecific,
|
|
|
|
SetPriority,
|
|
|
|
RotateSpecific
|
|
|
|
} I8259_EOI_MODE;
|
|
|
|
|
2010-01-21 12:51:13 +00:00
|
|
|
//
|
|
|
|
// Definitions for ICW Registers
|
|
|
|
//
|
|
|
|
typedef union _I8259_ICW1
|
|
|
|
{
|
2011-06-24 23:04:13 +00:00
|
|
|
struct
|
2010-01-21 12:51:13 +00:00
|
|
|
{
|
|
|
|
UCHAR NeedIcw4:1;
|
2011-06-24 23:04:13 +00:00
|
|
|
UCHAR OperatingMode:1;
|
|
|
|
UCHAR Interval:1;
|
|
|
|
UCHAR InterruptMode:1;
|
2010-01-21 12:51:13 +00:00
|
|
|
UCHAR Init:1;
|
|
|
|
UCHAR InterruptVectorAddress:3;
|
|
|
|
};
|
|
|
|
UCHAR Bits;
|
|
|
|
} I8259_ICW1, *PI8259_ICW1;
|
|
|
|
|
|
|
|
typedef union _I8259_ICW2
|
|
|
|
{
|
2011-06-24 23:04:13 +00:00
|
|
|
struct
|
2010-01-21 12:51:13 +00:00
|
|
|
{
|
|
|
|
UCHAR Sbz:3;
|
|
|
|
UCHAR InterruptVector:5;
|
|
|
|
};
|
|
|
|
UCHAR Bits;
|
|
|
|
} I8259_ICW2, *PI8259_ICW2;
|
|
|
|
|
|
|
|
typedef union _I8259_ICW3
|
|
|
|
{
|
|
|
|
union
|
|
|
|
{
|
2011-06-24 23:04:13 +00:00
|
|
|
struct
|
2010-01-21 12:51:13 +00:00
|
|
|
{
|
|
|
|
UCHAR SlaveIrq0:1;
|
|
|
|
UCHAR SlaveIrq1:1;
|
|
|
|
UCHAR SlaveIrq2:1;
|
|
|
|
UCHAR SlaveIrq3:1;
|
|
|
|
UCHAR SlaveIrq4:1;
|
|
|
|
UCHAR SlaveIrq5:1;
|
|
|
|
UCHAR SlaveIrq6:1;
|
|
|
|
UCHAR SlaveIrq7:1;
|
|
|
|
};
|
2011-06-24 23:04:13 +00:00
|
|
|
struct
|
2010-01-21 12:51:13 +00:00
|
|
|
{
|
|
|
|
UCHAR SlaveId:3;
|
|
|
|
UCHAR Reserved:5;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
UCHAR Bits;
|
|
|
|
} I8259_ICW3, *PI8259_ICW3;
|
|
|
|
|
|
|
|
typedef union _I8259_ICW4
|
|
|
|
{
|
2011-06-24 23:04:13 +00:00
|
|
|
struct
|
2010-01-21 12:51:13 +00:00
|
|
|
{
|
2011-06-24 23:04:13 +00:00
|
|
|
UCHAR SystemMode:1;
|
|
|
|
UCHAR EoiMode:1;
|
|
|
|
UCHAR BufferedMode:2;
|
2010-01-21 12:51:13 +00:00
|
|
|
UCHAR SpecialFullyNestedMode:1;
|
|
|
|
UCHAR Reserved:3;
|
|
|
|
};
|
|
|
|
UCHAR Bits;
|
|
|
|
} I8259_ICW4, *PI8259_ICW4;
|
|
|
|
|
2010-01-24 23:30:43 +00:00
|
|
|
typedef union _I8259_OCW2
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UCHAR IrqNumber:3;
|
|
|
|
UCHAR Sbz:2;
|
2011-06-24 23:04:13 +00:00
|
|
|
UCHAR EoiMode:3;
|
2010-01-24 23:30:43 +00:00
|
|
|
};
|
|
|
|
UCHAR Bits;
|
|
|
|
} I8259_OCW2, *PI8259_OCW2;
|
|
|
|
|
|
|
|
typedef union _I8259_OCW3
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
2011-06-24 23:04:13 +00:00
|
|
|
UCHAR ReadRequest:2;
|
2010-01-24 23:30:43 +00:00
|
|
|
UCHAR PollCommand:1;
|
|
|
|
UCHAR Sbo:1;
|
|
|
|
UCHAR Sbz:1;
|
|
|
|
UCHAR SpecialMaskMode:2;
|
|
|
|
UCHAR Reserved:1;
|
|
|
|
};
|
|
|
|
UCHAR Bits;
|
|
|
|
} I8259_OCW3, *PI8259_OCW3;
|
|
|
|
|
|
|
|
typedef union _I8259_ISR
|
|
|
|
{
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UCHAR Irq0:1;
|
|
|
|
UCHAR Irq1:1;
|
|
|
|
UCHAR Irq2:1;
|
|
|
|
UCHAR Irq3:1;
|
|
|
|
UCHAR Irq4:1;
|
|
|
|
UCHAR Irq5:1;
|
|
|
|
UCHAR Irq6:1;
|
|
|
|
UCHAR Irq7:1;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
UCHAR Bits;
|
|
|
|
} I8259_ISR, *PI8259_ISR;
|
|
|
|
|
|
|
|
typedef I8259_ISR I8259_IDR, *PI8259_IDR;
|
|
|
|
|
2010-01-21 12:51:13 +00:00
|
|
|
//
|
|
|
|
// See EISA System Architecture 2nd Edition (Tom Shanley, Don Anderson, John Swindle)
|
|
|
|
// P. 34, 35
|
|
|
|
//
|
|
|
|
// These ports are controlled by the i8259A Programmable Interrupt Controller (PIC)
|
|
|
|
//
|
|
|
|
#define EISA_ELCR_MASTER 0x4D0
|
|
|
|
#define EISA_ELCR_SLAVE 0x4D1
|
|
|
|
|
|
|
|
typedef union _EISA_ELCR
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UCHAR Irq0Level:1;
|
|
|
|
UCHAR Irq1Level:1;
|
|
|
|
UCHAR Irq2Level:1;
|
|
|
|
UCHAR Irq3Level:1;
|
|
|
|
UCHAR Irq4Level:1;
|
|
|
|
UCHAR Irq5Level:1;
|
|
|
|
UCHAR Irq6Level:1;
|
|
|
|
UCHAR Irq7Level:1;
|
|
|
|
} Master;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UCHAR Irq8Level:1;
|
|
|
|
UCHAR Irq9Level:1;
|
|
|
|
UCHAR Irq10Level:1;
|
|
|
|
UCHAR Irq11Level:1;
|
|
|
|
UCHAR Irq12Level:1;
|
|
|
|
UCHAR Irq13Level:1;
|
|
|
|
UCHAR Irq14Level:1;
|
|
|
|
UCHAR Irq15Level:1;
|
|
|
|
} Slave;
|
|
|
|
};
|
|
|
|
USHORT Bits;
|
|
|
|
} EISA_ELCR, *PEISA_ELCR;
|
|
|
|
|
2010-01-24 23:19:40 +00:00
|
|
|
typedef struct _PIC_MASK
|
|
|
|
{
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
UCHAR Master;
|
|
|
|
UCHAR Slave;
|
|
|
|
};
|
|
|
|
USHORT Both;
|
2011-06-24 23:04:13 +00:00
|
|
|
};
|
2010-01-24 23:19:40 +00:00
|
|
|
} PIC_MASK, *PPIC_MASK;
|
|
|
|
|
2010-01-24 23:30:43 +00:00
|
|
|
typedef
|
|
|
|
BOOLEAN
|
2015-09-15 23:03:42 +00:00
|
|
|
(NTAPI *PHAL_DISMISS_INTERRUPT)(
|
2010-01-24 23:30:43 +00:00
|
|
|
IN KIRQL Irql,
|
|
|
|
IN ULONG Irq,
|
|
|
|
OUT PKIRQL OldIrql
|
|
|
|
);
|
|
|
|
|
|
|
|
BOOLEAN
|
2015-09-15 23:03:42 +00:00
|
|
|
NTAPI
|
2010-01-24 23:30:43 +00:00
|
|
|
HalpDismissIrqGeneric(
|
|
|
|
IN KIRQL Irql,
|
|
|
|
IN ULONG Irq,
|
|
|
|
OUT PKIRQL OldIrql
|
|
|
|
);
|
|
|
|
|
|
|
|
BOOLEAN
|
2015-09-15 23:03:42 +00:00
|
|
|
NTAPI
|
2010-01-24 23:30:43 +00:00
|
|
|
HalpDismissIrq15(
|
|
|
|
IN KIRQL Irql,
|
|
|
|
IN ULONG Irq,
|
|
|
|
OUT PKIRQL OldIrql
|
|
|
|
);
|
|
|
|
|
|
|
|
BOOLEAN
|
2015-09-15 23:03:42 +00:00
|
|
|
NTAPI
|
2010-01-24 23:30:43 +00:00
|
|
|
HalpDismissIrq13(
|
|
|
|
IN KIRQL Irql,
|
|
|
|
IN ULONG Irq,
|
|
|
|
OUT PKIRQL OldIrql
|
|
|
|
);
|
|
|
|
|
|
|
|
BOOLEAN
|
2015-09-15 23:03:42 +00:00
|
|
|
NTAPI
|
2010-01-24 23:30:43 +00:00
|
|
|
HalpDismissIrq07(
|
|
|
|
IN KIRQL Irql,
|
|
|
|
IN ULONG Irq,
|
|
|
|
OUT PKIRQL OldIrql
|
|
|
|
);
|
|
|
|
|
[HAL]: Rewrite IRQL handling. Alex's original code (lately translated to C) was a copy of the MicroChannel (MCA), Checked-Build HAL, an unexplained choice considering MCA is not supported or even available anymore. Windows, on machines with a PIC, uses a mechanism called Lazy IRQL, in which the PIC is only programmed "lazily", meaning that lowering and raising the IRQL does not actually change the interrupt mask. Therefore, lower priority interrupts will still come in at high IRQL. At this point, the HAL will detect this, only now mask the PICs, and lie that the lower interrupt was "spurious", while setting a pending bit. When the IRQL is lowered, the bit is detected, and a software/delayed "INT" is done with the correct IRQ vector number. More details are available in the typical resources.
[HAL]: Implement support for Level interrupts, which are used by certain EISA cards, and more particularly, all PCI hardware. Level interrupts were not previously handled correctly, being treated as edge/latched interrupts instead.
[NTOS/HAL]: Remove VDM Alert KPCR hack (which was buggy). Now the PKTRAP_FRAME is passed as a parameter to HalpEndSoftwareInterrupt/HalEndSystemInterrupt. This also removes the HalpNestedTrap ASM hack, since the call can now be done in C.
[PERF]: On real machines, writing the PIC mask is a relatively expensive I/O operation, and IRQL lower/raise can happen hundreds of times a second. Lazy IRQL provides an important optimization.
[PERF]: Correctly handling level interrupts as level interrupts allows for faster, and more efficient, IRQ handling.
svn path=/trunk/; revision=45320
2010-01-29 21:10:33 +00:00
|
|
|
BOOLEAN
|
2015-09-15 23:03:42 +00:00
|
|
|
NTAPI
|
[HAL]: Rewrite IRQL handling. Alex's original code (lately translated to C) was a copy of the MicroChannel (MCA), Checked-Build HAL, an unexplained choice considering MCA is not supported or even available anymore. Windows, on machines with a PIC, uses a mechanism called Lazy IRQL, in which the PIC is only programmed "lazily", meaning that lowering and raising the IRQL does not actually change the interrupt mask. Therefore, lower priority interrupts will still come in at high IRQL. At this point, the HAL will detect this, only now mask the PICs, and lie that the lower interrupt was "spurious", while setting a pending bit. When the IRQL is lowered, the bit is detected, and a software/delayed "INT" is done with the correct IRQ vector number. More details are available in the typical resources.
[HAL]: Implement support for Level interrupts, which are used by certain EISA cards, and more particularly, all PCI hardware. Level interrupts were not previously handled correctly, being treated as edge/latched interrupts instead.
[NTOS/HAL]: Remove VDM Alert KPCR hack (which was buggy). Now the PKTRAP_FRAME is passed as a parameter to HalpEndSoftwareInterrupt/HalEndSystemInterrupt. This also removes the HalpNestedTrap ASM hack, since the call can now be done in C.
[PERF]: On real machines, writing the PIC mask is a relatively expensive I/O operation, and IRQL lower/raise can happen hundreds of times a second. Lazy IRQL provides an important optimization.
[PERF]: Correctly handling level interrupts as level interrupts allows for faster, and more efficient, IRQ handling.
svn path=/trunk/; revision=45320
2010-01-29 21:10:33 +00:00
|
|
|
HalpDismissIrqLevel(
|
|
|
|
IN KIRQL Irql,
|
|
|
|
IN ULONG Irq,
|
|
|
|
OUT PKIRQL OldIrql
|
|
|
|
);
|
|
|
|
|
|
|
|
BOOLEAN
|
2015-09-15 23:03:42 +00:00
|
|
|
NTAPI
|
[HAL]: Rewrite IRQL handling. Alex's original code (lately translated to C) was a copy of the MicroChannel (MCA), Checked-Build HAL, an unexplained choice considering MCA is not supported or even available anymore. Windows, on machines with a PIC, uses a mechanism called Lazy IRQL, in which the PIC is only programmed "lazily", meaning that lowering and raising the IRQL does not actually change the interrupt mask. Therefore, lower priority interrupts will still come in at high IRQL. At this point, the HAL will detect this, only now mask the PICs, and lie that the lower interrupt was "spurious", while setting a pending bit. When the IRQL is lowered, the bit is detected, and a software/delayed "INT" is done with the correct IRQ vector number. More details are available in the typical resources.
[HAL]: Implement support for Level interrupts, which are used by certain EISA cards, and more particularly, all PCI hardware. Level interrupts were not previously handled correctly, being treated as edge/latched interrupts instead.
[NTOS/HAL]: Remove VDM Alert KPCR hack (which was buggy). Now the PKTRAP_FRAME is passed as a parameter to HalpEndSoftwareInterrupt/HalEndSystemInterrupt. This also removes the HalpNestedTrap ASM hack, since the call can now be done in C.
[PERF]: On real machines, writing the PIC mask is a relatively expensive I/O operation, and IRQL lower/raise can happen hundreds of times a second. Lazy IRQL provides an important optimization.
[PERF]: Correctly handling level interrupts as level interrupts allows for faster, and more efficient, IRQ handling.
svn path=/trunk/; revision=45320
2010-01-29 21:10:33 +00:00
|
|
|
HalpDismissIrq15Level(
|
|
|
|
IN KIRQL Irql,
|
|
|
|
IN ULONG Irq,
|
|
|
|
OUT PKIRQL OldIrql
|
|
|
|
);
|
|
|
|
|
|
|
|
BOOLEAN
|
2015-09-15 23:03:42 +00:00
|
|
|
NTAPI
|
[HAL]: Rewrite IRQL handling. Alex's original code (lately translated to C) was a copy of the MicroChannel (MCA), Checked-Build HAL, an unexplained choice considering MCA is not supported or even available anymore. Windows, on machines with a PIC, uses a mechanism called Lazy IRQL, in which the PIC is only programmed "lazily", meaning that lowering and raising the IRQL does not actually change the interrupt mask. Therefore, lower priority interrupts will still come in at high IRQL. At this point, the HAL will detect this, only now mask the PICs, and lie that the lower interrupt was "spurious", while setting a pending bit. When the IRQL is lowered, the bit is detected, and a software/delayed "INT" is done with the correct IRQ vector number. More details are available in the typical resources.
[HAL]: Implement support for Level interrupts, which are used by certain EISA cards, and more particularly, all PCI hardware. Level interrupts were not previously handled correctly, being treated as edge/latched interrupts instead.
[NTOS/HAL]: Remove VDM Alert KPCR hack (which was buggy). Now the PKTRAP_FRAME is passed as a parameter to HalpEndSoftwareInterrupt/HalEndSystemInterrupt. This also removes the HalpNestedTrap ASM hack, since the call can now be done in C.
[PERF]: On real machines, writing the PIC mask is a relatively expensive I/O operation, and IRQL lower/raise can happen hundreds of times a second. Lazy IRQL provides an important optimization.
[PERF]: Correctly handling level interrupts as level interrupts allows for faster, and more efficient, IRQ handling.
svn path=/trunk/; revision=45320
2010-01-29 21:10:33 +00:00
|
|
|
HalpDismissIrq13Level(
|
|
|
|
IN KIRQL Irql,
|
|
|
|
IN ULONG Irq,
|
|
|
|
OUT PKIRQL OldIrql
|
|
|
|
);
|
|
|
|
|
|
|
|
BOOLEAN
|
2015-09-15 23:03:42 +00:00
|
|
|
NTAPI
|
[HAL]: Rewrite IRQL handling. Alex's original code (lately translated to C) was a copy of the MicroChannel (MCA), Checked-Build HAL, an unexplained choice considering MCA is not supported or even available anymore. Windows, on machines with a PIC, uses a mechanism called Lazy IRQL, in which the PIC is only programmed "lazily", meaning that lowering and raising the IRQL does not actually change the interrupt mask. Therefore, lower priority interrupts will still come in at high IRQL. At this point, the HAL will detect this, only now mask the PICs, and lie that the lower interrupt was "spurious", while setting a pending bit. When the IRQL is lowered, the bit is detected, and a software/delayed "INT" is done with the correct IRQ vector number. More details are available in the typical resources.
[HAL]: Implement support for Level interrupts, which are used by certain EISA cards, and more particularly, all PCI hardware. Level interrupts were not previously handled correctly, being treated as edge/latched interrupts instead.
[NTOS/HAL]: Remove VDM Alert KPCR hack (which was buggy). Now the PKTRAP_FRAME is passed as a parameter to HalpEndSoftwareInterrupt/HalEndSystemInterrupt. This also removes the HalpNestedTrap ASM hack, since the call can now be done in C.
[PERF]: On real machines, writing the PIC mask is a relatively expensive I/O operation, and IRQL lower/raise can happen hundreds of times a second. Lazy IRQL provides an important optimization.
[PERF]: Correctly handling level interrupts as level interrupts allows for faster, and more efficient, IRQ handling.
svn path=/trunk/; revision=45320
2010-01-29 21:10:33 +00:00
|
|
|
HalpDismissIrq07Level(
|
|
|
|
IN KIRQL Irql,
|
|
|
|
IN ULONG Irq,
|
|
|
|
OUT PKIRQL OldIrql
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
2015-09-15 10:35:49 +00:00
|
|
|
__cdecl
|
[HAL]: Rewrite IRQL handling. Alex's original code (lately translated to C) was a copy of the MicroChannel (MCA), Checked-Build HAL, an unexplained choice considering MCA is not supported or even available anymore. Windows, on machines with a PIC, uses a mechanism called Lazy IRQL, in which the PIC is only programmed "lazily", meaning that lowering and raising the IRQL does not actually change the interrupt mask. Therefore, lower priority interrupts will still come in at high IRQL. At this point, the HAL will detect this, only now mask the PICs, and lie that the lower interrupt was "spurious", while setting a pending bit. When the IRQL is lowered, the bit is detected, and a software/delayed "INT" is done with the correct IRQ vector number. More details are available in the typical resources.
[HAL]: Implement support for Level interrupts, which are used by certain EISA cards, and more particularly, all PCI hardware. Level interrupts were not previously handled correctly, being treated as edge/latched interrupts instead.
[NTOS/HAL]: Remove VDM Alert KPCR hack (which was buggy). Now the PKTRAP_FRAME is passed as a parameter to HalpEndSoftwareInterrupt/HalEndSystemInterrupt. This also removes the HalpNestedTrap ASM hack, since the call can now be done in C.
[PERF]: On real machines, writing the PIC mask is a relatively expensive I/O operation, and IRQL lower/raise can happen hundreds of times a second. Lazy IRQL provides an important optimization.
[PERF]: Correctly handling level interrupts as level interrupts allows for faster, and more efficient, IRQ handling.
svn path=/trunk/; revision=45320
2010-01-29 21:10:33 +00:00
|
|
|
HalpHardwareInterruptLevel(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2010-06-07 15:34:35 +00:00
|
|
|
//
|
|
|
|
// Hack Flags
|
|
|
|
//
|
|
|
|
#define HALP_REVISION_FROM_HACK_FLAGS(x) ((x) >> 24)
|
|
|
|
#define HALP_REVISION_HACK_FLAGS(x) ((x) >> 12)
|
|
|
|
#define HALP_HACK_FLAGS(x) ((x) & 0xFFF)
|
|
|
|
|
2010-06-07 15:09:44 +00:00
|
|
|
//
|
|
|
|
// Feature flags
|
|
|
|
//
|
|
|
|
#define HALP_CARD_FEATURE_FULL_DECODE 0x0001
|
|
|
|
|
|
|
|
//
|
|
|
|
// Match Flags
|
|
|
|
//
|
|
|
|
#define HALP_CHECK_CARD_REVISION_ID 0x10000
|
|
|
|
#define HALP_CHECK_CARD_SUBVENDOR_ID 0x20000
|
|
|
|
#define HALP_CHECK_CARD_SUBSYSTEM_ID 0x40000
|
|
|
|
|
2010-01-01 15:09:14 +00:00
|
|
|
//
|
|
|
|
// Mm PTE/PDE to Hal PTE/PDE
|
|
|
|
//
|
|
|
|
#define HalAddressToPde(x) (PHARDWARE_PTE)MiAddressToPde(x)
|
|
|
|
#define HalAddressToPte(x) (PHARDWARE_PTE)MiAddressToPte(x)
|
2011-06-24 23:04:13 +00:00
|
|
|
|
2009-10-29 19:58:41 +00:00
|
|
|
typedef struct _IDTUsageFlags
|
|
|
|
{
|
|
|
|
UCHAR Flags;
|
|
|
|
} IDTUsageFlags;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
KIRQL Irql;
|
|
|
|
UCHAR BusReleativeVector;
|
|
|
|
} IDTUsage;
|
|
|
|
|
|
|
|
typedef struct _HalAddressUsage
|
|
|
|
{
|
|
|
|
struct _HalAddressUsage *Next;
|
|
|
|
CM_RESOURCE_TYPE Type;
|
|
|
|
UCHAR Flags;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
ULONG Start;
|
|
|
|
ULONG Length;
|
|
|
|
} Element[];
|
|
|
|
} ADDRESS_USAGE, *PADDRESS_USAGE;
|
|
|
|
|
2005-06-18 14:30:09 +00:00
|
|
|
/* adapter.c */
|
2008-11-29 23:16:39 +00:00
|
|
|
PADAPTER_OBJECT NTAPI HalpAllocateAdapterEx(ULONG NumberOfMapRegisters,BOOLEAN IsMaster, BOOLEAN Dma32BitAddresses);
|
2007-10-19 23:21:45 +00:00
|
|
|
|
2009-10-29 19:58:41 +00:00
|
|
|
/* sysinfo.c */
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpRegisterVector(IN UCHAR Flags,
|
|
|
|
IN ULONG BusVector,
|
|
|
|
IN ULONG SystemVector,
|
|
|
|
IN KIRQL Irql);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpEnableInterruptHandler(IN UCHAR Flags,
|
|
|
|
IN ULONG BusVector,
|
|
|
|
IN ULONG SystemVector,
|
|
|
|
IN KIRQL Irql,
|
|
|
|
IN PVOID Handler,
|
|
|
|
IN KINTERRUPT_MODE Mode);
|
|
|
|
|
2010-01-21 12:51:13 +00:00
|
|
|
/* pic.c */
|
|
|
|
VOID NTAPI HalpInitializePICs(IN BOOLEAN EnableInterrupts);
|
2015-09-15 10:35:49 +00:00
|
|
|
VOID __cdecl HalpApcInterrupt(VOID);
|
|
|
|
VOID __cdecl HalpDispatchInterrupt(VOID);
|
2018-02-18 11:50:54 +00:00
|
|
|
PHAL_SW_INTERRUPT_HANDLER __cdecl HalpDispatchInterrupt2(VOID);
|
2010-07-26 21:32:38 +00:00
|
|
|
DECLSPEC_NORETURN VOID FASTCALL HalpApcInterrupt2ndEntry(IN PKTRAP_FRAME TrapFrame);
|
|
|
|
DECLSPEC_NORETURN VOID FASTCALL HalpDispatchInterrupt2ndEntry(IN PKTRAP_FRAME TrapFrame);
|
2005-06-18 14:30:09 +00:00
|
|
|
|
2015-08-29 16:45:00 +00:00
|
|
|
/* profil.c */
|
|
|
|
extern BOOLEAN HalpProfilingStopped;
|
|
|
|
|
2010-01-26 21:41:05 +00:00
|
|
|
/* timer.c */
|
2006-11-27 19:26:31 +00:00
|
|
|
VOID NTAPI HalpInitializeClock(VOID);
|
2015-09-15 10:35:49 +00:00
|
|
|
VOID __cdecl HalpClockInterrupt(VOID);
|
|
|
|
VOID __cdecl HalpProfileInterrupt(VOID);
|
2006-11-27 19:26:31 +00:00
|
|
|
|
2009-10-10 18:22:56 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpCalibrateStallExecution(VOID);
|
|
|
|
|
2005-06-18 14:30:09 +00:00
|
|
|
/* pci.c */
|
|
|
|
VOID HalpInitPciBus (VOID);
|
|
|
|
|
|
|
|
/* dma.c */
|
|
|
|
VOID HalpInitDma (VOID);
|
|
|
|
|
|
|
|
/* Non-generic initialization */
|
2006-09-30 03:33:50 +00:00
|
|
|
VOID HalpInitPhase0 (PLOADER_PARAMETER_BLOCK LoaderBlock);
|
2006-08-25 00:46:41 +00:00
|
|
|
VOID HalpInitPhase1(VOID);
|
2005-06-18 14:30:09 +00:00
|
|
|
|
2010-01-01 16:37:34 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpFlushTLB(VOID);
|
|
|
|
|
2006-11-29 22:12:50 +00:00
|
|
|
//
|
|
|
|
// KD Support
|
|
|
|
//
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpCheckPowerButton(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpRegisterKdSupportFunctions(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
HalpSetupPciDeviceForDebugging(
|
|
|
|
IN PVOID LoaderBlock,
|
|
|
|
IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice
|
|
|
|
);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
HalpReleasePciDeviceForDebugging(
|
|
|
|
IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice
|
|
|
|
);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Memory routines
|
|
|
|
//
|
2017-12-17 16:37:43 +00:00
|
|
|
ULONG64
|
2011-09-15 10:46:02 +00:00
|
|
|
NTAPI
|
|
|
|
HalpAllocPhysicalMemory(
|
|
|
|
IN PLOADER_PARAMETER_BLOCK LoaderBlock,
|
2017-12-17 16:37:43 +00:00
|
|
|
IN ULONG64 MaxAddress,
|
2011-09-15 10:46:02 +00:00
|
|
|
IN PFN_NUMBER PageCount,
|
|
|
|
IN BOOLEAN Aligned
|
|
|
|
);
|
|
|
|
|
2018-02-04 15:59:21 +00:00
|
|
|
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
|
|
|
|
);
|
|
|
|
|
2006-11-29 22:12:50 +00:00
|
|
|
PVOID
|
|
|
|
NTAPI
|
|
|
|
HalpMapPhysicalMemory64(
|
|
|
|
IN PHYSICAL_ADDRESS PhysicalAddress,
|
2012-03-28 12:15:54 +00:00
|
|
|
IN PFN_COUNT PageCount
|
2006-11-29 22:12:50 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpUnmapVirtualAddress(
|
|
|
|
IN PVOID VirtualAddress,
|
2012-03-28 12:15:54 +00:00
|
|
|
IN PFN_COUNT NumberPages
|
2006-11-29 22:12:50 +00:00
|
|
|
);
|
|
|
|
|
2005-06-18 14:30:09 +00:00
|
|
|
/* sysinfo.c */
|
2006-11-27 19:26:31 +00:00
|
|
|
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
|
|
|
|
);
|
2005-06-18 14:30:09 +00:00
|
|
|
|
2007-12-15 17:15:48 +00:00
|
|
|
//
|
|
|
|
// BIOS Routines
|
|
|
|
//
|
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
HalpBiosDisplayReset(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2010-02-26 00:07:22 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
HalpExitToV86(
|
|
|
|
PKTRAP_FRAME TrapFrame
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
2015-09-15 10:35:49 +00:00
|
|
|
__cdecl
|
2010-02-26 00:07:22 +00:00
|
|
|
HalpRealModeStart(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
- Stub out DbgKdWriteVirtualMemoryApi, DbgKdReadPhysicalMemoryApi, DbgKdWritePhysicalMemoryApi, DbgKdWriteBreakPointExApi, DbgKdRestoreBreakPointExApi, DbgKdSearchMemoryApi and DbgKdFillMemoryApi cases more properly.
- Fail on physical memory write like we do for read too.
- Don't handle OldVlm1/2 as they appear to be deprecated and unhandled in Windows.
- Implement HalHaltSystem to halt execution in a portable way. Default to xHalHaltSystem, a simple infinite loop, if we get called before HAL has initialized. Use this in KiBugCheckDebugBreak and the system shutdown handler instead of x86/AMD64/ARM intrinsics.
- Don't try to halt the CPU if KeBugCheck has been called 3 times or more -- if this happens, something has gone very wrong, and we shouldn't try to do anything special. Just loop infinitely.
- Fix KiBugCheckDebugBreak -- it shouldn't halt execution when called for the first chance as bugcheck callbacks have not been invoked at this point (nor has the BSOD been displayed). Use SEH to protect against a crash instead of checking KdDebuggerNotPresent as the debugger, if it is present, *could* disconnect while the trap is being handled. Also, don't halt execution if the debugger handled the breakpoint, just break again.
- Don't call MmMapIoSpace from HalpReboot! The reboot might take place at elevated IRQL (as high as HIGH_LEVEL if called from KeBugCheck), and thus can't use any Mm support routines. Use a PTE from the reserved HAL region and map it ourselves instead as done in the BIOS call code.
- Acquire the display ownership in HalReturnToFirmware in case the caller hasn't done so (as done in the KD reboot routine, for example).
- Just include ntndk.h in hal.h instead of including 6 NDK headers (which turns into more than half of the NDK anyway since those headers include other NDK headers).
- Crashing and rebooting from KD now works properly.
svn path=/trunk/; revision=43380
2009-10-11 20:16:45 +00:00
|
|
|
//
|
|
|
|
// Processor Halt Routine
|
|
|
|
//
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HaliHaltSystem(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2009-10-29 19:58:41 +00:00
|
|
|
//
|
2010-09-25 07:22:40 +00:00
|
|
|
// CMOS Routines
|
2009-10-29 19:58:41 +00:00
|
|
|
//
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpInitializeCmos(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2010-09-25 07:22:40 +00:00
|
|
|
UCHAR
|
|
|
|
NTAPI
|
|
|
|
HalpReadCmos(
|
|
|
|
IN UCHAR Reg
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpWriteCmos(
|
|
|
|
IN UCHAR Reg,
|
|
|
|
IN UCHAR Value
|
|
|
|
);
|
|
|
|
|
2009-10-29 19:58:41 +00:00
|
|
|
//
|
|
|
|
// Spinlock for protecting CMOS access
|
|
|
|
//
|
|
|
|
VOID
|
|
|
|
NTAPI
|
2011-09-07 10:14:48 +00:00
|
|
|
HalpAcquireCmosSpinLock(
|
2009-10-29 19:58:41 +00:00
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpReleaseCmosSpinLock(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2017-12-17 08:51:37 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpInitializeLegacyPICs(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2011-06-24 23:04:13 +00:00
|
|
|
NTSTATUS
|
2010-03-31 20:58:42 +00:00
|
|
|
NTAPI
|
|
|
|
HalpOpenRegistryKey(
|
|
|
|
IN PHANDLE KeyHandle,
|
|
|
|
IN HANDLE RootKey,
|
|
|
|
IN PUNICODE_STRING KeyName,
|
2011-06-24 23:04:13 +00:00
|
|
|
IN ACCESS_MASK DesiredAccess,
|
2010-03-31 20:58:42 +00:00
|
|
|
IN BOOLEAN Create
|
|
|
|
);
|
|
|
|
|
2010-04-01 19:42:07 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpGetNMICrashFlag(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2010-04-01 20:46:55 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
HalpGetDebugPortTable(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpReportSerialNumber(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
HalpMarkAcpiHal(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpBuildAddressMap(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2010-04-01 19:42:07 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpReportResourceUsage(
|
|
|
|
IN PUNICODE_STRING HalName,
|
|
|
|
IN INTERFACE_TYPE InterfaceType
|
|
|
|
);
|
|
|
|
|
2010-04-01 20:46:55 +00:00
|
|
|
ULONG
|
|
|
|
NTAPI
|
|
|
|
HalpIs16BitPortDecodeSupported(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2010-04-02 06:28:43 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
HalpQueryAcpiResourceRequirements(
|
|
|
|
OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requirements
|
|
|
|
);
|
|
|
|
|
2010-01-26 21:41:05 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
KeUpdateSystemTime(
|
|
|
|
IN PKTRAP_FRAME TrapFrame,
|
|
|
|
IN ULONG Increment,
|
|
|
|
IN KIRQL OldIrql
|
|
|
|
);
|
|
|
|
|
[HAL]: Bus support in the HAL actually creates a further wedge between the different x86 HALs: There are actually two dinstinct implementations. On the ACPI HAL, the system is assumed not to have things like special ISA, MCA, EISA buses, and a PCI driver is used in combination with the ACPI Interface for PCI Bus support. On non-ACPI systems, the legacy "Bus Handler" library is used, and the HAL provides a core set of CMOS, EISA, ISA, MCA and PCI bus handlers, each with their own routines and specific code. Additionally, PCI IRQ Routing and other PCI bus internals are handled directly by the HAL -- on the ACPI HAL, the PCI Bus support is implemented through a "Fake"/static bus handler, just to keep the functions shared. On ReactOS, both the ACPI and non-ACPI HAL were currently using a mix of both HAL bus handling types, mostly implemented the "ACPI way" (with a fake PCI bus handler and such).
As a result, none of the Hal*Bus HALDISPATCH routines were implemented, which bus drivers expect to find when they're not on ACPI systems (ReactOS today). eVb's new PCI driver was crashing, for example.
Furthermore, legacy systems suffer, because the ACPI HAL Bus routines (that we currently have) expect perfect ACPI-style-compliant systems, not the legacy crap from the early 90ies. This works fine in VMs and new hardware, but old hardware is left behind.
This patch basically corrects the first part of the problem, by making the bus handling support separate between ACPI and non-ACPI HALs. For now, the code remains 100% the same in functionality between both.
However, I have started adding the first few elements:
[HAL]: Implement HalRegisterBusHandler HALDISPATCH routine.
[HAL]: On legacy HALs, register the CMOS, ISA, SYSTEM handlers.
[HAL]: Add cmosbus.c. Stub all bus-specific bus handler routines in the xxxbus.c files.
No real functionality change occurs with this patch, yet.
svn path=/trunk/; revision=47649
2010-06-07 01:09:41 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpInitBusHandlers(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
2010-09-10 21:46:13 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
HaliInitPnpDriver(
|
|
|
|
VOID
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpDebugPciDumpBus(
|
2010-09-11 09:01:58 +00:00
|
|
|
IN ULONG i,
|
|
|
|
IN ULONG j,
|
|
|
|
IN ULONG k,
|
|
|
|
IN PPCI_COMMON_CONFIG PciData
|
2010-09-10 21:46:13 +00:00
|
|
|
);
|
|
|
|
|
2011-09-07 18:25:43 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
HalpInitProcessor(
|
|
|
|
IN ULONG ProcessorNumber,
|
|
|
|
IN PLOADER_PARAMETER_BLOCK LoaderBlock
|
|
|
|
);
|
|
|
|
|
2008-09-03 00:44:50 +00:00
|
|
|
#ifdef _M_AMD64
|
|
|
|
#define KfLowerIrql KeLowerIrql
|
2011-09-07 18:25:43 +00:00
|
|
|
#define KiEnterInterruptTrap(TrapFrame) /* We do all neccessary in asm code */
|
2011-09-15 10:46:02 +00:00
|
|
|
#define KiEoiHelper(TrapFrame) return /* Just return to the caller */
|
2012-03-28 12:15:54 +00:00
|
|
|
#define HalBeginSystemInterrupt(Irql, Vector, OldIrql) ((*(OldIrql) = PASSIVE_LEVEL), TRUE)
|
2008-09-03 00:44:50 +00:00
|
|
|
#ifndef CONFIG_SMP
|
|
|
|
/* On UP builds, spinlocks don't exist at IRQL >= DISPATCH */
|
|
|
|
#define KiAcquireSpinLock(SpinLock)
|
|
|
|
#define KiReleaseSpinLock(SpinLock)
|
|
|
|
#define KfAcquireSpinLock(SpinLock) KfRaiseIrql(DISPATCH_LEVEL);
|
|
|
|
#define KfReleaseSpinLock(SpinLock, OldIrql) KeLowerIrql(OldIrql);
|
|
|
|
#endif // !CONFIG_SMP
|
|
|
|
#endif // _M_AMD64
|
|
|
|
|
2010-01-01 21:07:22 +00:00
|
|
|
extern BOOLEAN HalpNMIInProgress;
|
|
|
|
|
2009-10-29 19:58:41 +00:00
|
|
|
extern ADDRESS_USAGE HalpDefaultIoSpace;
|
|
|
|
|
2006-11-27 19:26:31 +00:00
|
|
|
extern KSPIN_LOCK HalpSystemHardwareLock;
|
2005-06-18 14:30:09 +00:00
|
|
|
|
2009-10-29 19:58:41 +00:00
|
|
|
extern PADDRESS_USAGE HalpAddressUsageList;
|
|
|
|
|
2010-01-26 21:41:05 +00:00
|
|
|
extern LARGE_INTEGER HalpPerfCounter;
|
2010-04-01 20:46:55 +00:00
|
|
|
|
|
|
|
extern KAFFINITY HalpActiveProcessors;
|
|
|
|
|
|
|
|
extern BOOLEAN HalDisableFirmwareMapper;
|
|
|
|
extern PWCHAR HalHardwareIdString;
|
|
|
|
extern PWCHAR HalName;
|
2010-06-07 20:35:02 +00:00
|
|
|
|
|
|
|
extern KAFFINITY HalpDefaultInterruptAffinity;
|
|
|
|
|
2011-08-24 15:57:18 +00:00
|
|
|
extern IDTUsageFlags HalpIDTUsageFlags[MAXIMUM_IDTVECTOR+1];
|
2010-06-07 20:35:02 +00:00
|
|
|
|
2011-09-10 18:58:01 +00:00
|
|
|
extern const USHORT HalpBuildType;
|