Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2051 lines
46 KiB

  1. /*++ BUILD Version: 0010 // Increment this if a change has global effects
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. arc.h
  5. Abstract:
  6. This header file defines the ARC system firmware interface and the
  7. NT structures that are dependent on ARC types.
  8. Author:
  9. David N. Cutler (davec) 18-May-1991
  10. Revision History:
  11. --*/
  12. #ifndef _ARC_
  13. #define _ARC_
  14. #include "profiles.h"
  15. //
  16. // Define console input and console output file ids.
  17. //
  18. #define ARC_CONSOLE_INPUT 0
  19. #define ARC_CONSOLE_OUTPUT 1
  20. //
  21. // Define ARC_STATUS type.
  22. //
  23. typedef ULONG ARC_STATUS;
  24. //
  25. // Define the firmware entry point numbers.
  26. //
  27. typedef enum _FIRMWARE_ENTRY {
  28. LoadRoutine,
  29. InvokeRoutine,
  30. ExecuteRoutine,
  31. HaltRoutine,
  32. PowerDownRoutine,
  33. RestartRoutine,
  34. RebootRoutine,
  35. InteractiveModeRoutine,
  36. Reserved1,
  37. GetPeerRoutine,
  38. GetChildRoutine,
  39. GetParentRoutine,
  40. GetDataRoutine,
  41. AddChildRoutine,
  42. DeleteComponentRoutine,
  43. GetComponentRoutine,
  44. SaveConfigurationRoutine,
  45. GetSystemIdRoutine,
  46. MemoryRoutine,
  47. Reserved2,
  48. GetTimeRoutine,
  49. GetRelativeTimeRoutine,
  50. GetDirectoryEntryRoutine,
  51. OpenRoutine,
  52. CloseRoutine,
  53. ReadRoutine,
  54. ReadStatusRoutine,
  55. WriteRoutine,
  56. SeekRoutine,
  57. MountRoutine,
  58. GetEnvironmentRoutine,
  59. SetEnvironmentRoutine,
  60. GetFileInformationRoutine,
  61. SetFileInformationRoutine,
  62. FlushAllCachesRoutine,
  63. TestUnicodeCharacterRoutine,
  64. GetDisplayStatusRoutine,
  65. MaximumRoutine
  66. } FIRMWARE_ENTRY;
  67. //
  68. // Define software loading and execution routine types.
  69. //
  70. typedef
  71. ARC_STATUS
  72. (*PARC_EXECUTE_ROUTINE) (
  73. IN CHAR * FIRMWARE_PTR ImagePath,
  74. IN ULONG Argc,
  75. IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Argv,
  76. IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Envp
  77. );
  78. typedef
  79. ARC_STATUS
  80. (*PARC_INVOKE_ROUTINE) (
  81. IN ULONG EntryAddress,
  82. IN ULONG StackAddress,
  83. IN ULONG Argc,
  84. IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Argv,
  85. IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Envp
  86. );
  87. typedef
  88. ARC_STATUS
  89. (*PARC_LOAD_ROUTINE) (
  90. IN CHAR * FIRMWARE_PTR ImagePath,
  91. IN ULONG TopAddress,
  92. OUT ULONG * FIRMWARE_PTR EntryAddress,
  93. OUT ULONG * FIRMWARE_PTR LowAddress
  94. );
  95. //
  96. // Define firmware software loading and execution prototypes.
  97. //
  98. ARC_STATUS
  99. FwExecute (
  100. IN CHAR * FIRMWARE_PTR ImagePath,
  101. IN ULONG Argc,
  102. IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Argv,
  103. IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Envp
  104. );
  105. ARC_STATUS
  106. FwInvoke (
  107. IN ULONG EntryAddress,
  108. IN ULONG StackAddress,
  109. IN ULONG Argc,
  110. IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Argv,
  111. IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Envp
  112. );
  113. ARC_STATUS
  114. FwLoad (
  115. IN CHAR * FIRMWARE_PTR ImagePath,
  116. IN ULONG TopAddress,
  117. OUT ULONG * FIRMWARE_PTR EntryAddress,
  118. OUT ULONG * FIRMWARE_PTR LowAddress
  119. );
  120. //
  121. // Define program termination routine types.
  122. //
  123. typedef
  124. VOID
  125. (*PARC_HALT_ROUTINE) (
  126. VOID
  127. );
  128. typedef
  129. VOID
  130. (*PARC_POWERDOWN_ROUTINE) (
  131. VOID
  132. );
  133. typedef
  134. VOID
  135. (*PARC_RESTART_ROUTINE) (
  136. VOID
  137. );
  138. typedef
  139. VOID
  140. (*PARC_REBOOT_ROUTINE) (
  141. VOID
  142. );
  143. typedef
  144. VOID
  145. (*PARC_INTERACTIVE_MODE_ROUTINE) (
  146. VOID
  147. );
  148. //
  149. // Define firmware program termination prototypes.
  150. //
  151. VOID
  152. FwHalt (
  153. VOID
  154. );
  155. VOID
  156. FwPowerDown (
  157. VOID
  158. );
  159. VOID
  160. FwRestart (
  161. VOID
  162. );
  163. VOID
  164. FwReboot (
  165. VOID
  166. );
  167. VOID
  168. FwEnterInteractiveMode (
  169. VOID
  170. );
  171. // begin_ntddk
  172. //
  173. // Define configuration routine types.
  174. //
  175. // Configuration information.
  176. //
  177. // end_ntddk
  178. typedef enum _CONFIGURATION_CLASS {
  179. SystemClass,
  180. ProcessorClass,
  181. CacheClass,
  182. AdapterClass,
  183. ControllerClass,
  184. PeripheralClass,
  185. MemoryClass,
  186. MaximumClass
  187. } CONFIGURATION_CLASS, *PCONFIGURATION_CLASS;
  188. // begin_ntddk
  189. typedef enum _CONFIGURATION_TYPE {
  190. ArcSystem,
  191. CentralProcessor,
  192. FloatingPointProcessor,
  193. PrimaryIcache,
  194. PrimaryDcache,
  195. SecondaryIcache,
  196. SecondaryDcache,
  197. SecondaryCache,
  198. EisaAdapter,
  199. TcAdapter,
  200. ScsiAdapter,
  201. DtiAdapter,
  202. MultiFunctionAdapter,
  203. DiskController,
  204. TapeController,
  205. CdromController,
  206. WormController,
  207. SerialController,
  208. NetworkController,
  209. DisplayController,
  210. ParallelController,
  211. PointerController,
  212. KeyboardController,
  213. AudioController,
  214. OtherController,
  215. DiskPeripheral,
  216. FloppyDiskPeripheral,
  217. TapePeripheral,
  218. ModemPeripheral,
  219. MonitorPeripheral,
  220. PrinterPeripheral,
  221. PointerPeripheral,
  222. KeyboardPeripheral,
  223. TerminalPeripheral,
  224. OtherPeripheral,
  225. LinePeripheral,
  226. NetworkPeripheral,
  227. SystemMemory,
  228. DockingInformation,
  229. RealModeIrqRoutingTable,
  230. RealModePCIEnumeration,
  231. MaximumType
  232. } CONFIGURATION_TYPE, *PCONFIGURATION_TYPE;
  233. // end_ntddk
  234. typedef struct _CONFIGURATION_COMPONENT {
  235. CONFIGURATION_CLASS Class;
  236. CONFIGURATION_TYPE Type;
  237. DEVICE_FLAGS Flags;
  238. USHORT Version;
  239. USHORT Revision;
  240. ULONG Key;
  241. ULONG AffinityMask;
  242. ULONG ConfigurationDataLength;
  243. ULONG IdentifierLength;
  244. CHAR * FIRMWARE_PTR Identifier;
  245. } CONFIGURATION_COMPONENT, * FIRMWARE_PTR PCONFIGURATION_COMPONENT;
  246. typedef
  247. PCONFIGURATION_COMPONENT
  248. (*PARC_GET_CHILD_ROUTINE) (
  249. IN PCONFIGURATION_COMPONENT Component OPTIONAL
  250. );
  251. typedef
  252. PCONFIGURATION_COMPONENT
  253. (*PARC_GET_PARENT_ROUTINE) (
  254. IN PCONFIGURATION_COMPONENT Component
  255. );
  256. typedef
  257. PCONFIGURATION_COMPONENT
  258. (*PARC_GET_PEER_ROUTINE) (
  259. IN PCONFIGURATION_COMPONENT Component
  260. );
  261. typedef
  262. PCONFIGURATION_COMPONENT
  263. (*PARC_ADD_CHILD_ROUTINE) (
  264. IN PCONFIGURATION_COMPONENT Component,
  265. IN PCONFIGURATION_COMPONENT NewComponent,
  266. IN VOID * FIRMWARE_PTR ConfigurationData
  267. );
  268. typedef
  269. ARC_STATUS
  270. (*PARC_DELETE_COMPONENT_ROUTINE) (
  271. IN PCONFIGURATION_COMPONENT Component
  272. );
  273. typedef
  274. PCONFIGURATION_COMPONENT
  275. (*PARC_GET_COMPONENT_ROUTINE) (
  276. IN CHAR * FIRMWARE_PTR Path
  277. );
  278. typedef
  279. ARC_STATUS
  280. (*PARC_GET_DATA_ROUTINE) (
  281. OUT VOID * FIRMWARE_PTR ConfigurationData,
  282. IN PCONFIGURATION_COMPONENT Component
  283. );
  284. typedef
  285. ARC_STATUS
  286. (*PARC_SAVE_CONFIGURATION_ROUTINE) (
  287. VOID
  288. );
  289. //
  290. // Define firmware configuration prototypes.
  291. //
  292. PCONFIGURATION_COMPONENT
  293. FwGetChild (
  294. IN PCONFIGURATION_COMPONENT Component OPTIONAL
  295. );
  296. PCONFIGURATION_COMPONENT
  297. FwGetParent (
  298. IN PCONFIGURATION_COMPONENT Component
  299. );
  300. PCONFIGURATION_COMPONENT
  301. FwGetPeer (
  302. IN PCONFIGURATION_COMPONENT Component
  303. );
  304. PCONFIGURATION_COMPONENT
  305. FwAddChild (
  306. IN PCONFIGURATION_COMPONENT Component,
  307. IN PCONFIGURATION_COMPONENT NewComponent,
  308. IN VOID * FIRMWARE_PTR ConfigurationData OPTIONAL
  309. );
  310. ARC_STATUS
  311. FwDeleteComponent (
  312. IN PCONFIGURATION_COMPONENT Component
  313. );
  314. PCONFIGURATION_COMPONENT
  315. FwGetComponent(
  316. IN CHAR * FIRMWARE_PTR Path
  317. );
  318. ARC_STATUS
  319. FwGetConfigurationData (
  320. OUT VOID * FIRMWARE_PTR ConfigurationData,
  321. IN PCONFIGURATION_COMPONENT Component
  322. );
  323. ARC_STATUS
  324. FwSaveConfiguration (
  325. VOID
  326. );
  327. //
  328. // System information.
  329. //
  330. typedef struct _SYSTEM_ID {
  331. CHAR VendorId[8];
  332. CHAR ProductId[8];
  333. } SYSTEM_ID, * FIRMWARE_PTR PSYSTEM_ID;
  334. typedef
  335. PSYSTEM_ID
  336. (*PARC_GET_SYSTEM_ID_ROUTINE) (
  337. VOID
  338. );
  339. //
  340. // Define system identifier query routine type.
  341. //
  342. PSYSTEM_ID
  343. FwGetSystemId (
  344. VOID
  345. );
  346. //
  347. // Memory information.
  348. //
  349. typedef enum _MEMORY_TYPE {
  350. MemoryExceptionBlock,
  351. MemorySystemBlock,
  352. MemoryFree,
  353. MemoryBad,
  354. MemoryLoadedProgram,
  355. MemoryFirmwareTemporary,
  356. MemoryFirmwarePermanent,
  357. MemoryFreeContiguous,
  358. MemorySpecialMemory,
  359. MemoryMaximum
  360. } MEMORY_TYPE;
  361. typedef struct _MEMORY_DESCRIPTOR {
  362. MEMORY_TYPE MemoryType;
  363. ULONG BasePage;
  364. ULONG PageCount;
  365. } MEMORY_DESCRIPTOR, * FIRMWARE_PTR PMEMORY_DESCRIPTOR;
  366. #if defined(_IA64_)
  367. //
  368. // Cache Attribute.
  369. //
  370. #define WTU 0x1
  371. #define WTO 0x2
  372. #define WBO 0x4
  373. #define WBU 0x8
  374. #define WCU 0x10
  375. #define UCU 0x20
  376. #define UCUE 0x40
  377. #define UCO 0x80
  378. typedef enum _MEMORY_USAGE_TYPE {
  379. RegularMemory,
  380. MemoryMappedIo,
  381. ProcessorIoBlock,
  382. BootServicesCode,
  383. BootServicesData,
  384. RuntimeServicesCode,
  385. RuntimeServicesData,
  386. FirmwareSpace,
  387. DisplayMemory,
  388. CacheAttributeMaximum
  389. } MEMORY_USAGE_TYPE;
  390. typedef struct _CACHE_ATTRIBUTE_DESCRIPTOR {
  391. LIST_ENTRY ListEntry;
  392. MEMORY_USAGE_TYPE MemoryUsage;
  393. ULONG CacheAttribute;
  394. ULONG BasePage;
  395. ULONG PageCount;
  396. } CACHE_ATTRIBUTE_DESCRIPTOR, *PCACHE_ATTRIBUTE_DESCRIPTOR;
  397. #endif // defined(_IA64_)
  398. typedef
  399. PMEMORY_DESCRIPTOR
  400. (*PARC_MEMORY_ROUTINE) (
  401. IN PMEMORY_DESCRIPTOR MemoryDescriptor OPTIONAL
  402. );
  403. //
  404. // Define memory query routine type.
  405. //
  406. PMEMORY_DESCRIPTOR
  407. FwGetMemoryDescriptor (
  408. IN PMEMORY_DESCRIPTOR MemoryDescriptor OPTIONAL
  409. );
  410. //
  411. // Query time functions.
  412. //
  413. typedef
  414. PTIME_FIELDS
  415. (*PARC_GET_TIME_ROUTINE) (
  416. VOID
  417. );
  418. typedef
  419. ULONG
  420. (*PARC_GET_RELATIVE_TIME_ROUTINE) (
  421. VOID
  422. );
  423. //
  424. // Define query time routine types.
  425. //
  426. PTIME_FIELDS
  427. FwGetTime (
  428. VOID
  429. );
  430. ULONG
  431. FwGetRelativeTime (
  432. VOID
  433. );
  434. //
  435. // Define I/O routine types.
  436. //
  437. #define ArcReadOnlyFile 1
  438. #define ArcHiddenFile 2
  439. #define ArcSystemFile 4
  440. #define ArcArchiveFile 8
  441. #define ArcDirectoryFile 16
  442. #define ArcDeleteFile 32
  443. typedef enum _OPEN_MODE {
  444. ArcOpenReadOnly,
  445. ArcOpenWriteOnly,
  446. ArcOpenReadWrite,
  447. ArcCreateWriteOnly,
  448. ArcCreateReadWrite,
  449. ArcSupersedeWriteOnly,
  450. ArcSupersedeReadWrite,
  451. ArcOpenDirectory,
  452. ArcCreateDirectory,
  453. ArcOpenMaximumMode
  454. } OPEN_MODE;
  455. typedef struct _FILE_INFORMATION {
  456. LARGE_INTEGER StartingAddress;
  457. LARGE_INTEGER EndingAddress;
  458. LARGE_INTEGER CurrentPosition;
  459. CONFIGURATION_TYPE Type;
  460. ULONG FileNameLength;
  461. UCHAR Attributes;
  462. CHAR FileName[32];
  463. } FILE_INFORMATION, * FIRMWARE_PTR PFILE_INFORMATION;
  464. typedef enum _SEEK_MODE {
  465. SeekAbsolute,
  466. SeekRelative,
  467. SeekMaximum
  468. } SEEK_MODE;
  469. typedef enum _MOUNT_OPERATION {
  470. MountLoadMedia,
  471. MountUnloadMedia,
  472. MountMaximum
  473. } MOUNT_OPERATION;
  474. typedef struct _DIRECTORY_ENTRY {
  475. ULONG FileNameLength;
  476. UCHAR FileAttribute;
  477. CHAR FileName[32];
  478. } DIRECTORY_ENTRY, * FIRMWARE_PTR PDIRECTORY_ENTRY;
  479. typedef
  480. ARC_STATUS
  481. (*PARC_CLOSE_ROUTINE) (
  482. IN ULONG FileId
  483. );
  484. typedef
  485. ARC_STATUS
  486. (*PARC_MOUNT_ROUTINE) (
  487. IN CHAR * FIRMWARE_PTR MountPath,
  488. IN MOUNT_OPERATION Operation
  489. );
  490. typedef
  491. ARC_STATUS
  492. (*PARC_OPEN_ROUTINE) (
  493. IN CHAR * FIRMWARE_PTR OpenPath,
  494. IN OPEN_MODE OpenMode,
  495. OUT ULONG * FIRMWARE_PTR FileId
  496. );
  497. typedef
  498. ARC_STATUS
  499. (*PARC_READ_ROUTINE) (
  500. IN ULONG FileId,
  501. OUT VOID * FIRMWARE_PTR Buffer,
  502. IN ULONG Length,
  503. OUT ULONG * FIRMWARE_PTR Count
  504. );
  505. typedef
  506. ARC_STATUS
  507. (*PARC_READ_STATUS_ROUTINE) (
  508. IN ULONG FileId
  509. );
  510. typedef
  511. ARC_STATUS
  512. (*PARC_SEEK_ROUTINE) (
  513. IN ULONG FileId,
  514. IN LARGE_INTEGER * FIRMWARE_PTR Offset,
  515. IN SEEK_MODE SeekMode
  516. );
  517. typedef
  518. ARC_STATUS
  519. (*PARC_WRITE_ROUTINE) (
  520. IN ULONG FileId,
  521. IN VOID * FIRMWARE_PTR Buffer,
  522. IN ULONG Length,
  523. OUT ULONG * FIRMWARE_PTR Count
  524. );
  525. typedef
  526. ARC_STATUS
  527. (*PARC_GET_FILE_INFO_ROUTINE) (
  528. IN ULONG FileId,
  529. OUT PFILE_INFORMATION FileInformation
  530. );
  531. typedef
  532. ARC_STATUS
  533. (*PARC_SET_FILE_INFO_ROUTINE) (
  534. IN ULONG FileId,
  535. IN ULONG AttributeFlags,
  536. IN ULONG AttributeMask
  537. );
  538. typedef
  539. ARC_STATUS
  540. (*PARC_GET_DIRECTORY_ENTRY_ROUTINE) (
  541. IN ULONG FileId,
  542. OUT PDIRECTORY_ENTRY Buffer,
  543. IN ULONG Length,
  544. OUT ULONG * FIRMWARE_PTR Count
  545. );
  546. //
  547. // Define firmware I/O prototypes.
  548. //
  549. ARC_STATUS
  550. FwClose (
  551. IN ULONG FileId
  552. );
  553. ARC_STATUS
  554. FwMount (
  555. IN CHAR * FIRMWARE_PTR MountPath,
  556. IN MOUNT_OPERATION Operation
  557. );
  558. ARC_STATUS
  559. FwOpen (
  560. IN CHAR * FIRMWARE_PTR OpenPath,
  561. IN OPEN_MODE OpenMode,
  562. OUT ULONG * FIRMWARE_PTR FileId
  563. );
  564. ARC_STATUS
  565. FwRead (
  566. IN ULONG FileId,
  567. OUT VOID * FIRMWARE_PTR Buffer,
  568. IN ULONG Length,
  569. OUT ULONG * FIRMWARE_PTR Count
  570. );
  571. ARC_STATUS
  572. FwGetReadStatus (
  573. IN ULONG FileId
  574. );
  575. ARC_STATUS
  576. FwSeek (
  577. IN ULONG FileId,
  578. IN LARGE_INTEGER * FIRMWARE_PTR Offset,
  579. IN SEEK_MODE SeekMode
  580. );
  581. ARC_STATUS
  582. FwWrite (
  583. IN ULONG FileId,
  584. IN VOID * FIRMWARE_PTR Buffer,
  585. IN ULONG Length,
  586. OUT ULONG * FIRMWARE_PTR Count
  587. );
  588. ARC_STATUS
  589. FwGetFileInformation (
  590. IN ULONG FileId,
  591. OUT PFILE_INFORMATION FileInformation
  592. );
  593. ARC_STATUS
  594. FwSetFileInformation (
  595. IN ULONG FileId,
  596. IN ULONG AttributeFlags,
  597. IN ULONG AttributeMask
  598. );
  599. ARC_STATUS
  600. FwGetDirectoryEntry (
  601. IN ULONG FileId,
  602. OUT PDIRECTORY_ENTRY Buffer,
  603. IN ULONG Length,
  604. OUT ULONG * FIRMWARE_PTR Count
  605. );
  606. //
  607. // Define environment routine types.
  608. //
  609. typedef
  610. CHAR * FIRMWARE_PTR
  611. (*PARC_GET_ENVIRONMENT_ROUTINE) (
  612. IN CHAR * FIRMWARE_PTR Variable
  613. );
  614. typedef
  615. ARC_STATUS
  616. (*PARC_SET_ENVIRONMENT_ROUTINE) (
  617. IN CHAR * FIRMWARE_PTR Variable,
  618. IN CHAR * FIRMWARE_PTR Value
  619. );
  620. //
  621. // Define firmware environment prototypes.
  622. //
  623. CHAR * FIRMWARE_PTR
  624. FwGetEnvironmentVariable (
  625. IN CHAR * FIRMWARE_PTR Variable
  626. );
  627. ARC_STATUS
  628. FwSetEnvironmentVariable (
  629. IN CHAR * FIRMWARE_PTR Variable,
  630. IN CHAR * FIRMWARE_PTR Value
  631. );
  632. //
  633. // Define functions to acquire and release the firmware lock and the stub
  634. // function prototypes necessary to interface with the 32-bit firmware on
  635. // 64-bit systems.
  636. //
  637. // These routines are required for the 64-bit system until (if) 64-bit
  638. // firmware is ever supplied.
  639. //
  640. #if defined(_AXP64_) && defined(_NTHAL_)
  641. extern ULONGLONG HalpMarshallBuffer[];
  642. extern KSPIN_LOCK HalpFirmwareLock;
  643. CHAR * FIRMWARE_PTR
  644. HalpArcGetEnvironmentVariable(
  645. IN CHAR * FIRMWARE_PTR Variable
  646. );
  647. ARC_STATUS
  648. HalpArcSetEnvironmentVariable(
  649. IN CHAR * FIRMWARE_PTR Variable,
  650. IN CHAR * FIRMWARE_PTR Value
  651. );
  652. KIRQL
  653. FwAcquireFirmwareLock(
  654. VOID
  655. );
  656. VOID
  657. FwReleaseFirmwareLock(
  658. IN KIRQL OldIrql
  659. );
  660. #endif // _AXP64_ && defined(_NTHAL_)
  661. //
  662. // Define cache flush routine types
  663. //
  664. typedef
  665. VOID
  666. (*PARC_FLUSH_ALL_CACHES_ROUTINE) (
  667. VOID
  668. );
  669. //
  670. // Define firmware cache flush prototypes.
  671. //
  672. VOID
  673. FwFlushAllCaches (
  674. VOID
  675. );
  676. //
  677. // Define TestUnicodeCharacter and GetDisplayStatus routines.
  678. //
  679. typedef struct _ARC_DISPLAY_STATUS {
  680. USHORT CursorXPosition;
  681. USHORT CursorYPosition;
  682. USHORT CursorMaxXPosition;
  683. USHORT CursorMaxYPosition;
  684. UCHAR ForegroundColor;
  685. UCHAR BackgroundColor;
  686. BOOLEAN HighIntensity;
  687. BOOLEAN Underscored;
  688. BOOLEAN ReverseVideo;
  689. } ARC_DISPLAY_STATUS, * FIRMWARE_PTR PARC_DISPLAY_STATUS;
  690. typedef
  691. ARC_STATUS
  692. (*PARC_TEST_UNICODE_CHARACTER_ROUTINE) (
  693. IN ULONG FileId,
  694. IN WCHAR UnicodeCharacter
  695. );
  696. typedef
  697. PARC_DISPLAY_STATUS
  698. (*PARC_GET_DISPLAY_STATUS_ROUTINE) (
  699. IN ULONG FileId
  700. );
  701. ARC_STATUS
  702. FwTestUnicodeCharacter(
  703. IN ULONG FileId,
  704. IN WCHAR UnicodeCharacter
  705. );
  706. PARC_DISPLAY_STATUS
  707. FwGetDisplayStatus(
  708. IN ULONG FileId
  709. );
  710. //
  711. // Define low memory data structures.
  712. //
  713. // Define debug block structure.
  714. //
  715. typedef struct _DEBUG_BLOCK {
  716. ULONG Signature;
  717. ULONG Length;
  718. } DEBUG_BLOCK, * FIRMWARE_PTR PDEBUG_BLOCK;
  719. //
  720. // Define restart block structure.
  721. //
  722. #define ARC_RESTART_BLOCK_SIGNATURE 0x42545352
  723. typedef struct _BOOT_STATUS {
  724. ULONG BootStarted : 1;
  725. ULONG BootFinished : 1;
  726. ULONG RestartStarted : 1;
  727. ULONG RestartFinished : 1;
  728. ULONG PowerFailStarted : 1;
  729. ULONG PowerFailFinished : 1;
  730. ULONG ProcessorReady : 1;
  731. ULONG ProcessorRunning : 1;
  732. ULONG ProcessorStart : 1;
  733. } BOOT_STATUS, * FIRMWARE_PTR PBOOT_STATUS;
  734. typedef struct _ALPHA_RESTART_STATE {
  735. #if defined(_ALPHA_) || defined(_AXP64_)
  736. //
  737. // Control information
  738. //
  739. ULONG HaltReason;
  740. VOID * FIRMWARE_PTR LogoutFrame;
  741. ULONGLONG PalBase;
  742. //
  743. // Integer Save State
  744. //
  745. ULONGLONG IntV0;
  746. ULONGLONG IntT0;
  747. ULONGLONG IntT1;
  748. ULONGLONG IntT2;
  749. ULONGLONG IntT3;
  750. ULONGLONG IntT4;
  751. ULONGLONG IntT5;
  752. ULONGLONG IntT6;
  753. ULONGLONG IntT7;
  754. ULONGLONG IntS0;
  755. ULONGLONG IntS1;
  756. ULONGLONG IntS2;
  757. ULONGLONG IntS3;
  758. ULONGLONG IntS4;
  759. ULONGLONG IntS5;
  760. ULONGLONG IntFp;
  761. ULONGLONG IntA0;
  762. ULONGLONG IntA1;
  763. ULONGLONG IntA2;
  764. ULONGLONG IntA3;
  765. ULONGLONG IntA4;
  766. ULONGLONG IntA5;
  767. ULONGLONG IntT8;
  768. ULONGLONG IntT9;
  769. ULONGLONG IntT10;
  770. ULONGLONG IntT11;
  771. ULONGLONG IntRa;
  772. ULONGLONG IntT12;
  773. ULONGLONG IntAT;
  774. ULONGLONG IntGp;
  775. ULONGLONG IntSp;
  776. ULONGLONG IntZero;
  777. //
  778. // Floating Point Save State
  779. //
  780. ULONGLONG Fpcr;
  781. ULONGLONG FltF0;
  782. ULONGLONG FltF1;
  783. ULONGLONG FltF2;
  784. ULONGLONG FltF3;
  785. ULONGLONG FltF4;
  786. ULONGLONG FltF5;
  787. ULONGLONG FltF6;
  788. ULONGLONG FltF7;
  789. ULONGLONG FltF8;
  790. ULONGLONG FltF9;
  791. ULONGLONG FltF10;
  792. ULONGLONG FltF11;
  793. ULONGLONG FltF12;
  794. ULONGLONG FltF13;
  795. ULONGLONG FltF14;
  796. ULONGLONG FltF15;
  797. ULONGLONG FltF16;
  798. ULONGLONG FltF17;
  799. ULONGLONG FltF18;
  800. ULONGLONG FltF19;
  801. ULONGLONG FltF20;
  802. ULONGLONG FltF21;
  803. ULONGLONG FltF22;
  804. ULONGLONG FltF23;
  805. ULONGLONG FltF24;
  806. ULONGLONG FltF25;
  807. ULONGLONG FltF26;
  808. ULONGLONG FltF27;
  809. ULONGLONG FltF28;
  810. ULONGLONG FltF29;
  811. ULONGLONG FltF30;
  812. ULONGLONG FltF31;
  813. //
  814. // Architected Internal Processor State.
  815. //
  816. ULONG Asn;
  817. VOID * FIRMWARE_PTR GeneralEntry;
  818. VOID * FIRMWARE_PTR Iksp;
  819. VOID * FIRMWARE_PTR InterruptEntry;
  820. VOID * FIRMWARE_PTR Kgp;
  821. ULONG Mces;
  822. VOID * FIRMWARE_PTR MemMgmtEntry;
  823. VOID * FIRMWARE_PTR PanicEntry;
  824. VOID * FIRMWARE_PTR Pcr;
  825. VOID * FIRMWARE_PTR Pdr;
  826. ULONG Psr;
  827. VOID * FIRMWARE_PTR ReiRestartAddress;
  828. ULONG Sirr;
  829. VOID * FIRMWARE_PTR SyscallEntry;
  830. VOID * FIRMWARE_PTR Teb;
  831. VOID * FIRMWARE_PTR Thread;
  832. //
  833. // Processor Implementation-dependent State.
  834. //
  835. ULONGLONG PerProcessorState[175]; // allocate 2K maximum restart block
  836. #else
  837. ULONG PlaceHolder;
  838. #endif
  839. } ALPHA_RESTART_STATE, * FIRMWARE_PTR PALPHA_RESTART_STATE;
  840. typedef struct _I386_RESTART_STATE {
  841. #if defined(_X86_)
  842. //
  843. // Put state structure here.
  844. //
  845. ULONG PlaceHolder;
  846. #else
  847. ULONG PlaceHolder;
  848. #endif
  849. } I386_RESTART_STATE, *PI386_RESTART_STATE;
  850. #if defined(_IA64_)
  851. #include "pshpck16.h"
  852. #endif
  853. typedef struct _IA64_RESTART_STATE {
  854. #if defined(_IA64_)
  855. //
  856. // This structure is copied from CONTEXT structure in sdk/ntia64.h.
  857. //
  858. //
  859. // The flags values within this flag control the contents of
  860. // a CONTEXT record.
  861. //
  862. // If the context record is used as an input parameter, then
  863. // for each portion of the context record controlled by a flag
  864. // whose value is set, it is assumed that that portion of the
  865. // context record contains valid context. If the context record
  866. // is being used to modify a thread's context, then only that
  867. // portion of the threads context will be modified.
  868. //
  869. // If the context record is used as an IN OUT parameter to capture
  870. // the context of a thread, then only those portions of the thread's
  871. // context corresponding to set flags will be returned.
  872. //
  873. // The context record is never used as an OUT only parameter.
  874. //
  875. ULONG ContextFlags;
  876. ULONG Fill1[3]; // for alignment of following on 16-byte boundary
  877. //
  878. // This section is specified/returned if the ContextFlags word contains
  879. // the flag CONTEXT_DEBUG.
  880. //
  881. // N.B. CONTEXT_DEBUG is *not* part of CONTEXT_FULL.
  882. //
  883. ULONGLONG DbI0; // Instruction debug registers
  884. ULONGLONG DbI1;
  885. ULONGLONG DbI2;
  886. ULONGLONG DbI3;
  887. ULONGLONG DbI4;
  888. ULONGLONG DbI5;
  889. ULONGLONG DbI6;
  890. ULONGLONG DbI7;
  891. ULONGLONG DbD0; // Data debug registers
  892. ULONGLONG DbD1;
  893. ULONGLONG DbD2;
  894. ULONGLONG DbD3;
  895. ULONGLONG DbD4;
  896. ULONGLONG DbD5;
  897. ULONGLONG DbD6;
  898. ULONGLONG DbD7;
  899. //
  900. // This section is specified/returned if the ContextFlags word contains
  901. // the flag CONTEXT_LOWER_FLOATING_POINT.
  902. //
  903. FLOAT128 FltS0; // Lower saved (preserved)
  904. FLOAT128 FltS1;
  905. FLOAT128 FltS2;
  906. FLOAT128 FltS3;
  907. FLOAT128 FltS4;
  908. FLOAT128 FltS5;
  909. FLOAT128 FltT0; // Lower temporary (scratch)
  910. FLOAT128 FltT1;
  911. FLOAT128 FltT2;
  912. FLOAT128 FltT3;
  913. FLOAT128 FltT4;
  914. FLOAT128 FltT5;
  915. FLOAT128 FltT6;
  916. FLOAT128 FltT7;
  917. //
  918. // This section is specified/returned if the ContextFlags word contains
  919. // the flag CONTEXT_HIGHER_FLOATING_POINT.
  920. //
  921. FLOAT128 FltS6; // Higher saved (preserved) floats
  922. FLOAT128 FltS7;
  923. FLOAT128 FltS8;
  924. FLOAT128 FltS9;
  925. FLOAT128 FltS10;
  926. FLOAT128 FltS11;
  927. FLOAT128 FltS12;
  928. FLOAT128 FltS13;
  929. FLOAT128 FltS14;
  930. FLOAT128 FltS15;
  931. FLOAT128 FltS16;
  932. FLOAT128 FltS17;
  933. FLOAT128 FltS18;
  934. FLOAT128 FltS19;
  935. FLOAT128 FltS20;
  936. FLOAT128 FltS21;
  937. FLOAT128 FltF32;
  938. FLOAT128 FltF33;
  939. FLOAT128 FltF34;
  940. FLOAT128 FltF35;
  941. FLOAT128 FltF36;
  942. FLOAT128 FltF37;
  943. FLOAT128 FltF38;
  944. FLOAT128 FltF39;
  945. FLOAT128 FltF40;
  946. FLOAT128 FltF41;
  947. FLOAT128 FltF42;
  948. FLOAT128 FltF43;
  949. FLOAT128 FltF44;
  950. FLOAT128 FltF45;
  951. FLOAT128 FltF46;
  952. FLOAT128 FltF47;
  953. FLOAT128 FltF48;
  954. FLOAT128 FltF49;
  955. FLOAT128 FltF50;
  956. FLOAT128 FltF51;
  957. FLOAT128 FltF52;
  958. FLOAT128 FltF53;
  959. FLOAT128 FltF54;
  960. FLOAT128 FltF55;
  961. FLOAT128 FltF56;
  962. FLOAT128 FltF57;
  963. FLOAT128 FltF58;
  964. FLOAT128 FltF59;
  965. FLOAT128 FltF60;
  966. FLOAT128 FltF61;
  967. FLOAT128 FltF62;
  968. FLOAT128 FltF63;
  969. FLOAT128 FltF64;
  970. FLOAT128 FltF65;
  971. FLOAT128 FltF66;
  972. FLOAT128 FltF67;
  973. FLOAT128 FltF68;
  974. FLOAT128 FltF69;
  975. FLOAT128 FltF70;
  976. FLOAT128 FltF71;
  977. FLOAT128 FltF72;
  978. FLOAT128 FltF73;
  979. FLOAT128 FltF74;
  980. FLOAT128 FltF75;
  981. FLOAT128 FltF76;
  982. FLOAT128 FltF77;
  983. FLOAT128 FltF78;
  984. FLOAT128 FltF79;
  985. FLOAT128 FltF80;
  986. FLOAT128 FltF81;
  987. FLOAT128 FltF82;
  988. FLOAT128 FltF83;
  989. FLOAT128 FltF84;
  990. FLOAT128 FltF85;
  991. FLOAT128 FltF86;
  992. FLOAT128 FltF87;
  993. FLOAT128 FltF88;
  994. FLOAT128 FltF89;
  995. FLOAT128 FltF90;
  996. FLOAT128 FltF91;
  997. FLOAT128 FltF92;
  998. FLOAT128 FltF93;
  999. FLOAT128 FltF94;
  1000. FLOAT128 FltF95;
  1001. FLOAT128 FltF96;
  1002. FLOAT128 FltF97;
  1003. FLOAT128 FltF98;
  1004. FLOAT128 FltF99;
  1005. FLOAT128 FltF100;
  1006. FLOAT128 FltF101;
  1007. FLOAT128 FltF102;
  1008. FLOAT128 FltF103;
  1009. FLOAT128 FltF104;
  1010. FLOAT128 FltF105;
  1011. FLOAT128 FltF106;
  1012. FLOAT128 FltF107;
  1013. FLOAT128 FltF108;
  1014. FLOAT128 FltF109;
  1015. FLOAT128 FltF110;
  1016. FLOAT128 FltF111;
  1017. FLOAT128 FltF112;
  1018. FLOAT128 FltF113;
  1019. FLOAT128 FltF114;
  1020. FLOAT128 FltF115;
  1021. FLOAT128 FltF116;
  1022. FLOAT128 FltF117;
  1023. FLOAT128 FltF118;
  1024. FLOAT128 FltF119;
  1025. FLOAT128 FltF120;
  1026. FLOAT128 FltF121;
  1027. FLOAT128 FltF122;
  1028. FLOAT128 FltF123;
  1029. FLOAT128 FltF124;
  1030. FLOAT128 FltF125;
  1031. FLOAT128 FltF126;
  1032. FLOAT128 FltF127;
  1033. //
  1034. // This section is specified/returned if the ContextFlags word contains
  1035. // the flag CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT.
  1036. // **** TBD **** in some cases it may more efficient to return with
  1037. // CONTEXT_CONTROL
  1038. //
  1039. ULONGLONG StFPSR; // FP status
  1040. //
  1041. // This section is specified/returned if the ContextFlags word contains
  1042. // the flag CONTEXT_INTEGER.
  1043. //
  1044. // N.B. The registers gp, sp, rp are part of the control context
  1045. //
  1046. ULONGLONG IntGp; // global pointer (r1)
  1047. ULONGLONG IntT0;
  1048. ULONGLONG IntT1;
  1049. ULONGLONG IntS0;
  1050. ULONGLONG IntS1;
  1051. ULONGLONG IntS2;
  1052. ULONGLONG IntS3;
  1053. ULONGLONG IntV0; // return value (r8)
  1054. ULONGLONG IntAp; // argument pointer (r9)
  1055. ULONGLONG IntT2;
  1056. ULONGLONG IntT3;
  1057. ULONGLONG IntSp; // stack pointer (r12)
  1058. ULONGLONG IntT4;
  1059. ULONGLONG IntT5;
  1060. ULONGLONG IntT6;
  1061. ULONGLONG IntT7;
  1062. ULONGLONG IntT8;
  1063. ULONGLONG IntT9;
  1064. ULONGLONG IntT10;
  1065. ULONGLONG IntT11;
  1066. ULONGLONG IntT12;
  1067. ULONGLONG IntT13;
  1068. ULONGLONG IntT14;
  1069. ULONGLONG IntT15;
  1070. ULONGLONG IntT16;
  1071. ULONGLONG IntT17;
  1072. ULONGLONG IntT18;
  1073. ULONGLONG IntT19;
  1074. ULONGLONG IntT20;
  1075. ULONGLONG IntT21;
  1076. ULONGLONG IntT22;
  1077. ULONGLONG IntNats; // Nat bits for general registers
  1078. // r1-r31 in bit positions 1 to 31.
  1079. ULONGLONG Preds; // Predicates
  1080. ULONGLONG BrS0l; // Branch registers
  1081. ULONGLONG BrS0h;
  1082. ULONGLONG BrS1l;
  1083. ULONGLONG BrS1h;
  1084. ULONGLONG BrS2l;
  1085. ULONGLONG BrS2h;
  1086. ULONGLONG BrS3l;
  1087. ULONGLONG BrS3h;
  1088. ULONGLONG BrS4l;
  1089. ULONGLONG BrS4h;
  1090. ULONGLONG BrT0l;
  1091. ULONGLONG BrT0h;
  1092. ULONGLONG BrT1l;
  1093. ULONGLONG BrT1h;
  1094. ULONGLONG BrRpl; // return pointer
  1095. ULONGLONG BrRph;
  1096. ULONGLONG BrT2l;
  1097. ULONGLONG BrT2h;
  1098. ULONGLONG BrT3l;
  1099. ULONGLONG BrT3h;
  1100. ULONGLONG BrT4l;
  1101. ULONGLONG BrT4h;
  1102. ULONGLONG BrT5l;
  1103. ULONGLONG BrT5h;
  1104. ULONGLONG BrT6l;
  1105. ULONGLONG BrT6h;
  1106. ULONGLONG BrT7l;
  1107. ULONGLONG BrT7h;
  1108. ULONGLONG BrT8l;
  1109. ULONGLONG BrT8h;
  1110. ULONGLONG BrT9l;
  1111. ULONGLONG BrT9h;
  1112. // This section is specified/returned if the ContextFlags word contains
  1113. // the flag CONTEXT_CONTROL.
  1114. //
  1115. // Other application registers
  1116. ULONGLONG ApSunatcr; // User Nat collection register (preserved)
  1117. ULONGLONG ApSlc; // Loop counter register (preserved)
  1118. ULONGLONG ApTccv; // CMPXCHG value register (volatile)
  1119. ULONGLONG ApDCR;
  1120. // Register stack info
  1121. ULONGLONG RsPFS;
  1122. ULONGLONG RsBSP;
  1123. ULONGLONG RsBSPStore;
  1124. ULONGLONG RsRSC;
  1125. ULONGLONG RsRNAT;
  1126. // Trap Status Information
  1127. ULONGLONG StIPSR; // Interrupt Processor Status
  1128. ULONGLONG StIIP; // Interrupt IP
  1129. ULONGLONG StIFS; // Interrupt Frame Marker
  1130. ULONGLONG Fill; // padding for 16-byte alignment on stack, if needed
  1131. #else
  1132. ULONG PlaceHolder;
  1133. #endif // defined(_IA64_)
  1134. } IA64_RESTART_STATE, *PIA64_RESTART_STATE;
  1135. typedef struct _RESTART_BLOCK {
  1136. ULONG Signature;
  1137. ULONG Length;
  1138. USHORT Version;
  1139. USHORT Revision;
  1140. struct _RESTART_BLOCK * FIRMWARE_PTR NextRestartBlock;
  1141. VOID * FIRMWARE_PTR RestartAddress;
  1142. ULONG BootMasterId;
  1143. ULONG ProcessorId;
  1144. volatile BOOT_STATUS BootStatus;
  1145. ULONG CheckSum;
  1146. ULONG SaveAreaLength;
  1147. union {
  1148. ULONG SaveArea[1];
  1149. ALPHA_RESTART_STATE Alpha;
  1150. I386_RESTART_STATE I386;
  1151. IA64_RESTART_STATE Ia64;
  1152. } u;
  1153. } RESTART_BLOCK, * FIRMWARE_PTR PRESTART_BLOCK;
  1154. #if defined(_IA64_)
  1155. #include "poppack.h"
  1156. #endif
  1157. //
  1158. // Define system parameter block structure.
  1159. //
  1160. typedef struct _SYSTEM_PARAMETER_BLOCK {
  1161. ULONG Signature;
  1162. ULONG Length;
  1163. USHORT Version;
  1164. USHORT Revision;
  1165. PRESTART_BLOCK RestartBlock;
  1166. PDEBUG_BLOCK DebugBlock;
  1167. VOID * FIRMWARE_PTR GenerateExceptionVector;
  1168. VOID * FIRMWARE_PTR TlbMissExceptionVector;
  1169. ULONG FirmwareVectorLength;
  1170. VOID * FIRMWARE_PTR * FIRMWARE_PTR FirmwareVector;
  1171. ULONG VendorVectorLength;
  1172. VOID * FIRMWARE_PTR * FIRMWARE_PTR VendorVector;
  1173. ULONG AdapterCount;
  1174. ULONG Adapter0Type;
  1175. ULONG Adapter0Length;
  1176. VOID * FIRMWARE_PTR * FIRMWARE_PTR Adapter0Vector;
  1177. } SYSTEM_PARAMETER_BLOCK, * FIRMWARE_PTR PSYSTEM_PARAMETER_BLOCK;
  1178. //
  1179. // Define macros that call firmware routines indirectly through the firmware
  1180. // vector and provide type checking of argument values.
  1181. //
  1182. #if defined(_ALPHA_) || defined(_AXP64_)
  1183. #define SYSTEM_BLOCK ((SYSTEM_PARAMETER_BLOCK *)(KSEG0_BASE | 0x6FE000))
  1184. #elif defined(_IA64_)
  1185. extern SYSTEM_PARAMETER_BLOCK GlobalSystemBlock;
  1186. #define SYSTEM_BLOCK (&GlobalSystemBlock)
  1187. #elif defined(_X86_)
  1188. #if defined(ARCI386)
  1189. #define SYSTEM_BLOCK ((PSYSTEM_PARAMETER_BLOCK)(0x1000))
  1190. #else
  1191. extern SYSTEM_PARAMETER_BLOCK GlobalSystemBlock;
  1192. #define SYSTEM_BLOCK (&GlobalSystemBlock)
  1193. #endif
  1194. #endif
  1195. //
  1196. // Define software loading and execution functions.
  1197. //
  1198. #define ArcExecute(ImagePath, Argc, Argv, Envp) \
  1199. ((PARC_EXECUTE_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[ExecuteRoutine])) \
  1200. ((ImagePath), (Argc), (Argv), (Envp))
  1201. #define ArcInvoke(EntryAddress, StackAddress, Argc, Argv, Envp) \
  1202. ((PARC_INVOKE_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[InvokeRoutine])) \
  1203. ((EntryAddress), (StackAddress), (Argc), (Argv), (Envp))
  1204. #define ArcLoad(ImagePath, TopAddress, EntryAddress, LowAddress) \
  1205. ((PARC_LOAD_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[LoadRoutine])) \
  1206. ((ImagePath), (TopAddress), (EntryAddress), (LowAddress))
  1207. //
  1208. // Define program termination functions.
  1209. //
  1210. #define ArcHalt() \
  1211. ((PARC_HALT_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[HaltRoutine]))()
  1212. #define ArcPowerDown() \
  1213. ((PARC_POWERDOWN_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[PowerDownRoutine]))()
  1214. #define ArcRestart() \
  1215. ((PARC_RESTART_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[RestartRoutine]))()
  1216. #define ArcReboot() \
  1217. ((PARC_REBOOT_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[RebootRoutine]))()
  1218. #define ArcEnterInteractiveMode() \
  1219. ((PARC_INTERACTIVE_MODE_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[InteractiveModeRoutine]))()
  1220. //
  1221. // Define configuration functions.
  1222. //
  1223. #define ArcGetChild(Component) \
  1224. ((PARC_GET_CHILD_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetChildRoutine])) \
  1225. ((Component))
  1226. #define ArcGetParent(Component) \
  1227. ((PARC_GET_PARENT_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetParentRoutine])) \
  1228. ((Component))
  1229. #define ArcGetPeer(Component) \
  1230. ((PARC_GET_PEER_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetPeerRoutine])) \
  1231. ((Component))
  1232. #define ArcAddChild(Component, NewComponent, ConfigurationData) \
  1233. ((PARC_ADD_CHILD_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[AddChildRoutine])) \
  1234. ((Component), (NewComponent), (ConfigurationData))
  1235. #define ArcDeleteComponent(Component) \
  1236. ((PARC_DELETE_COMPONENT_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[DeleteComponentRoutine])) \
  1237. ((Component))
  1238. #define ArcGetComponent(Path) \
  1239. ((PARC_GET_COMPONENT_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetComponentRoutine])) \
  1240. ((Path))
  1241. #define ArcGetConfigurationData(ConfigurationData, Component) \
  1242. ((PARC_GET_DATA_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetDataRoutine])) \
  1243. ((ConfigurationData), (Component))
  1244. #define ArcSaveConfiguration() \
  1245. ((PARC_SAVE_CONFIGURATION_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[SaveConfigurationRoutine]))()
  1246. #define ArcGetSystemId() \
  1247. ((PARC_GET_SYSTEM_ID_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetSystemIdRoutine]))()
  1248. #define ArcGetMemoryDescriptor(MemoryDescriptor) \
  1249. ((PARC_MEMORY_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[MemoryRoutine])) \
  1250. ((MemoryDescriptor))
  1251. #define ArcGetTime() \
  1252. ((PARC_GET_TIME_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetTimeRoutine]))()
  1253. #define ArcGetRelativeTime() \
  1254. ((PARC_GET_RELATIVE_TIME_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetRelativeTimeRoutine]))()
  1255. //
  1256. // Define I/O functions.
  1257. //
  1258. #define ArcClose(FileId) \
  1259. ((PARC_CLOSE_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[CloseRoutine])) \
  1260. ((FileId))
  1261. #define ArcGetReadStatus(FileId) \
  1262. ((PARC_READ_STATUS_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[ReadStatusRoutine])) \
  1263. ((FileId))
  1264. #define ArcMount(MountPath, Operation) \
  1265. ((PARC_MOUNT_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[MountRoutine])) \
  1266. ((MountPath), (Operation))
  1267. #define ArcOpen(OpenPath, OpenMode, FileId) \
  1268. ((PARC_OPEN_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[OpenRoutine])) \
  1269. ((OpenPath), (OpenMode), (FileId))
  1270. #define ArcRead(FileId, Buffer, Length, Count) \
  1271. ((PARC_READ_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[ReadRoutine])) \
  1272. ((FileId), (Buffer), (Length), (Count))
  1273. #define ArcSeek(FileId, Offset, SeekMode) \
  1274. ((PARC_SEEK_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[SeekRoutine])) \
  1275. ((FileId), (Offset), (SeekMode))
  1276. #define ArcWrite(FileId, Buffer, Length, Count) \
  1277. ((PARC_WRITE_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[WriteRoutine])) \
  1278. ((FileId), (Buffer), (Length), (Count))
  1279. #define ArcGetFileInformation(FileId, FileInformation) \
  1280. ((PARC_GET_FILE_INFO_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetFileInformationRoutine])) \
  1281. ((FileId), (FileInformation))
  1282. #define ArcSetFileInformation(FileId, AttributeFlags, AttributeMask) \
  1283. ((PARC_SET_FILE_INFO_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[SetFileInformationRoutine])) \
  1284. ((FileId), (AttributeFlags), (AttributeMask))
  1285. #define ArcGetDirectoryEntry(FileId, Buffer, Length, Count) \
  1286. ((PARC_GET_DIRECTORY_ENTRY_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetDirectoryEntryRoutine])) \
  1287. ((FileId), (Buffer), (Length), (Count))
  1288. //
  1289. // Define environment functions.
  1290. //
  1291. #if defined(_AXP64_) && defined(_NTHAL_)
  1292. __inline
  1293. CHAR * FIRMWARE_PTR
  1294. ArcGetEnvironmentVariable(
  1295. IN PCHAR Variable
  1296. )
  1297. {
  1298. CHAR * FIRMWARE_PTR FwValue;
  1299. CHAR * FIRMWARE_PTR FwVariable;
  1300. //
  1301. // Raise IRQL to high level and acquire firmware lock.
  1302. //
  1303. KIRQL OldIrql = FwAcquireFirmwareLock();
  1304. //
  1305. // Copy variable name to a buffer that is addressable by firmware
  1306. // and query the firmware for the variable value.
  1307. //
  1308. FwVariable = (CHAR * FIRMWARE_PTR)&HalpMarshallBuffer[0];
  1309. strcpy(FwVariable, Variable);
  1310. FwValue = HalpArcGetEnvironmentVariable(FwVariable);
  1311. //
  1312. // Release the firmware lock and lower IRQL to its previous level.
  1313. //
  1314. FwReleaseFirmwareLock(OldIrql);
  1315. return FwValue;
  1316. }
  1317. #else
  1318. #define ArcGetEnvironmentVariable(Variable) \
  1319. ((PARC_GET_ENVIRONMENT_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetEnvironmentRoutine])) \
  1320. ((Variable))
  1321. #endif // _AXP64_ && defined(_NTHAL_)
  1322. #if defined(_AXP64_) && defined(_NTHAL_)
  1323. __inline
  1324. ARC_STATUS
  1325. ArcSetEnvironmentVariable(
  1326. IN PCHAR Variable,
  1327. IN PCHAR Value
  1328. )
  1329. {
  1330. ARC_STATUS ArcStatus;
  1331. CHAR * FIRMWARE_PTR FwValue;
  1332. CHAR * FIRMWARE_PTR FwVariable;
  1333. ULONG Length;
  1334. //
  1335. // Raise IRQL to high level and acquire firmware lock.
  1336. //
  1337. KIRQL OldIrql = FwAcquireFirmwareLock();
  1338. //
  1339. // Copy variable name and value to a buffer that is addressable by
  1340. // firmware and call firmware to set the variable value.
  1341. //
  1342. Length = strlen(Variable);
  1343. FwVariable = (CHAR * FIRMWARE_PTR)&HalpMarshallBuffer[0];
  1344. FwValue = FwVariable + Length + 1;
  1345. strcpy(FwVariable, Variable);
  1346. strcpy(FwValue, Value);
  1347. ArcStatus = HalpArcSetEnvironmentVariable(FwVariable, FwValue);
  1348. //
  1349. // Release the firmware lock and lower IRQL to its previous level.
  1350. //
  1351. FwReleaseFirmwareLock(OldIrql);
  1352. return ArcStatus;
  1353. }
  1354. #else
  1355. #define ArcSetEnvironmentVariable(Variable, Value) \
  1356. ((PARC_SET_ENVIRONMENT_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[SetEnvironmentRoutine])) \
  1357. ((Variable), (Value))
  1358. #endif // _AXP64_ && defined(_NTHAL_)
  1359. //
  1360. // Define cache flush functions.
  1361. //
  1362. #define ArcFlushAllCaches() \
  1363. ((PARC_FLUSH_ALL_CACHES_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[FlushAllCachesRoutine]))()
  1364. //
  1365. // Define TestUnicodeCharacter and GetDisplayStatus functions.
  1366. //
  1367. #define ArcTestUnicodeCharacter(FileId, UnicodeCharacter) \
  1368. ((PARC_TEST_UNICODE_CHARACTER_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[TestUnicodeCharacterRoutine])) \
  1369. ((FileId), (UnicodeCharacter))
  1370. #define ArcGetDisplayStatus(FileId) \
  1371. ((PARC_GET_DISPLAY_STATUS_ROUTINE)(SYSTEM_BLOCK->FirmwareVector[GetDisplayStatusRoutine])) \
  1372. ((FileId))
  1373. //
  1374. // Define configuration data structure used in all systems.
  1375. //
  1376. typedef struct _CONFIGURATION_COMPONENT_DATA {
  1377. struct _CONFIGURATION_COMPONENT_DATA *Parent;
  1378. struct _CONFIGURATION_COMPONENT_DATA *Child;
  1379. struct _CONFIGURATION_COMPONENT_DATA *Sibling;
  1380. CONFIGURATION_COMPONENT ComponentEntry;
  1381. PVOID ConfigurationData;
  1382. } CONFIGURATION_COMPONENT_DATA, *PCONFIGURATION_COMPONENT_DATA;
  1383. //
  1384. // Define generic display configuration data structure.
  1385. //
  1386. typedef struct _MONITOR_CONFIGURATION_DATA {
  1387. USHORT Version;
  1388. USHORT Revision;
  1389. USHORT HorizontalResolution;
  1390. USHORT HorizontalDisplayTime;
  1391. USHORT HorizontalBackPorch;
  1392. USHORT HorizontalFrontPorch;
  1393. USHORT HorizontalSync;
  1394. USHORT VerticalResolution;
  1395. USHORT VerticalBackPorch;
  1396. USHORT VerticalFrontPorch;
  1397. USHORT VerticalSync;
  1398. USHORT HorizontalScreenSize;
  1399. USHORT VerticalScreenSize;
  1400. } MONITOR_CONFIGURATION_DATA, *PMONITOR_CONFIGURATION_DATA;
  1401. //
  1402. // Define generic floppy configuration data structure.
  1403. //
  1404. typedef struct _FLOPPY_CONFIGURATION_DATA {
  1405. USHORT Version;
  1406. USHORT Revision;
  1407. CHAR Size[8];
  1408. ULONG MaxDensity;
  1409. ULONG MountDensity;
  1410. } FLOPPY_CONFIGURATION_DATA, *PFLOPPY_CONFIGURATION_DATA;
  1411. //
  1412. // Define memory allocation structures used in all systems.
  1413. //
  1414. typedef enum _TYPE_OF_MEMORY {
  1415. LoaderExceptionBlock = MemoryExceptionBlock, // 0
  1416. LoaderSystemBlock = MemorySystemBlock, // 1
  1417. LoaderFree = MemoryFree, // 2
  1418. LoaderBad = MemoryBad, // 3
  1419. LoaderLoadedProgram = MemoryLoadedProgram, // 4
  1420. LoaderFirmwareTemporary = MemoryFirmwareTemporary, // 5
  1421. LoaderFirmwarePermanent = MemoryFirmwarePermanent, // 6
  1422. LoaderOsloaderHeap, // 7
  1423. LoaderOsloaderStack, // 8
  1424. LoaderSystemCode, // 9
  1425. LoaderHalCode, // a
  1426. LoaderBootDriver, // b
  1427. LoaderConsoleInDriver, // c
  1428. LoaderConsoleOutDriver, // d
  1429. LoaderStartupDpcStack, // e
  1430. LoaderStartupKernelStack, // f
  1431. LoaderStartupPanicStack, // 10
  1432. LoaderStartupPcrPage, // 11
  1433. LoaderStartupPdrPage, // 12
  1434. LoaderRegistryData, // 13
  1435. LoaderMemoryData, // 14
  1436. LoaderNlsData, // 15
  1437. LoaderSpecialMemory, // 16
  1438. LoaderBBTMemory, // 17
  1439. LoaderReserve, // 18
  1440. LoaderXIPRom, // 19
  1441. LoaderHALCachedMemory, // 1a
  1442. LoaderMaximum // 1b
  1443. } TYPE_OF_MEMORY;
  1444. typedef struct _MEMORY_ALLOCATION_DESCRIPTOR {
  1445. LIST_ENTRY ListEntry;
  1446. TYPE_OF_MEMORY MemoryType;
  1447. ULONG BasePage;
  1448. ULONG PageCount;
  1449. } MEMORY_ALLOCATION_DESCRIPTOR, *PMEMORY_ALLOCATION_DESCRIPTOR;
  1450. //
  1451. // Define loader parameter block structure.
  1452. //
  1453. typedef struct _NLS_DATA_BLOCK {
  1454. PVOID AnsiCodePageData;
  1455. PVOID OemCodePageData;
  1456. PVOID UnicodeCaseTableData;
  1457. } NLS_DATA_BLOCK, *PNLS_DATA_BLOCK;
  1458. typedef struct _ARC_DISK_SIGNATURE {
  1459. LIST_ENTRY ListEntry;
  1460. ULONG Signature;
  1461. PCHAR ArcName;
  1462. ULONG CheckSum;
  1463. BOOLEAN ValidPartitionTable;
  1464. BOOLEAN xInt13;
  1465. BOOLEAN IsGpt;
  1466. UCHAR Reserved;
  1467. UCHAR GptSignature[16];
  1468. } ARC_DISK_SIGNATURE, *PARC_DISK_SIGNATURE;
  1469. typedef struct _ARC_DISK_INFORMATION {
  1470. LIST_ENTRY DiskSignatures;
  1471. } ARC_DISK_INFORMATION, *PARC_DISK_INFORMATION;
  1472. typedef struct _I386_LOADER_BLOCK {
  1473. #if defined(_X86_) || defined(_AMD64_)
  1474. PVOID CommonDataArea;
  1475. ULONG MachineType; // Temporary only
  1476. ULONG VirtualBias;
  1477. #else
  1478. ULONG PlaceHolder;
  1479. #endif
  1480. } I386_LOADER_BLOCK, *PI386_LOADER_BLOCK;
  1481. typedef struct _ALPHA_LOADER_BLOCK {
  1482. #if defined(_ALPHA_) || defined(_AXP64_)
  1483. ULONG_PTR DpcStack;
  1484. ULONG FirstLevelDcacheSize;
  1485. ULONG FirstLevelDcacheFillSize;
  1486. ULONG FirstLevelIcacheSize;
  1487. ULONG FirstLevelIcacheFillSize;
  1488. ULONG_PTR GpBase;
  1489. ULONG_PTR PanicStack;
  1490. ULONG PcrPage;
  1491. ULONG PdrPage;
  1492. ULONG SecondLevelDcacheSize;
  1493. ULONG SecondLevelDcacheFillSize;
  1494. ULONG SecondLevelIcacheSize;
  1495. ULONG SecondLevelIcacheFillSize;
  1496. ULONG PhysicalAddressBits;
  1497. ULONG MaximumAddressSpaceNumber;
  1498. UCHAR SystemSerialNumber[16];
  1499. UCHAR SystemType[8];
  1500. ULONG SystemVariant;
  1501. ULONG SystemRevision;
  1502. ULONG ProcessorType;
  1503. ULONG ProcessorRevision;
  1504. ULONG CycleClockPeriod;
  1505. ULONG PageSize;
  1506. PVOID RestartBlock;
  1507. ULONGLONG FirmwareRestartAddress;
  1508. ULONG FirmwareRevisionId;
  1509. PVOID PalBaseAddress;
  1510. UCHAR FirmwareVersion[16];
  1511. UCHAR FirmwareBuildTimeStamp[20];
  1512. #else
  1513. ULONG PlaceHolder;
  1514. #endif
  1515. } ALPHA_LOADER_BLOCK, *PALPHA_LOADER_BLOCK;
  1516. #if defined(_IA64_)
  1517. typedef struct _TR_INFO {
  1518. ULONG Index;
  1519. ULONG PageSize;
  1520. ULONGLONG VirtualAddress;
  1521. ULONGLONG PhysicalAddress;
  1522. } TR_INFO, *PTR_INFO;
  1523. typedef struct _EFI_MEM_MAP_PARAM {
  1524. PUCHAR MemoryMap;
  1525. ULONGLONG MemoryMapSize;
  1526. ULONGLONG MapKey;
  1527. ULONGLONG DescriptorSize;
  1528. ULONG DescriptorVersion;
  1529. } EFI_MEM_MAP_PARAM, *PEFI_MEM_MAP_PARAM;
  1530. //
  1531. // VM info structure definitions
  1532. //
  1533. typedef union _IA64_VM_SUMMARY1 {
  1534. struct {
  1535. ULONGLONG HwWalker : 1;
  1536. ULONGLONG PhysAddrSize : 7;
  1537. ULONGLONG KeySize : 8;
  1538. ULONGLONG MaxPkr : 8;
  1539. ULONGLONG HashTagId : 8;
  1540. ULONGLONG MaxDtrEntry : 8;
  1541. ULONGLONG MaxItrEntry : 8;
  1542. ULONGLONG NumUniqueTcs : 8;
  1543. ULONGLONG NumTcLevels : 8;
  1544. };
  1545. ULONGLONG Ulong64;
  1546. } IA64_VM_SUMMARY1;
  1547. typedef union _IA64_VM_SUMMARY2 {
  1548. struct {
  1549. ULONGLONG ImplVaMsb : 8;
  1550. ULONGLONG RidSize : 8;
  1551. ULONGLONG Rsvd : 48;
  1552. };
  1553. ULONGLONG Ulong64;
  1554. } IA64_VM_SUMMARY2;
  1555. typedef union _IA64_DEPENDENT_FEATURES {
  1556. struct {
  1557. ULONGLONG Rsvd : 41;
  1558. ULONGLONG XIregResource : 1;
  1559. ULONGLONG XRegResource : 1;
  1560. ULONGLONG DisableDynamicPrediatePrediction : 1;
  1561. ULONGLONG DisableProcessorPhysicalNumber : 1;
  1562. ULONGLONG DisableDynamicDataCachePrefetch : 1;
  1563. ULONGLONG DisableDynamicInstructionCache : 1;
  1564. ULONGLONG DisableDynamicBranchPrediction : 1;
  1565. ULONGLONG Rsvd2 : 8;
  1566. ULONGLONG DisableBINIT : 1;
  1567. ULONGLONG DisableCoherency : 1;
  1568. ULONGLONG DisableCache : 1;
  1569. ULONGLONG EnableCMCIPromotion : 1;
  1570. ULONGLONG EnableMCAtoBINIT : 1;
  1571. };
  1572. ULONGLONG Ulong64;
  1573. } IA64_DEPENDENT_FEATURES;
  1574. typedef struct _IA64_PTCE_INFO {
  1575. ULONGLONG PtceBase;
  1576. union {
  1577. struct {
  1578. ULONG Count1;
  1579. ULONG Count2;
  1580. };
  1581. ULONGLONG Ulong64;
  1582. } PtceTcCount;
  1583. union {
  1584. struct {
  1585. ULONG Strides1;
  1586. ULONG Strides2;
  1587. };
  1588. ULONGLONG Ulong64;
  1589. } PtceStrides;
  1590. } IA64_PTCE_INFO;
  1591. typedef struct _PROCESSOR_CONIG_INFO {
  1592. ULONGLONG InsertPageSizeInfo;
  1593. ULONGLONG PurgePageSizeInfo;
  1594. IA64_VM_SUMMARY1 VmSummaryInfo1;
  1595. IA64_VM_SUMMARY2 VmSummaryInfo2;
  1596. ULONGLONG NumOfPhysStackedRegs;
  1597. ULONGLONG RseHints;
  1598. IA64_PTCE_INFO PtceInfo;
  1599. IA64_DEPENDENT_FEATURES FeaturesImplemented;
  1600. IA64_DEPENDENT_FEATURES FeaturesCurSetting;
  1601. IA64_DEPENDENT_FEATURES FeaturesSoftControl;
  1602. ULONGLONG ImplRegisterInfo1;
  1603. ULONGLONG ImplRegisterInfo2;
  1604. } PROCESSOR_CONFIG_INFO, *PPROCESSOR_CONFIG_INFO;
  1605. #endif
  1606. typedef struct _IA64_LOADER_BLOCK {
  1607. #if defined(_IA64_)
  1608. ULONG MachineType;
  1609. ULONG_PTR KernelPhysicalBase;
  1610. ULONG_PTR KernelVirtualBase;
  1611. ULONG_PTR InterruptStack;
  1612. ULONG_PTR PanicStack;
  1613. ULONG_PTR PcrPage;
  1614. ULONG_PTR PdrPage;
  1615. ULONG_PTR PcrPage2;
  1616. ULONG_PTR FpswaInterface;
  1617. ULONG_PTR EfiSystemTable;
  1618. ULONG_PTR AcpiRsdt;
  1619. ULONG_PTR PalProcVirtual;
  1620. TR_INFO ItrInfo[8];
  1621. TR_INFO DtrInfo[8];
  1622. EFI_MEM_MAP_PARAM EfiMemMapParam;
  1623. ULONG_PTR Reserved[10];
  1624. PROCESSOR_CONFIG_INFO ProcessorConfigInfo;
  1625. #else
  1626. ULONG PlaceHolder;
  1627. #endif
  1628. } IA64_LOADER_BLOCK, *PIA64_LOADER_BLOCK;
  1629. typedef struct _LOADER_PARAMETER_EXTENSION {
  1630. ULONG Size; // set to sizeof (struct _LOADER_PARAMETER_EXTENSION)
  1631. PROFILE_PARAMETER_BLOCK Profile;
  1632. ULONG MajorVersion;
  1633. ULONG MinorVersion;
  1634. PVOID InfFileImage; // Inf used to identify "broken" machines.
  1635. ULONG InfFileSize;
  1636. //
  1637. // Pointer to the triage block, if present.
  1638. //
  1639. PVOID TriageDumpBlock;
  1640. ULONG LoaderPagesSpanned; // Virtual Memory spanned by the loader
  1641. // that MM cannot recover the VA for.
  1642. struct _HEADLESS_LOADER_BLOCK *HeadlessLoaderBlock;
  1643. struct _SMBIOS_TABLE_HEADER *SMBiosEPSHeader;
  1644. PVOID DrvDBImage; // Database used to identify "broken" drivers.
  1645. ULONG DrvDBSize;
  1646. // If booting from the Network (PXE) then we will
  1647. // save the Network boot params in this loader block
  1648. struct _NETWORK_LOADER_BLOCK *NetworkLoaderBlock;
  1649. } LOADER_PARAMETER_EXTENSION, *PLOADER_PARAMETER_EXTENSION;
  1650. struct _SETUP_LOADER_BLOCK;
  1651. struct _HEADLESS_LOADER_BLOCK;
  1652. struct _SMBIOS_TABLE_HEADER;
  1653. typedef struct _NETWORK_LOADER_BLOCK {
  1654. // Binary contents of the entire DHCP Acknowledgment
  1655. // packet received by PXE.
  1656. PUCHAR DHCPServerACK;
  1657. ULONG DHCPServerACKLength;
  1658. // Binary contents of the entire BINL Reply
  1659. // packet received by PXE.
  1660. PUCHAR BootServerReplyPacket;
  1661. ULONG BootServerReplyPacketLength;
  1662. } NETWORK_LOADER_BLOCK, * PNETWORK_LOADER_BLOCK;
  1663. typedef struct _LOADER_PARAMETER_BLOCK {
  1664. LIST_ENTRY LoadOrderListHead;
  1665. LIST_ENTRY MemoryDescriptorListHead;
  1666. LIST_ENTRY BootDriverListHead;
  1667. ULONG_PTR KernelStack;
  1668. ULONG_PTR Prcb;
  1669. ULONG_PTR Process;
  1670. ULONG_PTR Thread;
  1671. ULONG RegistryLength;
  1672. PVOID RegistryBase;
  1673. PCONFIGURATION_COMPONENT_DATA ConfigurationRoot;
  1674. PCHAR ArcBootDeviceName;
  1675. PCHAR ArcHalDeviceName;
  1676. PCHAR NtBootPathName;
  1677. PCHAR NtHalPathName;
  1678. PCHAR LoadOptions;
  1679. PNLS_DATA_BLOCK NlsData;
  1680. PARC_DISK_INFORMATION ArcDiskInformation;
  1681. PVOID OemFontFile;
  1682. struct _SETUP_LOADER_BLOCK *SetupLoaderBlock;
  1683. PLOADER_PARAMETER_EXTENSION Extension;
  1684. union {
  1685. I386_LOADER_BLOCK I386;
  1686. ALPHA_LOADER_BLOCK Alpha;
  1687. IA64_LOADER_BLOCK Ia64;
  1688. } u;
  1689. } LOADER_PARAMETER_BLOCK, *PLOADER_PARAMETER_BLOCK;
  1690. #endif // _ARC_