]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Csm/BiosThunk/BlockIoDxe/Edd.h
IntelFrameworkModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / IntelFrameworkModulePkg / Csm / BiosThunk / BlockIoDxe / Edd.h
1 /** @file
2 Include file to suport EDD 3.0.
3 This file is coded to T13 D1386 Revision 3
4 Availible on http://www.t13.org/#Project drafts
5 Currently at ftp://fission.dt.wdc.com/pub/standards/x3t13/project/d1386r3.pdf
6
7 Copyright (c) 1999 - 2010, Intel Corporation. All rights reserved.<BR>
8
9 SPDX-License-Identifier: BSD-2-Clause-Patent
10
11 **/
12
13 #ifndef _EDD_H_
14 #define _EDD_H_
15
16 //
17 // packing with no compiler padding, so that the fields
18 // of the following architected structures can be
19 // properly accessed from C code.
20 //
21 #pragma pack(1)
22
23 typedef struct {
24 UINT8 Bus;
25 UINT8 Device;
26 UINT8 Function;
27 UINT8 Controller;
28 UINT32 Reserved;
29 } EDD_PCI;
30
31 typedef struct {
32 UINT16 Base;
33 UINT16 Reserved;
34 UINT32 Reserved2;
35 } EDD_LEGACY;
36
37 typedef union {
38 EDD_PCI Pci;
39 EDD_LEGACY Legacy;
40 } EDD_INTERFACE_PATH;
41
42 typedef struct {
43 UINT8 Master;
44 UINT8 Reserved[15];
45 } EDD_ATA;
46
47 typedef struct {
48 UINT8 Master;
49 UINT8 Lun;
50 UINT8 Reserved[14];
51 } EDD_ATAPI;
52
53 typedef struct {
54 UINT16 Pun;
55 UINT64 Lun;
56 UINT8 Reserved[6];
57 } EDD_SCSI;
58
59 typedef struct {
60 UINT64 SerialNumber;
61 UINT64 Reserved;
62 } EDD_USB;
63
64 typedef struct {
65 UINT64 Guid;
66 UINT64 Reserved;
67 } EDD_1394;
68
69 typedef struct {
70 UINT64 Wwn;
71 UINT64 Lun;
72 } EDD_FIBRE;
73
74 typedef union {
75 EDD_ATA Ata;
76 EDD_ATAPI Atapi;
77 EDD_SCSI Scsi;
78 EDD_USB Usb;
79 EDD_1394 FireWire;
80 EDD_FIBRE FibreChannel;
81 } EDD_DEVICE_PATH;
82
83 typedef struct {
84 UINT16 StructureSize;
85 UINT16 Flags;
86 UINT32 MaxCylinders;
87 UINT32 MaxHeads;
88 UINT32 SectorsPerTrack;
89 UINT64 PhysicalSectors;
90 UINT16 BytesPerSector;
91 UINT32 Fdpt;
92 UINT16 Key;
93 UINT8 DevicePathLength;
94 UINT8 Reserved1;
95 UINT16 Reserved2;
96 CHAR8 HostBusType[4];
97 CHAR8 InterfaceType[8];
98 EDD_INTERFACE_PATH InterfacePath;
99 EDD_DEVICE_PATH DevicePath;
100 UINT8 Reserved3;
101 UINT8 Checksum;
102 } EDD_DRIVE_PARAMETERS;
103
104 //
105 // EDD_DRIVE_PARAMETERS.Flags defines
106 //
107 #define EDD_GEOMETRY_VALID 0x02
108 #define EDD_DEVICE_REMOVABLE 0x04
109 #define EDD_WRITE_VERIFY_SUPPORTED 0x08
110 #define EDD_DEVICE_CHANGE 0x10
111 #define EDD_DEVICE_LOCKABLE 0x20
112
113 //
114 // BUGBUG: This bit does not follow the spec. It tends to be always set
115 // to work properly with Win98.
116 //
117 #define EDD_DEVICE_GEOMETRY_MAX 0x40
118
119 typedef struct {
120 UINT8 PacketSizeInBytes; // 0x18
121 UINT8 Zero;
122 UINT8 NumberOfBlocks; // Max 0x7f
123 UINT8 Zero2;
124 UINT32 SegOffset;
125 UINT64 Lba;
126 UINT64 TransferBuffer;
127 UINT32 ExtendedBlockCount; // Max 0xffffffff
128 UINT32 Zero3;
129 } EDD_DEVICE_ADDRESS_PACKET;
130
131 #define EDD_VERSION_30 0x30
132
133 //
134 // Int 13 BIOS Errors
135 //
136 #define BIOS_PASS 0x00
137 #define BIOS_WRITE_PROTECTED 0x03
138 #define BIOS_SECTOR_NOT_FOUND 0x04
139 #define BIOS_RESET_FAILED 0x05
140 #define BIOS_DISK_CHANGED 0x06
141 #define BIOS_DRIVE_DOES_NOT_EXIST 0x07
142 #define BIOS_DMA_ERROR 0x08
143 #define BIOS_DATA_BOUNDRY_ERROR 0x09
144 #define BIOS_BAD_SECTOR 0x0a
145 #define BIOS_BAD_TRACK 0x0b
146 #define BIOS_MEADIA_TYPE_NOT_FOUND 0x0c
147 #define BIOS_INVALED_FORMAT 0x0d
148 #define BIOS_ECC_ERROR 0x10
149 #define BIOS_ECC_CORRECTED_ERROR 0x11
150 #define BIOS_HARD_DRIVE_FAILURE 0x20
151 #define BIOS_SEEK_FAILED 0x40
152 #define BIOS_DRIVE_TIMEOUT 0x80
153 #define BIOS_DRIVE_NOT_READY 0xaa
154 #define BIOS_UNDEFINED_ERROR 0xbb
155 #define BIOS_WRITE_FAULT 0xcc
156 #define BIOS_SENSE_FAILED 0xff
157
158 #define MAX_EDD11_XFER 0xfe00
159
160 #pragma pack()
161 //
162 // Internal Data Structures
163 //
164 typedef struct {
165 CHAR8 Letter;
166 UINT8 Number;
167 UINT8 EddVersion;
168 BOOLEAN ExtendedInt13;
169 BOOLEAN DriveLockingAndEjecting;
170 BOOLEAN Edd;
171 BOOLEAN Extensions64Bit;
172 BOOLEAN ParametersValid;
173 UINT8 ErrorCode;
174 VOID *FdptPointer;
175 BOOLEAN Floppy;
176 BOOLEAN AtapiFloppy;
177 UINT8 MaxHead;
178 UINT8 MaxSector;
179 UINT16 MaxCylinder;
180 UINT16 Pad;
181 EDD_DRIVE_PARAMETERS Parameters;
182 } BIOS_LEGACY_DRIVE;
183
184 #define BIOS_CONSOLE_BLOCK_IO_DEV_SIGNATURE SIGNATURE_32 ('b', 'b', 'i', 'o')
185 typedef struct {
186 UINTN Signature;
187
188 EFI_HANDLE Handle;
189 EFI_HANDLE ControllerHandle;
190 EFI_BLOCK_IO_PROTOCOL BlockIo;
191 EFI_BLOCK_IO_MEDIA BlockMedia;
192 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
193 EFI_PCI_IO_PROTOCOL *PciIo;
194 EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
195
196 BIOS_LEGACY_DRIVE Bios;
197
198 } BIOS_BLOCK_IO_DEV;
199
200 #define BIOS_BLOCK_IO_FROM_THIS(a) CR (a, BIOS_BLOCK_IO_DEV, BlockIo, BIOS_CONSOLE_BLOCK_IO_DEV_SIGNATURE)
201
202 #endif