00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
#ifndef _HAL_
00024
#define _HAL_
00025
00026
00027
00028
00029
00030 #define OEM_FONT_VERSION 0x200
00031 #define OEM_FONT_TYPE 0
00032 #define OEM_FONT_ITALIC 0
00033 #define OEM_FONT_UNDERLINE 0
00034 #define OEM_FONT_STRIKEOUT 0
00035 #define OEM_FONT_CHARACTER_SET 255
00036 #define OEM_FONT_FAMILY (3 << 4)
00037
00038
00039
00040
00041
00042
00043
00044
#include "pshpack1.h"
00045 typedef struct _OEM_FONT_FILE_HEADER {
00046 USHORT Version;
00047 ULONG
FileSize;
00048 UCHAR
Copyright[60];
00049 USHORT Type;
00050 USHORT Points;
00051 USHORT VerticleResolution;
00052 USHORT HorizontalResolution;
00053 USHORT Ascent;
00054 USHORT InternalLeading;
00055 USHORT ExternalLeading;
00056 UCHAR
Italic;
00057 UCHAR
Underline;
00058 UCHAR
StrikeOut;
00059 USHORT Weight;
00060 UCHAR
CharacterSet;
00061 USHORT PixelWidth;
00062 USHORT PixelHeight;
00063 UCHAR
Family;
00064 USHORT AverageWidth;
00065 USHORT MaximumWidth;
00066 UCHAR
FirstCharacter;
00067 UCHAR
LastCharacter;
00068 UCHAR
DefaultCharacter;
00069 UCHAR
BreakCharacter;
00070 USHORT WidthInBytes;
00071 ULONG
Device;
00072 ULONG
Face;
00073 ULONG
BitsPointer;
00074 ULONG
BitsOffset;
00075 UCHAR
Filler;
00076
struct {
00077 USHORT Width;
00078 USHORT Offset;
00079 } Map[1];
00080 }
OEM_FONT_FILE_HEADER, *
POEM_FONT_FILE_HEADER;
00081
#include "poppack.h"
00082
00083
00084
00085
00086
00087
00088
00089 typedef struct _DEVICE_DESCRIPTION {
00090 ULONG
Version;
00091 BOOLEAN
Master;
00092 BOOLEAN
ScatterGather;
00093 BOOLEAN
DemandMode;
00094 BOOLEAN
AutoInitialize;
00095 BOOLEAN
Dma32BitAddresses;
00096 BOOLEAN
IgnoreCount;
00097 BOOLEAN
Reserved1;
00098 BOOLEAN
Dma64BitAddresses;
00099 ULONG
BusNumber;
00100 ULONG
DmaChannel;
00101 INTERFACE_TYPE
InterfaceType;
00102 DMA_WIDTH
DmaWidth;
00103 DMA_SPEED
DmaSpeed;
00104 ULONG
MaximumLength;
00105 ULONG
DmaPort;
00106 }
DEVICE_DESCRIPTION, *
PDEVICE_DESCRIPTION;
00107
00108
00109
00110
00111
00112 #define DEVICE_DESCRIPTION_VERSION 0
00113 #define DEVICE_DESCRIPTION_VERSION1 1
00114
00115
00116
00117
00118
00119
00120
00121 typedef struct _PARTITION_DESCRIPTOR {
00122 UCHAR
ActiveFlag;
00123 UCHAR
StartingTrack;
00124 UCHAR
StartingCylinderLsb;
00125 UCHAR
StartingCylinderMsb;
00126 UCHAR
PartitionType;
00127 UCHAR
EndingTrack;
00128 UCHAR
EndingCylinderLsb;
00129 UCHAR
EndingCylinderMsb;
00130 UCHAR
StartingSectorLsb0;
00131 UCHAR
StartingSectorLsb1;
00132 UCHAR
StartingSectorMsb0;
00133 UCHAR
StartingSectorMsb1;
00134 UCHAR
PartitionLengthLsb0;
00135 UCHAR
PartitionLengthLsb1;
00136 UCHAR
PartitionLengthMsb0;
00137 UCHAR
PartitionLengthMsb1;
00138 }
PARTITION_DESCRIPTOR, *
PPARTITION_DESCRIPTOR;
00139
00140
00141
00142
00143
00144 #define NUM_PARTITION_TABLE_ENTRIES 4
00145
00146
00147
00148
00149
00150 #define PARTITION_TABLE_OFFSET (0x1be / 2)
00151 #define BOOT_SIGNATURE_OFFSET ((0x200 / 2) - 1)
00152
00153
00154
00155
00156
00157 #define BOOT_RECORD_SIGNATURE (0xaa55)
00158
00159
00160
00161
00162
00163 #define PARTITION_BUFFER_SIZE 2048
00164
00165
00166
00167
00168
00169 #define PARTITION_ACTIVE_FLAG 0x80
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
typedef
00180 BOOLEAN
00181 (*PHAL_RESET_DISPLAY_PARAMETERS) (
00182 IN ULONG Columns,
00183 IN ULONG Rows
00184 );
00185
00186
NTHALAPI
00187
VOID
00188
HalAcquireDisplayOwnership (
00189 IN
PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters
00190 );
00191
00192
00193
00194
NTHALAPI
00195
VOID
00196
HalDisplayString (
00197 PUCHAR String
00198 );
00199
00200
NTHALAPI
00201
VOID
00202
HalQueryDisplayParameters (
00203 OUT PULONG WidthInCharacters,
00204 OUT PULONG HeightInLines,
00205 OUT PULONG CursorColumn,
00206 OUT PULONG CursorRow
00207 );
00208
00209
NTHALAPI
00210
VOID
00211
HalSetDisplayParameters (
00212 IN ULONG CursorColumn,
00213 IN ULONG CursorRow
00214 );
00215
00216
NTHALAPI
00217 BOOLEAN
00218
HalInitSystem (
00219 IN ULONG Phase,
00220 IN
PLOADER_PARAMETER_BLOCK LoaderBlock
00221 );
00222
00223
NTHALAPI
00224
VOID
00225
HalProcessorIdle(
00226 VOID
00227 );
00228
00229
NTHALAPI
00230
VOID
00231
HalReportResourceUsage (
00232 VOID
00233 );
00234
00235
NTHALAPI
00236 ULONG
00237
HalSetTimeIncrement (
00238 IN ULONG DesiredIncrement
00239 );
00240
00241
00242
00243
00244
00245
NTHALAPI
00246
ARC_STATUS
00247
HalGetEnvironmentVariable (
00248 IN PCHAR Variable,
00249 IN USHORT Length,
00250 OUT PCHAR Buffer
00251 );
00252
00253
NTHALAPI
00254
ARC_STATUS
00255
HalSetEnvironmentVariable (
00256 IN PCHAR Variable,
00257 IN PCHAR Value
00258 );
00259
00260
00261
00262
00263
00264
00265
#if defined(_ALPHA_) || defined(_IA64_) // ntddk ntifs ntndis
00266
00267
00268
NTHALAPI
00269
VOID
00270 HalChangeColorPage (
00271 IN PVOID NewColor,
00272 IN PVOID OldColor,
00273 IN ULONG PageFrame
00274 );
00275
00276
NTHALAPI
00277
VOID
00278 HalFlushDcachePage (
00279 IN PVOID Color,
00280 IN ULONG PageFrame,
00281 IN ULONG Length
00282 );
00283
00284
NTHALAPI
00285
VOID
00286 HalFlushIoBuffers (
00287 IN
PMDL Mdl,
00288 IN BOOLEAN ReadOperation,
00289 IN BOOLEAN DmaOperation
00290 );
00291
00292
NTHALAPI
00293 ULONG
00294 HalGetDmaAlignmentRequirement (
00295 VOID
00296 );
00297
00298
NTHALAPI
00299
VOID
00300 HalPurgeDcachePage (
00301 IN PVOID Color,
00302 IN ULONG PageFrame,
00303 IN ULONG Length
00304 );
00305
00306
NTHALAPI
00307
VOID
00308 HalPurgeIcachePage (
00309 IN PVOID Color,
00310 IN ULONG PageFrame,
00311 IN ULONG Length
00312 );
00313
00314
NTHALAPI
00315
VOID
00316 HalSweepDcache (
00317 VOID
00318 );
00319
00320
NTHALAPI
00321
VOID
00322 HalSweepDcacheRange (
00323 IN PVOID BaseAddress,
00324 IN ULONG Length
00325 );
00326
00327
NTHALAPI
00328
VOID
00329 HalSweepIcache (
00330 VOID
00331 );
00332
00333
NTHALAPI
00334
VOID
00335 HalSweepIcacheRange (
00336 IN PVOID BaseAddress,
00337 IN ULONG Length
00338 );
00339
00340
00341
NTHALAPI
00342
VOID
00343 HalZeroPage (
00344 IN PVOID NewColor,
00345 IN PVOID OldColor,
00346 IN PFN_NUMBER PageFrame
00347 );
00348
00349
#endif // ntddk ntifs ntndis
00350
00351
#if defined(_M_IX86) // ntddk ntifs ntndis
00352
00353
#define HalGetDmaAlignmentRequirement() 1L // ntddk ntifs ntndis
00354
00355
NTHALAPI
00356
VOID
00357 HalHandleNMI (
00358 IN OUT PVOID NmiInformation
00359 );
00360
00361
#endif // ntddk ntifs ntndis
00362
00363
00364
#if defined(_M_IA64)
00365
00366
NTHALAPI
00367
VOID
00368 HalSweepCacheRange (
00369 IN PVOID BaseAddress,
00370 IN ULONG Length
00371 );
00372
00373
00374
NTHALAPI
00375 LONGLONG
00376 HalCallPal (
00377 IN ULONGLONG FunctionIndex,
00378 IN ULONGLONG Arguement1,
00379 IN ULONGLONG Arguement2,
00380 IN ULONGLONG Arguement3,
00381 OUT PULONGLONG ReturnValue0,
00382 OUT PULONGLONG ReturnValue1,
00383 OUT PULONGLONG ReturnValue2,
00384 OUT PULONGLONG ReturnValue3
00385 );
00386
00387
#endif
00388
00389
NTHALAPI
00390
VOID
00391
KeFlushWriteBuffer (
00392 VOID
00393 );
00394
00395
00396
#if defined(_ALPHA_)
00397
00398
NTHALAPI
00399 PVOID
00400 HalCreateQva(
00401 IN PHYSICAL_ADDRESS PhysicalAddress,
00402 IN PVOID VirtualAddress
00403 );
00404
00405
NTHALAPI
00406 PVOID
00407 HalDereferenceQva(
00408 PVOID Qva,
00409 INTERFACE_TYPE InterfaceType,
00410 ULONG BusNumber
00411 );
00412
00413
#endif
00414
00415
#if !defined(_X86_)
00416
00417
NTHALAPI
00418 BOOLEAN
00419
HalCallBios (
00420 IN ULONG BiosCommand,
00421 IN OUT PULONG Eax,
00422 IN OUT PULONG Ebx,
00423 IN OUT PULONG Ecx,
00424 IN OUT PULONG Edx,
00425 IN OUT PULONG Esi,
00426 IN OUT PULONG Edi,
00427 IN OUT PULONG Ebp
00428 );
00429
00430
#endif
00431
00432
00433
00434
00435
00436
NTHALAPI
00437
VOID
00438
HalCalibratePerformanceCounter (
00439 IN
volatile PLONG Number,
00440 IN ULONGLONG NewCount
00441 );
00442
00443
NTHALAPI
00444 ULONG_PTR
00445
HalSetProfileInterval (
00446 IN ULONG_PTR Interval
00447 );
00448
00449
00450
NTHALAPI
00451
VOID
00452
HalStartProfileInterrupt (
00453 KPROFILE_SOURCE ProfileSource
00454 );
00455
00456
NTHALAPI
00457
VOID
00458
HalStopProfileInterrupt (
00459 KPROFILE_SOURCE ProfileSource
00460 );
00461
00462
00463
00464
00465
00466
NTHALAPI
00467 BOOLEAN
00468
HalQueryRealTimeClock (
00469 OUT PTIME_FIELDS TimeFields
00470 );
00471
00472
NTHALAPI
00473 BOOLEAN
00474
HalSetRealTimeClock (
00475 IN PTIME_FIELDS TimeFields
00476 );
00477
00478
#if defined(_M_IX86)
00479
00480
NTHALAPI
00481
VOID
00482
FASTCALL
00483 HalRequestSoftwareInterrupt (
00484 KIRQL RequestIrql
00485 );
00486
00487 ULONG
00488
FASTCALL
00489 HalSystemVectorDispatchEntry (
00490 IN ULONG Vector,
00491 OUT PKINTERRUPT_ROUTINE **FlatDispatch,
00492 OUT PKINTERRUPT_ROUTINE *NoConnection
00493 );
00494
00495
#endif
00496
00497
00498
00499
00500
00501
NTHALAPI
00502
VOID
00503
HalReturnToFirmware (
00504 IN FIRMWARE_REENTRY Routine
00505 );
00506
00507
00508
00509
00510
00511
NTHALAPI
00512
VOID
00513
HalDisableSystemInterrupt (
00514 IN ULONG Vector,
00515 IN KIRQL Irql
00516 );
00517
00518
NTHALAPI
00519 BOOLEAN
00520
HalEnableSystemInterrupt (
00521 IN ULONG Vector,
00522 IN KIRQL Irql,
00523 IN
KINTERRUPT_MODE InterruptMode
00524 );
00525
00526
00527
00528
00529
00530
#if !defined(NO_LEGACY_DRIVERS)
00531
NTHALAPI
00532
NTSTATUS
00533
HalAssignSlotResources (
00534 IN PUNICODE_STRING RegistryPath,
00535 IN PUNICODE_STRING DriverClassName OPTIONAL,
00536 IN
PDRIVER_OBJECT DriverObject,
00537 IN
PDEVICE_OBJECT DeviceObject,
00538 IN INTERFACE_TYPE BusType,
00539 IN ULONG BusNumber,
00540 IN ULONG SlotNumber,
00541 IN OUT PCM_RESOURCE_LIST *AllocatedResources
00542 );
00543
00544
NTHALAPI
00545 ULONG
00546
HalGetInterruptVector(
00547 IN INTERFACE_TYPE InterfaceType,
00548 IN ULONG BusNumber,
00549 IN ULONG BusInterruptLevel,
00550 IN ULONG BusInterruptVector,
00551 OUT PKIRQL Irql,
00552 OUT PKAFFINITY Affinity
00553 );
00554
00555
NTHALAPI
00556 ULONG
00557
HalSetBusData(
00558 IN BUS_DATA_TYPE BusDataType,
00559 IN ULONG BusNumber,
00560 IN ULONG SlotNumber,
00561 IN PVOID Buffer,
00562 IN ULONG Length
00563 );
00564
#endif // NO_LEGACY_DRIVERS
00565
00566
NTHALAPI
00567 ULONG
00568
HalSetBusDataByOffset(
00569 IN BUS_DATA_TYPE BusDataType,
00570 IN ULONG BusNumber,
00571 IN ULONG SlotNumber,
00572 IN PVOID Buffer,
00573 IN ULONG Offset,
00574 IN ULONG Length
00575 );
00576
00577
NTHALAPI
00578 BOOLEAN
00579
HalTranslateBusAddress(
00580 IN INTERFACE_TYPE InterfaceType,
00581 IN ULONG BusNumber,
00582 IN PHYSICAL_ADDRESS BusAddress,
00583 IN OUT PULONG AddressSpace,
00584 OUT PPHYSICAL_ADDRESS TranslatedAddress
00585 );
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
NTHALAPI
00604 PVOID
00605
HalAllocateCrashDumpRegisters(
00606 IN
PADAPTER_OBJECT AdapterObject,
00607 IN OUT PULONG NumberOfMapRegisters
00608 );
00609
00610
#if !defined(NO_LEGACY_DRIVERS)
00611
NTHALAPI
00612 ULONG
00613
HalGetBusData(
00614 IN BUS_DATA_TYPE BusDataType,
00615 IN ULONG BusNumber,
00616 IN ULONG SlotNumber,
00617 IN PVOID Buffer,
00618 IN ULONG Length
00619 );
00620
#endif // NO_LEGACY_DRIVERS
00621
00622
NTHALAPI
00623 ULONG
00624
HalGetBusDataByOffset(
00625 IN BUS_DATA_TYPE BusDataType,
00626 IN ULONG BusNumber,
00627 IN ULONG SlotNumber,
00628 IN PVOID Buffer,
00629 IN ULONG Offset,
00630 IN ULONG Length
00631 );
00632
00633
NTHALAPI
00634
PADAPTER_OBJECT
00635
HalGetAdapter(
00636 IN PDEVICE_DESCRIPTION DeviceDescription,
00637 IN OUT PULONG NumberOfMapRegisters
00638 );
00639
00640
00641
00642
#if !defined(NO_LEGACY_DRIVERS)
00643
NTHALAPI
00644
NTSTATUS
00645
HalAdjustResourceList (
00646 IN OUT PIO_RESOURCE_REQUIREMENTS_LIST *pResourceList
00647 );
00648
#endif // NO_LEGACY_DRIVERS
00649
00650
00651
00652
00653
00654
#if !defined(NO_LEGACY_DRIVERS)
00655
NTHALAPI
00656 BOOLEAN
00657
HalMakeBeep(
00658 IN ULONG Frequency
00659 );
00660
#endif // NO_LEGACY_DRIVERS
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
#if defined(NO_LEGACY_DRIVERS)
00671
NTKERNELAPI
00672
VOID
00673
IoAssignDriveLetters(
00674
PLOADER_PARAMETER_BLOCK LoaderBlock,
00675 PSTRING NtDeviceName,
00676 OUT PUCHAR NtSystemPath,
00677 OUT PSTRING NtSystemPathString
00678 );
00679
00680
#else
00681
NTHALAPI
00682
VOID
00683
IoAssignDriveLetters(
00684
PLOADER_PARAMETER_BLOCK LoaderBlock,
00685 PSTRING NtDeviceName,
00686 OUT PUCHAR NtSystemPath,
00687 OUT PSTRING NtSystemPathString
00688 );
00689
#endif // NO_LEGACY_DRIVERS
00690
00691
00692
00693
00694
#if defined(NO_LEGACY_DRIVERS)
00695
NTKERNELAPI
00696
NTSTATUS
00697
IoReadPartitionTable(
00698 IN
PDEVICE_OBJECT DeviceObject,
00699 IN ULONG SectorSize,
00700 IN BOOLEAN ReturnRecognizedPartitions,
00701 OUT
struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer
00702 );
00703
00704
NTKERNELAPI
00705
NTSTATUS
00706
IoSetPartitionInformation(
00707 IN
PDEVICE_OBJECT DeviceObject,
00708 IN ULONG SectorSize,
00709 IN ULONG PartitionNumber,
00710 IN ULONG PartitionType
00711 );
00712
00713
NTKERNELAPI
00714
NTSTATUS
00715
IoWritePartitionTable(
00716 IN
PDEVICE_OBJECT DeviceObject,
00717 IN ULONG SectorSize,
00718 IN ULONG SectorsPerTrack,
00719 IN ULONG NumberOfHeads,
00720 IN
struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer
00721 );
00722
00723
#else
00724
NTHALAPI
00725
NTSTATUS
00726
IoReadPartitionTable(
00727 IN
PDEVICE_OBJECT DeviceObject,
00728 IN ULONG SectorSize,
00729 IN BOOLEAN ReturnRecognizedPartitions,
00730 OUT
struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer
00731 );
00732
00733
NTHALAPI
00734
NTSTATUS
00735
IoSetPartitionInformation(
00736 IN
PDEVICE_OBJECT DeviceObject,
00737 IN ULONG SectorSize,
00738 IN ULONG PartitionNumber,
00739 IN ULONG PartitionType
00740 );
00741
00742
NTHALAPI
00743
NTSTATUS
00744
IoWritePartitionTable(
00745 IN
PDEVICE_OBJECT DeviceObject,
00746 IN ULONG SectorSize,
00747 IN ULONG SectorsPerTrack,
00748 IN ULONG NumberOfHeads,
00749 IN
struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer
00750 );
00751
#endif // NO_LEGACY_DRIVERS
00752
00753
00754
00755
00756
00757
00758
00759
NTHALAPI
00760 BOOLEAN
00761
HalAllProcessorsStarted (
00762 VOID
00763 );
00764
00765
NTHALAPI
00766
VOID
00767
HalInitializeProcessor (
00768 IN ULONG Number,
00769 IN
PLOADER_PARAMETER_BLOCK LoaderBlock
00770 );
00771
00772
NTHALAPI
00773 BOOLEAN
00774
HalStartNextProcessor (
00775 IN
PLOADER_PARAMETER_BLOCK LoaderBlock,
00776 IN PKPROCESSOR_STATE ProcessorState
00777 );
00778
00779
NTHALAPI
00780
VOID
00781
HalRequestIpi (
00782 IN ULONG Mask
00783 );
00784
00785
00786
00787
00788
00789
00790
00791
NTHALAPI
00792 BOOLEAN
00793
KdPortInitialize (
00794
PDEBUG_PARAMETERS DebugParameters,
00795
PLOADER_PARAMETER_BLOCK LoaderBlock,
00796 BOOLEAN Initialize
00797 );
00798
00799
NTHALAPI
00800 ULONG
00801
KdPortGetByte (
00802 OUT PUCHAR Input
00803 );
00804
00805
NTHALAPI
00806 ULONG
00807
KdPortPollByte (
00808 OUT PUCHAR Input
00809 );
00810
00811
NTHALAPI
00812
VOID
00813
KdPortPutByte (
00814 IN UCHAR Output
00815 );
00816
00817
NTHALAPI
00818
VOID
00819
KdPortRestore (
00820 VOID
00821 );
00822
00823
NTHALAPI
00824
VOID
00825
KdPortSave (
00826 VOID
00827 );
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
NTHALAPI
00838 LARGE_INTEGER
00839
KeQueryPerformanceCounter (
00840 IN PLARGE_INTEGER PerformanceFrequency OPTIONAL
00841 );
00842
00843
00844
00845
00846
00847
00848
NTHALAPI
00849
VOID
00850
KeStallExecutionProcessor (
00851 IN ULONG MicroSeconds
00852 );
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
typedef
00868
VOID
00869 (*PDEVICE_CONTROL_COMPLETION)(
00870 IN
struct _DEVICE_CONTROL_CONTEXT *ControlContext
00871 );
00872
00873 typedef struct _DEVICE_CONTROL_CONTEXT {
00874 NTSTATUS Status;
00875 PDEVICE_HANDLER_OBJECT DeviceHandler;
00876 PDEVICE_OBJECT DeviceObject;
00877 ULONG
ControlCode;
00878 PVOID
Buffer;
00879 PULONG
BufferLength;
00880 PVOID
Context;
00881 }
DEVICE_CONTROL_CONTEXT, *
PDEVICE_CONTROL_CONTEXT;
00882
00883
00884
00885 typedef struct _HAL_DEVICE_CONTROL {
00886
00887
00888
00889 struct _BUS_HANDLER *
Handler;
00890 struct _BUS_HANDLER *
RootHandler;
00891
00892
00893
00894
00895 PVOID
BusExtensionData;
00896
00897
00898
00899
00900 ULONG
HalReserved[4];
00901
00902
00903
00904
00905 ULONG
BusExtenderReserved[4];
00906
00907
00908
00909
00910 PDEVICE_CONTROL_COMPLETION CompletionRoutine;
00911 DEVICE_CONTROL_CONTEXT DeviceControl;
00912
00913 }
HAL_DEVICE_CONTROL_CONTEXT, *
PHAL_DEVICE_CONTROL_CONTEXT;
00914
00915
00916
typedef
00917 ULONG
00918 (*PGETSETBUSDATA)(
00919 IN
struct _BUS_HANDLER *BusHandler,
00920 IN
struct _BUS_HANDLER *RootHandler,
00921 IN ULONG SlotNumber,
00922 IN PVOID
Buffer,
00923 IN ULONG
Offset,
00924 IN ULONG Length
00925 );
00926
00927
typedef
00928 ULONG
00929 (*PGETINTERRUPTVECTOR)(
00930 IN
struct _BUS_HANDLER *BusHandler,
00931 IN
struct _BUS_HANDLER *RootHandler,
00932 IN ULONG BusInterruptLevel,
00933 IN ULONG BusInterruptVector,
00934 OUT PKIRQL Irql,
00935 OUT PKAFFINITY Affinity
00936 );
00937
00938
typedef
00939 BOOLEAN
00940 (*PTRANSLATEBUSADDRESS)(
00941 IN
struct _BUS_HANDLER *BusHandler,
00942 IN
struct _BUS_HANDLER *RootHandler,
00943 IN PHYSICAL_ADDRESS BusAddress,
00944 IN OUT PULONG AddressSpace,
00945 OUT PPHYSICAL_ADDRESS TranslatedAddress
00946 );
00947
00948
typedef NTSTATUS
00949 (*PADJUSTRESOURCELIST)(
00950 IN
struct _BUS_HANDLER *BusHandler,
00951 IN
struct _BUS_HANDLER *RootHandler,
00952 IN OUT PIO_RESOURCE_REQUIREMENTS_LIST *pResourceList
00953 );
00954
00955
typedef PDEVICE_HANDLER_OBJECT
00956 (*PREFERENCE_DEVICE_HANDLER)(
00957 IN
struct _BUS_HANDLER *BusHandler,
00958 IN
struct _BUS_HANDLER *RootHandler,
00959 IN ULONG SlotNumber
00960 );
00961
00962
00963
00964
00965
00966
00967
typedef NTSTATUS
00968 (*PASSIGNSLOTRESOURCES)(
00969 IN
struct _BUS_HANDLER *BusHandler,
00970 IN
struct _BUS_HANDLER *RootHandler,
00971 IN PUNICODE_STRING RegistryPath,
00972 IN PUNICODE_STRING DriverClassName OPTIONAL,
00973 IN
PDRIVER_OBJECT DriverObject,
00974 IN
PDEVICE_OBJECT DeviceObject OPTIONAL,
00975 IN ULONG SlotNumber,
00976 IN OUT PCM_RESOURCE_LIST *AllocatedResources
00977 );
00978
00979
typedef
00980
NTSTATUS
00981 (*PQUERY_BUS_SLOTS)(
00982 IN
struct _BUS_HANDLER *BusHandler,
00983 IN
struct _BUS_HANDLER *RootHandler,
00984 IN ULONG
BufferSize,
00985 OUT PULONG SlotNumbers,
00986 OUT PULONG ReturnedLength
00987 );
00988
00989
typedef ULONG
00990 (*PGET_SET_DEVICE_INSTANCE_DATA)(
00991 IN
struct _BUS_HANDLER *BusHandler,
00992 IN
struct _BUS_HANDLER *RootHandler,
00993 IN
PDEVICE_HANDLER_OBJECT DeviceHandler,
00994 IN ULONG DataType,
00995 IN PVOID
Buffer,
00996 IN ULONG
Offset,
00997 IN ULONG Length
00998 );
00999
01000
01001
typedef
01002
NTSTATUS
01003 (*PDEVICE_CONTROL)(
01004 IN
PHAL_DEVICE_CONTROL_CONTEXT Context
01005 );
01006
01007
01008
typedef
01009
NTSTATUS
01010 (*PHIBERNATEBRESUMEBUS)(
01011 IN
struct _BUS_HANDLER *BusHandler,
01012 IN
struct _BUS_HANDLER *RootHandler
01013 );
01014
01015
01016
01017
01018
01019 #define BUS_SUPPORTED_RANGE_VERSION 1
01020
01021 typedef struct _SUPPORTED_RANGE {
01022 struct _SUPPORTED_RANGE *
Next;
01023 ULONG
SystemAddressSpace;
01024 LONGLONG
SystemBase;
01025 LONGLONG
Base;
01026 LONGLONG
Limit;
01027 }
SUPPORTED_RANGE, *
PSUPPORTED_RANGE;
01028
01029 typedef struct _SUPPORTED_RANGES {
01030 USHORT Version;
01031 BOOLEAN
Sorted;
01032 UCHAR
Reserved;
01033
01034 ULONG
NoIO;
01035 SUPPORTED_RANGE IO;
01036
01037 ULONG
NoMemory;
01038 SUPPORTED_RANGE Memory;
01039
01040 ULONG
NoPrefetchMemory;
01041 SUPPORTED_RANGE PrefetchMemory;
01042
01043 ULONG
NoDma;
01044 SUPPORTED_RANGE Dma;
01045 }
SUPPORTED_RANGES, *
PSUPPORTED_RANGES;
01046
01047
01048
01049
01050
01051 #define BUS_HANDLER_VERSION 1
01052
01053 typedef struct _BUS_HANDLER {
01054
01055
01056
01057
01058 ULONG
Version;
01059
01060
01061
01062
01063
01064 INTERFACE_TYPE
InterfaceType;
01065 BUS_DATA_TYPE
ConfigurationType;
01066 ULONG
BusNumber;
01067
01068
01069
01070
01071
01072
01073 PDEVICE_OBJECT DeviceObject;
01074
01075
01076
01077
01078
01079 struct _BUS_HANDLER *
ParentHandler;
01080
01081
01082
01083
01084
01085 PVOID
BusData;
01086
01087
01088
01089
01090
01091 ULONG
DeviceControlExtensionSize;
01092
01093
01094
01095
01096
01097 PSUPPORTED_RANGES BusAddresses;
01098
01099
01100
01101
01102
01103 ULONG
Reserved[4];
01104
01105
01106
01107
01108
01109 PGETSETBUSDATA GetBusData;
01110 PGETSETBUSDATA SetBusData;
01111 PADJUSTRESOURCELIST AdjustResourceList;
01112 PASSIGNSLOTRESOURCES AssignSlotResources;
01113 PGETINTERRUPTVECTOR GetInterruptVector;
01114 PTRANSLATEBUSADDRESS TranslateBusAddress;
01115
01116 PVOID
Spare1;
01117 PVOID
Spare2;
01118 PVOID
Spare3;
01119 PVOID
Spare4;
01120 PVOID
Spare5;
01121 PVOID
Spare6;
01122 PVOID
Spare7;
01123 PVOID
Spare8;
01124
01125 }
BUS_HANDLER, *
PBUS_HANDLER;
01126
01127
01128
VOID
01129
HalpInitBusHandler (
01130 VOID
01131 );
01132
01133
typedef
01134
NTSTATUS
01135 (*PINSTALL_BUS_HANDLER)(
01136 IN
PBUS_HANDLER Bus
01137 );
01138
01139
typedef
01140
NTSTATUS
01141 (*pHalRegisterBusHandler)(
01142 IN INTERFACE_TYPE
InterfaceType,
01143 IN BUS_DATA_TYPE AssociatedConfigurationSpace,
01144 IN ULONG
BusNumber,
01145 IN INTERFACE_TYPE ParentBusType,
01146 IN ULONG ParentBusNumber,
01147 IN ULONG SizeofBusExtensionData,
01148 IN
PINSTALL_BUS_HANDLER InstallBusHandlers,
01149 OUT
PBUS_HANDLER *BusHandler
01150 );
01151
01152
NTSTATUS
01153
HaliRegisterBusHandler (
01154 IN INTERFACE_TYPE InterfaceType,
01155 IN BUS_DATA_TYPE AssociatedConfigurationSpace,
01156 IN ULONG BusNumber,
01157 IN INTERFACE_TYPE ParentBusType,
01158 IN ULONG ParentBusNumber,
01159 IN ULONG SizeofBusExtensionData,
01160 IN PINSTALL_BUS_HANDLER InstallBusHandlers,
01161 OUT PBUS_HANDLER *BusHandler
01162 );
01163
01164
01165
typedef
01166
PBUS_HANDLER
01167 (
FASTCALL *pHalHandlerForBus) (
01168 IN INTERFACE_TYPE
InterfaceType,
01169 IN ULONG
BusNumber
01170 );
01171
01172
01173
PBUS_HANDLER
01174
FASTCALL
01175
HaliReferenceHandlerForBus (
01176 IN INTERFACE_TYPE InterfaceType,
01177 IN ULONG BusNumber
01178 );
01179
01180
PBUS_HANDLER
01181
FASTCALL
01182
HaliHandlerForBus (
01183 IN INTERFACE_TYPE InterfaceType,
01184 IN ULONG BusNumber
01185 );
01186
01187
typedef VOID
01188 (
FASTCALL *pHalRefernceBusHandler) (
01189 IN
PBUS_HANDLER BusHandler
01190 );
01191
01192
VOID
01193
FASTCALL
01194
HaliDerefernceBusHandler (
01195 IN PBUS_HANDLER BusHandler
01196 );
01197
01198
typedef
01199
PBUS_HANDLER
01200 (
FASTCALL *pHalHandlerForConfigSpace) (
01201 IN BUS_DATA_TYPE ConfigSpace,
01202 IN ULONG
BusNumber
01203 );
01204
01205
PBUS_HANDLER
01206
FASTCALL
01207
HaliHandlerForConfigSpace (
01208 IN BUS_DATA_TYPE ConfigSpace,
01209 IN ULONG BusNumber
01210 );
01211
01212
01213
typedef
01214
VOID
01215 (
FASTCALL *pHalReferenceBusHandler) (
01216 IN
PBUS_HANDLER BusHandler
01217 );
01218
01219
01220
VOID
01221
FASTCALL
01222
HaliReferenceBusHandler (
01223 IN PBUS_HANDLER BusHandler
01224 );
01225
01226
VOID
01227
FASTCALL
01228
HaliDereferenceBusHandler (
01229 IN PBUS_HANDLER BusHandler
01230 );
01231
01232
01233
NTSTATUS
01234
HaliQueryBusSlots (
01235 IN PBUS_HANDLER BusHandler,
01236 IN ULONG BufferSize,
01237 OUT PULONG SlotNumbers,
01238 OUT PULONG ReturnedLength
01239 );
01240
01241
NTSTATUS
01242
HaliAdjustResourceListRange (
01243 IN PSUPPORTED_RANGES SupportedRanges,
01244 IN PSUPPORTED_RANGE InterruptRanges,
01245 IN OUT PIO_RESOURCE_REQUIREMENTS_LIST *pResourceList
01246 );
01247
01248
VOID
01249
HaliLocateHiberRanges (
01250 IN PVOID MemoryMap
01251 );
01252
01253
01254
typedef
01255
VOID
01256 (*pHalSetWakeEnable)(
01257 IN BOOLEAN Enable
01258 );
01259
01260
01261
typedef
01262
VOID
01263 (*pHalSetWakeAlarm)(
01264 IN ULONGLONG WakeTime,
01265 IN PTIME_FIELDS WakeTimeFields
01266 );
01267
01268
typedef
01269
VOID
01270 (*pHalLocateHiberRanges)(
01271 IN PVOID MemoryMap
01272 );
01273
01274
01275
01276
01277
01278
01279
01280
01281 typedef enum _HAL_QUERY_INFORMATION_CLASS {
01282
HalInstalledBusInformation,
01283
HalProfileSourceInformation,
01284
HalInformationClassUnused1,
01285
HalPowerInformation,
01286
HalProcessorSpeedInformation,
01287
HalCallbackInformation,
01288
HalMapRegisterInformation,
01289
HalMcaLogInformation,
01290
HalFrameBufferCachingInformation,
01291
HalDisplayBiosInformation,
01292
HalProcessorFeatureInformation
01293
01294 }
HAL_QUERY_INFORMATION_CLASS, *
PHAL_QUERY_INFORMATION_CLASS;
01295
01296
01297 typedef enum _HAL_SET_INFORMATION_CLASS {
01298
HalProfileSourceInterval,
01299
HalProfileSourceInterruptHandler,
01300
HalMcaRegisterDriver
01301 }
HAL_SET_INFORMATION_CLASS, *
PHAL_SET_INFORMATION_CLASS;
01302
01303
01304
typedef
01305
NTSTATUS
01306 (*pHalQuerySystemInformation)(
01307 IN
HAL_QUERY_INFORMATION_CLASS InformationClass,
01308 IN ULONG
BufferSize,
01309 IN OUT PVOID
Buffer,
01310 OUT PULONG ReturnedLength
01311 );
01312
01313
NTSTATUS
01314
HaliQuerySystemInformation(
01315 IN HAL_SET_INFORMATION_CLASS InformationClass,
01316 IN ULONG BufferSize,
01317 IN OUT PVOID Buffer,
01318 OUT PULONG ReturnedLength
01319 );
01320
01321
typedef
01322
NTSTATUS
01323 (*pHalSetSystemInformation)(
01324 IN
HAL_SET_INFORMATION_CLASS InformationClass,
01325 IN ULONG
BufferSize,
01326 IN PVOID
Buffer
01327 );
01328
01329
NTSTATUS
01330
HaliSetSystemInformation(
01331 IN HAL_SET_INFORMATION_CLASS InformationClass,
01332 IN ULONG BufferSize,
01333 IN PVOID Buffer
01334 );
01335
01336
typedef
01337
VOID
01338 (
FASTCALL *
pHalExamineMBR)(
01339 IN
PDEVICE_OBJECT DeviceObject,
01340 IN ULONG
SectorSize,
01341 IN ULONG MBRTypeIdentifier,
01342 OUT PVOID *
Buffer
01343 );
01344
01345
typedef
01346
VOID
01347 (
FASTCALL *
pHalIoAssignDriveLetters)(
01348 IN
struct _LOADER_PARAMETER_BLOCK *LoaderBlock,
01349 IN PSTRING NtDeviceName,
01350 OUT PUCHAR NtSystemPath,
01351 OUT PSTRING NtSystemPathString
01352 );
01353
01354
typedef
01355
NTSTATUS
01356 (
FASTCALL *
pHalIoReadPartitionTable)(
01357 IN
PDEVICE_OBJECT DeviceObject,
01358 IN ULONG
SectorSize,
01359 IN BOOLEAN ReturnRecognizedPartitions,
01360 OUT
struct _DRIVE_LAYOUT_INFORMATION **PartitionBuffer
01361 );
01362
01363
typedef
01364
NTSTATUS
01365 (
FASTCALL *
pHalIoSetPartitionInformation)(
01366 IN
PDEVICE_OBJECT DeviceObject,
01367 IN ULONG
SectorSize,
01368 IN ULONG PartitionNumber,
01369 IN ULONG PartitionType
01370 );
01371
01372
typedef
01373
NTSTATUS
01374 (
FASTCALL *
pHalIoWritePartitionTable)(
01375 IN
PDEVICE_OBJECT DeviceObject,
01376 IN ULONG
SectorSize,
01377 IN ULONG SectorsPerTrack,
01378 IN ULONG NumberOfHeads,
01379 IN
struct _DRIVE_LAYOUT_INFORMATION *PartitionBuffer
01380 );
01381
01382
typedef
01383
NTSTATUS
01384 (*pHalQueryBusSlots)(
01385 IN
PBUS_HANDLER BusHandler,
01386 IN ULONG
BufferSize,
01387 OUT PULONG SlotNumbers,
01388 OUT PULONG ReturnedLength
01389 );
01390
01391
typedef
01392
NTSTATUS
01393 (*pHalInitPnpDriver)(
01394
VOID
01395 );
01396
01397
NTSTATUS
01398
HaliInitPnpDriver(
01399 VOID
01400 );
01401
01402 typedef struct _PM_DISPATCH_TABLE {
01403 ULONG
Signature;
01404 ULONG
Version;
01405 PVOID
Function[1];
01406 }
PM_DISPATCH_TABLE, *
PPM_DISPATCH_TABLE;
01407
01408
typedef
01409
NTSTATUS
01410 (*pHalInitPowerManagement)(
01411 IN
PPM_DISPATCH_TABLE PmDriverDispatchTable,
01412 OUT
PPM_DISPATCH_TABLE *
PmHalDispatchTable
01413 );
01414
01415
NTSTATUS
01416
HaliInitPowerManagement(
01417 IN PPM_DISPATCH_TABLE PmDriverDispatchTable,
01418 IN OUT PPM_DISPATCH_TABLE *PmHalDispatchTable
01419 );
01420
01421
typedef
01422
struct _DMA_ADAPTER *
01423 (*pHalGetDmaAdapter)(
01424 IN PVOID Context,
01425 IN
struct _DEVICE_DESCRIPTION *DeviceDescriptor,
01426 OUT PULONG NumberOfMapRegisters
01427 );
01428
01429
struct _DMA_ADAPTER *
01430
HaliGetDmaAdapter(
01431 IN PVOID Context,
01432 IN
struct _DEVICE_DESCRIPTION *DeviceDescriptor,
01433 OUT PULONG NumberOfMapRegisters
01434 );
01435
01436
typedef
01437
NTSTATUS
01438 (*pHalGetInterruptTranslator)(
01439 IN INTERFACE_TYPE ParentInterfaceType,
01440 IN ULONG ParentBusNumber,
01441 IN INTERFACE_TYPE BridgeInterfaceType,
01442 IN
USHORT Size,
01443 IN
USHORT Version,
01444 OUT
PTRANSLATOR_INTERFACE Translator,
01445 OUT PULONG BridgeBusNumber
01446 );
01447
01448
NTSTATUS
01449
HaliGetInterruptTranslator(
01450 IN INTERFACE_TYPE ParentInterfaceType,
01451 IN ULONG ParentBusNumber,
01452 IN INTERFACE_TYPE BridgeInterfaceType,
01453 IN USHORT Size,
01454 IN USHORT Version,
01455 OUT
PTRANSLATOR_INTERFACE Translator,
01456 OUT PULONG BridgeBusNumber
01457 );
01458
01459
typedef
01460 BOOLEAN
01461 (*pHalTranslateBusAddress)(
01462 IN INTERFACE_TYPE
InterfaceType,
01463 IN ULONG
BusNumber,
01464 IN PHYSICAL_ADDRESS BusAddress,
01465 IN OUT PULONG AddressSpace,
01466 OUT PPHYSICAL_ADDRESS TranslatedAddress
01467 );
01468
01469
typedef
01470
NTSTATUS
01471 (*pHalAssignSlotResources) (
01472 IN PUNICODE_STRING RegistryPath,
01473 IN PUNICODE_STRING DriverClassName OPTIONAL,
01474 IN
PDRIVER_OBJECT DriverObject,
01475 IN
PDEVICE_OBJECT DeviceObject,
01476 IN INTERFACE_TYPE BusType,
01477 IN ULONG
BusNumber,
01478 IN ULONG SlotNumber,
01479 IN OUT PCM_RESOURCE_LIST *AllocatedResources
01480 );
01481
01482
typedef
01483
VOID
01484 (*pHalHaltSystem) (
01485
VOID
01486 );
01487
01488
typedef
01489
VOID
01490 (*pHalResetDisplay) (
01491
VOID
01492 );
01493
01494
typedef
01495 BOOLEAN
01496 (*pHalFindBusAddressTranslation) (
01497 IN PHYSICAL_ADDRESS BusAddress,
01498 IN OUT PULONG AddressSpace,
01499 OUT PPHYSICAL_ADDRESS TranslatedAddress,
01500 IN OUT PULONG_PTR Context,
01501 IN BOOLEAN NextBus
01502 );
01503
01504 typedef struct {
01505 ULONG
Version;
01506 pHalQuerySystemInformation HalQuerySystemInformation;
01507 pHalSetSystemInformation HalSetSystemInformation;
01508 pHalQueryBusSlots HalQueryBusSlots;
01509 ULONG Spare1;
01510 pHalExamineMBR HalExamineMBR;
01511 pHalIoAssignDriveLetters HalIoAssignDriveLetters;
01512 pHalIoReadPartitionTable HalIoReadPartitionTable;
01513 pHalIoSetPartitionInformation HalIoSetPartitionInformation;
01514 pHalIoWritePartitionTable HalIoWritePartitionTable;
01515
01516 pHalHandlerForBus
HalReferenceHandlerForBus;
01517 pHalReferenceBusHandler
HalReferenceBusHandler;
01518 pHalReferenceBusHandler
HalDereferenceBusHandler;
01519
01520 pHalInitPnpDriver HalInitPnpDriver;
01521 pHalInitPowerManagement HalInitPowerManagement;
01522
01523 pHalGetDmaAdapter HalGetDmaAdapter;
01524 pHalGetInterruptTranslator HalGetInterruptTranslator;
01525 }
HAL_DISPATCH, *
PHAL_DISPATCH;
01526
01527
#if defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || defined(_NTHAL_)
01528
01529
extern PHAL_DISPATCH HalDispatchTable;
01530
#define HALDISPATCH HalDispatchTable
01531
01532
#else
01533
01534 extern HAL_DISPATCH HalDispatchTable;
01535 #define HALDISPATCH (&HalDispatchTable)
01536
01537
#endif
01538
01539 #define HAL_DISPATCH_VERSION 2
01540
01541 #define HalDispatchTableVersion HALDISPATCH->Version
01542 #define HalQuerySystemInformation HALDISPATCH->HalQuerySystemInformation
01543 #define HalSetSystemInformation HALDISPATCH->HalSetSystemInformation
01544 #define HalQueryBusSlots HALDISPATCH->HalQueryBusSlots
01545 #define HalExamineMBR HALDISPATCH->HalExamineMBR
01546 #define HalIoAssignDriveLetters HALDISPATCH->HalIoAssignDriveLetters
01547 #define HalIoReadPartitionTable HALDISPATCH->HalIoReadPartitionTable
01548 #define HalIoSetPartitionInformation HALDISPATCH->HalIoSetPartitionInformation
01549 #define HalIoWritePartitionTable HALDISPATCH->HalIoWritePartitionTable
01550
01551 #define HalReferenceHandlerForBus HALDISPATCH->HalReferenceHandlerForBus
01552 #define HalReferenceBusHandler HALDISPATCH->HalReferenceBusHandler
01553 #define HalDereferenceBusHandler HALDISPATCH->HalDereferenceBusHandler
01554
01555 #define HalInitPnpDriver HALDISPATCH->HalInitPnpDriver
01556 #define HalInitPowerManagement HALDISPATCH->HalInitPowerManagement
01557
01558 #define HalGetDmaAdapter HALDISPATCH->HalGetDmaAdapter
01559 #define HalGetInterruptTranslator HALDISPATCH->HalGetInterruptTranslator
01560
01561
01562 typedef struct {
01563 ULONG
Version;
01564
01565 pHalHandlerForBus
HalHandlerForBus;
01566 pHalHandlerForConfigSpace
HalHandlerForConfigSpace;
01567 pHalLocateHiberRanges HalLocateHiberRanges;
01568
01569 pHalRegisterBusHandler HalRegisterBusHandler;
01570
01571 pHalSetWakeEnable HalSetWakeEnable;
01572 pHalSetWakeAlarm HalSetWakeAlarm;
01573
01574 pHalTranslateBusAddress HalPciTranslateBusAddress;
01575 pHalAssignSlotResources HalPciAssignSlotResources;
01576
01577 pHalHaltSystem HalHaltSystem;
01578
01579 pHalFindBusAddressTranslation HalFindBusAddressTranslation;
01580
01581 pHalResetDisplay HalResetDisplay;
01582
01583 }
HAL_PRIVATE_DISPATCH, *
PHAL_PRIVATE_DISPATCH;
01584
01585
01586
#if defined(_NTDRIVER_) || defined(_NTDDK_) || defined(_NTIFS_) || defined(_NTHAL_)
01587
01588
extern PHAL_PRIVATE_DISPATCH HalPrivateDispatchTable;
01589
#define HALPDISPATCH HalPrivateDispatchTable
01590
01591
#else
01592
01593 extern HAL_PRIVATE_DISPATCH HalPrivateDispatchTable;
01594 #define HALPDISPATCH (&HalPrivateDispatchTable)
01595
01596
#endif
01597
01598 #define HAL_PRIVATE_DISPATCH_VERSION 1
01599
01600 #define HalRegisterBusHandler HALPDISPATCH->HalRegisterBusHandler
01601 #define HalHandlerForBus HALPDISPATCH->HalHandlerForBus
01602 #define HalHandlerForConfigSpace HALPDISPATCH->HalHandlerForConfigSpace
01603 #define HalLocateHiberRanges HALPDISPATCH->HalLocateHiberRanges
01604 #define HalSetWakeEnable HALPDISPATCH->HalSetWakeEnable
01605 #define HalSetWakeAlarm HALPDISPATCH->HalSetWakeAlarm
01606 #define HalHaltSystem HALPDISPATCH->HalHaltSystem
01607 #define HalResetDisplay HALPDISPATCH->HalResetDisplay
01608
01609
01610
01611
01612
01613
01614
01615
01616 typedef struct _HAL_BUS_INFORMATION{
01617 INTERFACE_TYPE BusType;
01618 BUS_DATA_TYPE
ConfigurationType;
01619 ULONG
BusNumber;
01620 ULONG
Reserved;
01621 }
HAL_BUS_INFORMATION, *
PHAL_BUS_INFORMATION;
01622
01623
01624 typedef struct _HAL_PROFILE_SOURCE_INFORMATION {
01625 KPROFILE_SOURCE
Source;
01626 BOOLEAN
Supported;
01627 ULONG
Interval;
01628 }
HAL_PROFILE_SOURCE_INFORMATION, *
PHAL_PROFILE_SOURCE_INFORMATION;
01629
01630
01631 typedef struct _HAL_PROFILE_SOURCE_INTERVAL {
01632 KPROFILE_SOURCE
Source;
01633 ULONG_PTR
Interval;
01634 }
HAL_PROFILE_SOURCE_INTERVAL, *
PHAL_PROFILE_SOURCE_INTERVAL;
01635
01636
01637 typedef enum _HAL_DISPLAY_BIOS_INFORMATION {
01638
HalDisplayInt10Bios,
01639
HalDisplayEmulatedBios,
01640
HalDisplayNoBios
01641 }
HAL_DISPLAY_BIOS_INFORMATION, *
PHAL_DISPLAY_BIOS_INFORMATION;
01642
01643
01644 typedef struct _HAL_POWER_INFORMATION {
01645 ULONG
TBD;
01646 }
HAL_POWER_INFORMATION, *
PHAL_POWER_INFORMATION;
01647
01648
01649 typedef struct _HAL_PROCESSOR_SPEED_INFO {
01650 ULONG
TBD;
01651 }
HAL_PROCESSOR_SPEED_INFORMATION, *
PHAL_PROCESSOR_SPEED_INFORMATION;
01652
01653
01654 typedef struct _HAL_CALLBACKS {
01655 PCALLBACK_OBJECT SetSystemInformation;
01656 PCALLBACK_OBJECT BusCheck;
01657 }
HAL_CALLBACKS, *
PHAL_CALLBACKS;
01658
01659
01660 typedef struct _HAL_PROCESSOR_FEATURE {
01661 ULONG
UsableFeatureBits;
01662 }
HAL_PROCESSOR_FEATURE;
01663
01664
#if defined(_X86_) || defined(_IA64_)
01665
01666
01667
01668
01669
01670
01671
01672
typedef union _MCI_ADDR{
01673
struct {
01674 ULONG Address;
01675 ULONG Reserved;
01676 };
01677
01678 ULONGLONG QuadPart;
01679 } MCI_ADDR, *PMCI_ADDR;
01680
01681
01682
typedef enum {
01683 HAL_MCE_RECORD,
01684 HAL_MCA_RECORD
01685 } MCA_EXCEPTION_TYPE;
01686
01687
01688
01689
01690
01691
01692
typedef struct _MCA_EXCEPTION {
01693
01694 ULONG VersionNumber;
01695 MCA_EXCEPTION_TYPE ExceptionType;
01696 LARGE_INTEGER TimeStamp;
01697 ULONG ProcessorNumber;
01698
01699
union {
01700
struct {
01701 UCHAR BankNumber;
01702 MCI_STATS
Status;
01703 MCI_ADDR Address;
01704 ULONGLONG Misc;
01705 } Mca;
01706
01707
struct {
01708 ULONGLONG Address;
01709 ULONGLONG Type;
01710 } Mce;
01711 } u;
01712
01713 } MCA_EXCEPTION, *PMCA_EXCEPTION;
01714
01715
01716
01717
01718
typedef
01719
VOID
01720 (*PDRIVER_EXCPTN_CALLBACK) (
01721 IN PVOID Context,
01722 IN PMCA_EXCEPTION BankLog
01723 );
01724
01725
01726
01727
01728
typedef struct _MCA_DRIVER_INFO {
01729 PDRIVER_EXCPTN_CALLBACK ExceptionCallback;
01730
PKDEFERRED_ROUTINE DpcCallback;
01731 PVOID DeviceContext;
01732 } MCA_DRIVER_INFO, *PMCA_DRIVER_INFO;
01733
01734
#endif
01735
01736
01737
01738 typedef struct _SCATTER_GATHER_ELEMENT {
01739 PHYSICAL_ADDRESS
Address;
01740 ULONG
Length;
01741 ULONG_PTR
Reserved;
01742 }
SCATTER_GATHER_ELEMENT, *
PSCATTER_GATHER_ELEMENT;
01743
01744
#pragma warning(disable:4200)
01745 typedef struct _SCATTER_GATHER_LIST {
01746 ULONG
NumberOfElements;
01747 ULONG_PTR
Reserved;
01748 SCATTER_GATHER_ELEMENT Elements[];
01749 }
SCATTER_GATHER_LIST, *
PSCATTER_GATHER_LIST;
01750
#pragma warning(default:4200)
01751
01752
01753
01754 typedef struct _DMA_OPERATIONS *
PDMA_OPERATIONS;
01755
01756 typedef struct _DMA_ADAPTER {
01757 USHORT Version;
01758 USHORT Size;
01759 PDMA_OPERATIONS DmaOperations;
01760
01761 }
DMA_ADAPTER, *
PDMA_ADAPTER;
01762
01763 typedef VOID (*
PPUT_DMA_ADAPTER)(
01764
PDMA_ADAPTER DmaAdapter
01765 );
01766
01767 typedef PVOID (*
PALLOCATE_COMMON_BUFFER)(
01768 IN
PDMA_ADAPTER DmaAdapter,
01769 IN ULONG Length,
01770 OUT PPHYSICAL_ADDRESS LogicalAddress,
01771 IN BOOLEAN CacheEnabled
01772 );
01773
01774 typedef VOID (*
PFREE_COMMON_BUFFER)(
01775 IN
PDMA_ADAPTER DmaAdapter,
01776 IN ULONG Length,
01777 IN PHYSICAL_ADDRESS LogicalAddress,
01778 IN PVOID VirtualAddress,
01779 IN BOOLEAN CacheEnabled
01780 );
01781
01782 typedef NTSTATUS (*
PALLOCATE_ADAPTER_CHANNEL)(
01783 IN
PDMA_ADAPTER DmaAdapter,
01784 IN
PDEVICE_OBJECT DeviceObject,
01785 IN ULONG NumberOfMapRegisters,
01786 IN
PDRIVER_CONTROL ExecutionRoutine,
01787 IN PVOID Context
01788 );
01789
01790 typedef BOOLEAN (*
PFLUSH_ADAPTER_BUFFERS)(
01791 IN
PDMA_ADAPTER DmaAdapter,
01792 IN
PMDL Mdl,
01793 IN PVOID MapRegisterBase,
01794 IN PVOID CurrentVa,
01795 IN ULONG Length,
01796 IN BOOLEAN WriteToDevice
01797 );
01798
01799 typedef VOID (*
PFREE_ADAPTER_CHANNEL)(
01800 IN
PDMA_ADAPTER DmaAdapter
01801 );
01802
01803 typedef VOID (*
PFREE_MAP_REGISTERS)(
01804 IN
PDMA_ADAPTER DmaAdapter,
01805 PVOID MapRegisterBase,
01806 ULONG NumberOfMapRegisters
01807 );
01808
01809 typedef PHYSICAL_ADDRESS (*
PMAP_TRANSFER)(
01810 IN
PDMA_ADAPTER DmaAdapter,
01811 IN
PMDL Mdl,
01812 IN PVOID MapRegisterBase,
01813 IN PVOID CurrentVa,
01814 IN OUT PULONG Length,
01815 IN BOOLEAN WriteToDevice
01816 );
01817
01818 typedef ULONG (*
PGET_DMA_ALIGNMENT)(
01819 IN
PDMA_ADAPTER DmaAdapter
01820 );
01821
01822 typedef ULONG (*
PREAD_DMA_COUNTER)(
01823 IN
PDMA_ADAPTER DmaAdapter
01824 );
01825
01826
typedef VOID
01827 (*PDRIVER_LIST_CONTROL)(
01828 IN
struct _DEVICE_OBJECT *DeviceObject,
01829 IN
struct _IRP *
Irp,
01830 IN
PSCATTER_GATHER_LIST ScatterGather,
01831 IN PVOID Context
01832 );
01833
01834
typedef NTSTATUS
01835 (*PGET_SCATTER_GATHER_LIST)(
01836 IN
PDMA_ADAPTER DmaAdapter,
01837 IN
PDEVICE_OBJECT DeviceObject,
01838 IN
PMDL Mdl,
01839 IN PVOID CurrentVa,
01840 IN ULONG Length,
01841 IN
PDRIVER_LIST_CONTROL ExecutionRoutine,
01842 IN PVOID Context,
01843 IN BOOLEAN WriteToDevice
01844 );
01845
01846
typedef VOID
01847 (*PPUT_SCATTER_GATHER_LIST)(
01848 IN
PDMA_ADAPTER DmaAdapter,
01849 IN
PSCATTER_GATHER_LIST ScatterGather,
01850 IN BOOLEAN WriteToDevice
01851 );
01852
01853 typedef struct _DMA_OPERATIONS {
01854 ULONG
Size;
01855 PPUT_DMA_ADAPTER PutDmaAdapter;
01856 PALLOCATE_COMMON_BUFFER AllocateCommonBuffer;
01857 PFREE_COMMON_BUFFER FreeCommonBuffer;
01858 PALLOCATE_ADAPTER_CHANNEL AllocateAdapterChannel;
01859 PFLUSH_ADAPTER_BUFFERS FlushAdapterBuffers;
01860 PFREE_ADAPTER_CHANNEL FreeAdapterChannel;
01861 PFREE_MAP_REGISTERS FreeMapRegisters;
01862 PMAP_TRANSFER MapTransfer;
01863 PGET_DMA_ALIGNMENT GetDmaAlignment;
01864 PREAD_DMA_COUNTER ReadDmaCounter;
01865 PGET_SCATTER_GATHER_LIST GetScatterGatherList;
01866 PPUT_SCATTER_GATHER_LIST PutScatterGatherList;
01867 }
DMA_OPERATIONS;
01868
01869
01870
01871
01872
#if defined(_AXP64_)
01873
01874
01875
01876
01877
#ifndef USE_DMA_MACROS
01878
#define USE_DMA_MACROS
01879
#endif
01880
01881
01882
01883
01884
#ifndef NO_LEGACY_DRIVERS
01885
#define NO_LEGACY_DRIVERS
01886
#endif
01887
01888
#endif // _AXP64_
01889
01890
01891
#if defined(USE_DMA_MACROS) && (defined(_NTDDK_) || defined(_NTDRIVER_))
01892
01893
01894
01895 __inline
01896 PVOID
01897
HalAllocateCommonBuffer(
01898 IN PDMA_ADAPTER DmaAdapter,
01899 IN ULONG Length,
01900 OUT PPHYSICAL_ADDRESS LogicalAddress,
01901 IN BOOLEAN CacheEnabled
01902 ){
01903
01904
PALLOCATE_COMMON_BUFFER allocateCommonBuffer;
01905 PVOID commonBuffer;
01906
01907 allocateCommonBuffer = *(DmaAdapter)->DmaOperations->AllocateCommonBuffer;
01908
ASSERT( allocateCommonBuffer !=
NULL );
01909
01910 commonBuffer = allocateCommonBuffer( DmaAdapter,
01911 Length,
01912 LogicalAddress,
01913 CacheEnabled );
01914
01915
return commonBuffer;
01916 }
01917
01918 __inline
01919
VOID
01920
HalFreeCommonBuffer(
01921 IN PDMA_ADAPTER DmaAdapter,
01922 IN ULONG Length,
01923 IN PHYSICAL_ADDRESS LogicalAddress,
01924 IN PVOID VirtualAddress,
01925 IN BOOLEAN CacheEnabled
01926 ){
01927
01928
PFREE_COMMON_BUFFER freeCommonBuffer;
01929
01930 freeCommonBuffer = *(DmaAdapter)->DmaOperations->FreeCommonBuffer;
01931
ASSERT( freeCommonBuffer != NULL );
01932
01933 freeCommonBuffer( DmaAdapter,
01934 Length,
01935 LogicalAddress,
01936 VirtualAddress,
01937 CacheEnabled );
01938 }
01939
01940 __inline
01941
NTSTATUS
01942
IoAllocateAdapterChannel(
01943 IN PDMA_ADAPTER DmaAdapter,
01944 IN
PDEVICE_OBJECT DeviceObject,
01945 IN ULONG NumberOfMapRegisters,
01946 IN PDRIVER_CONTROL ExecutionRoutine,
01947 IN PVOID Context
01948 ){
01949
01950
PALLOCATE_ADAPTER_CHANNEL allocateAdapterChannel;
01951
NTSTATUS status;
01952
01953 allocateAdapterChannel =
01954 *(DmaAdapter)->DmaOperations->AllocateAdapterChannel;
01955
01956
ASSERT( allocateAdapterChannel != NULL );
01957
01958 status = allocateAdapterChannel( DmaAdapter,
01959 DeviceObject,
01960 NumberOfMapRegisters,
01961 ExecutionRoutine,
01962 Context );
01963
01964
return status;
01965 }
01966
01967 __inline
01968 BOOLEAN
01969
IoFlushAdapterBuffers(
01970 IN PDMA_ADAPTER DmaAdapter,
01971 IN
PMDL Mdl,
01972 IN PVOID MapRegisterBase,
01973 IN PVOID CurrentVa,
01974 IN ULONG Length,
01975 IN BOOLEAN WriteToDevice
01976 ){
01977
01978
PFLUSH_ADAPTER_BUFFERS flushAdapterBuffers;
01979 BOOLEAN result;
01980
01981 flushAdapterBuffers = *(DmaAdapter)->DmaOperations->FlushAdapterBuffers;
01982
ASSERT( flushAdapterBuffers != NULL );
01983
01984 result = flushAdapterBuffers( DmaAdapter,
01985 Mdl,
01986 MapRegisterBase,
01987 CurrentVa,
01988 Length,
01989 WriteToDevice );
01990
return result;
01991 }
01992
01993 __inline
01994
VOID
01995
IoFreeAdapterChannel(
01996 IN PDMA_ADAPTER DmaAdapter
01997 ){
01998
01999
PFREE_ADAPTER_CHANNEL freeAdapterChannel;
02000
02001 freeAdapterChannel = *(DmaAdapter)->DmaOperations->FreeAdapterChannel;
02002
ASSERT( freeAdapterChannel != NULL );
02003
02004 freeAdapterChannel( DmaAdapter );
02005 }
02006
02007 __inline
02008
VOID
02009
IoFreeMapRegisters(
02010 IN PDMA_ADAPTER DmaAdapter,
02011 IN PVOID MapRegisterBase,
02012 IN ULONG NumberOfMapRegisters
02013 ){
02014
02015
PFREE_MAP_REGISTERS freeMapRegisters;
02016
02017 freeMapRegisters = *(DmaAdapter)->DmaOperations->FreeMapRegisters;
02018
ASSERT( freeMapRegisters != NULL );
02019
02020 freeMapRegisters( DmaAdapter,
02021 MapRegisterBase,
02022 NumberOfMapRegisters );
02023 }
02024
02025
02026 __inline
02027 PHYSICAL_ADDRESS
02028
IoMapTransfer(
02029 IN PDMA_ADAPTER DmaAdapter,
02030 IN
PMDL Mdl,
02031 IN PVOID MapRegisterBase,
02032 IN PVOID CurrentVa,
02033 IN OUT PULONG Length,
02034 IN BOOLEAN WriteToDevice
02035 ){
02036
02037 PHYSICAL_ADDRESS physicalAddress;
02038
PMAP_TRANSFER mapTransfer;
02039
02040 mapTransfer = *(DmaAdapter)->DmaOperations->MapTransfer;
02041
ASSERT( mapTransfer != NULL );
02042
02043 physicalAddress = mapTransfer( DmaAdapter,
02044 Mdl,
02045 MapRegisterBase,
02046 CurrentVa,
02047 Length,
02048 WriteToDevice );
02049
02050
return physicalAddress;
02051 }
02052
02053 __inline
02054 ULONG
02055 HalGetDmaAlignment(
02056 IN PDMA_ADAPTER DmaAdapter
02057 )
02058 {
02059
PGET_DMA_ALIGNMENT getDmaAlignment;
02060 ULONG alignment;
02061
02062 getDmaAlignment = *(DmaAdapter)->DmaOperations->GetDmaAlignment;
02063
ASSERT( getDmaAlignment != NULL );
02064
02065 alignment = getDmaAlignment( DmaAdapter );
02066
return alignment;
02067 }
02068
02069 __inline
02070 ULONG
02071
HalReadDmaCounter(
02072 IN PDMA_ADAPTER DmaAdapter
02073 )
02074 {
02075
PREAD_DMA_COUNTER readDmaCounter;
02076 ULONG counter;
02077
02078 readDmaCounter = *(DmaAdapter)->DmaOperations->ReadDmaCounter;
02079
ASSERT( readDmaCounter != NULL );
02080
02081 counter = readDmaCounter( DmaAdapter );
02082
return counter;
02083 }
02084
02085
02086
02087
#else
02088
02089
02090
02091
02092
NTHALAPI
02093
NTSTATUS
02094
HalAllocateAdapterChannel(
02095 IN
PADAPTER_OBJECT AdapterObject,
02096 IN
PWAIT_CONTEXT_BLOCK Wcb,
02097 IN ULONG NumberOfMapRegisters,
02098 IN PDRIVER_CONTROL ExecutionRoutine
02099 );
02100
02101
NTHALAPI
02102 PVOID
02103
HalAllocateCommonBuffer(
02104 IN
PADAPTER_OBJECT AdapterObject,
02105 IN ULONG Length,
02106 OUT PPHYSICAL_ADDRESS LogicalAddress,
02107 IN BOOLEAN CacheEnabled
02108 );
02109
02110
NTHALAPI
02111
VOID
02112
HalFreeCommonBuffer(
02113 IN
PADAPTER_OBJECT AdapterObject,
02114 IN ULONG Length,
02115 IN PHYSICAL_ADDRESS LogicalAddress,
02116 IN PVOID VirtualAddress,
02117 IN BOOLEAN CacheEnabled
02118 );
02119
02120
NTHALAPI
02121 ULONG
02122
HalReadDmaCounter(
02123 IN
PADAPTER_OBJECT AdapterObject
02124 );
02125
02126
NTHALAPI
02127 BOOLEAN
02128
IoFlushAdapterBuffers(
02129 IN
PADAPTER_OBJECT AdapterObject,
02130 IN
PMDL Mdl,
02131 IN PVOID MapRegisterBase,
02132 IN PVOID CurrentVa,
02133 IN ULONG Length,
02134 IN BOOLEAN WriteToDevice
02135 );
02136
02137
NTHALAPI
02138
VOID
02139
IoFreeAdapterChannel(
02140 IN
PADAPTER_OBJECT AdapterObject
02141 );
02142
02143
NTHALAPI
02144
VOID
02145
IoFreeMapRegisters(
02146 IN
PADAPTER_OBJECT AdapterObject,
02147 IN PVOID MapRegisterBase,
02148 IN ULONG NumberOfMapRegisters
02149 );
02150
02151
NTHALAPI
02152 PHYSICAL_ADDRESS
02153
IoMapTransfer(
02154 IN
PADAPTER_OBJECT AdapterObject,
02155 IN
PMDL Mdl,
02156 IN PVOID MapRegisterBase,
02157 IN PVOID CurrentVa,
02158 IN OUT PULONG Length,
02159 IN BOOLEAN WriteToDevice
02160 );
02161
#endif // USE_DMA_MACROS && (_NTDDK_ || _NTDRIVER_)
02162
02163
NTSTATUS
02164
HalGetScatterGatherList (
02165 IN
PADAPTER_OBJECT DmaAdapter,
02166 IN
PDEVICE_OBJECT DeviceObject,
02167 IN
PMDL Mdl,
02168 IN PVOID CurrentVa,
02169 IN ULONG Length,
02170 IN PDRIVER_LIST_CONTROL ExecutionRoutine,
02171 IN PVOID Context,
02172 IN BOOLEAN WriteToDevice
02173 );
02174
02175
VOID
02176
HalPutScatterGatherList (
02177 IN
PADAPTER_OBJECT DmaAdapter,
02178 IN PSCATTER_GATHER_LIST ScatterGather,
02179 IN BOOLEAN WriteToDevice
02180 );
02181
02182
VOID
02183
HalPutDmaAdapter(
02184 IN
PADAPTER_OBJECT DmaAdapter
02185 );
02186
02187
02188
02189
#endif // _HAL_
02190