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