test: arc.h Source File

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# arc.h

Go to the documentation of this file.

    00001 /*++ BUILD Version: 0010    // Increment this if a change has global effects
    00002
    00003 Copyright (c) 1991  Microsoft Corporation
    00004
    00005 Module Name:
    00006
    00007     arc.h
    00008
    00009 Abstract:
    00010
    00011     This header file defines the ARC system firmware interface and the
    00012     NT structures that are dependent on ARC types.
    00013
    00014 Author:
    00015
    00016     David N. Cutler (davec) 18-May-1991
    00017
    00018
    00019 Revision History:
    00020
    00021 --*/
    00022
    00023 #ifndef _ARC_
    00024 #define _ARC_
    00025
    00026 #include "profiles.h"
    00027
    00028
    00029 //
    00030 // Define console input and console output file ids.
    00031 //
    00032
    00033 #define ARC_CONSOLE_INPUT 0
    00034 #define ARC_CONSOLE_OUTPUT 1
    00035
    00036 //
    00037 // Define ARC_STATUS type.
    00038 //
    00039
    00040 typedef ULONG ARC_STATUS;
    00041
    00042 //
    00043 // Define the firmware entry point numbers.
    00044 //
    00045
    00046 typedef enum _FIRMWARE_ENTRY {
    00047     LoadRoutine,
    00048     InvokeRoutine,
    00049     ExecuteRoutine,
    00050     HaltRoutine,
    00051     PowerDownRoutine,
    00052     RestartRoutine,
    00053     RebootRoutine,
    00054     InteractiveModeRoutine,
    00055     Reserved1,
    00056     GetPeerRoutine,
    00057     GetChildRoutine,
    00058     GetParentRoutine,
    00059     GetDataRoutine,
    00060     AddChildRoutine,
    00061     DeleteComponentRoutine,
    00062     GetComponentRoutine,
    00063     SaveConfigurationRoutine,
    00064     GetSystemIdRoutine,
    00065     MemoryRoutine,
    00066     Reserved2,
    00067     GetTimeRoutine,
    00068     GetRelativeTimeRoutine,
    00069     GetDirectoryEntryRoutine,
    00070     OpenRoutine,
    00071     CloseRoutine,
    00072     ReadRoutine,
    00073     ReadStatusRoutine,
    00074     WriteRoutine,
    00075     SeekRoutine,
    00076     MountRoutine,
    00077     GetEnvironmentRoutine,
    00078     SetEnvironmentRoutine,
    00079     GetFileInformationRoutine,
    00080     SetFileInformationRoutine,
    00081     FlushAllCachesRoutine,
    00082     TestUnicodeCharacterRoutine,
    00083     GetDisplayStatusRoutine,
    00084     MaximumRoutine
    00085 } FIRMWARE_ENTRY;
    00086
    00087 //
    00088 // Define software loading and execution routine types.
    00089 //
    00090
    00091 typedef
    00092 ARC_STATUS
    00093 (*PARC_EXECUTE_ROUTINE) (
    00094     IN CHAR * FIRMWARE_PTR ImagePath,
    00095     IN ULONG Argc,
    00096     IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Argv,
    00097     IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Envp
    00098     );
    00099
    00100 typedef
    00101 ARC_STATUS
    00102 (*PARC_INVOKE_ROUTINE) (
    00103     IN ULONG EntryAddress,
    00104     IN ULONG StackAddress,
    00105     IN ULONG Argc,
    00106     IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Argv,
    00107     IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Envp
    00108     );
    00109
    00110 typedef
    00111 ARC_STATUS
    00112 (*PARC_LOAD_ROUTINE) (
    00113     IN CHAR * FIRMWARE_PTR ImagePath,
    00114     IN ULONG TopAddress,
    00115     OUT ULONG * FIRMWARE_PTR EntryAddress,
    00116     OUT ULONG * FIRMWARE_PTR LowAddress
    00117     );
    00118
    00119 //
    00120 // Define firmware software loading and execution prototypes.
    00121 //
    00122
    00123 ARC_STATUS
    00124 FwExecute (
    00125     IN CHAR * FIRMWARE_PTR ImagePath,
    00126     IN ULONG Argc,
    00127     IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Argv,
    00128     IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Envp
    00129     );
    00130
    00131 ARC_STATUS
    00132 FwInvoke (
    00133     IN ULONG EntryAddress,
    00134     IN ULONG StackAddress,
    00135     IN ULONG Argc,
    00136     IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Argv,
    00137     IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Envp
    00138     );
    00139
    00140 ARC_STATUS
    00141 FwLoad (
    00142     IN CHAR * FIRMWARE_PTR ImagePath,
    00143     IN ULONG TopAddress,
    00144     OUT ULONG * FIRMWARE_PTR EntryAddress,
    00145     OUT ULONG * FIRMWARE_PTR LowAddress
    00146     );
    00147
    00148 //
    00149 // Define program termination routine types.
    00150 //
    00151
    00152 typedef
    00153 VOID
    00154 (*PARC_HALT_ROUTINE) (
    00155     VOID
    00156     );
    00157
    00158 typedef
    00159 VOID
    00160 (*PARC_POWERDOWN_ROUTINE) (
    00161     VOID
    00162     );
    00163
    00164 typedef
    00165 VOID
    00166 (*PARC_RESTART_ROUTINE) (
    00167     VOID
    00168     );
    00169
    00170 typedef
    00171 VOID
    00172 (*PARC_REBOOT_ROUTINE) (
    00173     VOID
    00174     );
    00175
    00176 typedef
    00177 VOID
    00178 (*PARC_INTERACTIVE_MODE_ROUTINE) (
    00179     VOID
    00180     );
    00181
    00182 //
    00183 // Define firmware program termination prototypes.
    00184 //
    00185
    00186 VOID
    00187 FwHalt (
    00188     VOID
    00189     );
    00190
    00191 VOID
    00192 FwPowerDown (
    00193     VOID
    00194     );
    00195
    00196 VOID
    00197 FwRestart (
    00198     VOID
    00199     );
    00200
    00201 VOID
    00202 FwReboot (
    00203     VOID
    00204     );
    00205
    00206 VOID
    00207 FwEnterInteractiveMode (
    00208     VOID
    00209     );
    00210
    00211 // begin_ntddk
    00212 //
    00213 // Define configuration routine types.
    00214 //
    00215 // Configuration information.
    00216 //
    00217 // end_ntddk
    00218
    00219 typedef enum _CONFIGURATION_CLASS {
    00220     SystemClass,
    00221     ProcessorClass,
    00222     CacheClass,
    00223     AdapterClass,
    00224     ControllerClass,
    00225     PeripheralClass,
    00226     MemoryClass,
    00227     MaximumClass
    00228 } CONFIGURATION_CLASS, *PCONFIGURATION_CLASS;
    00229
    00230 // begin_ntddk
    00231
    00232 typedef enum _CONFIGURATION_TYPE {
    00233     ArcSystem,
    00234     CentralProcessor,
    00235     FloatingPointProcessor,
    00236     PrimaryIcache,
    00237     PrimaryDcache,
    00238     SecondaryIcache,
    00239     SecondaryDcache,
    00240     SecondaryCache,
    00241     EisaAdapter,
    00242     TcAdapter,
    00243     ScsiAdapter,
    00244     DtiAdapter,
    00245     MultiFunctionAdapter,
    00246     DiskController,
    00247     TapeController,
    00248     CdromController,
    00249     WormController,
    00250     SerialController,
    00251     NetworkController,
    00252     DisplayController,
    00253     ParallelController,
    00254     PointerController,
    00255     KeyboardController,
    00256     AudioController,
    00257     OtherController,
    00258     DiskPeripheral,
    00259     FloppyDiskPeripheral,
    00260     TapePeripheral,
    00261     ModemPeripheral,
    00262     MonitorPeripheral,
    00263     PrinterPeripheral,
    00264     PointerPeripheral,
    00265     KeyboardPeripheral,
    00266     TerminalPeripheral,
    00267     OtherPeripheral,
    00268     LinePeripheral,
    00269     NetworkPeripheral,
    00270     SystemMemory,
    00271     DockingInformation,
    00272     RealModeIrqRoutingTable,
    00273     MaximumType
    00274 } CONFIGURATION_TYPE, *PCONFIGURATION_TYPE;
    00275
    00276 // end_ntddk
    00277
    00278 typedef struct _CONFIGURATION_COMPONENT {
    00279     CONFIGURATION_CLASS Class;
    00280     CONFIGURATION_TYPE Type;
    00281     DEVICE_FLAGS Flags;
    00282     USHORT Version;
    00283     USHORT Revision;
    00284     ULONG Key;
    00285     ULONG AffinityMask;
    00286     ULONG ConfigurationDataLength;
    00287     ULONG IdentifierLength;
    00288     CHAR * FIRMWARE_PTR Identifier;
    00289 } CONFIGURATION_COMPONENT, * FIRMWARE_PTR PCONFIGURATION_COMPONENT;
    00290
    00291 typedef
    00292 PCONFIGURATION_COMPONENT
    00293 (*PARC_GET_CHILD_ROUTINE) (
    00294     IN PCONFIGURATION_COMPONENT Component OPTIONAL
    00295     );
    00296
    00297 typedef
    00298 PCONFIGURATION_COMPONENT
    00299 (*PARC_GET_PARENT_ROUTINE) (
    00300     IN PCONFIGURATION_COMPONENT Component
    00301     );
    00302
    00303 typedef
    00304 PCONFIGURATION_COMPONENT
    00305 (*PARC_GET_PEER_ROUTINE) (
    00306     IN PCONFIGURATION_COMPONENT Component
    00307     );
    00308
    00309 typedef
    00310 PCONFIGURATION_COMPONENT
    00311 (*PARC_ADD_CHILD_ROUTINE) (
    00312     IN PCONFIGURATION_COMPONENT Component,
    00313     IN PCONFIGURATION_COMPONENT NewComponent,
    00314     IN VOID * FIRMWARE_PTR ConfigurationData
    00315     );
    00316
    00317 typedef
    00318 ARC_STATUS
    00319 (*PARC_DELETE_COMPONENT_ROUTINE) (
    00320     IN PCONFIGURATION_COMPONENT Component
    00321     );
    00322
    00323 typedef
    00324 PCONFIGURATION_COMPONENT
    00325 (*PARC_GET_COMPONENT_ROUTINE) (
    00326     IN CHAR * FIRMWARE_PTR Path
    00327     );
    00328
    00329 typedef
    00330 ARC_STATUS
    00331 (*PARC_GET_DATA_ROUTINE) (
    00332     OUT VOID * FIRMWARE_PTR ConfigurationData,
    00333     IN PCONFIGURATION_COMPONENT Component
    00334     );
    00335
    00336 typedef
    00337 ARC_STATUS
    00338 (*PARC_SAVE_CONFIGURATION_ROUTINE) (
    00339     VOID
    00340     );
    00341
    00342 //
    00343 // Define firmware configuration prototypes.
    00344 //
    00345
    00346 PCONFIGURATION_COMPONENT
    00347 FwGetChild (
    00348     IN PCONFIGURATION_COMPONENT Component OPTIONAL
    00349     );
    00350
    00351 PCONFIGURATION_COMPONENT
    00352 FwGetParent (
    00353     IN PCONFIGURATION_COMPONENT Component
    00354     );
    00355
    00356 PCONFIGURATION_COMPONENT
    00357 FwGetPeer (
    00358     IN PCONFIGURATION_COMPONENT Component
    00359     );
    00360
    00361 PCONFIGURATION_COMPONENT
    00362 FwAddChild (
    00363     IN PCONFIGURATION_COMPONENT Component,
    00364     IN PCONFIGURATION_COMPONENT NewComponent,
    00365     IN VOID * FIRMWARE_PTR ConfigurationData OPTIONAL
    00366     );
    00367
    00368 ARC_STATUS
    00369 FwDeleteComponent (
    00370     IN PCONFIGURATION_COMPONENT Component
    00371     );
    00372
    00373 PCONFIGURATION_COMPONENT
    00374 FwGetComponent(
    00375     IN CHAR * FIRMWARE_PTR Path
    00376     );
    00377
    00378 ARC_STATUS
    00379 FwGetConfigurationData (
    00380     OUT VOID * FIRMWARE_PTR ConfigurationData,
    00381     IN PCONFIGURATION_COMPONENT Component
    00382     );
    00383
    00384 ARC_STATUS
    00385 FwSaveConfiguration (
    00386     VOID
    00387     );
    00388
    00389 //
    00390 // System information.
    00391 //
    00392
    00393 typedef struct _SYSTEM_ID {
    00394     CHAR VendorId[8];
    00395     CHAR ProductId[8];
    00396 } SYSTEM_ID, * FIRMWARE_PTR PSYSTEM_ID;
    00397
    00398 typedef
    00399 PSYSTEM_ID
    00400 (*PARC_GET_SYSTEM_ID_ROUTINE) (
    00401     VOID
    00402     );
    00403
    00404 //
    00405 // Define system identifier query routine type.
    00406 //
    00407
    00408 PSYSTEM_ID
    00409 FwGetSystemId (
    00410     VOID
    00411     );
    00412
    00413 //
    00414 // Memory information.
    00415 //
    00416
    00417 typedef enum _MEMORY_TYPE {
    00418     MemoryExceptionBlock,
    00419     MemorySystemBlock,
    00420     MemoryFree,
    00421     MemoryBad,
    00422     MemoryLoadedProgram,
    00423     MemoryFirmwareTemporary,
    00424     MemoryFirmwarePermanent,
    00425     MemoryFreeContiguous,
    00426     MemorySpecialMemory,
    00427     MemoryMaximum
    00428 } MEMORY_TYPE;
    00429
    00430 typedef struct _MEMORY_DESCRIPTOR {
    00431     MEMORY_TYPE MemoryType;
    00432     ULONG BasePage;
    00433     ULONG PageCount;
    00434 } MEMORY_DESCRIPTOR, * FIRMWARE_PTR PMEMORY_DESCRIPTOR;
    00435
    00436 #if defined(_IA64_)
    00437
    00438 //
    00439 // Cache Attribute.
    00440 //
    00441
    00442 #define WTU    0x1
    00443 #define WTO    0x2
    00444 #define WBO    0x4
    00445 #define WBU    0x8
    00446 #define WCU    0x10
    00447 #define UCU    0x20
    00448 #define UCUE   0x40
    00449 #define UCO    0x80
    00450
    00451 typedef enum _MEMORY_USAGE_TYPE {
    00452     RegularMemory,
    00453     MemoryMappedIo,
    00454     ProcessorIoBlock,
    00455     BootServicesCode,
    00456     BootServicesData,
    00457     RuntimeServicesCode,
    00458     RuntimeServicesData,
    00459     FirmwareSpace,
    00460     DisplayMemory,
    00461     CacheAttributeMaximum
    00462 } MEMORY_USAGE_TYPE;
    00463
    00464 typedef struct _CACHE_ATTRIBUTE_DESCRIPTOR {
    00465     LIST_ENTRY ListEntry;
    00466     MEMORY_USAGE_TYPE MemoryUsage;
    00467     ULONG CacheAttribute;
    00468     ULONG BasePage;
    00469     ULONG PageCount;
    00470 } CACHE_ATTRIBUTE_DESCRIPTOR, *PCACHE_ATTRIBUTE_DESCRIPTOR;
    00471
    00472 CACHE_ATTRIBUTE_DESCRIPTOR CacheDescriptorList[10];
    00473
    00474 #endif // defined(_IA64_)
    00475
    00476 typedef
    00477 PMEMORY_DESCRIPTOR
    00478 (*PARC_MEMORY_ROUTINE) (
    00479     IN PMEMORY_DESCRIPTOR MemoryDescriptor OPTIONAL
    00480     );
    00481
    00482 //
    00483 // Define memory query routine type.
    00484 //
    00485
    00486 PMEMORY_DESCRIPTOR
    00487 FwGetMemoryDescriptor (
    00488     IN PMEMORY_DESCRIPTOR MemoryDescriptor OPTIONAL
    00489     );
    00490
    00491 //
    00492 // Query time functions.
    00493 //
    00494
    00495 typedef
    00496 PTIME_FIELDS
    00497 (*PARC_GET_TIME_ROUTINE) (
    00498     VOID
    00499     );
    00500
    00501 typedef
    00502 ULONG
    00503 (*PARC_GET_RELATIVE_TIME_ROUTINE) (
    00504     VOID
    00505     );
    00506
    00507 //
    00508 // Define query time routine types.
    00509 //
    00510
    00511 PTIME_FIELDS
    00512 FwGetTime (
    00513     VOID
    00514     );
    00515
    00516 ULONG
    00517 FwGetRelativeTime (
    00518     VOID
    00519     );
    00520
    00521 //
    00522 // Define I/O routine types.
    00523 //
    00524
    00525 #define ArcReadOnlyFile   1
    00526 #define ArcHiddenFile     2
    00527 #define ArcSystemFile     4
    00528 #define ArcArchiveFile    8
    00529 #define ArcDirectoryFile 16
    00530 #define ArcDeleteFile    32
    00531
    00532 typedef enum _OPEN_MODE {
    00533     ArcOpenReadOnly,
    00534     ArcOpenWriteOnly,
    00535     ArcOpenReadWrite,
    00536     ArcCreateWriteOnly,
    00537     ArcCreateReadWrite,
    00538     ArcSupersedeWriteOnly,
    00539     ArcSupersedeReadWrite,
    00540     ArcOpenDirectory,
    00541     ArcCreateDirectory,
    00542     ArcOpenMaximumMode
    00543 } OPEN_MODE;
    00544
    00545 typedef struct _FILE_INFORMATION {
    00546     LARGE_INTEGER StartingAddress;
    00547     LARGE_INTEGER EndingAddress;
    00548     LARGE_INTEGER CurrentPosition;
    00549     CONFIGURATION_TYPE Type;
    00550     ULONG FileNameLength;
    00551     UCHAR Attributes;
    00552     CHAR FileName[32];
    00553 } FILE_INFORMATION, * FIRMWARE_PTR PFILE_INFORMATION;
    00554
    00555 typedef enum _SEEK_MODE {
    00556     SeekAbsolute,
    00557     SeekRelative,
    00558     SeekMaximum
    00559 } SEEK_MODE;
    00560
    00561 typedef enum _MOUNT_OPERATION {
    00562     MountLoadMedia,
    00563     MountUnloadMedia,
    00564     MountMaximum
    00565 } MOUNT_OPERATION;
    00566
    00567 typedef struct _DIRECTORY_ENTRY {
    00568         ULONG FileNameLength;
    00569         UCHAR FileAttribute;
    00570         CHAR FileName[32];
    00571 } DIRECTORY_ENTRY, * FIRMWARE_PTR PDIRECTORY_ENTRY;
    00572
    00573 typedef
    00574 ARC_STATUS
    00575 (*PARC_CLOSE_ROUTINE) (
    00576     IN ULONG FileId
    00577     );
    00578
    00579 typedef
    00580 ARC_STATUS
    00581 (*PARC_MOUNT_ROUTINE) (
    00582     IN CHAR * FIRMWARE_PTR MountPath,
    00583     IN MOUNT_OPERATION Operation
    00584     );
    00585
    00586 typedef
    00587 ARC_STATUS
    00588 (*PARC_OPEN_ROUTINE) (
    00589     IN CHAR * FIRMWARE_PTR OpenPath,
    00590     IN OPEN_MODE OpenMode,
    00591     OUT ULONG * FIRMWARE_PTR FileId
    00592     );
    00593
    00594 typedef
    00595 ARC_STATUS
    00596 (*PARC_READ_ROUTINE) (
    00597     IN ULONG FileId,
    00598     OUT VOID * FIRMWARE_PTR Buffer,
    00599     IN ULONG Length,
    00600     OUT ULONG * FIRMWARE_PTR Count
    00601     );
    00602
    00603 typedef
    00604 ARC_STATUS
    00605 (*PARC_READ_STATUS_ROUTINE) (
    00606     IN ULONG FileId
    00607     );
    00608
    00609 typedef
    00610 ARC_STATUS
    00611 (*PARC_SEEK_ROUTINE) (
    00612     IN ULONG FileId,
    00613     IN LARGE_INTEGER * FIRMWARE_PTR Offset,
    00614     IN SEEK_MODE SeekMode
    00615     );
    00616
    00617 typedef
    00618 ARC_STATUS
    00619 (*PARC_WRITE_ROUTINE) (
    00620     IN ULONG FileId,
    00621     IN VOID * FIRMWARE_PTR Buffer,
    00622     IN ULONG Length,
    00623     OUT ULONG * FIRMWARE_PTR Count
    00624     );
    00625
    00626 typedef
    00627 ARC_STATUS
    00628 (*PARC_GET_FILE_INFO_ROUTINE) (
    00629     IN ULONG FileId,
    00630     OUT PFILE_INFORMATION FileInformation
    00631     );
    00632
    00633 typedef
    00634 ARC_STATUS
    00635 (*PARC_SET_FILE_INFO_ROUTINE) (
    00636     IN ULONG FileId,
    00637     IN ULONG AttributeFlags,
    00638     IN ULONG AttributeMask
    00639     );
    00640
    00641 typedef
    00642 ARC_STATUS
    00643 (*PARC_GET_DIRECTORY_ENTRY_ROUTINE) (
    00644     IN ULONG FileId,
    00645     OUT PDIRECTORY_ENTRY Buffer,
    00646     IN ULONG Length,
    00647     OUT ULONG * FIRMWARE_PTR Count
    00648     );
    00649
    00650 //
    00651 // Define firmware I/O prototypes.
    00652 //
    00653
    00654 ARC_STATUS
    00655 FwClose (
    00656     IN ULONG FileId
    00657     );
    00658
    00659 ARC_STATUS
    00660 FwMount (
    00661     IN CHAR * FIRMWARE_PTR MountPath,
    00662     IN MOUNT_OPERATION Operation
    00663     );
    00664
    00665 ARC_STATUS
    00666 FwOpen (
    00667     IN CHAR * FIRMWARE_PTR OpenPath,
    00668     IN OPEN_MODE OpenMode,
    00669     OUT ULONG * FIRMWARE_PTR FileId
    00670     );
    00671
    00672 ARC_STATUS
    00673 FwRead (
    00674     IN ULONG FileId,
    00675     OUT VOID * FIRMWARE_PTR Buffer,
    00676     IN ULONG Length,
    00677     OUT ULONG * FIRMWARE_PTR Count
    00678     );
    00679
    00680 ARC_STATUS
    00681 FwGetReadStatus (
    00682     IN ULONG FileId
    00683     );
    00684
    00685 ARC_STATUS
    00686 FwSeek (
    00687     IN ULONG FileId,
    00688     IN LARGE_INTEGER * FIRMWARE_PTR Offset,
    00689     IN SEEK_MODE SeekMode
    00690     );
    00691
    00692 ARC_STATUS
    00693 FwWrite (
    00694     IN ULONG FileId,
    00695     IN VOID * FIRMWARE_PTR Buffer,
    00696     IN ULONG Length,
    00697     OUT ULONG * FIRMWARE_PTR Count
    00698     );
    00699
    00700 ARC_STATUS
    00701 FwGetFileInformation (
    00702     IN ULONG FileId,
    00703     OUT PFILE_INFORMATION FileInformation
    00704     );
    00705
    00706 ARC_STATUS
    00707 FwSetFileInformation (
    00708     IN ULONG FileId,
    00709     IN ULONG AttributeFlags,
    00710     IN ULONG AttributeMask
    00711     );
    00712
    00713 ARC_STATUS
    00714 FwGetDirectoryEntry (
    00715     IN ULONG FileId,
    00716     OUT PDIRECTORY_ENTRY Buffer,
    00717     IN ULONG Length,
    00718     OUT ULONG * FIRMWARE_PTR Count
    00719     );
    00720
    00721
    00722 //
    00723 // Define environment routine types.
    00724 //
    00725
    00726 typedef
    00727 CHAR * FIRMWARE_PTR
    00728 (*PARC_GET_ENVIRONMENT_ROUTINE) (
    00729     IN CHAR * FIRMWARE_PTR Variable
    00730     );
    00731
    00732 typedef
    00733 ARC_STATUS
    00734 (*PARC_SET_ENVIRONMENT_ROUTINE) (
    00735     IN CHAR * FIRMWARE_PTR Variable,
    00736     IN CHAR * FIRMWARE_PTR Value
    00737     );
    00738
    00739 //
    00740 // Define firmware environment prototypes.
    00741 //
    00742
    00743 CHAR * FIRMWARE_PTR
    00744 FwGetEnvironmentVariable (
    00745     IN CHAR * FIRMWARE_PTR Variable
    00746     );
    00747
    00748 ARC_STATUS
    00749 FwSetEnvironmentVariable (
    00750     IN CHAR * FIRMWARE_PTR Variable,
    00751     IN CHAR * FIRMWARE_PTR Value
    00752     );
    00753
    00754 //
    00755 // Define inline functions to acquire and release the firmware lock
    00756 // and the stub function prototypes necessary to interface with the
    00757 // 32-bit firmware on 64-bit systems.
    00758 //
    00759 // These routines are required for the 64-bit system until (if) 64-bit
    00760 // firmware is ever supplied.
    00761 //
    00762 #if defined(_AXP64_) && defined(_NTHAL_)
    00763
    00764 extern KSPIN_LOCK HalpFirmwareLock;
    00765
    00766 CHAR * FIRMWARE_PTR
    00767 HalpArcGetEnvironmentVariable(
    00768     IN PCHAR Variable
    00769     );
    00770
    00771 ARC_STATUS
    00772 HalpArcSetEnvironmentVariable(
    00773     IN PCHAR Variable,
    00774     IN PCHAR Value
    00775     );
    00776
    00777 KIRQL
    00778 FwAcquireFirmwareLock(
    00779     VOID
    00780     );
    00781
    00782 VOID
    00783 FwReleaseFirmwareLock(
    00784     IN KIRQL OldIrql
    00785     );
    00786
    00787 #endif // _AXP64_  && defined(_NTHAL_)
    00788
    00789
    00790 //
    00791 // Define cache flush routine types
    00792 //
    00793
    00794 typedef
    00795 VOID
    00796 (*PARC_FLUSH_ALL_CACHES_ROUTINE) (
    00797     VOID
    00798     );
    00799
    00800 //
    00801 // Define firmware cache flush prototypes.
    00802 //
    00803
    00804 VOID
    00805 FwFlushAllCaches (
    00806     VOID
    00807     );
    00808
    00809 //
    00810 // Define TestUnicodeCharacter and GetDisplayStatus routines.
    00811 //
    00812
    00813 typedef struct _ARC_DISPLAY_STATUS {
    00814     USHORT CursorXPosition;
    00815     USHORT CursorYPosition;
    00816     USHORT CursorMaxXPosition;
    00817     USHORT CursorMaxYPosition;
    00818     UCHAR ForegroundColor;
    00819     UCHAR BackgroundColor;
    00820     BOOLEAN HighIntensity;
    00821     BOOLEAN Underscored;
    00822     BOOLEAN ReverseVideo;
    00823 } ARC_DISPLAY_STATUS, * FIRMWARE_PTR PARC_DISPLAY_STATUS;
    00824
    00825 typedef
    00826 ARC_STATUS
    00827 (*PARC_TEST_UNICODE_CHARACTER_ROUTINE) (
    00828     IN ULONG FileId,
    00829     IN WCHAR UnicodeCharacter
    00830     );
    00831
    00832 typedef
    00833 PARC_DISPLAY_STATUS
    00834 (*PARC_GET_DISPLAY_STATUS_ROUTINE) (
    00835     IN ULONG FileId
    00836     );
    00837
    00838 ARC_STATUS
    00839 FwTestUnicodeCharacter(
    00840     IN ULONG FileId,
    00841     IN WCHAR UnicodeCharacter
    00842     );
    00843
    00844 PARC_DISPLAY_STATUS
    00845 FwGetDisplayStatus(
    00846     IN ULONG FileId
    00847     );
    00848
    00849
    00850 //
    00851 // Define low memory data structures.
    00852 //
    00853 // Define debug block structure.
    00854 //
    00855
    00856 typedef struct _DEBUG_BLOCK {
    00857     ULONG Signature;
    00858     ULONG Length;
    00859 } DEBUG_BLOCK, * FIRMWARE_PTR PDEBUG_BLOCK;
    00860
    00861 //
    00862 // Define restart block structure.
    00863 //
    00864
    00865 #define ARC_RESTART_BLOCK_SIGNATURE 0x42545352
    00866
    00867 typedef struct _BOOT_STATUS {
    00868     ULONG BootStarted : 1;
    00869     ULONG BootFinished : 1;
    00870     ULONG RestartStarted : 1;
    00871     ULONG RestartFinished : 1;
    00872     ULONG PowerFailStarted : 1;
    00873     ULONG PowerFailFinished : 1;
    00874     ULONG ProcessorReady : 1;
    00875     ULONG ProcessorRunning : 1;
    00876     ULONG ProcessorStart : 1;
    00877 } BOOT_STATUS, * FIRMWARE_PTR PBOOT_STATUS;
    00878
    00879 typedef struct _ALPHA_RESTART_STATE {
    00880
    00881 #if defined(_ALPHA_) || defined(_AXP64_)
    00882
    00883     //
    00884     // Control information
    00885     //
    00886
    00887     ULONG HaltReason;
    00888     VOID * FIRMWARE_PTR LogoutFrame;
    00889     ULONGLONG PalBase;
    00890
    00891     //
    00892     // Integer Save State
    00893     //
    00894
    00895     ULONGLONG IntV0;
    00896     ULONGLONG IntT0;
    00897     ULONGLONG IntT1;
    00898     ULONGLONG IntT2;
    00899     ULONGLONG IntT3;
    00900     ULONGLONG IntT4;
    00901     ULONGLONG IntT5;
    00902     ULONGLONG IntT6;
    00903     ULONGLONG IntT7;
    00904     ULONGLONG IntS0;
    00905     ULONGLONG IntS1;
    00906     ULONGLONG IntS2;
    00907     ULONGLONG IntS3;
    00908     ULONGLONG IntS4;
    00909     ULONGLONG IntS5;
    00910     ULONGLONG IntFp;
    00911     ULONGLONG IntA0;
    00912     ULONGLONG IntA1;
    00913     ULONGLONG IntA2;
    00914     ULONGLONG IntA3;
    00915     ULONGLONG IntA4;
    00916     ULONGLONG IntA5;
    00917     ULONGLONG IntT8;
    00918     ULONGLONG IntT9;
    00919     ULONGLONG IntT10;
    00920     ULONGLONG IntT11;
    00921     ULONGLONG IntRa;
    00922     ULONGLONG IntT12;
    00923     ULONGLONG IntAT;
    00924     ULONGLONG IntGp;
    00925     ULONGLONG IntSp;
    00926     ULONGLONG IntZero;
    00927
    00928     //
    00929     // Floating Point Save State
    00930     //
    00931
    00932     ULONGLONG Fpcr;
    00933     ULONGLONG FltF0;
    00934     ULONGLONG FltF1;
    00935     ULONGLONG FltF2;
    00936     ULONGLONG FltF3;
    00937     ULONGLONG FltF4;
    00938     ULONGLONG FltF5;
    00939     ULONGLONG FltF6;
    00940     ULONGLONG FltF7;
    00941     ULONGLONG FltF8;
    00942     ULONGLONG FltF9;
    00943     ULONGLONG FltF10;
    00944     ULONGLONG FltF11;
    00945     ULONGLONG FltF12;
    00946     ULONGLONG FltF13;
    00947     ULONGLONG FltF14;
    00948     ULONGLONG FltF15;
    00949     ULONGLONG FltF16;
    00950     ULONGLONG FltF17;
    00951     ULONGLONG FltF18;
    00952     ULONGLONG FltF19;
    00953     ULONGLONG FltF20;
    00954     ULONGLONG FltF21;
    00955     ULONGLONG FltF22;
    00956     ULONGLONG FltF23;
    00957     ULONGLONG FltF24;
    00958     ULONGLONG FltF25;
    00959     ULONGLONG FltF26;
    00960     ULONGLONG FltF27;
    00961     ULONGLONG FltF28;
    00962     ULONGLONG FltF29;
    00963     ULONGLONG FltF30;
    00964     ULONGLONG FltF31;
    00965
    00966     //
    00967     // Architected Internal Processor State.
    00968     //
    00969
    00970     ULONG Asn;
    00971     VOID * FIRMWARE_PTR GeneralEntry;
    00972     VOID * FIRMWARE_PTR Iksp;
    00973     VOID * FIRMWARE_PTR InterruptEntry;
    00974     VOID * FIRMWARE_PTR Kgp;
    00975     ULONG Mces;
    00976     VOID * FIRMWARE_PTR MemMgmtEntry;
    00977     VOID * FIRMWARE_PTR PanicEntry;
    00978     VOID * FIRMWARE_PTR Pcr;
    00979     VOID * FIRMWARE_PTR Pdr;
    00980     ULONG Psr;
    00981     VOID * FIRMWARE_PTR ReiRestartAddress;
    00982     ULONG Sirr;
    00983     VOID * FIRMWARE_PTR SyscallEntry;
    00984     VOID * FIRMWARE_PTR Teb;
    00985     VOID * FIRMWARE_PTR Thread;
    00986
    00987     //
    00988     // Processor Implementation-dependent State.
    00989     //
    00990
    00991     ULONGLONG PerProcessorState[175];   // allocate 2K maximum restart block
    00992
    00993 #else
    00994
    00995     ULONG PlaceHolder;
    00996
    00997 #endif
    00998
    00999 } ALPHA_RESTART_STATE, * FIRMWARE_PTR PALPHA_RESTART_STATE;
    01000
    01001 typedef struct _I386_RESTART_STATE {
    01002
    01003 #if defined(_X86_)
    01004
    01005     //
    01006     // Put state structure here.
    01007     //
    01008
    01009     ULONG PlaceHolder;
    01010
    01011 #else
    01012
    01013     ULONG PlaceHolder;
    01014
    01015 #endif
    01016
    01017 } I386_RESTART_STATE, *PI386_RESTART_STATE;
    01018
    01019 #if defined(_IA64_)
    01020 #include "pshpck16.h"
    01021 #endif
    01022
    01023
    01024 typedef struct _IA64_RESTART_STATE {
    01025
    01026 #if defined(_IA64_)
    01027
    01028 // @@BEGIN_DDKSPLIT
    01029
    01030     //
    01031     // This structure is copied from CONTEXT structure in sdk/ntia64.h.
    01032     //
    01033
    01034     //
    01035     // The flags values within this flag control the contents of
    01036     // a CONTEXT record.
    01037     //
    01038     // If the context record is used as an input parameter, then
    01039     // for each portion of the context record controlled by a flag
    01040     // whose value is set, it is assumed that that portion of the
    01041     // context record contains valid context. If the context record
    01042     // is being used to modify a thread's context, then only that
    01043     // portion of the threads context will be modified.
    01044     //
    01045     // If the context record is used as an IN OUT parameter to capture
    01046     // the context of a thread, then only those portions of the thread's
    01047     // context corresponding to set flags will be returned.
    01048     //
    01049     // The context record is never used as an OUT only parameter.
    01050     //
    01051
    01052     ULONG ContextFlags;
    01053     ULONG Fill1[3];         // for alignment of following on 16-byte boundary
    01054
    01055     //
    01056     // This section is specified/returned if the ContextFlags word contains
    01057     // the flag CONTEXT_DEBUG.
    01058     //
    01059     // N.B. CONTEXT_DEBUG is *not* part of CONTEXT_FULL.
    01060     //
    01061
    01062     ULONGLONG DbI0;         // Instruction debug registers
    01063     ULONGLONG DbI1;
    01064     ULONGLONG DbI2;
    01065     ULONGLONG DbI3;
    01066     ULONGLONG DbI4;
    01067     ULONGLONG DbI5;
    01068     ULONGLONG DbI6;
    01069     ULONGLONG DbI7;
    01070
    01071     ULONGLONG DbD0;         // Data debug registers
    01072     ULONGLONG DbD1;
    01073     ULONGLONG DbD2;
    01074     ULONGLONG DbD3;
    01075     ULONGLONG DbD4;
    01076     ULONGLONG DbD5;
    01077     ULONGLONG DbD6;
    01078     ULONGLONG DbD7;
    01079
    01080     //
    01081     // This section is specified/returned if the ContextFlags word contains
    01082     // the flag CONTEXT_LOWER_FLOATING_POINT.
    01083     //
    01084
    01085     FLOAT128 FltS0;                         // Lower saved (preserved)
    01086     FLOAT128 FltS1;
    01087     FLOAT128 FltS2;
    01088     FLOAT128 FltS3;
    01089     FLOAT128 FltS4;
    01090     FLOAT128 FltS5;
    01091     FLOAT128 FltT0;                         // Lower temporary (scratch)
    01092     FLOAT128 FltT1;
    01093     FLOAT128 FltT2;
    01094     FLOAT128 FltT3;
    01095     FLOAT128 FltT4;
    01096     FLOAT128 FltT5;
    01097     FLOAT128 FltT6;
    01098     FLOAT128 FltT7;
    01099
    01100     //
    01101     // This section is specified/returned if the ContextFlags word contains
    01102     // the flag CONTEXT_HIGHER_FLOATING_POINT.
    01103     //
    01104
    01105     FLOAT128 FltS6;                         // Higher saved (preserved) floats
    01106     FLOAT128 FltS7;
    01107     FLOAT128 FltS8;
    01108     FLOAT128 FltS9;
    01109     FLOAT128 FltS10;
    01110     FLOAT128 FltS11;
    01111     FLOAT128 FltS12;
    01112     FLOAT128 FltS13;
    01113     FLOAT128 FltS14;
    01114     FLOAT128 FltS15;
    01115     FLOAT128 FltS16;
    01116     FLOAT128 FltS17;
    01117     FLOAT128 FltS18;
    01118     FLOAT128 FltS19;
    01119     FLOAT128 FltS20;
    01120     FLOAT128 FltS21;
    01121
    01122     FLOAT128 FltF32;
    01123     FLOAT128 FltF33;
    01124     FLOAT128 FltF34;
    01125     FLOAT128 FltF35;
    01126     FLOAT128 FltF36;
    01127     FLOAT128 FltF37;
    01128     FLOAT128 FltF38;
    01129     FLOAT128 FltF39;
    01130
    01131     FLOAT128 FltF40;
    01132     FLOAT128 FltF41;
    01133     FLOAT128 FltF42;
    01134     FLOAT128 FltF43;
    01135     FLOAT128 FltF44;
    01136     FLOAT128 FltF45;
    01137     FLOAT128 FltF46;
    01138     FLOAT128 FltF47;
    01139     FLOAT128 FltF48;
    01140     FLOAT128 FltF49;
    01141
    01142     FLOAT128 FltF50;
    01143     FLOAT128 FltF51;
    01144     FLOAT128 FltF52;
    01145     FLOAT128 FltF53;
    01146     FLOAT128 FltF54;
    01147     FLOAT128 FltF55;
    01148     FLOAT128 FltF56;
    01149     FLOAT128 FltF57;
    01150     FLOAT128 FltF58;
    01151     FLOAT128 FltF59;
    01152
    01153     FLOAT128 FltF60;
    01154     FLOAT128 FltF61;
    01155     FLOAT128 FltF62;
    01156     FLOAT128 FltF63;
    01157     FLOAT128 FltF64;
    01158     FLOAT128 FltF65;
    01159     FLOAT128 FltF66;
    01160     FLOAT128 FltF67;
    01161     FLOAT128 FltF68;
    01162     FLOAT128 FltF69;
    01163
    01164     FLOAT128 FltF70;
    01165     FLOAT128 FltF71;
    01166     FLOAT128 FltF72;
    01167     FLOAT128 FltF73;
    01168     FLOAT128 FltF74;
    01169     FLOAT128 FltF75;
    01170     FLOAT128 FltF76;
    01171     FLOAT128 FltF77;
    01172     FLOAT128 FltF78;
    01173     FLOAT128 FltF79;
    01174
    01175     FLOAT128 FltF80;
    01176     FLOAT128 FltF81;
    01177     FLOAT128 FltF82;
    01178     FLOAT128 FltF83;
    01179     FLOAT128 FltF84;
    01180     FLOAT128 FltF85;
    01181     FLOAT128 FltF86;
    01182     FLOAT128 FltF87;
    01183     FLOAT128 FltF88;
    01184     FLOAT128 FltF89;
    01185
    01186     FLOAT128 FltF90;
    01187     FLOAT128 FltF91;
    01188     FLOAT128 FltF92;
    01189     FLOAT128 FltF93;
    01190     FLOAT128 FltF94;
    01191     FLOAT128 FltF95;
    01192     FLOAT128 FltF96;
    01193     FLOAT128 FltF97;
    01194     FLOAT128 FltF98;
    01195     FLOAT128 FltF99;
    01196
    01197     FLOAT128 FltF100;
    01198     FLOAT128 FltF101;
    01199     FLOAT128 FltF102;
    01200     FLOAT128 FltF103;
    01201     FLOAT128 FltF104;
    01202     FLOAT128 FltF105;
    01203     FLOAT128 FltF106;
    01204     FLOAT128 FltF107;
    01205     FLOAT128 FltF108;
    01206     FLOAT128 FltF109;
    01207
    01208     FLOAT128 FltF110;
    01209     FLOAT128 FltF111;
    01210     FLOAT128 FltF112;
    01211     FLOAT128 FltF113;
    01212     FLOAT128 FltF114;
    01213     FLOAT128 FltF115;
    01214     FLOAT128 FltF116;
    01215     FLOAT128 FltF117;
    01216     FLOAT128 FltF118;
    01217     FLOAT128 FltF119;
    01218
    01219     FLOAT128 FltF120;
    01220     FLOAT128 FltF121;
    01221     FLOAT128 FltF122;
    01222     FLOAT128 FltF123;
    01223     FLOAT128 FltF124;
    01224     FLOAT128 FltF125;
    01225     FLOAT128 FltF126;
    01226     FLOAT128 FltF127;
    01227
    01228     //
    01229     // This section is specified/returned if the ContextFlags word contains
    01230     // the flag CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT.
    01231     // **** TBD **** in some cases it may more efficient to return with
    01232     // CONTEXT_CONTROL
    01233     //
    01234
    01235     ULONGLONG StFPSR;   // FP status
    01236
    01237     //
    01238     // This section is specified/returned if the ContextFlags word contains
    01239     // the flag CONTEXT_INTEGER.
    01240     //
    01241     // N.B. The registers gp, sp, rp are part of the control context
    01242     //
    01243
    01244     ULONGLONG IntGp;                        // global pointer (r1)
    01245     ULONGLONG IntT0;
    01246     ULONGLONG IntT1;
    01247     ULONGLONG IntS0;
    01248     ULONGLONG IntS1;
    01249     ULONGLONG IntS2;
    01250     ULONGLONG IntS3;
    01251     ULONGLONG IntV0;                        // return value (r8)
    01252     ULONGLONG IntAp;                        // argument pointer (r9)
    01253     ULONGLONG IntT2;
    01254     ULONGLONG IntT3;
    01255     ULONGLONG IntSp;                        // stack pointer (r12)
    01256     ULONGLONG IntT4;
    01257     ULONGLONG IntT5;
    01258     ULONGLONG IntT6;
    01259     ULONGLONG IntT7;
    01260     ULONGLONG IntT8;
    01261     ULONGLONG IntT9;
    01262     ULONGLONG IntT10;
    01263     ULONGLONG IntT11;
    01264     ULONGLONG IntT12;
    01265     ULONGLONG IntT13;
    01266     ULONGLONG IntT14;
    01267     ULONGLONG IntT15;
    01268     ULONGLONG IntT16;
    01269     ULONGLONG IntT17;
    01270     ULONGLONG IntT18;
    01271     ULONGLONG IntT19;
    01272     ULONGLONG IntT20;
    01273     ULONGLONG IntT21;
    01274     ULONGLONG IntT22;
    01275
    01276     ULONGLONG IntNats;                      // Nat bits for general registers
    01277                                             // r1-r31 in bit positions 1 to 31.
    01278     ULONGLONG Preds;                        // Predicates
    01279
    01280     ULONGLONG BrS0l;                        // Branch registers
    01281     ULONGLONG BrS0h;
    01282     ULONGLONG BrS1l;
    01283     ULONGLONG BrS1h;
    01284     ULONGLONG BrS2l;
    01285     ULONGLONG BrS2h;
    01286     ULONGLONG BrS3l;
    01287     ULONGLONG BrS3h;
    01288     ULONGLONG BrS4l;
    01289     ULONGLONG BrS4h;
    01290     ULONGLONG BrT0l;
    01291     ULONGLONG BrT0h;
    01292     ULONGLONG BrT1l;
    01293     ULONGLONG BrT1h;
    01294     ULONGLONG BrRpl;                        // return pointer
    01295     ULONGLONG BrRph;
    01296     ULONGLONG BrT2l;
    01297     ULONGLONG BrT2h;
    01298     ULONGLONG BrT3l;
    01299     ULONGLONG BrT3h;
    01300     ULONGLONG BrT4l;
    01301     ULONGLONG BrT4h;
    01302     ULONGLONG BrT5l;
    01303     ULONGLONG BrT5h;
    01304     ULONGLONG BrT6l;
    01305     ULONGLONG BrT6h;
    01306     ULONGLONG BrT7l;
    01307     ULONGLONG BrT7h;
    01308     ULONGLONG BrT8l;
    01309     ULONGLONG BrT8h;
    01310     ULONGLONG BrT9l;
    01311     ULONGLONG BrT9h;
    01312
    01313     // This section is specified/returned if the ContextFlags word contains
    01314     // the flag CONTEXT_CONTROL.
    01315     //
    01316
    01317     // Other application registers
    01318     ULONGLONG ApSunatcr;          // User Nat collection register (preserved)
    01319     ULONGLONG ApSlc;              // Loop counter register (preserved)
    01320     ULONGLONG ApTccv;             // CMPXCHG value register (volatile)
    01321
    01322     ULONGLONG ApDCR;
    01323
    01324     // Register stack info
    01325     ULONGLONG RsPFS;
    01326     ULONGLONG RsBSP;
    01327     ULONGLONG RsBSPStore;
    01328     ULONGLONG RsRSC;
    01329     ULONGLONG RsRNAT;
    01330
    01331     // Trap Status Information
    01332     ULONGLONG StIPSR;   // Interrupt Processor Status
    01333     ULONGLONG StIIP;    // Interrupt IP
    01334     ULONGLONG StIFS;    // Interrupt Frame Marker
    01335
    01336     ULONGLONG Fill;     // padding for 16-byte alignment on stack, if needed
    01337
    01338 // @@END_DDKSPLIT
    01339
    01340 #else
    01341
    01342     ULONG PlaceHolder;
    01343
    01344 #endif // defined(_IA64_)
    01345
    01346 } IA64_RESTART_STATE, *PIA64_RESTART_STATE;
    01347
    01348
    01349
    01350 typedef struct _RESTART_BLOCK {
    01351     ULONG Signature;
    01352     ULONG Length;
    01353     USHORT Version;
    01354     USHORT Revision;
    01355     struct _RESTART_BLOCK * FIRMWARE_PTR NextRestartBlock;
    01356     VOID * FIRMWARE_PTR RestartAddress;
    01357     ULONG BootMasterId;
    01358     ULONG ProcessorId;
    01359     volatile BOOT_STATUS BootStatus;
    01360     ULONG CheckSum;
    01361     ULONG SaveAreaLength;
    01362     union {
    01363         ULONG SaveArea[1];
    01364         ALPHA_RESTART_STATE Alpha;
    01365         I386_RESTART_STATE I386;
    01366         IA64_RESTART_STATE Ia64;
    01367     } u;
    01368
    01369 } RESTART_BLOCK, * FIRMWARE_PTR PRESTART_BLOCK;
    01370
    01371 #if defined(_IA64_)
    01372 #include "poppack.h"
    01373 #endif
    01374
    01375 //
    01376 // Define system parameter block structure.
    01377 //
    01378
    01379 typedef struct _SYSTEM_PARAMETER_BLOCK {
    01380     ULONG Signature;
    01381     ULONG Length;
    01382     USHORT Version;
    01383     USHORT Revision;
    01384     PRESTART_BLOCK RestartBlock;
    01385     PDEBUG_BLOCK DebugBlock;
    01386     VOID * FIRMWARE_PTR GenerateExceptionVector;
    01387     VOID * FIRMWARE_PTR TlbMissExceptionVector;
    01388     ULONG FirmwareVectorLength;
    01389     VOID * FIRMWARE_PTR * FIRMWARE_PTR FirmwareVector;
    01390     ULONG VendorVectorLength;
    01391     VOID * FIRMWARE_PTR * FIRMWARE_PTR VendorVector;
    01392     ULONG AdapterCount;
    01393     ULONG Adapter0Type;
    01394     ULONG Adapter0Length;
    01395     VOID * FIRMWARE_PTR * FIRMWARE_PTR Adapter0Vector;
    01396 } SYSTEM_PARAMETER_BLOCK, * FIRMWARE_PTR PSYSTEM_PARAMETER_BLOCK;
    01397
    01398 //
    01399 // Define macros that call firmware routines indirectly through the firmware
    01400 // vector and provide type checking of argument values.
    01401 //
    01402
    01403 #if defined(_ALPHA_) || defined(_AXP64_)
    01404
    01405 #define SYSTEM_BLOCK ((SYSTEM_PARAMETER_BLOCK *)(KSEG0_BASE | 0x6FE000))
    01406
    01407 #elif defined(_IA64_)
    01408
    01409 extern SYSTEM_PARAMETER_BLOCK GlobalSystemBlock;
    01410
    01411 #define SYSTEM_BLOCK (&GlobalSystemBlock)
    01412
    01413 #elif defined(_X86_)
    01414
    01415 #if defined(ARCI386)
    01416 #define SYSTEM_BLOCK ((PSYSTEM_PARAMETER_BLOCK)(0x1000))
    01417
    01418 #else
    01419 extern SYSTEM_PARAMETER_BLOCK GlobalSystemBlock;
    01420
    01421 #define SYSTEM_BLOCK (&GlobalSystemBlock)
    01422
    01423 #endif
    01424
    01425 #endif
    01426
    01427 //
    01428 // Define software loading and execution functions.
    01429 //
    01430
    01431 #define ArcExecute(ImagePath, Argc, Argv, Envp) \
    01432     ((PARC_EXECUTE_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[ExecuteRoutine])) \
    01433         ((ImagePath), (Argc), (Argv), (Envp))
    01434
    01435 #define ArcInvoke(EntryAddress, StackAddress, Argc, Argv, Envp) \
    01436     ((PARC_INVOKE_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[InvokeRoutine])) \
    01437         ((EntryAddress), (StackAddress), (Argc), (Argv), (Envp))
    01438
    01439 #define ArcLoad(ImagePath, TopAddress, EntryAddress, LowAddress) \
    01440     ((PARC_LOAD_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[LoadRoutine])) \
    01441         ((ImagePath), (TopAddress), (EntryAddress), (LowAddress))
    01442
    01443 //
    01444 // Define program termination functions.
    01445 //
    01446
    01447 #define ArcHalt() \
    01448     ((PARC_HALT_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[HaltRoutine]))()
    01449
    01450 #define ArcPowerDown() \
    01451     ((PARC_POWERDOWN_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[PowerDownRoutine]))()
    01452
    01453 #define ArcRestart() \
    01454     ((PARC_RESTART_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[RestartRoutine]))()
    01455
    01456 #define ArcReboot() \
    01457     ((PARC_REBOOT_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[RebootRoutine]))()
    01458
    01459 #define ArcEnterInteractiveMode() \
    01460     ((PARC_INTERACTIVE_MODE_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[InteractiveModeRoutine]))()
    01461
    01462 //
    01463 // Define configuration functions.
    01464 //
    01465
    01466 #define ArcGetChild(Component) \
    01467     ((PARC_GET_CHILD_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetChildRoutine])) \
    01468         ((Component))
    01469
    01470 #define ArcGetParent(Component) \
    01471     ((PARC_GET_PARENT_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetParentRoutine])) \
    01472         ((Component))
    01473
    01474 #define ArcGetPeer(Component) \
    01475     ((PARC_GET_PEER_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetPeerRoutine])) \
    01476         ((Component))
    01477
    01478 #define ArcAddChild(Component, NewComponent, ConfigurationData) \
    01479     ((PARC_ADD_CHILD_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[AddChildRoutine])) \
    01480         ((Component), (NewComponent), (ConfigurationData))
    01481
    01482 #define ArcDeleteComponent(Component) \
    01483     ((PARC_DELETE_COMPONENT_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[DeleteComponentRoutine])) \
    01484         ((Component))
    01485
    01486 #define ArcGetComponent(Path) \
    01487     ((PARC_GET_COMPONENT_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetComponentRoutine])) \
    01488         ((Path))
    01489
    01490 #define ArcGetConfigurationData(ConfigurationData, Component) \
    01491     ((PARC_GET_DATA_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetDataRoutine])) \
    01492         ((ConfigurationData), (Component))
    01493
    01494 #define ArcSaveConfiguration() \
    01495     ((PARC_SAVE_CONFIGURATION_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[SaveConfigurationRoutine]))()
    01496
    01497 #define ArcGetSystemId() \
    01498     ((PARC_GET_SYSTEM_ID_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetSystemIdRoutine]))()
    01499
    01500 #define ArcGetMemoryDescriptor(MemoryDescriptor) \
    01501     ((PARC_MEMORY_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[MemoryRoutine])) \
    01502         ((MemoryDescriptor))
    01503
    01504 #define ArcGetTime() \
    01505     ((PARC_GET_TIME_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetTimeRoutine]))()
    01506
    01507 #define ArcGetRelativeTime() \
    01508     ((PARC_GET_RELATIVE_TIME_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetRelativeTimeRoutine]))()
    01509
    01510 //
    01511 // Define I/O functions.
    01512 //
    01513
    01514 #define ArcClose(FileId) \
    01515     ((PARC_CLOSE_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[CloseRoutine])) \
    01516         ((FileId))
    01517
    01518 #define ArcGetReadStatus(FileId) \
    01519     ((PARC_READ_STATUS_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[ReadStatusRoutine])) \
    01520         ((FileId))
    01521
    01522 #define ArcMount(MountPath, Operation) \
    01523     ((PARC_MOUNT_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[MountRoutine])) \
    01524         ((MountPath), (Operation))
    01525
    01526 #define ArcOpen(OpenPath, OpenMode, FileId) \
    01527     ((PARC_OPEN_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[OpenRoutine])) \
    01528         ((OpenPath), (OpenMode), (FileId))
    01529
    01530 #define ArcRead(FileId, Buffer, Length, Count) \
    01531     ((PARC_READ_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[ReadRoutine])) \
    01532         ((FileId), (Buffer), (Length), (Count))
    01533
    01534 #define ArcSeek(FileId, Offset, SeekMode) \
    01535     ((PARC_SEEK_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[SeekRoutine])) \
    01536         ((FileId), (Offset), (SeekMode))
    01537
    01538 #define ArcWrite(FileId, Buffer, Length, Count) \
    01539     ((PARC_WRITE_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[WriteRoutine])) \
    01540         ((FileId), (Buffer), (Length), (Count))
    01541
    01542 #define ArcGetFileInformation(FileId, FileInformation) \
    01543     ((PARC_GET_FILE_INFO_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetFileInformationRoutine])) \
    01544         ((FileId), (FileInformation))
    01545
    01546 #define ArcSetFileInformation(FileId, AttributeFlags, AttributeMask) \
    01547     ((PARC_SET_FILE_INFO_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[SetFileInformationRoutine])) \
    01548         ((FileId), (AttributeFlags), (AttributeMask))
    01549
    01550 #define ArcGetDirectoryEntry(FileId, Buffer, Length, Count) \
    01551     ((PARC_GET_DIRECTORY_ENTRY_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetDirectoryEntryRoutine])) \
    01552         ((FileId), (Buffer), (Length), (Count))
    01553
    01554
    01555 //
    01556 // Define environment functions.
    01557 //
    01558 #if defined(_AXP64_) && defined(_NTHAL_)
    01559
    01560 __inline
    01561 CHAR * FIRMWARE_PTR
    01562 ArcGetEnvironmentVariable(
    01563     IN PCHAR Variable
    01564     )
    01565 {
    01566     CHAR * FIRMWARE_PTR FwPtr;
    01567     KIRQL OldIrql = FwAcquireFirmwareLock();
    01568     FwPtr = HalpArcGetEnvironmentVariable(Variable);
    01569     FwReleaseFirmwareLock(OldIrql);
    01570     return FwPtr;
    01571 }
    01572 #else
    01573
    01574 #define ArcGetEnvironmentVariable(Variable) \
    01575     ((PARC_GET_ENVIRONMENT_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetEnvironmentRoutine])) \
    01576         ((Variable))
    01577 #endif // _AXP64_  && defined(_NTHAL_)
    01578
    01579 #if defined(_AXP64_) && defined(_NTHAL_)
    01580
    01581 __inline
    01582 ARC_STATUS
    01583 ArcSetEnvironmentVariable(
    01584     IN PCHAR Variable,
    01585     IN PCHAR Value
    01586     )
    01587 {
    01588     ARC_STATUS ArcStatus;
    01589     KIRQL OldIrql = FwAcquireFirmwareLock();
    01590     ArcStatus = HalpArcSetEnvironmentVariable(Variable, Value);
    01591     FwReleaseFirmwareLock(OldIrql);
    01592     return ArcStatus;
    01593 }
    01594 #else
    01595
    01596 #define ArcSetEnvironmentVariable(Variable, Value) \
    01597     ((PARC_SET_ENVIRONMENT_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[SetEnvironmentRoutine])) \
    01598         ((Variable), (Value))
    01599 #endif // _AXP64_ && defined(_NTHAL_)
    01600
    01601
    01602 //
    01603 // Define cache flush functions.
    01604 //
    01605
    01606 #define ArcFlushAllCaches() \
    01607     ((PARC_FLUSH_ALL_CACHES_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[FlushAllCachesRoutine]))()
    01608
    01609 //
    01610 // Define TestUnicodeCharacter and GetDisplayStatus functions.
    01611 //
    01612
    01613 #define ArcTestUnicodeCharacter(FileId, UnicodeCharacter) \
    01614     ((PARC_TEST_UNICODE_CHARACTER_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[TestUnicodeCharacterRoutine])) \
    01615         ((FileId), (UnicodeCharacter))
    01616
    01617 #define ArcGetDisplayStatus(FileId) \
    01618     ((PARC_GET_DISPLAY_STATUS_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetDisplayStatusRoutine])) \
    01619         ((FileId))
    01620
    01621
    01622 //
    01623 // Define configuration data structure used in all systems.
    01624 //
    01625
    01626 typedef struct _CONFIGURATION_COMPONENT_DATA {
    01627     struct _CONFIGURATION_COMPONENT_DATA *Parent;
    01628     struct _CONFIGURATION_COMPONENT_DATA *Child;
    01629     struct _CONFIGURATION_COMPONENT_DATA *Sibling;
    01630     CONFIGURATION_COMPONENT ComponentEntry;
    01631     PVOID ConfigurationData;
    01632 } CONFIGURATION_COMPONENT_DATA, *PCONFIGURATION_COMPONENT_DATA;
    01633
    01634 //
    01635 // Define generic display configuration data structure.
    01636 //
    01637
    01638 typedef struct _MONITOR_CONFIGURATION_DATA {
    01639     USHORT Version;
    01640     USHORT Revision;
    01641     USHORT HorizontalResolution;
    01642     USHORT HorizontalDisplayTime;
    01643     USHORT HorizontalBackPorch;
    01644     USHORT HorizontalFrontPorch;
    01645     USHORT HorizontalSync;
    01646     USHORT VerticalResolution;
    01647     USHORT VerticalBackPorch;
    01648     USHORT VerticalFrontPorch;
    01649     USHORT VerticalSync;
    01650     USHORT HorizontalScreenSize;
    01651     USHORT VerticalScreenSize;
    01652 } MONITOR_CONFIGURATION_DATA, *PMONITOR_CONFIGURATION_DATA;
    01653
    01654 //
    01655 // Define generic floppy configuration data structure.
    01656 //
    01657
    01658 typedef struct _FLOPPY_CONFIGURATION_DATA {
    01659     USHORT Version;
    01660     USHORT Revision;
    01661     CHAR Size[8];
    01662     ULONG MaxDensity;
    01663     ULONG MountDensity;
    01664 } FLOPPY_CONFIGURATION_DATA, *PFLOPPY_CONFIGURATION_DATA;
    01665
    01666 //
    01667 // Define memory allocation structures used in all systems.
    01668 //
    01669
    01670 typedef enum _TYPE_OF_MEMORY {
    01671     LoaderExceptionBlock = MemoryExceptionBlock,            //  0
    01672     LoaderSystemBlock = MemorySystemBlock,                  //  1
    01673     LoaderFree = MemoryFree,                                //  2
    01674     LoaderBad = MemoryBad,                                  //  3
    01675     LoaderLoadedProgram = MemoryLoadedProgram,              //  4
    01676     LoaderFirmwareTemporary = MemoryFirmwareTemporary,      //  5
    01677     LoaderFirmwarePermanent = MemoryFirmwarePermanent,      //  6
    01678     LoaderOsloaderHeap,                                     //  7
    01679     LoaderOsloaderStack,                                    //  8
    01680     LoaderSystemCode,                                       //  9
    01681     LoaderHalCode,                                          //  a
    01682     LoaderBootDriver,                                       //  b
    01683     LoaderConsoleInDriver,                                  //  c
    01684     LoaderConsoleOutDriver,                                 //  d
    01685     LoaderStartupDpcStack,                                  //  e
    01686     LoaderStartupKernelStack,                               //  f
    01687     LoaderStartupPanicStack,                                // 10
    01688     LoaderStartupPcrPage,                                   // 11
    01689     LoaderStartupPdrPage,                                   // 12
    01690     LoaderRegistryData,                                     // 13
    01691     LoaderMemoryData,                                       // 14
    01692     LoaderNlsData,                                          // 15
    01693     LoaderSpecialMemory,                                    // 16
    01694     LoaderBBTMemory,                                        // 17
    01695     LoaderMaximum                                           // 18
    01696 } TYPE_OF_MEMORY;
    01697
    01698 typedef struct _MEMORY_ALLOCATION_DESCRIPTOR {
    01699     LIST_ENTRY ListEntry;
    01700     TYPE_OF_MEMORY MemoryType;
    01701     ULONG BasePage;
    01702     ULONG PageCount;
    01703 } MEMORY_ALLOCATION_DESCRIPTOR, *PMEMORY_ALLOCATION_DESCRIPTOR;
    01704
    01705
    01706 //
    01707 // Define loader parameter block structure.
    01708 //
    01709
    01710 typedef struct _NLS_DATA_BLOCK {
    01711     PVOID AnsiCodePageData;
    01712     PVOID OemCodePageData;
    01713     PVOID UnicodeCaseTableData;
    01714 } NLS_DATA_BLOCK, *PNLS_DATA_BLOCK;
    01715
    01716 typedef struct _ARC_DISK_SIGNATURE {
    01717     LIST_ENTRY ListEntry;
    01718     ULONG   Signature;
    01719     PCHAR   ArcName;
    01720     ULONG   CheckSum;
    01721     BOOLEAN ValidPartitionTable;
    01722     BOOLEAN xInt13;
    01723 } ARC_DISK_SIGNATURE, *PARC_DISK_SIGNATURE;
    01724
    01725 typedef struct _ARC_DISK_INFORMATION {
    01726     LIST_ENTRY DiskSignatures;
    01727 } ARC_DISK_INFORMATION, *PARC_DISK_INFORMATION;
    01728
    01729 typedef struct _I386_LOADER_BLOCK {
    01730
    01731 #if defined(_X86_)
    01732
    01733     PVOID CommonDataArea;
    01734     ULONG MachineType;      // Temporary only
    01735     ULONG VirtualBias;
    01736
    01737 #else
    01738
    01739     ULONG PlaceHolder;
    01740
    01741 #endif
    01742
    01743 } I386_LOADER_BLOCK, *PI386_LOADER_BLOCK;
    01744
    01745 typedef struct _ALPHA_LOADER_BLOCK {
    01746
    01747 #if defined(_ALPHA_) || defined(_AXP64_)
    01748
    01749     ULONG_PTR DpcStack;
    01750     ULONG FirstLevelDcacheSize;
    01751     ULONG FirstLevelDcacheFillSize;
    01752     ULONG FirstLevelIcacheSize;
    01753     ULONG FirstLevelIcacheFillSize;
    01754     ULONG_PTR GpBase;
    01755     ULONG_PTR PanicStack;
    01756     ULONG PcrPage;
    01757     ULONG PdrPage;
    01758     ULONG SecondLevelDcacheSize;
    01759     ULONG SecondLevelDcacheFillSize;
    01760     ULONG SecondLevelIcacheSize;
    01761     ULONG SecondLevelIcacheFillSize;
    01762     ULONG PhysicalAddressBits;
    01763     ULONG MaximumAddressSpaceNumber;
    01764     UCHAR SystemSerialNumber[16];
    01765     UCHAR SystemType[8];
    01766     ULONG SystemVariant;
    01767     ULONG SystemRevision;
    01768     ULONG ProcessorType;
    01769     ULONG ProcessorRevision;
    01770     ULONG CycleClockPeriod;
    01771     ULONG PageSize;
    01772     PVOID RestartBlock;
    01773     ULONGLONG FirmwareRestartAddress;
    01774     ULONG FirmwareRevisionId;
    01775     PVOID PalBaseAddress;
    01776     UCHAR FirmwareVersion[16];
    01777     UCHAR FirmwareBuildTimeStamp[20];
    01778
    01779 #else
    01780
    01781     ULONG PlaceHolder;
    01782
    01783 #endif
    01784
    01785 } ALPHA_LOADER_BLOCK, *PALPHA_LOADER_BLOCK;
    01786
    01787 #if defined(_IA64_)
    01788 typedef struct _TR_INFO {
    01789     ULONG Index;
    01790     ULONG PageSize;
    01791     ULONGLONG VirtualAddress;
    01792     ULONGLONG PhysicalAddress;
    01793 } TR_INFO, *PTR_INFO;
    01794 #endif
    01795
    01796 typedef struct _IA64_LOADER_BLOCK {
    01797
    01798 #if defined(_IA64_)
    01799
    01800     ULONG_PTR SalSystemTable;
    01801     ULONG_PTR MPSConfigTable;
    01802     ULONG_PTR AcpiRsdt;
    01803     ULONG_PTR KernelPhysicalBase;
    01804     ULONG_PTR KernelVirtualBase;
    01805     ULONG_PTR InterruptStack;
    01806     ULONG_PTR PanicStack;
    01807     ULONG_PTR PcrPage;
    01808     ULONG_PTR PdrPage;
    01809     ULONG_PTR PcrPage2;
    01810     ULONG MachineType;
    01811     TR_INFO ItrInfo[8];
    01812     TR_INFO DtrInfo[8];
    01813     ULONG_PTR EfiSystemTable;
    01814     ULONG_PTR PalProcVirtual;
    01815
    01816 #else
    01817
    01818     ULONG PlaceHolder;
    01819
    01820 #endif
    01821
    01822 } IA64_LOADER_BLOCK, *PIA64_LOADER_BLOCK;
    01823
    01824 typedef struct _LOADER_PARAMETER_EXTENSION {
    01825     ULONG   Size; // set to sizeof (struct _LOADER_PARAMETER_EXTENSION)
    01826     PROFILE_PARAMETER_BLOCK Profile;
    01827     ULONG   MajorVersion;
    01828     ULONG   MinorVersion;
    01829     PVOID   InfFileImage;   // Inf used to identify "broken" machines.
    01830     ULONG   InfFileSize;
    01831
    01832     //
    01833     // Pointer to the triage block, if present.
    01834     //
    01835
    01836     PVOID TriageDumpBlock;
    01837
    01838
    01839 } LOADER_PARAMETER_EXTENSION, *PLOADER_PARAMETER_EXTENSION;
    01840
    01841 struct _SETUP_LOADER_BLOCK;
    01842
    01843 typedef struct _LOADER_PARAMETER_BLOCK {
    01844     LIST_ENTRY LoadOrderListHead;
    01845     LIST_ENTRY MemoryDescriptorListHead;
    01846     LIST_ENTRY BootDriverListHead;
    01847     ULONG_PTR KernelStack;
    01848     ULONG_PTR Prcb;
    01849     ULONG_PTR Process;
    01850     ULONG_PTR Thread;
    01851     ULONG RegistryLength;
    01852     PVOID RegistryBase;
    01853     PCONFIGURATION_COMPONENT_DATA ConfigurationRoot;
    01854     PCHAR ArcBootDeviceName;
    01855     PCHAR ArcHalDeviceName;
    01856     PCHAR NtBootPathName;
    01857     PCHAR NtHalPathName;
    01858     PCHAR LoadOptions;
    01859     PNLS_DATA_BLOCK NlsData;
    01860     PARC_DISK_INFORMATION ArcDiskInformation;
    01861     PVOID OemFontFile;
    01862     struct _SETUP_LOADER_BLOCK *SetupLoaderBlock;
    01863     PLOADER_PARAMETER_EXTENSION Extension;
    01864
    01865     union {
    01866         I386_LOADER_BLOCK I386;
    01867         ALPHA_LOADER_BLOCK Alpha;
    01868         IA64_LOADER_BLOCK Ia64;
    01869     } u;
    01870
    01871 } LOADER_PARAMETER_BLOCK, *PLOADER_PARAMETER_BLOCK;
    01872
    01873 #endif // _ARC_
    01874