1 /*++ 2 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> 3 This program and the accompanying materials 4 are licensed and made available under the terms and conditions of the BSD License 5 which accompanies this distribution. The full text of the license may be found at 6 http://opensource.org/licenses/bsd-license.php 7 8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 10 11 Module Name: 12 13 TapeIo.h 14 15 Abstract: 16 EFI_TAPE_IO_PROTOCOL as defined in the UEFI 2.0. 17 Provide services to control and access a tape device. 18 19 Revision History 20 21 --*/ 22 23 #ifndef __EFI_TAPE_IO_PROTOCOL_H__ 24 #define __EFI_TAPE_IO_PROTOCOL_H__ 25 26 #define EFI_TAPE_IO_PROTOCOL_GUID \ 27 { \ 28 0x1e93e633, 0xd65a, 0x459e, {0xab, 0x84, 0x93, 0xd9, 0xec, 0x26, 0x6d, 0x18 } \ 29 } 30 31 typedef struct _EFI_TAPE_IO_PROTOCOL EFI_TAPE_IO_PROTOCOL; 32 33 typedef struct { 34 UINT64 Signature; 35 UINT32 Revision; 36 UINT32 BootDescSize; 37 UINT32 BootDescCRC; 38 EFI_GUID TapeGUID; 39 EFI_GUID TapeType; 40 EFI_GUID TapeUnique; 41 UINT32 BLLocation; 42 UINT32 BLBlocksize; 43 UINT32 BLFilesize; 44 CHAR8 OSVersion[40]; 45 CHAR8 AppVersion[40]; 46 CHAR8 CreationDate[10]; 47 CHAR8 CreationTime[10]; 48 CHAR8 SystemName[256]; // UTF-8 49 CHAR8 TapeTitle[120]; // UTF-8 50 CHAR8 pad[468]; // pad to 1024 51 } TAPE_HEADER; 52 53 typedef 54 EFI_STATUS 55 (EFIAPI *EFI_TAPE_READ) ( 56 IN EFI_TAPE_IO_PROTOCOL *This, 57 IN OUT UINTN *BufferSize, 58 OUT VOID *Buffer 59 ) 60 /*++ 61 62 Routine Description: 63 Reads from the tape. 64 65 Arguments: 66 This - A pointer to the EFI_TAPE_IO_PROTOCOL instance. 67 BufferSize - Size of the buffer in bytes pointed to by Buffer. 68 Buffer - Pointer to the buffer for data to be read into. 69 70 Returns: 71 EFI_SUCCESS - Data was successfully transferred from the media. 72 EFI_END_OF_FILE - A filemark was encountered which limited the data 73 transferred by the read operation or the head is positioned 74 just after a filemark. 75 EFI_NO_MEDIA - No media is loaded in the device. 76 EFI_NOT_READY - The transfer failed since the device was not ready (e.g. not 77 online). The transfer may be retried at a later time. 78 EFI_UNSUPPORTED - The device does not support this type of transfer. 79 EFI_TIMEOUT - The transfer failed to complete within the timeout specified. 80 EFI_MEDIA_CHANGED - The media in the device was changed since the last access. 81 The transfer was aborted since the current position of the 82 media may be incorrect. 83 EFI_INVALID_PARAMETER - A NULL Buffer was specified with a non-zero 84 BufferSize or the device is operating in fixed block 85 size mode and the BufferSize was not a multiple of 86 device's fixed block size 87 EFI_DEVICE_ERROR - A device error occurred while attempting to transfer data 88 from the media. 89 90 --*/ 91 ; 92 93 typedef 94 EFI_STATUS 95 (EFIAPI *EFI_TAPE_WRITE) ( 96 IN EFI_TAPE_IO_PROTOCOL *This, 97 IN UINTN *BufferSize, 98 IN VOID *Buffer 99 ) 100 /*++ 101 102 Routine Description: 103 Writes to the tape. 104 105 Arguments: 106 This - A pointer to the EFI_TAPE_IO_PROTOCOL instance. 107 BufferSize - Size of the buffer in bytes pointed to by Buffer. 108 Buffer - Pointer to the buffer for data to be written from. 109 110 Returns: 111 EFI_SUCCESS - Data was successfully transferred to the media. 112 EFI_END_OF_MEDIA - The logical end of media has been reached. Data may have 113 been successfully transferred to the media. 114 EFI_NO_MEDIA - No media is loaded in the device. 115 EFI_NOT_READY - The transfer failed since the device was not ready (e.g. not 116 online). The transfer may be retried at a later time. 117 EFI_UNSUPPORTED - The device does not support this type of transfer. 118 EFI_TIMEOUT - The transfer failed to complete within the timeout specified. 119 EFI_MEDIA_CHANGED - The media in the device was changed since the last access. 120 The transfer was aborted since the current position of the 121 media may be incorrect. 122 EFI_WRITE_PROTECTED - The media in the device is write-protected. The transfer 123 was aborted since a write cannot be completed. 124 EFI_INVALID_PARAMETER - A NULL Buffer was specified with a non-zero 125 BufferSize or the device is operating in fixed block 126 size mode and the BufferSize was not a multiple of 127 device's fixed block size 128 EFI_DEVICE_ERROR A device error occurred while attempting to transfer data 129 from the media. 130 131 --*/ 132 ; 133 134 135 typedef 136 EFI_STATUS 137 (EFIAPI *EFI_TAPE_REWIND) ( 138 IN EFI_TAPE_IO_PROTOCOL *This 139 ) 140 /*++ 141 142 Routine Description: 143 Rewinds the tape. 144 145 Arguments: 146 This - A pointer to the EFI_TAPE_IO_PROTOCOL instance. 147 148 Returns: 149 EFI_SUCCESS - The media was successfully repositioned. 150 EFI_NO_MEDIA - No media is loaded in the device. 151 EFI_NOT_READY - Repositioning the media failed since the device was not 152 ready (e.g. not online). The transfer may be retried at a later time. 153 EFI_UNSUPPORTED - The device does not support this type of media repositioning. 154 EFI_TIMEOUT - Repositioning of the media did not complete within the timeout specified. 155 EFI_DEVICE_ERROR - A device error occurred while attempting to reposition the media. 156 157 --*/ 158 ; 159 160 161 typedef 162 EFI_STATUS 163 (EFIAPI *EFI_TAPE_SPACE) ( 164 IN EFI_TAPE_IO_PROTOCOL *This, 165 INTN Direction, 166 UINTN Type 167 ) 168 /*++ 169 170 Routine Description: 171 Positions the tape. 172 173 Arguments: 174 This - A pointer to the EFI_TAPE_IO_PROTOCOL instance. 175 Direction - Direction and number of data blocks or filemarks to space over on media. 176 Type - Type of mark to space over on media. 177 178 Returns: 179 EFI_SUCCESS - The media was successfully repositioned. 180 EFI_END_OF_MEDIA - Beginning or end of media was reached before the 181 indicated number of data blocks or filemarks were found. 182 EFI_NO_MEDIA - No media is loaded in the device. 183 EFI_NOT_READY - The reposition failed since the device was not ready (e.g. not 184 online). The reposition may be retried at a later time. 185 EFI_UNSUPPORTED - The device does not support this type of repositioning. 186 EFI_TIMEOUT - The repositioning failed to complete within the timeout specified. 187 EFI_MEDIA_CHANGED - The media in the device was changed since the last access. 188 Repositioning the media was aborted since the current 189 position of the media may be incorrect. 190 EFI_DEVICE_ERROR - A device error occurred while attempting to reposition the media. 191 192 --*/ 193 ; 194 195 typedef 196 EFI_STATUS 197 (EFIAPI *EFI_TAPE_WRITEFM) ( 198 IN EFI_TAPE_IO_PROTOCOL *This, 199 IN UINTN Count 200 ) 201 /*++ 202 203 Routine Description: 204 Writes filemarks to the media. 205 206 Arguments: 207 This - A pointer to the EFI_TAPE_IO_PROTOCOL instance. 208 Count - Number of filemarks to write to the media. 209 210 Returns: 211 EFI_SUCCESS - Data was successfully transferred from the media. 212 EFI_NO_MEDIA - No media is loaded in the device. 213 EFI_NOT_READY - The transfer failed since the device was not ready (e.g. not 214 online). The transfer may be retried at a later time. 215 EFI_UNSUPPORTED - The device does not support this type of repositioning. 216 EFI_TIMEOUT - The transfer failed to complete within the timeout specified. 217 EFI_MEDIA_CHANGED - The media in the device was changed since the last access. 218 The transfer was aborted since the current position of the 219 media may be incorrect. 220 EFI_DEVICE_ERROR - A device error occurred while attempting to transfer data from the media. 221 222 --*/ 223 ; 224 225 typedef 226 EFI_STATUS 227 (EFIAPI *EFI_TAPE_RESET) ( 228 IN EFI_TAPE_IO_PROTOCOL *This, 229 IN BOOLEAN ExtendedVerification 230 ) 231 /*++ 232 233 Routine Description: 234 Resets the tape device. 235 236 Arguments: 237 This - A pointer to the EFI_TAPE_IO_PROTOCOL instance. 238 ExtendedVerification - Indicates whether the parent bus should also be reset. 239 240 Returns: 241 EFI_SUCCESS - The bus and/or device were successfully reset. 242 EFI_NO_MEDIA - No media is loaded in the device. 243 EFI_NOT_READY - The reset failed since the device and/or bus was not ready. 244 The reset may be retried at a later time. 245 EFI_UNSUPPORTED - The device does not support this type of reset. 246 EFI_TIMEOUT - The reset did not complete within the timeout allowed. 247 EFI_DEVICE_ERROR - A device error occurred while attempting to reset the bus and/or device. 248 249 --*/ 250 ; 251 252 struct _EFI_TAPE_IO_PROTOCOL { 253 EFI_TAPE_READ TapeRead; 254 EFI_TAPE_WRITE TapeWrite; 255 EFI_TAPE_REWIND TapeRewind; 256 EFI_TAPE_SPACE TapeSpace; 257 EFI_TAPE_WRITEFM TapeWriteFM; 258 EFI_TAPE_RESET TapeReset; 259 }; 260 261 extern EFI_GUID gEfiTapeIoProtocolGuid; 262 263 #endif 264