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