Leaked source code of windows server 2003
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.

120 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. efi.h
  5. Abstract:
  6. On-disk Data types for EFI disks. See chapter 16 of the "Extensible
  7. Firmware Interface Specification" for more information on these data
  8. types.
  9. Author:
  10. Matthew D Hendel (math) 07-Sept-1999
  11. Revision History:
  12. --*/
  13. #pragma once
  14. #include <pshpack1.h>
  15. #define EFI_PARTITION_TABLE_SIGNATURE (0x5452415020494645)
  16. #define EFI_PARTITION_TABLE_REVISION (0x0010000)
  17. //
  18. // This is the PartitionType in the boot record for an EFI-partitioned disk.
  19. //
  20. #define EFI_MBR_PARTITION_TYPE (0xEE)
  21. typedef struct _EFI_PARTITION_ENTRY {
  22. GUID PartitionType;
  23. GUID UniquePartition;
  24. ULONG64 StartingLBA;
  25. ULONG64 EndingLBA;
  26. ULONG64 Attributes;
  27. WCHAR Name [36];
  28. } EFI_PARTITION_ENTRY, *PEFI_PARTITION_ENTRY;
  29. //
  30. // Sanity Check: Since this is an on-disk structure defined in a specification
  31. // the fields can never move or change size.
  32. //
  33. C_ASSERT (
  34. FIELD_OFFSET (EFI_PARTITION_ENTRY, UniquePartition) == 16 &&
  35. FIELD_OFFSET (EFI_PARTITION_ENTRY, Name) == 56 &&
  36. sizeof (EFI_PARTITION_ENTRY) == 128);
  37. typedef struct _EFI_PARTITION_HEADER {
  38. ULONG64 Signature;
  39. ULONG32 Revision;
  40. ULONG32 HeaderSize;
  41. ULONG32 HeaderCRC32;
  42. ULONG32 Reserved;
  43. ULONG64 MyLBA;
  44. ULONG64 AlternateLBA;
  45. ULONG64 FirstUsableLBA;
  46. ULONG64 LastUsableLBA;
  47. GUID DiskGUID;
  48. ULONG64 PartitionEntryLBA;
  49. ULONG32 NumberOfEntries;
  50. ULONG32 SizeOfPartitionEntry;
  51. ULONG32 PartitionEntryCRC32;
  52. } EFI_PARTITION_HEADER, *PEFI_PARTITION_HEADER;
  53. //
  54. // Sanity Check: Since the partition table header is a well-defined on-disk
  55. // structure, it's fields and offsets can never change. Make sure this is
  56. // the case.
  57. //
  58. C_ASSERT (
  59. FIELD_OFFSET (EFI_PARTITION_HEADER, Revision) == 8 &&
  60. FIELD_OFFSET (EFI_PARTITION_HEADER, PartitionEntryCRC32) == 88);
  61. typedef struct _MBR_PARTITION_RECORD {
  62. UCHAR BootIndicator;
  63. UCHAR StartHead;
  64. UCHAR StartSector;
  65. UCHAR StartTrack;
  66. UCHAR OSIndicator;
  67. UCHAR EndHead;
  68. UCHAR EndSector;
  69. UCHAR EndTrack;
  70. ULONG32 StartingLBA;
  71. ULONG32 SizeInLBA;
  72. } MBR_PARTITION_RECORD;
  73. #define MBR_SIGNATURE 0xaa55
  74. #define MIN_MBR_DEVICE_SIZE 0x80000
  75. #define MBR_ERRATA_PAD 0x40000 // 128 MB
  76. #define MAX_MBR_PARTITIONS 4
  77. typedef struct _MASTER_BOOT_RECORD {
  78. UCHAR BootStrapCode[440];
  79. ULONG DiskSignature;
  80. USHORT Unused;
  81. MBR_PARTITION_RECORD Partition[MAX_MBR_PARTITIONS];
  82. USHORT Signature;
  83. } MASTER_BOOT_RECORD, *PMASTER_BOOT_RECORD;
  84. C_ASSERT (sizeof (MASTER_BOOT_RECORD) == 512);
  85. #include <poppack.h>