Subversion Repositories Kolibri OS

Rev

Rev 8150 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                              ;;
  3. ;; Copyright (C) KolibriOS team 2020-2021. All rights reserved. ;;
  4. ;; Distributed under terms of the GNU General Public License    ;;
  5. ;; Version 2, or (at your option) any later version.            ;;
  6. ;;                                                              ;;
  7. ;; Written by Ivan Baravy                                       ;;
  8. ;;                                                              ;;
  9. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  10. ;;                                                              ;;
  11. ;; Based on UEFI library for fasm by bzt, Public Domain.        ;;
  12. ;;                                                              ;;
  13. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  14.  
  15. EFI_LOCATE_SEARCH_TYPE:
  16. .AllHandles       = 0
  17. .ByRegisterNotify = 1
  18. .ByProtocol       = 2
  19.  
  20. ; EFI_MEMORY_TYPE
  21. EFI_RESERVED_MEMORY_TYPE        = 0
  22. EFI_LOADER_CODE                 = 1
  23. EFI_LOADER_DATA                 = 2
  24. EFI_BOOT_SERVICES_CODE          = 3
  25. EFI_BOOT_SERVICES_DATA          = 4
  26. EFI_RUNTIME_SERVICES_CODE       = 5
  27. EFI_RUNTIME_SERVICES_DATA       = 6
  28. EFI_CONVENTIONAL_MEMORY         = 7
  29. EFI_UNUSABLE_MEMORY             = 8
  30. EFI_ACPI_RECLAIM_MEMORY         = 9
  31. EFI_ACPI_MEMORY_NVS             = 10
  32. EFI_MEMORY_MAPPED_IO            = 11
  33. EFI_MEMORY_MAPPED_IO_PORT_SPACE = 12
  34. EFI_PAL_CODE                    = 13
  35. EFI_PERSISTENT_MEMORY           = 14
  36. EFI_MAX_MEMORY_TYPE             = 15
  37.  
  38. ; EFI_ALLOCATE_TYPE
  39. EFI_ALLOCATE_ANY_PAGES   = 0
  40. EFI_ALLOCATE_MAX_ADDRESS = 1
  41. EFI_ALLOCATE_ADDRESS     = 2
  42.  
  43. EFI_MEMORY_UC                   = 0x00000001
  44. EFI_MEMORY_WC                   = 0x00000002
  45. EFI_MEMORY_WT                   = 0x00000004
  46. EFI_MEMORY_WB                   = 0x00000008
  47. EFI_MEMORY_UCE                  = 0x00000010
  48. EFI_MEMORY_WP                   = 0x00001000
  49. EFI_MEMORY_RP                   = 0x00002000
  50. EFI_MEMORY_XP                   = 0x00004000
  51. EFI_MEMORY_NV                   = 0x00008000
  52. EFI_MEMORY_MORE_RELIABLE        = 0x00010000
  53. EFI_MEMORY_RO                   = 0x00020000
  54.  
  55. EFI_SUCCESS                     = 0
  56. EFI_LOAD_ERROR                  = EFIERR or 1
  57. EFI_INVALID_PARAMETER           = EFIERR or 2
  58. EFI_UNSUPPORTED                 = EFIERR or 3
  59. EFI_BAD_BUFFER_SIZE             = EFIERR or 4
  60. EFI_BUFFER_TOO_SMALL            = EFIERR or 5
  61. EFI_NOT_READY                   = EFIERR or 6
  62. EFI_DEVICE_ERROR                = EFIERR or 7
  63. EFI_WRITE_PROTECTED             = EFIERR or 8
  64. EFI_OUT_OF_RESOURCES            = EFIERR or 9
  65. EFI_VOLUME_CORRUPTED            = EFIERR or 10
  66. EFI_VOLUME_FULL                 = EFIERR or 11
  67. EFI_NO_MEDIA                    = EFIERR or 12
  68. EFI_MEDIA_CHANGED               = EFIERR or 13
  69. EFI_NOT_FOUND                   = EFIERR or 14
  70. EFI_ACCESS_DENIED               = EFIERR or 15
  71. EFI_NO_RESPONSE                 = EFIERR or 16
  72. EFI_NO_MAPPING                  = EFIERR or 17
  73. EFI_TIMEOUT                     = EFIERR or 18
  74. EFI_NOT_STARTED                 = EFIERR or 19
  75. EFI_ALREADY_STARTED             = EFIERR or 20
  76. EFI_ABORTED                     = EFIERR or 21
  77. EFI_ICMP_ERROR                  = EFIERR or 22
  78. EFI_TFTP_ERROR                  = EFIERR or 23
  79. EFI_PROTOCOL_ERROR              = EFIERR or 24
  80.  
  81.  
  82. EFI_FILE_SYSTEM_INFO_ID equ 0x93,0x6e,0x57,0x09,0x3f,0x6d,0xd2,0x11, \
  83.                             0x39,0x8e,0x00,0xa0,0xc9,0x69,0x72,0x3b
  84.  
  85. EFI_SYSTEM_TABLE_SIGNATURE equ 0x49,0x42,0x49,0x20,0x53,0x59,0x53,0x54
  86.  
  87. EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID equ 0x22,0x5b,0x4e,0x96, \
  88.                                          0x59,0x64,0xd2,0x11, \
  89.                                          0x8e,0x39,0x00,0xa0, \
  90.                                          0xc9,0x69,0x72,0x3b
  91.  
  92. EFI_LOADED_IMAGE_PROTOCOL_GUID equ 0xA1,0x31,0x1b,0x5b,0x62,0x95,0xd2,0x11, \
  93.                                     0x8E,0x3F,0x00,0xA0,0xC9,0x69,0x72,0x3B
  94.  
  95. EFI_BLOCK_IO_PROTOCOL_GUID equ 0x21,0x5b,0x4e,0x96,0x59,0x64,0xd2,0x11, \
  96.                                0x8e,0x39,0x00,0xa0,0xc9,0x69,0x72,0x3b
  97.  
  98. EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID equ 0xde,0xa9,0x42,0x90,0xdc,0x23,0x38,0x4a, \
  99.                                       0x96,0xfb,0x7a,0xde,0xd0,0x80,0x51,0x6a
  100.  
  101. EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID equ 0xBB, 0x7E, 0x70, 0x2F, \
  102.                                          0x1A, 0x4A, 0xd4, 0x11, \
  103.                                          0x9A, 0x38, 0x00, 0x90, \
  104.                                          0x27, 0x3F, 0xC1, 0x4D
  105.  
  106. EFI_FILE_MODE_READ   = 1
  107. EFI_FILE_MODE_WRITE  = 2
  108. EFI_FILE_MODE_CREATE = 0x8000000000000000
  109.  
  110. struct EFI_MEMORY_DESCRIPTOR
  111.   Type          dd ?
  112.                 dd ?    ; align
  113.   PhysicalStart DQ ?
  114.   VirtualStart  DQ ?
  115.   NumberOfPages DQ ?
  116.   Attribute     DQ ?
  117. ends
  118.  
  119. struct EFI_FILE_SYSTEM_INFO
  120.   Size          DQ ?
  121.   ReadOnly      db ?
  122.                 rb 7
  123.   VolumeSize    DQ ?
  124.   FreeSpace     DQ ?
  125.   BlockSize     dd ?
  126.   VolumeLabel   rw 32
  127. ends
  128.  
  129. struct EFI_TABLE_HEADER
  130.   Signature             DQ ?
  131.   Revision              dd ?
  132.   HeaderSize            dd ?
  133.   CRC32                 dd ?
  134.   Reserved              dd ?
  135. ends
  136.  
  137. struct EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
  138.   Reset                 DN ?
  139.   OutputString          DN ?
  140.   TestString            DN ?
  141.   QueryMode             DN ?
  142.   SetMode               DN ?
  143.   SetAttribute          DN ?
  144.   ClearScreen           DN ?
  145.   SetCursorPosition     DN ?
  146.   EnableCursor          DN ?
  147.   Mode                  DN ?
  148. ends
  149.  
  150.  
  151. struct SIMPLE_INPUT_INTERFACE
  152.   Reset                 DN ?
  153.   ReadKeyStroke         DN ?
  154.   WaitForKey            DN ?
  155. ends
  156.  
  157. struct EFI_BOOT_SERVICES
  158.   Hdr                        EFI_TABLE_HEADER
  159.   RaisePriority              DN ?
  160.   RestorePriority            DN ?
  161.   AllocatePages              DN ?
  162.   FreePages                  DN ?
  163.   GetMemoryMap               DN ?
  164.   AllocatePool               DN ?
  165.   FreePool                   DN ?
  166.   CreateEvent                DN ?
  167.   SetTimer                   DN ?
  168.   WaitForEvent               DN ?
  169.   SignalEvent                DN ?
  170.   CloseEvent                 DN ?
  171.   CheckEvent                 DN ?
  172.   InstallProtocolInterface   DN ?
  173.   ReInstallProtocolInterface DN ?
  174.   UnInstallProtocolInterface DN ?
  175.   HandleProtocol             DN ?
  176.   Reserved                   DN ?
  177.   RegisterProtocolNotify     DN ?
  178.   LocateHandle               DN ?
  179.   LocateDevicePath           DN ?
  180.   InstallConfigurationTable  DN ?
  181.   ImageLoad                  DN ?
  182.   ImageStart                 DN ?
  183.   Exit                       DN ?
  184.   ImageUnLoad                DN ?
  185.   ExitBootServices           DN ?
  186.   GetNextMonotonicCount      DN ?
  187.   Stall                      DN ?
  188.   SetWatchdogTimer           DN ?
  189.   ConnectController          DN ?
  190.   DisConnectController       DN ?
  191.   OpenProtocol               DN ?
  192.   CloseProtocol              DN ?
  193.   OpenProtocolInformation    DN ?
  194.   ProtocolsPerHandle         DN ?
  195.   LocateHandleBuffer         DN ?
  196.   LocateProtocol             DN ?
  197.   InstallMultipleProtocolInterfaces DN ?
  198.   UnInstallMultipleProtocolInterfaces DN ?
  199.   CalculateCrc32             DN ?
  200.   CopyMem                    DN ?
  201.   SetMem                     DN ?
  202. ends
  203.  
  204. struct EFI_RUNTIME_SERVICES
  205.   Hdr                   EFI_TABLE_HEADER
  206.   GetTime               DN ?
  207.   SetTime               DN ?
  208.   GetWakeUpTime         DN ?
  209.   SetWakeUpTime         DN ?
  210.   SetVirtualAddressMap  DN ?
  211.   ConvertPointer        DN ?
  212.   GetVariable           DN ?
  213.   GetNextVariableName   DN ?
  214.   SetVariable           DN ?
  215.   GetNextHighMonoCount  DN ?
  216.   ResetSystem           DN ?
  217. ends
  218.  
  219. struct EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
  220.   Revision              DQ ?
  221.   OpenVolume            DN ?
  222. ends
  223.  
  224. struct EFI_FILE_PROTOCOL
  225.   Revision              DQ ?
  226.   Open                  DN ?
  227.   Close                 DN ?
  228.   Delete                DN ?
  229.   Read                  DN ?
  230.   Write                 DN ?
  231.   GetPosition           DN ?
  232.   SetPosition           DN ?
  233.   GetInfo               DN ?
  234.   SetInfo               DN ?
  235.   Flush                 DN ?
  236.   OpenEx                DN ?
  237.   ReadEx                DN ?
  238.   WriteEx               DN ?
  239.   FlushEx               DN ?
  240. ends
  241.  
  242. struct EFI_GRAPHICS_OUTPUT_PROTOCOL
  243.   QueryMode             DN ?
  244.   SetMode               DN ?
  245.   Blt                   DN ?
  246.   Mode                  DN ?
  247. ends
  248.  
  249. struct EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE
  250.   MaxMode               dd ?
  251.   Mode                  dd ?
  252.   Info                  DN ?
  253.   SizeOfInfo            DN ?
  254.   FrameBufferBase       DQ ?
  255.   FrameBufferSize       DN ?
  256. ends
  257.  
  258. EFI_GRAPHICS_PIXEL_FORMAT:
  259. .PixelRedGreenBlueReserved8BitPerColor = 0
  260. .PixelBlueGreenRedReserved8BitPerColor = 1
  261. .PixelBitMask = 2
  262. .PixelBltOnly = 3
  263. .PixelFormatMax = 4
  264.  
  265. struct EFI_PIXEL_BITMASK
  266.   RedMask               dd ?
  267.   GreenMask             dd ?
  268.   BlueMask              dd ?
  269.   ReservedMask          dd ?
  270. ends
  271.  
  272. struct EFI_GRAPHICS_OUTPUT_MODE_INFORMATION
  273.   Version               dd ?
  274.   HorizontalResolution  dd ?
  275.   VerticalResolution    dd ?
  276.   PixelFormat           dd ?
  277.   PixelInformation      EFI_PIXEL_BITMASK
  278.   PixelsPerScanLine     dd ?
  279. ends
  280.  
  281. struct PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS
  282.   Read  DN ?
  283.   Write DN ?
  284. ends
  285.  
  286. struct EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
  287.   ParentHandle          DN ? ; EFI_HANDLE
  288.   PollMem               DN ?
  289.   PollIo                DN ?
  290.   Mem                   PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS
  291.   Io                    PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS
  292.   Pci                   PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS
  293.   CopyMem               DN ?
  294.   Map                   DN ?
  295.   Unmap                 DN ?
  296.   AllocateBuffer        DN ?
  297.   FreeBuffer            DN ?
  298.   Flush                 DN ?
  299.   GetAttributes         DN ?
  300.   SetAttributes         DN ?
  301.   Configuration         DN ?
  302.   SegmentNumber         dd ?
  303. ends
  304.  
  305. struct EFI_QWORD_ADDRESS_SPACE_DESCRIPTOR       ; described in acpi spec
  306.   Type              db ?
  307.   Length            dw ?
  308.   ResourceType      db ?
  309.   GeneralFlags      db ?
  310.   SpecificFlags     db ?
  311.   Granularity       dq ?
  312.   RangeMinimum      dq ?
  313.   RangeMaximum      dq ?
  314.   TranslationOffset dq ?
  315.   AddressLength dq ?
  316. ends
  317.  
  318. EFI_RESOURCE_DESCRIPTOR_TYPE.QWORD_ADDRESS_SPACE = 0x8a
  319. EFI_RESOURCE_DESCRIPTOR_TYPE.END_TAG = 0x79
  320.  
  321. EFI_RESOURCE_TYPE.MEMORY = 0
  322. EFI_RESOURCE_TYPE.IO = 1
  323. EFI_RESOURCE_TYPE.BUS = 2
  324.