]>
Commit | Line | Data |
---|---|---|
79964ac8 | 1 | /** @file\r |
2 | This file declares BlockIo PPI used to access block-oriented storage devices\r | |
3 | \r | |
2bbaeb0d | 4 | Copyright (c) 2007 - 2009, Intel Corporation\r |
79964ac8 | 5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | Module Name: BlockIo.h\r | |
14 | \r | |
15 | @par Revision Reference:\r | |
16 | This PPI is defined in Framework of EFI Recovery Spec\r | |
17 | Version 0.9\r | |
18 | \r | |
19 | **/\r | |
20 | \r | |
21 | #ifndef _PEI_BLOCK_IO_H_\r | |
22 | #define _PEI_BLOCK_IO_H_\r | |
23 | \r | |
b80fbe85 | 24 | #include <PiPei.h>\r |
25 | \r | |
79964ac8 | 26 | #define EFI_PEI_IDE_BLOCK_IO_PPI \\r |
27 | { \\r | |
28 | 0x0964e5b22, 0x6459, 0x11d2, { 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \\r | |
29 | }\r | |
30 | \r | |
31 | #define EFI_PEI_144_FLOPPY_BLOCK_IO_PPI \\r | |
32 | { \\r | |
33 | 0xda6855bd, 0x07b7, 0x4c05, { 0x9e, 0xd8, 0xe2, 0x59, 0xfd, 0x36, 0x0e, 0x22 } \\r | |
34 | }\r | |
35 | \r | |
36 | #define EFI_PEI_VIRTUAL_BLOCK_IO_PPI \\r | |
37 | { \\r | |
38 | 0x695d8aa1, 0x42ee, 0x4c46, { 0x80, 0x5c, 0x6e, 0xa6, 0xbc, 0xe7, 0x99, 0xe3 } \\r | |
39 | }\r | |
40 | \r | |
41 | typedef struct _EFI_PEI_RECOVERY_BLOCK_IO_PPI EFI_PEI_RECOVERY_BLOCK_IO_PPI;\r | |
42 | \r | |
43 | typedef UINT64 EFI_PEI_LBA;\r | |
44 | \r | |
45 | typedef enum {\r | |
46 | LegacyFloppy = 0,\r | |
47 | IdeCDROM = 1,\r | |
48 | IdeLS120 = 2,\r | |
49 | UsbMassStorage= 3,\r | |
50 | MaxDeviceType\r | |
51 | } EFI_PEI_BLOCK_DEVICE_TYPE;\r | |
52 | \r | |
50877421 | 53 | ///\r |
54 | /// Inconsistent with specification here: \r | |
55 | /// PEI_BLOCK_IO_MEDIA has been changed to EFI_PEI_BLOCK_IO_MEDIA, because\r | |
56 | /// "EFI_" prefix is missing in spec due to typo.\r | |
57 | ///\r | |
79964ac8 | 58 | typedef struct {\r |
59 | EFI_PEI_BLOCK_DEVICE_TYPE DeviceType;\r | |
60 | BOOLEAN MediaPresent;\r | |
61 | UINTN LastBlock;\r | |
62 | UINTN BlockSize;\r | |
63 | } EFI_PEI_BLOCK_IO_MEDIA;\r | |
64 | \r | |
65 | /**\r | |
66 | Gets the count of block I/O devices that one specific block driver detects.\r | |
67 | \r | |
68 | @param PeiServices General-purpose services that are available to every PEIM.\r | |
69 | @param This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.\r | |
70 | @param NumberBlockDevices The number of block I/O devices discovered.\r | |
71 | \r | |
72 | @return Status code\r | |
73 | \r | |
74 | **/\r | |
75 | typedef\r | |
76 | EFI_STATUS\r | |
69686d56 | 77 | (EFIAPI *EFI_PEI_GET_NUMBER_BLOCK_DEVICES)(\r |
79964ac8 | 78 | IN EFI_PEI_SERVICES **PeiServices,\r |
79 | IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,\r | |
80 | OUT UINTN *NumberBlockDevices\r | |
81 | );\r | |
82 | \r | |
83 | /**\r | |
84 | Gets a block device's media information.\r | |
85 | \r | |
86 | @param PeiServices General-purpose services that are available to every PEIM\r | |
87 | @param This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.\r | |
88 | @param DeviceIndex Specifies the block device to which the function\r | |
89 | wants to talk. Because the driver that implements Block I/O PPIs\r | |
90 | will manage multiple block devices, the PPIs that want to talk to a single\r | |
91 | device must specify the device index that was assigned during the enumeration\r | |
92 | process. This index is a number from one to NumberBlockDevices.\r | |
93 | @param MediaInfo The media information of the specified block media.\r | |
94 | \r | |
95 | @retval EFI_SUCCESS Media information about the specified block device was obtained successfully.\r | |
96 | @retval EFI_DEVICE_ERROR Cannot get the media information due to a hardware error.\r | |
97 | \r | |
98 | **/\r | |
99 | typedef\r | |
100 | EFI_STATUS\r | |
69686d56 | 101 | (EFIAPI *EFI_PEI_GET_DEVICE_MEDIA_INFORMATION)(\r |
79964ac8 | 102 | IN EFI_PEI_SERVICES **PeiServices,\r |
103 | IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,\r | |
104 | IN UINTN DeviceIndex,\r | |
105 | OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo\r | |
106 | );\r | |
107 | \r | |
108 | /**\r | |
109 | Reads the requested number of blocks from the specified block device.\r | |
110 | \r | |
111 | @param PeiServices General-purpose services that are available to every PEIM.\r | |
112 | @param This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.\r | |
113 | @param DeviceIndex Specifies the block device to which the function wants to talk.\r | |
114 | @param StartLBA The starting logical block address (LBA) to read from on the device\r | |
115 | @param BufferSize The size of the Buffer in bytes. This number must\r | |
116 | be a multiple of the intrinsic block size of the device.\r | |
117 | @param Buffer A pointer to the destination buffer for the data.\r | |
118 | The caller is responsible for the ownership of the buffer.\r | |
119 | \r | |
120 | @retval EFI_SUCCESS The data was read correctly from the device.\r | |
121 | @retval EFI_DEVICE_ERROR The device reported an error while attempting to perform the read operation.\r | |
122 | @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r | |
123 | or the buffer is not properly aligned.\r | |
124 | @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of\r | |
125 | the intrinsic block size of the device.\r | |
126 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
127 | \r | |
128 | **/\r | |
129 | typedef\r | |
130 | EFI_STATUS\r | |
69686d56 | 131 | (EFIAPI *EFI_PEI_READ_BLOCKS)(\r |
79964ac8 | 132 | IN EFI_PEI_SERVICES **PeiServices,\r |
133 | IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,\r | |
134 | IN UINTN DeviceIndex,\r | |
135 | IN EFI_PEI_LBA StartLBA,\r | |
136 | IN UINTN BufferSize,\r | |
137 | OUT VOID *Buffer\r | |
138 | );\r | |
139 | \r | |
2bbaeb0d | 140 | ///\r |
141 | /// EFI_PEI_RECOVERY_BLOCK_IO_PPI provides the services that are required\r | |
142 | /// to access a block I/O device during PEI recovery boot mode.\r | |
143 | ///\r | |
79964ac8 | 144 | struct _EFI_PEI_RECOVERY_BLOCK_IO_PPI {\r |
2bbaeb0d | 145 | ///\r |
146 | /// Gets the number of block I/O devices that the specific block driver manages.\r | |
147 | ///\r | |
79964ac8 | 148 | EFI_PEI_GET_NUMBER_BLOCK_DEVICES GetNumberOfBlockDevices;\r |
2bbaeb0d | 149 | \r |
150 | ///\r | |
151 | /// Gets the specified media information.\r | |
152 | ///\r | |
79964ac8 | 153 | EFI_PEI_GET_DEVICE_MEDIA_INFORMATION GetBlockDeviceMediaInfo;\r |
2bbaeb0d | 154 | \r |
155 | ///\r | |
156 | /// Reads the requested number of blocks from the specified block device.\r | |
157 | ///\r | |
79964ac8 | 158 | EFI_PEI_READ_BLOCKS ReadBlocks;\r |
159 | };\r | |
160 | \r | |
161 | extern EFI_GUID gEfiPeiIdeBlockIoPpiGuid;\r | |
162 | extern EFI_GUID gEfiPei144FloppyBlockIoPpiGuid;\r | |
163 | extern EFI_GUID gEfiPeiVirtualBlockIoPpiGuid;\r | |
164 | \r | |
165 | #endif\r |