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