2006-05-10 17:47:44 +00:00
|
|
|
/*++ NDK Version: 0098
|
2005-11-22 04:57:45 +00:00
|
|
|
|
|
|
|
Copyright (c) Alex Ionescu. All rights reserved.
|
|
|
|
|
|
|
|
Header Name:
|
|
|
|
|
|
|
|
haltypes.h
|
|
|
|
|
|
|
|
Abstract:
|
|
|
|
|
|
|
|
Type definitions for the HAL.
|
|
|
|
|
|
|
|
Author:
|
|
|
|
|
2006-05-10 17:47:44 +00:00
|
|
|
Alex Ionescu (alexi@tinykrnl.org) - Updated - 27-Feb-2006
|
2005-11-22 04:57:45 +00:00
|
|
|
|
|
|
|
--*/
|
|
|
|
|
2005-06-18 23:33:40 +00:00
|
|
|
#ifndef _HALTYPES_H
|
|
|
|
#define _HALTYPES_H
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Dependencies
|
|
|
|
//
|
2005-11-25 00:17:40 +00:00
|
|
|
#include <umtypes.h>
|
|
|
|
|
|
|
|
#ifndef NTOS_MODE_USER
|
2005-06-18 23:33:40 +00:00
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// HalShutdownSystem Types
|
|
|
|
//
|
2006-05-10 17:47:44 +00:00
|
|
|
typedef enum _FIRMWARE_REENTRY
|
2005-06-19 03:25:33 +00:00
|
|
|
{
|
2005-06-26 01:08:55 +00:00
|
|
|
HalHaltRoutine,
|
|
|
|
HalPowerDownRoutine,
|
|
|
|
HalRestartRoutine,
|
|
|
|
HalRebootRoutine,
|
|
|
|
HalInteractiveModeRoutine,
|
|
|
|
HalMaximumRoutine
|
2005-06-19 07:41:35 +00:00
|
|
|
} FIRMWARE_REENTRY, *PFIRMWARE_REENTRY;
|
2005-06-18 23:33:40 +00:00
|
|
|
|
2006-05-10 17:47:44 +00:00
|
|
|
//
|
|
|
|
// HAL Private function Types
|
|
|
|
//
|
|
|
|
typedef
|
|
|
|
PBUS_HANDLER
|
2009-10-30 22:07:26 +00:00
|
|
|
(FASTCALL *pHalHandlerForConfigSpace)(
|
2013-01-13 14:49:21 +00:00
|
|
|
_In_ BUS_DATA_TYPE ConfigSpace,
|
|
|
|
_In_ ULONG BusNumber
|
2006-05-10 17:47:44 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
typedef
|
|
|
|
NTSTATUS
|
2006-11-27 19:26:31 +00:00
|
|
|
(NTAPI *PINSTALL_BUS_HANDLER)(
|
2013-01-13 14:49:21 +00:00
|
|
|
_In_ PBUS_HANDLER Bus
|
2006-05-10 17:47:44 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
typedef
|
|
|
|
NTSTATUS
|
2006-11-27 19:26:31 +00:00
|
|
|
(NTAPI *pHalRegisterBusHandler)(
|
2013-01-13 14:49:21 +00:00
|
|
|
_In_ INTERFACE_TYPE InterfaceType,
|
|
|
|
_In_ BUS_DATA_TYPE ConfigSpace,
|
|
|
|
_In_ ULONG BusNumber,
|
|
|
|
_In_ INTERFACE_TYPE ParentInterfaceType,
|
|
|
|
_In_ ULONG ParentBusNumber,
|
|
|
|
_In_ ULONG ContextSize,
|
|
|
|
_In_ PINSTALL_BUS_HANDLER InstallCallback,
|
|
|
|
_Out_ PBUS_HANDLER *BusHandler
|
2006-05-10 17:47:44 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
typedef
|
|
|
|
VOID
|
2006-11-27 19:26:31 +00:00
|
|
|
(NTAPI *pHalSetWakeEnable)(
|
2013-01-13 14:49:21 +00:00
|
|
|
_In_ BOOLEAN Enable
|
2006-05-10 17:47:44 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
typedef
|
|
|
|
VOID
|
2006-11-27 19:26:31 +00:00
|
|
|
(NTAPI *pHalSetWakeAlarm)(
|
2013-01-13 14:49:21 +00:00
|
|
|
_In_ ULONGLONG AlartTime,
|
|
|
|
_In_ PTIME_FIELDS TimeFields
|
2006-05-10 17:47:44 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
typedef
|
|
|
|
VOID
|
2006-11-27 19:26:31 +00:00
|
|
|
(NTAPI *pHalLocateHiberRanges)(
|
2013-01-13 14:49:21 +00:00
|
|
|
_In_ PVOID MemoryMap
|
2006-05-10 17:47:44 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
typedef
|
2011-03-11 13:00:20 +00:00
|
|
|
NTSTATUS
|
2006-11-27 19:26:31 +00:00
|
|
|
(NTAPI *pHalAllocateMapRegisters)(
|
2013-01-13 14:49:21 +00:00
|
|
|
_In_ PADAPTER_OBJECT AdapterObject,
|
|
|
|
_In_ ULONG Unknown,
|
|
|
|
_In_ ULONG Unknown2,
|
2006-05-10 17:47:44 +00:00
|
|
|
PMAP_REGISTER_ENTRY Registers
|
|
|
|
);
|
|
|
|
|
2006-11-27 19:26:31 +00:00
|
|
|
//
|
|
|
|
// HAL Bus Handler Callback Types
|
|
|
|
//
|
|
|
|
typedef
|
|
|
|
NTSTATUS
|
2009-10-30 22:07:26 +00:00
|
|
|
(NTAPI *PADJUSTRESOURCELIST)(
|
2013-01-13 14:49:21 +00:00
|
|
|
_In_ PBUS_HANDLER BusHandler,
|
|
|
|
_In_ PBUS_HANDLER RootHandler,
|
|
|
|
_Inout_ PIO_RESOURCE_REQUIREMENTS_LIST *Resources
|
2006-11-27 19:26:31 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
typedef
|
|
|
|
NTSTATUS
|
2009-10-30 22:07:26 +00:00
|
|
|
(NTAPI *PASSIGNSLOTRESOURCES)(
|
2013-01-13 14:49:21 +00:00
|
|
|
_In_ PBUS_HANDLER BusHandler,
|
|
|
|
_In_ PBUS_HANDLER RootHandler,
|
|
|
|
_In_ PUNICODE_STRING RegistryPath,
|
|
|
|
_In_ PUNICODE_STRING DriverClassName,
|
|
|
|
_In_ PDRIVER_OBJECT DriverObject,
|
|
|
|
_In_ PDEVICE_OBJECT DeviceObject,
|
|
|
|
_In_ ULONG SlotNumber,
|
|
|
|
_Inout_ PCM_RESOURCE_LIST *AllocatedResources
|
2006-11-27 19:26:31 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
typedef
|
|
|
|
ULONG
|
2009-10-30 22:07:26 +00:00
|
|
|
(NTAPI *PGETSETBUSDATA)(
|
2013-01-13 14:49:21 +00:00
|
|
|
_In_ PBUS_HANDLER BusHandler,
|
|
|
|
_In_ PBUS_HANDLER RootHandler,
|
|
|
|
_In_ ULONG SlotNumber,
|
|
|
|
_Out_ PVOID Buffer,
|
|
|
|
_In_ ULONG Offset,
|
|
|
|
_In_ ULONG Length
|
2006-11-27 19:26:31 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
typedef
|
|
|
|
ULONG
|
2009-10-30 22:07:26 +00:00
|
|
|
(NTAPI *PGETINTERRUPTVECTOR)(
|
2013-01-13 14:49:21 +00:00
|
|
|
_In_ PBUS_HANDLER BusHandler,
|
|
|
|
_In_ PBUS_HANDLER RootHandler,
|
|
|
|
_In_ ULONG BusInterruptLevel,
|
|
|
|
_In_ ULONG BusInterruptVector,
|
|
|
|
_Out_ PKIRQL Irql,
|
|
|
|
_Out_ PKAFFINITY Affinity
|
2006-11-27 19:26:31 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
typedef
|
2009-10-30 22:07:26 +00:00
|
|
|
BOOLEAN
|
|
|
|
(NTAPI *PTRANSLATEBUSADDRESS)(
|
2013-01-13 14:49:21 +00:00
|
|
|
_In_ PBUS_HANDLER BusHandler,
|
|
|
|
_In_ PBUS_HANDLER RootHandler,
|
|
|
|
_In_ PHYSICAL_ADDRESS BusAddress,
|
|
|
|
_Inout_ PULONG AddressSpace,
|
|
|
|
_Out_ PPHYSICAL_ADDRESS TranslatedAddress
|
2006-11-27 19:26:31 +00:00
|
|
|
);
|
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
|
|
|
// Hal Private dispatch Table
|
|
|
|
//
|
2005-12-04 03:24:11 +00:00
|
|
|
#define HAL_PRIVATE_DISPATCH_VERSION 2
|
2005-06-23 03:18:20 +00:00
|
|
|
typedef struct _HAL_PRIVATE_DISPATCH
|
|
|
|
{
|
|
|
|
ULONG Version;
|
2006-05-10 17:47:44 +00:00
|
|
|
pHalHandlerForBus HalHandlerForBus;
|
|
|
|
pHalHandlerForConfigSpace HalHandlerForConfigSpace;
|
|
|
|
pHalLocateHiberRanges HalLocateHiberRanges;
|
|
|
|
pHalRegisterBusHandler HalRegisterBusHandler;
|
|
|
|
pHalSetWakeEnable HalSetWakeEnable;
|
|
|
|
pHalSetWakeAlarm HalSetWakeAlarm;
|
|
|
|
pHalTranslateBusAddress HalPciTranslateBusAddress;
|
|
|
|
pHalAssignSlotResources HalPciAssignSlotResources;
|
|
|
|
pHalHaltSystem HalHaltSystem;
|
|
|
|
pHalFindBusAddressTranslation HalFindBusAddressTranslation;
|
|
|
|
pHalResetDisplay HalResetDisplay;
|
|
|
|
pHalAllocateMapRegisters HalAllocateMapRegisters;
|
|
|
|
pKdSetupPciDeviceForDebugging KdSetupPciDeviceForDebugging;
|
|
|
|
pKdReleasePciDeviceForDebugging KdReleasePciDeviceforDebugging;
|
|
|
|
pKdGetAcpiTablePhase0 KdGetAcpiTablePhase0;
|
|
|
|
pKdCheckPowerButton KdCheckPowerButton;
|
|
|
|
pHalVectorToIDTEntry HalVectorToIDTEntry;
|
|
|
|
pKdMapPhysicalMemory64 KdMapPhysicalMemory64;
|
|
|
|
pKdUnmapVirtualAddress KdUnmapVirtualAddress;
|
|
|
|
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
|
|
|
pKdGetPciDataByOffset KdGetPciDataByOffset;
|
|
|
|
pKdSetPciDataByOffset KdSetPciDataByOffset;
|
|
|
|
PVOID HalGetInterruptVectorOverride;
|
|
|
|
PVOID HalGetVectorInputOverride;
|
|
|
|
#endif
|
2005-06-23 03:18:20 +00:00
|
|
|
} HAL_PRIVATE_DISPATCH, *PHAL_PRIVATE_DISPATCH;
|
|
|
|
|
2009-10-30 22:07:26 +00:00
|
|
|
//
|
|
|
|
// HAL Supported Range
|
|
|
|
//
|
|
|
|
#define HAL_SUPPORTED_RANGE_VERSION 1
|
|
|
|
typedef struct _SUPPORTED_RANGE
|
|
|
|
{
|
|
|
|
struct _SUPPORTED_RANGE *Next;
|
|
|
|
ULONG SystemAddressSpace;
|
|
|
|
LONGLONG SystemBase;
|
|
|
|
LONGLONG Base;
|
|
|
|
LONGLONG Limit;
|
|
|
|
} SUPPORTED_RANGE, *PSUPPORTED_RANGE;
|
|
|
|
|
2013-01-13 14:49:21 +00:00
|
|
|
typedef struct _SUPPORTED_RANGES
|
2009-10-30 22:07:26 +00:00
|
|
|
{
|
|
|
|
USHORT Version;
|
|
|
|
BOOLEAN Sorted;
|
|
|
|
UCHAR Reserved;
|
|
|
|
ULONG NoIO;
|
|
|
|
SUPPORTED_RANGE IO;
|
|
|
|
ULONG NoMemory;
|
|
|
|
SUPPORTED_RANGE Memory;
|
|
|
|
ULONG NoPrefetchMemory;
|
|
|
|
SUPPORTED_RANGE PrefetchMemory;
|
|
|
|
ULONG NoDma;
|
|
|
|
SUPPORTED_RANGE Dma;
|
|
|
|
} SUPPORTED_RANGES, *PSUPPORTED_RANGES;
|
|
|
|
|
2006-11-27 19:26:31 +00:00
|
|
|
//
|
|
|
|
// HAL Bus Handler
|
|
|
|
//
|
2009-10-30 22:07:26 +00:00
|
|
|
#define HAL_BUS_HANDLER_VERSION 1
|
2006-11-27 19:26:31 +00:00
|
|
|
typedef struct _BUS_HANDLER
|
|
|
|
{
|
|
|
|
ULONG Version;
|
|
|
|
INTERFACE_TYPE InterfaceType;
|
|
|
|
BUS_DATA_TYPE ConfigurationType;
|
|
|
|
ULONG BusNumber;
|
|
|
|
PDEVICE_OBJECT DeviceObject;
|
|
|
|
struct _BUS_HANDLER *ParentHandler;
|
|
|
|
PVOID BusData;
|
|
|
|
ULONG DeviceControlExtensionSize;
|
2009-10-30 22:07:26 +00:00
|
|
|
PSUPPORTED_RANGES BusAddresses;
|
2006-11-27 19:26:31 +00:00
|
|
|
ULONG Reserved[4];
|
2009-10-30 22:07:26 +00:00
|
|
|
PGETSETBUSDATA GetBusData;
|
|
|
|
PGETSETBUSDATA SetBusData;
|
|
|
|
PADJUSTRESOURCELIST AdjustResourceList;
|
|
|
|
PASSIGNSLOTRESOURCES AssignSlotResources;
|
|
|
|
PGETINTERRUPTVECTOR GetInterruptVector;
|
|
|
|
PTRANSLATEBUSADDRESS TranslateBusAddress;
|
|
|
|
PVOID Spare1;
|
|
|
|
PVOID Spare2;
|
|
|
|
PVOID Spare3;
|
|
|
|
PVOID Spare4;
|
|
|
|
PVOID Spare5;
|
|
|
|
PVOID Spare6;
|
|
|
|
PVOID Spare7;
|
|
|
|
PVOID Spare8;
|
2006-11-27 19:26:31 +00:00
|
|
|
} BUS_HANDLER;
|
|
|
|
|
2009-10-30 22:07:26 +00:00
|
|
|
//
|
|
|
|
// HAL Chip Hacks
|
|
|
|
//
|
2009-11-09 22:59:49 +00:00
|
|
|
#define HAL_PCI_CHIP_HACK_BROKEN_ACPI_TIMER 0x01
|
|
|
|
#define HAL_PCI_CHIP_HACK_DISABLE_HIBERNATE 0x02
|
|
|
|
#define HAL_PCI_CHIP_HACK_DISABLE_ACPI_IRQ_ROUTING 0x04
|
|
|
|
#define HAL_PCI_CHIP_HACK_USB_SMI_DISABLE 0x08
|
2009-10-30 22:07:26 +00:00
|
|
|
|
2005-11-27 20:18:33 +00:00
|
|
|
//
|
2006-05-10 17:47:44 +00:00
|
|
|
// Kernel Exports
|
2005-11-27 20:18:33 +00:00
|
|
|
//
|
2012-02-26 19:04:00 +00:00
|
|
|
#if (defined(_NTDRIVER_) || defined(_NTHAL_)) && !defined(_BLDR_)
|
2006-11-27 19:26:31 +00:00
|
|
|
extern NTSYSAPI PHAL_PRIVATE_DISPATCH HalPrivateDispatchTable;
|
|
|
|
#define HALPRIVATEDISPATCH ((PHAL_PRIVATE_DISPATCH)&HalPrivateDispatchTable)
|
2005-11-27 20:18:33 +00:00
|
|
|
#else
|
2006-11-27 19:26:31 +00:00
|
|
|
extern NTSYSAPI HAL_PRIVATE_DISPATCH HalPrivateDispatchTable;
|
|
|
|
#define HALPRIVATEDISPATCH (&HalPrivateDispatchTable)
|
2005-11-27 20:18:33 +00:00
|
|
|
#endif
|
2005-06-18 23:33:40 +00:00
|
|
|
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
2006-05-10 17:47:44 +00:00
|
|
|
// HAL Exports
|
2005-11-22 04:57:45 +00:00
|
|
|
//
|
2009-01-19 23:22:22 +00:00
|
|
|
extern PUCHAR NTHALAPI KdComPortInUse;
|
2005-11-22 04:57:45 +00:00
|
|
|
|
2011-03-15 19:45:43 +00:00
|
|
|
//
|
|
|
|
// HAL Constants
|
|
|
|
//
|
|
|
|
#define HAL_IRQ_TRANSLATOR_VERSION 0x0
|
|
|
|
|
2005-06-18 23:33:40 +00:00
|
|
|
#endif
|
2005-11-25 00:17:40 +00:00
|
|
|
#endif
|
2005-06-18 23:33:40 +00:00
|
|
|
|
2006-11-27 19:26:31 +00:00
|
|
|
|
2007-08-04 08:26:58 +00:00
|
|
|
|