]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | This file declares BlockIo PPI used to access block-oriented storage devices\r | |
3 | \r | |
4 | Copyright (c) 2006, Intel Corporation \r | |
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 | |
24 | #define EFI_PEI_VIRTUAL_BLOCK_IO_PPI \\r | |
25 | { \\r | |
26 | 0x695d8aa1, 0x42ee, 0x4c46, {0x80, 0x5c, 0x6e, 0xa6, 0xbc, 0xe7, 0x99, 0xe3 } \\r | |
27 | }\r | |
28 | \r | |
29 | typedef struct _EFI_PEI_RECOVERY_BLOCK_IO_PPI EFI_PEI_RECOVERY_BLOCK_IO_PPI;\r | |
30 | \r | |
31 | typedef UINT64 EFI_PEI_LBA;\r | |
32 | \r | |
33 | typedef enum {\r | |
34 | LegacyFloppy = 0,\r | |
35 | IdeCDROM = 1,\r | |
36 | IdeLS120 = 2,\r | |
37 | UsbMassStorage= 3,\r | |
38 | MaxDeviceType\r | |
39 | } EFI_PEI_BLOCK_DEVICE_TYPE;\r | |
40 | \r | |
41 | typedef struct {\r | |
42 | EFI_PEI_BLOCK_DEVICE_TYPE DeviceType;\r | |
43 | BOOLEAN MediaPresent;\r | |
44 | UINTN LastBlock;\r | |
45 | UINTN BlockSize;\r | |
46 | } EFI_PEI_BLOCK_IO_MEDIA;\r | |
47 | \r | |
48 | /**\r | |
49 | Gets the count of block I/O devices that one specific block driver detects.\r | |
50 | \r | |
51 | @param PeiServices General-purpose services that are available to every PEIM.\r | |
52 | @param This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.\r | |
53 | @param NumberBlockDevices The number of block I/O devices discovered.\r | |
54 | \r | |
55 | @return Status code\r | |
56 | \r | |
57 | **/\r | |
58 | typedef\r | |
59 | EFI_STATUS\r | |
60 | (EFIAPI *EFI_PEI_GET_NUMBER_BLOCK_DEVICES) (\r | |
61 | IN EFI_PEI_SERVICES **PeiServices,\r | |
62 | IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,\r | |
63 | OUT UINTN *NumberBlockDevices\r | |
64 | );\r | |
65 | \r | |
66 | /**\r | |
67 | Gets a block device's media information.\r | |
68 | \r | |
69 | @param PeiServices General-purpose services that are available to every PEIM\r | |
70 | @param This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.\r | |
71 | @param DeviceIndex Specifies the block device to which the function\r | |
72 | wants to talk. Because the driver that implements Block I/O PPIs\r | |
73 | will manage multiple block devices, the PPIs that want to talk to a single\r | |
74 | device must specify the device index that was assigned during the enumeration\r | |
75 | process. This index is a number from one to NumberBlockDevices.\r | |
76 | @param MediaInfo The media information of the specified block media.\r | |
77 | \r | |
78 | @retval EFI_SUCCESS Media information about the specified block device was obtained successfully.\r | |
79 | @retval EFI_DEVICE_ERROR Cannot get the media information due to a hardware error.\r | |
80 | \r | |
81 | **/\r | |
82 | typedef\r | |
83 | EFI_STATUS\r | |
84 | (EFIAPI *EFI_PEI_GET_DEVICE_MEDIA_INFORMATION) (\r | |
85 | IN EFI_PEI_SERVICES **PeiServices,\r | |
86 | IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,\r | |
87 | IN UINTN DeviceIndex,\r | |
88 | OUT EFI_PEI_BLOCK_IO_MEDIA *MediaInfo\r | |
89 | );\r | |
90 | \r | |
91 | /**\r | |
92 | Reads the requested number of blocks from the specified block device.\r | |
93 | \r | |
94 | @param PeiServices General-purpose services that are available to every PEIM.\r | |
95 | @param This Indicates the EFI_PEI_RECOVERY_BLOCK_IO_PPI instance.\r | |
96 | @param DeviceIndex Specifies the block device to which the function wants to talk.\r | |
97 | @param StartLBA The starting logical block address (LBA) to read from on the device\r | |
98 | @param BufferSize The size of the Buffer in bytes. This number must\r | |
99 | be a multiple of the intrinsic block size of the device.\r | |
100 | @param Buffer A pointer to the destination buffer for the data.\r | |
101 | The caller is responsible for the ownership of the buffer.\r | |
102 | \r | |
103 | @retval EFI_SUCCESS The data was read correctly from the device.\r | |
104 | @retval EFI_DEVICE_ERROR The device reported an error while attempting to perform the read operation.\r | |
105 | @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r | |
106 | or the buffer is not properly aligned.\r | |
107 | @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of\r | |
108 | the intrinsic block size of the device.\r | |
109 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
110 | \r | |
111 | **/\r | |
112 | typedef\r | |
113 | EFI_STATUS\r | |
114 | (EFIAPI *EFI_PEI_READ_BLOCKS) (\r | |
115 | IN EFI_PEI_SERVICES **PeiServices,\r | |
116 | IN EFI_PEI_RECOVERY_BLOCK_IO_PPI *This,\r | |
117 | IN UINTN DeviceIndex,\r | |
118 | IN EFI_PEI_LBA StartLBA,\r | |
119 | IN UINTN BufferSize,\r | |
120 | OUT VOID *Buffer\r | |
121 | );\r | |
122 | \r | |
123 | /**\r | |
124 | @par Ppi Description:\r | |
125 | EFI_PEI_RECOVERY_BLOCK_IO_PPI provides the services that are required \r | |
126 | to access a block I/O device during PEI recovery boot mode. \r | |
127 | \r | |
128 | @param GetNumberOfBlockDevices\r | |
129 | Gets the number of block I/O devices that the specific block driver manages.\r | |
130 | \r | |
131 | @param GetBlockDeviceMediaInfo\r | |
132 | Gets the specified media information.\r | |
133 | \r | |
134 | @param ReadBlocks\r | |
135 | Reads the requested number of blocks from the specified block device.\r | |
136 | \r | |
137 | **/\r | |
138 | struct _EFI_PEI_RECOVERY_BLOCK_IO_PPI {\r | |
139 | EFI_PEI_GET_NUMBER_BLOCK_DEVICES GetNumberOfBlockDevices;\r | |
140 | EFI_PEI_GET_DEVICE_MEDIA_INFORMATION GetBlockDeviceMediaInfo;\r | |
141 | EFI_PEI_READ_BLOCKS ReadBlocks;\r | |
142 | };\r | |
143 | \r | |
144 | extern EFI_GUID gEfiPeiBlockIoPpiGuid;\r | |
145 | \r | |
146 | #endif\r |