| 1 | /** @file\r |
| 2 | Copyright (c) 2006, Intel Corporation\r |
| 3 | All rights reserved. This program and the accompanying materials\r |
| 4 | are licensed and made available under the terms and conditions of the BSD License\r |
| 5 | which accompanies this distribution. The full text of the license may be found at\r |
| 6 | http://opensource.org/licenses/bsd-license.php\r |
| 7 | \r |
| 8 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
| 9 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r |
| 10 | \r |
| 11 | Module Name: AtapiPassThru.h\r |
| 12 | \r |
| 13 | **/\r |
| 14 | \r |
| 15 | #ifndef _APT_H\r |
| 16 | #define _APT_H\r |
| 17 | \r |
| 18 | \r |
| 19 | \r |
| 20 | #include <Uefi.h>\r |
| 21 | \r |
| 22 | #include <Protocol/ScsiPassThru.h>\r |
| 23 | #include <Protocol/ScsiPassThruExt.h>\r |
| 24 | #include <Protocol/PciIo.h>\r |
| 25 | \r |
| 26 | #include <Library/DebugLib.h>\r |
| 27 | #include <Library/UefiDriverEntryPoint.h>\r |
| 28 | #include <Library/BaseLib.h>\r |
| 29 | #include <Library/UefiLib.h>\r |
| 30 | #include <Library/BaseMemoryLib.h>\r |
| 31 | #include <Library/MemoryAllocationLib.h>\r |
| 32 | #include <Library/UefiBootServicesTableLib.h>\r |
| 33 | #include <Library/PcdLib.h>\r |
| 34 | #include <IndustryStandard/pci22.h>\r |
| 35 | \r |
| 36 | ///\r |
| 37 | /// bit definition\r |
| 38 | ///\r |
| 39 | #define bit(a) (1 << (a))\r |
| 40 | \r |
| 41 | #define MAX_TARGET_ID 4\r |
| 42 | \r |
| 43 | //\r |
| 44 | // IDE Registers\r |
| 45 | //\r |
| 46 | typedef union {\r |
| 47 | UINT16 Command; /* when write */\r |
| 48 | UINT16 Status; /* when read */\r |
| 49 | } IDE_CMD_OR_STATUS;\r |
| 50 | \r |
| 51 | typedef union {\r |
| 52 | UINT16 Error; /* when read */\r |
| 53 | UINT16 Feature; /* when write */\r |
| 54 | } IDE_ERROR_OR_FEATURE;\r |
| 55 | \r |
| 56 | typedef union {\r |
| 57 | UINT16 AltStatus; /* when read */\r |
| 58 | UINT16 DeviceControl; /* when write */\r |
| 59 | } IDE_AltStatus_OR_DeviceControl;\r |
| 60 | \r |
| 61 | \r |
| 62 | typedef enum {\r |
| 63 | IdePrimary = 0,\r |
| 64 | IdeSecondary = 1,\r |
| 65 | IdeMaxChannel = 2\r |
| 66 | } EFI_IDE_CHANNEL;\r |
| 67 | \r |
| 68 | ///\r |
| 69 | \r |
| 70 | \r |
| 71 | //\r |
| 72 | // Bit definitions in Programming Interface byte of the Class Code field\r |
| 73 | // in PCI IDE controller's Configuration Space\r |
| 74 | //\r |
| 75 | #define IDE_PRIMARY_OPERATING_MODE BIT0\r |
| 76 | #define IDE_PRIMARY_PROGRAMMABLE_INDICATOR BIT1\r |
| 77 | #define IDE_SECONDARY_OPERATING_MODE BIT2\r |
| 78 | #define IDE_SECONDARY_PROGRAMMABLE_INDICATOR BIT3\r |
| 79 | \r |
| 80 | \r |
| 81 | #define ATAPI_MAX_CHANNEL 2\r |
| 82 | \r |
| 83 | ///\r |
| 84 | /// IDE registers set\r |
| 85 | ///\r |
| 86 | typedef struct {\r |
| 87 | UINT16 Data;\r |
| 88 | IDE_ERROR_OR_FEATURE Reg1;\r |
| 89 | UINT16 SectorCount;\r |
| 90 | UINT16 SectorNumber;\r |
| 91 | UINT16 CylinderLsb;\r |
| 92 | UINT16 CylinderMsb;\r |
| 93 | UINT16 Head;\r |
| 94 | IDE_CMD_OR_STATUS Reg;\r |
| 95 | IDE_AltStatus_OR_DeviceControl Alt;\r |
| 96 | UINT16 DriveAddress;\r |
| 97 | } IDE_BASE_REGISTERS;\r |
| 98 | \r |
| 99 | #define ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE EFI_SIGNATURE_32 ('a', 's', 'p', 't')\r |
| 100 | \r |
| 101 | typedef struct {\r |
| 102 | UINTN Signature;\r |
| 103 | EFI_HANDLE Handle;\r |
| 104 | EFI_SCSI_PASS_THRU_PROTOCOL ScsiPassThru;\r |
| 105 | EFI_EXT_SCSI_PASS_THRU_PROTOCOL ExtScsiPassThru;\r |
| 106 | EFI_PCI_IO_PROTOCOL *PciIo;\r |
| 107 | UINT64 OriginalPciAttributes;\r |
| 108 | //\r |
| 109 | // Local Data goes here\r |
| 110 | //\r |
| 111 | IDE_BASE_REGISTERS *IoPort;\r |
| 112 | IDE_BASE_REGISTERS AtapiIoPortRegisters[2];\r |
| 113 | UINT32 LatestTargetId;\r |
| 114 | UINT64 LatestLun;\r |
| 115 | } ATAPI_SCSI_PASS_THRU_DEV;\r |
| 116 | \r |
| 117 | //\r |
| 118 | // IDE registers' base addresses\r |
| 119 | //\r |
| 120 | typedef struct {\r |
| 121 | UINT16 CommandBlockBaseAddr;\r |
| 122 | UINT16 ControlBlockBaseAddr;\r |
| 123 | } IDE_REGISTERS_BASE_ADDR;\r |
| 124 | \r |
| 125 | #define ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS(a) \\r |
| 126 | CR (a, \\r |
| 127 | ATAPI_SCSI_PASS_THRU_DEV, \\r |
| 128 | ScsiPassThru, \\r |
| 129 | ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE \\r |
| 130 | )\r |
| 131 | \r |
| 132 | #define ATAPI_EXT_SCSI_PASS_THRU_DEV_FROM_THIS(a) \\r |
| 133 | CR (a, \\r |
| 134 | ATAPI_SCSI_PASS_THRU_DEV, \\r |
| 135 | ExtScsiPassThru, \\r |
| 136 | ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE \\r |
| 137 | )\r |
| 138 | \r |
| 139 | //\r |
| 140 | // Global Variables\r |
| 141 | //\r |
| 142 | extern EFI_DRIVER_BINDING_PROTOCOL gAtapiScsiPassThruDriverBinding;\r |
| 143 | extern EFI_COMPONENT_NAME_PROTOCOL gAtapiScsiPassThruComponentName;\r |
| 144 | extern EFI_COMPONENT_NAME2_PROTOCOL gAtapiScsiPassThruComponentName2;\r |
| 145 | \r |
| 146 | //\r |
| 147 | // ATAPI Command op code\r |
| 148 | //\r |
| 149 | #define OP_INQUIRY 0x12\r |
| 150 | #define OP_LOAD_UNLOAD_CD 0xa6\r |
| 151 | #define OP_MECHANISM_STATUS 0xbd\r |
| 152 | #define OP_MODE_SELECT_10 0x55\r |
| 153 | #define OP_MODE_SENSE_10 0x5a\r |
| 154 | #define OP_PAUSE_RESUME 0x4b\r |
| 155 | #define OP_PLAY_AUDIO_10 0x45\r |
| 156 | #define OP_PLAY_AUDIO_MSF 0x47\r |
| 157 | #define OP_PLAY_CD 0xbc\r |
| 158 | #define OP_PLAY_CD_MSF 0xb4\r |
| 159 | #define OP_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e\r |
| 160 | #define OP_READ_10 0x28\r |
| 161 | #define OP_READ_12 0xa8\r |
| 162 | #define OP_READ_CAPACITY 0x25\r |
| 163 | #define OP_READ_CD 0xbe\r |
| 164 | #define OP_READ_CD_MSF 0xb9\r |
| 165 | #define OP_READ_HEADER 0x44\r |
| 166 | #define OP_READ_SUB_CHANNEL 0x42\r |
| 167 | #define OP_READ_TOC 0x43\r |
| 168 | #define OP_REQUEST_SENSE 0x03\r |
| 169 | #define OP_SCAN 0xba\r |
| 170 | #define OP_SEEK_10 0x2b\r |
| 171 | #define OP_SET_CD_SPEED 0xbb\r |
| 172 | #define OP_STOPPLAY_SCAN 0x4e\r |
| 173 | #define OP_START_STOP_UNIT 0x1b\r |
| 174 | #define OP_TEST_UNIT_READY 0x00\r |
| 175 | \r |
| 176 | #define OP_FORMAT_UNIT 0x04\r |
| 177 | #define OP_READ_FORMAT_CAPACITIES 0x23\r |
| 178 | #define OP_VERIFY 0x2f\r |
| 179 | #define OP_WRITE_10 0x2a\r |
| 180 | #define OP_WRITE_12 0xaa\r |
| 181 | #define OP_WRITE_AND_VERIFY 0x2e\r |
| 182 | \r |
| 183 | //\r |
| 184 | // ATA Command\r |
| 185 | //\r |
| 186 | #define ATAPI_SOFT_RESET_CMD 0x08\r |
| 187 | \r |
| 188 | typedef enum {\r |
| 189 | DataIn = 0,\r |
| 190 | DataOut = 1,\r |
| 191 | DataBi = 2,\r |
| 192 | NoData = 3,\r |
| 193 | End = 0xff\r |
| 194 | } DATA_DIRECTION;\r |
| 195 | \r |
| 196 | typedef struct {\r |
| 197 | UINT8 OpCode;\r |
| 198 | DATA_DIRECTION Direction;\r |
| 199 | } SCSI_COMMAND_SET;\r |
| 200 | \r |
| 201 | #define MAX_CHANNEL 2\r |
| 202 | \r |
| 203 | #define ValidCdbLength(Len) ((Len) == 6 || (Len) == 10 || (Len) == 12) ? 1 : 0\r |
| 204 | \r |
| 205 | //\r |
| 206 | // IDE registers bit definitions\r |
| 207 | //\r |
| 208 | // ATA Err Reg bitmap\r |
| 209 | //\r |
| 210 | #define BBK_ERR bit (7) ///< Bad block detected\r |
| 211 | #define UNC_ERR bit (6) ///< Uncorrectable Data\r |
| 212 | #define MC_ERR bit (5) ///< Media Change\r |
| 213 | #define IDNF_ERR bit (4) ///< ID Not Found\r |
| 214 | #define MCR_ERR bit (3) ///< Media Change Requested\r |
| 215 | #define ABRT_ERR bit (2) ///< Aborted Command\r |
| 216 | #define TK0NF_ERR bit (1) ///< Track 0 Not Found\r |
| 217 | #define AMNF_ERR bit (0) ///< Address Mark Not Found\r |
| 218 | \r |
| 219 | //\r |
| 220 | // ATAPI Err Reg bitmap\r |
| 221 | //\r |
| 222 | #define SENSE_KEY_ERR (bit (7) | bit (6) | bit (5) | bit (4))\r |
| 223 | #define EOM_ERR bit (1) ///< End of Media Detected\r |
| 224 | #define ILI_ERR bit (0) ///< Illegal Length Indication\r |
| 225 | \r |
| 226 | //\r |
| 227 | // Device/Head Reg\r |
| 228 | //\r |
| 229 | #define LBA_MODE bit (6)\r |
| 230 | #define DEV bit (4)\r |
| 231 | #define HS3 bit (3)\r |
| 232 | #define HS2 bit (2)\r |
| 233 | #define HS1 bit (1)\r |
| 234 | #define HS0 bit (0)\r |
| 235 | #define CHS_MODE (0)\r |
| 236 | #define DRV0 (0)\r |
| 237 | #define DRV1 (1)\r |
| 238 | #define MST_DRV DRV0\r |
| 239 | #define SLV_DRV DRV1\r |
| 240 | \r |
| 241 | //\r |
| 242 | // Status Reg\r |
| 243 | //\r |
| 244 | #define BSY bit (7) ///< Controller Busy\r |
| 245 | #define DRDY bit (6) ///< Drive Ready\r |
| 246 | #define DWF bit (5) ///< Drive Write Fault\r |
| 247 | #define DSC bit (4) ///< Disk Seek Complete\r |
| 248 | #define DRQ bit (3) ///< Data Request\r |
| 249 | #define CORR bit (2) ///< Corrected Data\r |
| 250 | #define IDX bit (1) ///< Index\r |
| 251 | #define ERR bit (0) ///< Error\r |
| 252 | #define CHECK bit (0) ///< Check bit for ATAPI Status Reg\r |
| 253 | \r |
| 254 | //\r |
| 255 | // Device Control Reg\r |
| 256 | //\r |
| 257 | #define SRST bit (2) ///< Software Reset\r |
| 258 | #define IEN_L bit (1) ///< Interrupt Enable\r |
| 259 | \r |
| 260 | //\r |
| 261 | // ATAPI Feature Register\r |
| 262 | //\r |
| 263 | #define OVERLAP bit (1)\r |
| 264 | #define DMA bit (0)\r |
| 265 | \r |
| 266 | //\r |
| 267 | // ATAPI Interrupt Reason Reson Reg (ATA Sector Count Register)\r |
| 268 | //\r |
| 269 | #define RELEASE bit (2)\r |
| 270 | #define IO bit (1)\r |
| 271 | #define CoD bit (0)\r |
| 272 | \r |
| 273 | #define PACKET_CMD 0xA0\r |
| 274 | \r |
| 275 | #define DEFAULT_CMD (0xa0)\r |
| 276 | //\r |
| 277 | // default content of device control register, disable INT\r |
| 278 | //\r |
| 279 | #define DEFAULT_CTL (0x0a)\r |
| 280 | #define MAX_ATAPI_BYTE_COUNT (0xfffe)\r |
| 281 | \r |
| 282 | //\r |
| 283 | // function prototype\r |
| 284 | //\r |
| 285 | \r |
| 286 | EFI_STATUS\r |
| 287 | EFIAPI\r |
| 288 | AtapiScsiPassThruDriverBindingSupported (\r |
| 289 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r |
| 290 | IN EFI_HANDLE Controller,\r |
| 291 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r |
| 292 | );\r |
| 293 | \r |
| 294 | EFI_STATUS\r |
| 295 | EFIAPI\r |
| 296 | AtapiScsiPassThruDriverBindingStart (\r |
| 297 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r |
| 298 | IN EFI_HANDLE Controller,\r |
| 299 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r |
| 300 | );\r |
| 301 | \r |
| 302 | EFI_STATUS\r |
| 303 | EFIAPI\r |
| 304 | AtapiScsiPassThruDriverBindingStop (\r |
| 305 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r |
| 306 | IN EFI_HANDLE Controller,\r |
| 307 | IN UINTN NumberOfChildren,\r |
| 308 | IN EFI_HANDLE *ChildHandleBuffer\r |
| 309 | );\r |
| 310 | \r |
| 311 | //\r |
| 312 | // EFI Component Name Functions\r |
| 313 | //\r |
| 314 | /**\r |
| 315 | Retrieves a Unicode string that is the user readable name of the driver.\r |
| 316 | \r |
| 317 | This function retrieves the user readable name of a driver in the form of a\r |
| 318 | Unicode string. If the driver specified by This has a user readable name in\r |
| 319 | the language specified by Language, then a pointer to the driver name is\r |
| 320 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r |
| 321 | by This does not support the language specified by Language,\r |
| 322 | then EFI_UNSUPPORTED is returned.\r |
| 323 | \r |
| 324 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r |
| 325 | EFI_COMPONENT_NAME_PROTOCOL instance.\r |
| 326 | \r |
| 327 | @param Language[in] A pointer to a Null-terminated ASCII string\r |
| 328 | array indicating the language. This is the\r |
| 329 | language of the driver name that the caller is\r |
| 330 | requesting, and it must match one of the\r |
| 331 | languages specified in SupportedLanguages. The\r |
| 332 | number of languages supported by a driver is up\r |
| 333 | to the driver writer. Language is specified\r |
| 334 | in RFC 3066 or ISO 639-2 language code format.\r |
| 335 | \r |
| 336 | @param DriverName[out] A pointer to the Unicode string to return.\r |
| 337 | This Unicode string is the name of the\r |
| 338 | driver specified by This in the language\r |
| 339 | specified by Language.\r |
| 340 | \r |
| 341 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r |
| 342 | This and the language specified by Language was\r |
| 343 | returned in DriverName.\r |
| 344 | \r |
| 345 | @retval EFI_INVALID_PARAMETER Language is NULL.\r |
| 346 | \r |
| 347 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r |
| 348 | \r |
| 349 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r |
| 350 | the language specified by Language.\r |
| 351 | \r |
| 352 | **/\r |
| 353 | EFI_STATUS\r |
| 354 | EFIAPI\r |
| 355 | AtapiScsiPassThruComponentNameGetDriverName (\r |
| 356 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r |
| 357 | IN CHAR8 *Language,\r |
| 358 | OUT CHAR16 **DriverName\r |
| 359 | );\r |
| 360 | \r |
| 361 | \r |
| 362 | /**\r |
| 363 | Retrieves a Unicode string that is the user readable name of the controller\r |
| 364 | that is being managed by a driver.\r |
| 365 | \r |
| 366 | This function retrieves the user readable name of the controller specified by\r |
| 367 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r |
| 368 | driver specified by This has a user readable name in the language specified by\r |
| 369 | Language, then a pointer to the controller name is returned in ControllerName,\r |
| 370 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r |
| 371 | managing the controller specified by ControllerHandle and ChildHandle,\r |
| 372 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r |
| 373 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r |
| 374 | \r |
| 375 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r |
| 376 | EFI_COMPONENT_NAME_PROTOCOL instance.\r |
| 377 | \r |
| 378 | @param ControllerHandle[in] The handle of a controller that the driver\r |
| 379 | specified by This is managing. This handle\r |
| 380 | specifies the controller whose name is to be\r |
| 381 | returned.\r |
| 382 | \r |
| 383 | @param ChildHandle[in] The handle of the child controller to retrieve\r |
| 384 | the name of. This is an optional parameter that\r |
| 385 | may be NULL. It will be NULL for device\r |
| 386 | drivers. It will also be NULL for a bus drivers\r |
| 387 | that wish to retrieve the name of the bus\r |
| 388 | controller. It will not be NULL for a bus\r |
| 389 | driver that wishes to retrieve the name of a\r |
| 390 | child controller.\r |
| 391 | \r |
| 392 | @param Language[in] A pointer to a Null-terminated ASCII string\r |
| 393 | array indicating the language. This is the\r |
| 394 | language of the driver name that the caller is\r |
| 395 | requesting, and it must match one of the\r |
| 396 | languages specified in SupportedLanguages. The\r |
| 397 | number of languages supported by a driver is up\r |
| 398 | to the driver writer. Language is specified in\r |
| 399 | RFC 3066 or ISO 639-2 language code format.\r |
| 400 | \r |
| 401 | @param ControllerName[out] A pointer to the Unicode string to return.\r |
| 402 | This Unicode string is the name of the\r |
| 403 | controller specified by ControllerHandle and\r |
| 404 | ChildHandle in the language specified by\r |
| 405 | Language from the point of view of the driver\r |
| 406 | specified by This.\r |
| 407 | \r |
| 408 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r |
| 409 | the language specified by Language for the\r |
| 410 | driver specified by This was returned in\r |
| 411 | DriverName.\r |
| 412 | \r |
| 413 | @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r |
| 414 | \r |
| 415 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r |
| 416 | EFI_HANDLE.\r |
| 417 | \r |
| 418 | @retval EFI_INVALID_PARAMETER Language is NULL.\r |
| 419 | \r |
| 420 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r |
| 421 | \r |
| 422 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r |
| 423 | managing the controller specified by\r |
| 424 | ControllerHandle and ChildHandle.\r |
| 425 | \r |
| 426 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r |
| 427 | the language specified by Language.\r |
| 428 | \r |
| 429 | **/\r |
| 430 | EFI_STATUS\r |
| 431 | EFIAPI\r |
| 432 | AtapiScsiPassThruComponentNameGetControllerName (\r |
| 433 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r |
| 434 | IN EFI_HANDLE ControllerHandle,\r |
| 435 | IN EFI_HANDLE ChildHandle OPTIONAL,\r |
| 436 | IN CHAR8 *Language,\r |
| 437 | OUT CHAR16 **ControllerName\r |
| 438 | );\r |
| 439 | \r |
| 440 | \r |
| 441 | EFI_STATUS\r |
| 442 | EFIAPI\r |
| 443 | AtapiScsiPassThruDriverEntryPoint (\r |
| 444 | IN EFI_HANDLE ImageHandle,\r |
| 445 | IN EFI_SYSTEM_TABLE *SystemTable\r |
| 446 | )\r |
| 447 | /*++\r |
| 448 | \r |
| 449 | Routine Description:\r |
| 450 | \r |
| 451 | Entry point for EFI drivers.\r |
| 452 | \r |
| 453 | Arguments:\r |
| 454 | \r |
| 455 | ImageHandle - EFI_HANDLE\r |
| 456 | SystemTable - EFI_SYSTEM_TABLE\r |
| 457 | \r |
| 458 | Returns:\r |
| 459 | \r |
| 460 | EFI_SUCCESS\r |
| 461 | Others \r |
| 462 | \r |
| 463 | --*/\r |
| 464 | ;\r |
| 465 | \r |
| 466 | EFI_STATUS\r |
| 467 | RegisterAtapiScsiPassThru (\r |
| 468 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r |
| 469 | IN EFI_HANDLE Controller,\r |
| 470 | IN EFI_PCI_IO_PROTOCOL *PciIo,\r |
| 471 | IN UINT64 OriginalPciAttributes\r |
| 472 | )\r |
| 473 | /*++\r |
| 474 | \r |
| 475 | Routine Description:\r |
| 476 | Attaches SCSI Pass Thru Protocol for specified IDE channel.\r |
| 477 | \r |
| 478 | Arguments:\r |
| 479 | This - Protocol instance pointer.\r |
| 480 | Controller - Parent device handle to the IDE channel. \r |
| 481 | PciIo - PCI I/O protocol attached on the "Controller". \r |
| 482 | \r |
| 483 | Returns:\r |
| 484 | Always return EFI_SUCCESS unless installing SCSI Pass Thru Protocol failed.\r |
| 485 | \r |
| 486 | --*/\r |
| 487 | ;\r |
| 488 | \r |
| 489 | EFI_STATUS\r |
| 490 | EFIAPI\r |
| 491 | AtapiScsiPassThruFunction (\r |
| 492 | IN EFI_SCSI_PASS_THRU_PROTOCOL *This,\r |
| 493 | IN UINT32 Target,\r |
| 494 | IN UINT64 Lun,\r |
| 495 | IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,\r |
| 496 | IN EFI_EVENT Event OPTIONAL\r |
| 497 | )\r |
| 498 | /*++\r |
| 499 | \r |
| 500 | Routine Description:\r |
| 501 | \r |
| 502 | Implements EFI_SCSI_PASS_THRU_PROTOCOL.PassThru() function.\r |
| 503 | \r |
| 504 | Arguments:\r |
| 505 | \r |
| 506 | This: The EFI_SCSI_PASS_THRU_PROTOCOL instance.\r |
| 507 | Target: The Target ID of the ATAPI device to send the SCSI \r |
| 508 | Request Packet. To ATAPI devices attached on an IDE\r |
| 509 | Channel, Target ID 0 indicates Master device;Target\r |
| 510 | ID 1 indicates Slave device.\r |
| 511 | Lun: The LUN of the ATAPI device to send the SCSI Request\r |
| 512 | Packet. To the ATAPI device, Lun is always 0.\r |
| 513 | Packet: The SCSI Request Packet to send to the ATAPI device \r |
| 514 | specified by Target and Lun.\r |
| 515 | Event: If non-blocking I/O is not supported then Event is ignored, \r |
| 516 | and blocking I/O is performed.\r |
| 517 | If Event is NULL, then blocking I/O is performed.\r |
| 518 | If Event is not NULL and non blocking I/O is supported, \r |
| 519 | then non-blocking I/O is performed, and Event will be signaled \r |
| 520 | when the SCSI Request Packet completes. \r |
| 521 | \r |
| 522 | Returns: \r |
| 523 | \r |
| 524 | EFI_STATUS\r |
| 525 | \r |
| 526 | --*/\r |
| 527 | ;\r |
| 528 | \r |
| 529 | EFI_STATUS\r |
| 530 | EFIAPI\r |
| 531 | AtapiScsiPassThruGetNextDevice (\r |
| 532 | IN EFI_SCSI_PASS_THRU_PROTOCOL *This,\r |
| 533 | IN OUT UINT32 *Target,\r |
| 534 | IN OUT UINT64 *Lun\r |
| 535 | )\r |
| 536 | /*++\r |
| 537 | \r |
| 538 | Routine Description:\r |
| 539 | \r |
| 540 | Used to retrieve the list of legal Target IDs for SCSI devices \r |
| 541 | on a SCSI channel.\r |
| 542 | \r |
| 543 | Arguments:\r |
| 544 | \r |
| 545 | This - Protocol instance pointer.\r |
| 546 | Target - On input, a pointer to the Target ID of a SCSI \r |
| 547 | device present on the SCSI channel. On output, \r |
| 548 | a pointer to the Target ID of the next SCSI device\r |
| 549 | present on a SCSI channel. An input value of \r |
| 550 | 0xFFFFFFFF retrieves the Target ID of the first \r |
| 551 | SCSI device present on a SCSI channel.\r |
| 552 | Lun - On input, a pointer to the LUN of a SCSI device\r |
| 553 | present on the SCSI channel. On output, a pointer\r |
| 554 | to the LUN of the next SCSI device present on \r |
| 555 | a SCSI channel.\r |
| 556 | Returns:\r |
| 557 | \r |
| 558 | EFI_SUCCESS - The Target ID and Lun of the next SCSI device \r |
| 559 | on the SCSI channel was returned in Target and Lun.\r |
| 560 | EFI_NOT_FOUND - There are no more SCSI devices on this SCSI channel.\r |
| 561 | EFI_INVALID_PARAMETER - Target is not 0xFFFFFFFF,and Target and Lun were not\r |
| 562 | returned on a previous call to GetNextDevice().\r |
| 563 | \r |
| 564 | --*/\r |
| 565 | ;\r |
| 566 | \r |
| 567 | EFI_STATUS\r |
| 568 | EFIAPI\r |
| 569 | AtapiScsiPassThruBuildDevicePath (\r |
| 570 | IN EFI_SCSI_PASS_THRU_PROTOCOL *This,\r |
| 571 | IN UINT32 Target,\r |
| 572 | IN UINT64 Lun,\r |
| 573 | IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r |
| 574 | )\r |
| 575 | /*++\r |
| 576 | \r |
| 577 | Routine Description:\r |
| 578 | \r |
| 579 | Used to allocate and build a device path node for a SCSI device \r |
| 580 | on a SCSI channel. Would not build device path for a SCSI Host Controller.\r |
| 581 | \r |
| 582 | Arguments:\r |
| 583 | \r |
| 584 | This - Protocol instance pointer.\r |
| 585 | Target - The Target ID of the SCSI device for which\r |
| 586 | a device path node is to be allocated and built.\r |
| 587 | Lun - The LUN of the SCSI device for which a device \r |
| 588 | path node is to be allocated and built.\r |
| 589 | DevicePath - A pointer to a single device path node that \r |
| 590 | describes the SCSI device specified by \r |
| 591 | Target and Lun. This function is responsible \r |
| 592 | for allocating the buffer DevicePath with the boot\r |
| 593 | service AllocatePool(). It is the caller's \r |
| 594 | responsibility to free DevicePath when the caller\r |
| 595 | is finished with DevicePath. \r |
| 596 | Returns:\r |
| 597 | EFI_SUCCESS - The device path node that describes the SCSI device\r |
| 598 | specified by Target and Lun was allocated and \r |
| 599 | returned in DevicePath.\r |
| 600 | EFI_NOT_FOUND - The SCSI devices specified by Target and Lun does\r |
| 601 | not exist on the SCSI channel.\r |
| 602 | EFI_INVALID_PARAMETER - DevicePath is NULL.\r |
| 603 | EFI_OUT_OF_RESOURCES - There are not enough resources to allocate \r |
| 604 | DevicePath.\r |
| 605 | \r |
| 606 | --*/\r |
| 607 | ;\r |
| 608 | \r |
| 609 | EFI_STATUS\r |
| 610 | EFIAPI\r |
| 611 | AtapiScsiPassThruGetTargetLun (\r |
| 612 | IN EFI_SCSI_PASS_THRU_PROTOCOL *This,\r |
| 613 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r |
| 614 | OUT UINT32 *Target,\r |
| 615 | OUT UINT64 *Lun\r |
| 616 | )\r |
| 617 | /*++\r |
| 618 | \r |
| 619 | Routine Description:\r |
| 620 | \r |
| 621 | Used to translate a device path node to a Target ID and LUN.\r |
| 622 | \r |
| 623 | Arguments:\r |
| 624 | \r |
| 625 | This - Protocol instance pointer.\r |
| 626 | DevicePath - A pointer to the device path node that \r |
| 627 | describes a SCSI device on the SCSI channel.\r |
| 628 | Target - A pointer to the Target ID of a SCSI device \r |
| 629 | on the SCSI channel. \r |
| 630 | Lun - A pointer to the LUN of a SCSI device on \r |
| 631 | the SCSI channel. \r |
| 632 | Returns:\r |
| 633 | \r |
| 634 | EFI_SUCCESS - DevicePath was successfully translated to a \r |
| 635 | Target ID and LUN, and they were returned \r |
| 636 | in Target and Lun.\r |
| 637 | EFI_INVALID_PARAMETER - DevicePath/Target/Lun is NULL.\r |
| 638 | EFI_UNSUPPORTED - This driver does not support the device path \r |
| 639 | node type in DevicePath.\r |
| 640 | EFI_NOT_FOUND - A valid translation from DevicePath to a \r |
| 641 | Target ID and LUN does not exist.\r |
| 642 | \r |
| 643 | --*/\r |
| 644 | ;\r |
| 645 | \r |
| 646 | EFI_STATUS\r |
| 647 | EFIAPI\r |
| 648 | AtapiScsiPassThruResetChannel (\r |
| 649 | IN EFI_SCSI_PASS_THRU_PROTOCOL *This\r |
| 650 | )\r |
| 651 | /*++\r |
| 652 | \r |
| 653 | Routine Description:\r |
| 654 | \r |
| 655 | Resets a SCSI channel.This operation resets all the \r |
| 656 | SCSI devices connected to the SCSI channel.\r |
| 657 | \r |
| 658 | Arguments:\r |
| 659 | \r |
| 660 | This - Protocol instance pointer.\r |
| 661 | \r |
| 662 | Returns:\r |
| 663 | \r |
| 664 | EFI_SUCCESS - The SCSI channel was reset.\r |
| 665 | EFI_UNSUPPORTED - The SCSI channel does not support \r |
| 666 | a channel reset operation.\r |
| 667 | EFI_DEVICE_ERROR - A device error occurred while \r |
| 668 | attempting to reset the SCSI channel.\r |
| 669 | EFI_TIMEOUT - A timeout occurred while attempting \r |
| 670 | to reset the SCSI channel.\r |
| 671 | \r |
| 672 | --*/\r |
| 673 | ;\r |
| 674 | \r |
| 675 | EFI_STATUS\r |
| 676 | EFIAPI\r |
| 677 | AtapiScsiPassThruResetTarget (\r |
| 678 | IN EFI_SCSI_PASS_THRU_PROTOCOL *This,\r |
| 679 | IN UINT32 Target,\r |
| 680 | IN UINT64 Lun\r |
| 681 | )\r |
| 682 | /*++\r |
| 683 | \r |
| 684 | Routine Description:\r |
| 685 | \r |
| 686 | Resets a SCSI device that is connected to a SCSI channel.\r |
| 687 | \r |
| 688 | Arguments:\r |
| 689 | \r |
| 690 | This - Protocol instance pointer.\r |
| 691 | Target - The Target ID of the SCSI device to reset. \r |
| 692 | Lun - The LUN of the SCSI device to reset.\r |
| 693 | \r |
| 694 | Returns:\r |
| 695 | \r |
| 696 | EFI_SUCCESS - The SCSI device specified by Target and \r |
| 697 | Lun was reset.\r |
| 698 | EFI_UNSUPPORTED - The SCSI channel does not support a target\r |
| 699 | reset operation.\r |
| 700 | EFI_INVALID_PARAMETER - Target or Lun are invalid.\r |
| 701 | EFI_DEVICE_ERROR - A device error occurred while attempting \r |
| 702 | to reset the SCSI device specified by Target \r |
| 703 | and Lun.\r |
| 704 | EFI_TIMEOUT - A timeout occurred while attempting to reset \r |
| 705 | the SCSI device specified by Target and Lun.\r |
| 706 | \r |
| 707 | --*/\r |
| 708 | ;\r |
| 709 | \r |
| 710 | EFI_STATUS\r |
| 711 | EFIAPI\r |
| 712 | AtapiExtScsiPassThruFunction (\r |
| 713 | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r |
| 714 | IN UINT8 *Target,\r |
| 715 | IN UINT64 Lun,\r |
| 716 | IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,\r |
| 717 | IN EFI_EVENT Event OPTIONAL\r |
| 718 | )\r |
| 719 | /*++\r |
| 720 | \r |
| 721 | Routine Description:\r |
| 722 | \r |
| 723 | Implements EFI_EXT_SCSI_PASS_THRU_PROTOCOL.PassThru() function.\r |
| 724 | \r |
| 725 | Arguments:\r |
| 726 | \r |
| 727 | This: The EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r |
| 728 | Target: The Target ID of the ATAPI device to send the SCSI \r |
| 729 | Request Packet. To ATAPI devices attached on an IDE\r |
| 730 | Channel, Target ID 0 indicates Master device;Target\r |
| 731 | ID 1 indicates Slave device.\r |
| 732 | Lun: The LUN of the ATAPI device to send the SCSI Request\r |
| 733 | Packet. To the ATAPI device, Lun is always 0.\r |
| 734 | Packet: The SCSI Request Packet to send to the ATAPI device \r |
| 735 | specified by Target and Lun.\r |
| 736 | Event: If non-blocking I/O is not supported then Event is ignored, \r |
| 737 | and blocking I/O is performed.\r |
| 738 | If Event is NULL, then blocking I/O is performed.\r |
| 739 | If Event is not NULL and non blocking I/O is supported, \r |
| 740 | then non-blocking I/O is performed, and Event will be signaled \r |
| 741 | when the SCSI Request Packet completes. \r |
| 742 | \r |
| 743 | Returns: \r |
| 744 | \r |
| 745 | EFI_STATUS\r |
| 746 | \r |
| 747 | --*/\r |
| 748 | ;\r |
| 749 | \r |
| 750 | EFI_STATUS\r |
| 751 | EFIAPI\r |
| 752 | AtapiExtScsiPassThruGetNextTargetLun (\r |
| 753 | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r |
| 754 | IN OUT UINT8 **Target,\r |
| 755 | IN OUT UINT64 *Lun\r |
| 756 | )\r |
| 757 | /*++\r |
| 758 | \r |
| 759 | Routine Description:\r |
| 760 | \r |
| 761 | Used to retrieve the list of legal Target IDs for SCSI devices \r |
| 762 | on a SCSI channel.\r |
| 763 | \r |
| 764 | Arguments:\r |
| 765 | \r |
| 766 | This - Protocol instance pointer.\r |
| 767 | Target - On input, a pointer to the Target ID of a SCSI \r |
| 768 | device present on the SCSI channel. On output, \r |
| 769 | a pointer to the Target ID of the next SCSI device\r |
| 770 | present on a SCSI channel. An input value of \r |
| 771 | 0xFFFFFFFF retrieves the Target ID of the first \r |
| 772 | SCSI device present on a SCSI channel.\r |
| 773 | Lun - On input, a pointer to the LUN of a SCSI device\r |
| 774 | present on the SCSI channel. On output, a pointer\r |
| 775 | to the LUN of the next SCSI device present on \r |
| 776 | a SCSI channel.\r |
| 777 | Returns:\r |
| 778 | \r |
| 779 | EFI_SUCCESS - The Target ID and Lun of the next SCSI device \r |
| 780 | on the SCSI channel was returned in Target and Lun.\r |
| 781 | EFI_NOT_FOUND - There are no more SCSI devices on this SCSI channel.\r |
| 782 | EFI_INVALID_PARAMETER - Target is not 0xFFFFFFFF,and Target and Lun were not\r |
| 783 | returned on a previous call to GetNextDevice().\r |
| 784 | \r |
| 785 | --*/\r |
| 786 | ;\r |
| 787 | \r |
| 788 | EFI_STATUS\r |
| 789 | EFIAPI\r |
| 790 | AtapiExtScsiPassThruBuildDevicePath (\r |
| 791 | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r |
| 792 | IN UINT8 *Target,\r |
| 793 | IN UINT64 Lun,\r |
| 794 | IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r |
| 795 | )\r |
| 796 | /*++\r |
| 797 | \r |
| 798 | Routine Description:\r |
| 799 | \r |
| 800 | Used to allocate and build a device path node for a SCSI device \r |
| 801 | on a SCSI channel. Would not build device path for a SCSI Host Controller.\r |
| 802 | \r |
| 803 | Arguments:\r |
| 804 | \r |
| 805 | This - Protocol instance pointer.\r |
| 806 | Target - The Target ID of the SCSI device for which\r |
| 807 | a device path node is to be allocated and built.\r |
| 808 | Lun - The LUN of the SCSI device for which a device \r |
| 809 | path node is to be allocated and built.\r |
| 810 | DevicePath - A pointer to a single device path node that \r |
| 811 | describes the SCSI device specified by \r |
| 812 | Target and Lun. This function is responsible \r |
| 813 | for allocating the buffer DevicePath with the boot\r |
| 814 | service AllocatePool(). It is the caller's \r |
| 815 | responsibility to free DevicePath when the caller\r |
| 816 | is finished with DevicePath. \r |
| 817 | Returns:\r |
| 818 | EFI_SUCCESS - The device path node that describes the SCSI device\r |
| 819 | specified by Target and Lun was allocated and \r |
| 820 | returned in DevicePath.\r |
| 821 | EFI_NOT_FOUND - The SCSI devices specified by Target and Lun does\r |
| 822 | not exist on the SCSI channel.\r |
| 823 | EFI_INVALID_PARAMETER - DevicePath is NULL.\r |
| 824 | EFI_OUT_OF_RESOURCES - There are not enough resources to allocate \r |
| 825 | DevicePath.\r |
| 826 | \r |
| 827 | --*/\r |
| 828 | ;\r |
| 829 | \r |
| 830 | EFI_STATUS\r |
| 831 | EFIAPI\r |
| 832 | AtapiExtScsiPassThruGetTargetLun (\r |
| 833 | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r |
| 834 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r |
| 835 | OUT UINT8 **Target,\r |
| 836 | OUT UINT64 *Lun\r |
| 837 | )\r |
| 838 | /*++\r |
| 839 | \r |
| 840 | Routine Description:\r |
| 841 | \r |
| 842 | Used to translate a device path node to a Target ID and LUN.\r |
| 843 | \r |
| 844 | Arguments:\r |
| 845 | \r |
| 846 | This - Protocol instance pointer.\r |
| 847 | DevicePath - A pointer to the device path node that \r |
| 848 | describes a SCSI device on the SCSI channel.\r |
| 849 | Target - A pointer to the Target ID of a SCSI device \r |
| 850 | on the SCSI channel. \r |
| 851 | Lun - A pointer to the LUN of a SCSI device on \r |
| 852 | the SCSI channel. \r |
| 853 | Returns:\r |
| 854 | \r |
| 855 | EFI_SUCCESS - DevicePath was successfully translated to a \r |
| 856 | Target ID and LUN, and they were returned \r |
| 857 | in Target and Lun.\r |
| 858 | EFI_INVALID_PARAMETER - DevicePath/Target/Lun is NULL.\r |
| 859 | EFI_UNSUPPORTED - This driver does not support the device path \r |
| 860 | node type in DevicePath.\r |
| 861 | EFI_NOT_FOUND - A valid translation from DevicePath to a \r |
| 862 | Target ID and LUN does not exist.\r |
| 863 | \r |
| 864 | --*/\r |
| 865 | ;\r |
| 866 | \r |
| 867 | EFI_STATUS\r |
| 868 | EFIAPI\r |
| 869 | AtapiExtScsiPassThruResetChannel (\r |
| 870 | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This\r |
| 871 | )\r |
| 872 | /*++\r |
| 873 | \r |
| 874 | Routine Description:\r |
| 875 | \r |
| 876 | Resets a SCSI channel.This operation resets all the \r |
| 877 | SCSI devices connected to the SCSI channel.\r |
| 878 | \r |
| 879 | Arguments:\r |
| 880 | \r |
| 881 | This - Protocol instance pointer.\r |
| 882 | \r |
| 883 | Returns:\r |
| 884 | \r |
| 885 | EFI_SUCCESS - The SCSI channel was reset.\r |
| 886 | EFI_UNSUPPORTED - The SCSI channel does not support \r |
| 887 | a channel reset operation.\r |
| 888 | EFI_DEVICE_ERROR - A device error occurred while \r |
| 889 | attempting to reset the SCSI channel.\r |
| 890 | EFI_TIMEOUT - A timeout occurred while attempting \r |
| 891 | to reset the SCSI channel.\r |
| 892 | \r |
| 893 | --*/\r |
| 894 | ;\r |
| 895 | \r |
| 896 | EFI_STATUS\r |
| 897 | EFIAPI\r |
| 898 | AtapiExtScsiPassThruResetTarget (\r |
| 899 | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r |
| 900 | IN UINT8 *Target,\r |
| 901 | IN UINT64 Lun\r |
| 902 | )\r |
| 903 | /*++\r |
| 904 | \r |
| 905 | Routine Description:\r |
| 906 | \r |
| 907 | Resets a SCSI device that is connected to a SCSI channel.\r |
| 908 | \r |
| 909 | Arguments:\r |
| 910 | \r |
| 911 | This - Protocol instance pointer.\r |
| 912 | Target - The Target ID of the SCSI device to reset. \r |
| 913 | Lun - The LUN of the SCSI device to reset.\r |
| 914 | \r |
| 915 | Returns:\r |
| 916 | \r |
| 917 | EFI_SUCCESS - The SCSI device specified by Target and \r |
| 918 | Lun was reset.\r |
| 919 | EFI_UNSUPPORTED - The SCSI channel does not support a target\r |
| 920 | reset operation.\r |
| 921 | EFI_INVALID_PARAMETER - Target or Lun are invalid.\r |
| 922 | EFI_DEVICE_ERROR - A device error occurred while attempting \r |
| 923 | to reset the SCSI device specified by Target \r |
| 924 | and Lun.\r |
| 925 | EFI_TIMEOUT - A timeout occurred while attempting to reset \r |
| 926 | the SCSI device specified by Target and Lun.\r |
| 927 | \r |
| 928 | --*/\r |
| 929 | ;\r |
| 930 | \r |
| 931 | EFI_STATUS\r |
| 932 | EFIAPI\r |
| 933 | AtapiExtScsiPassThruGetNextTarget (\r |
| 934 | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r |
| 935 | IN OUT UINT8 **Target\r |
| 936 | )\r |
| 937 | /*++\r |
| 938 | \r |
| 939 | Routine Description:\r |
| 940 | Used to retrieve the list of legal Target IDs for SCSI devices \r |
| 941 | on a SCSI channel.\r |
| 942 | \r |
| 943 | Arguments:\r |
| 944 | This - Protocol instance pointer.\r |
| 945 | Target - On input, a pointer to the Target ID of a SCSI \r |
| 946 | device present on the SCSI channel. On output, \r |
| 947 | a pointer to the Target ID of the next SCSI device\r |
| 948 | present on a SCSI channel. An input value of \r |
| 949 | 0xFFFFFFFF retrieves the Target ID of the first \r |
| 950 | SCSI device present on a SCSI channel.\r |
| 951 | Lun - On input, a pointer to the LUN of a SCSI device\r |
| 952 | present on the SCSI channel. On output, a pointer\r |
| 953 | to the LUN of the next SCSI device present on \r |
| 954 | a SCSI channel.\r |
| 955 | \r |
| 956 | Returns:\r |
| 957 | EFI_SUCCESS - The Target ID and Lun of the next SCSI device \r |
| 958 | on the SCSI channel was returned in Target and Lun.\r |
| 959 | EFI_NOT_FOUND - There are no more SCSI devices on this SCSI channel.\r |
| 960 | EFI_INVALID_PARAMETER - Target is not 0xFFFFFFFF,and Target and Lun were not\r |
| 961 | returned on a previous call to GetNextDevice().\r |
| 962 | \r |
| 963 | --*/\r |
| 964 | ;\r |
| 965 | \r |
| 966 | EFI_STATUS\r |
| 967 | CheckSCSIRequestPacket (\r |
| 968 | EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet\r |
| 969 | )\r |
| 970 | /*++\r |
| 971 | \r |
| 972 | Routine Description:\r |
| 973 | \r |
| 974 | Checks the parameters in the SCSI Request Packet to make sure\r |
| 975 | they are valid for a SCSI Pass Thru request.\r |
| 976 | \r |
| 977 | Arguments:\r |
| 978 | \r |
| 979 | Packet - The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET \r |
| 980 | \r |
| 981 | Returns:\r |
| 982 | \r |
| 983 | EFI_STATUS\r |
| 984 | \r |
| 985 | --*/\r |
| 986 | ;\r |
| 987 | \r |
| 988 | EFI_STATUS\r |
| 989 | SubmitBlockingIoCommand (\r |
| 990 | ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r |
| 991 | UINT32 Target,\r |
| 992 | EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet\r |
| 993 | )\r |
| 994 | /*++\r |
| 995 | \r |
| 996 | Routine Description:\r |
| 997 | \r |
| 998 | Performs blocking I/O request.\r |
| 999 | \r |
| 1000 | Arguments:\r |
| 1001 | \r |
| 1002 | AtapiScsiPrivate: Private data structure for the specified channel.\r |
| 1003 | Target: The Target ID of the ATAPI device to send the SCSI \r |
| 1004 | Request Packet. To ATAPI devices attached on an IDE\r |
| 1005 | Channel, Target ID 0 indicates Master device;Target\r |
| 1006 | ID 1 indicates Slave device.\r |
| 1007 | Packet: The SCSI Request Packet to send to the ATAPI device \r |
| 1008 | specified by Target.\r |
| 1009 | \r |
| 1010 | Returns: EFI_STATUS \r |
| 1011 | \r |
| 1012 | --*/\r |
| 1013 | ;\r |
| 1014 | \r |
| 1015 | BOOLEAN\r |
| 1016 | IsCommandValid (\r |
| 1017 | EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet\r |
| 1018 | )\r |
| 1019 | /*++\r |
| 1020 | \r |
| 1021 | Routine Description:\r |
| 1022 | \r |
| 1023 | Checks the requested SCSI command: \r |
| 1024 | Is it supported by this driver?\r |
| 1025 | Is the Data transfer direction reasonable?\r |
| 1026 | \r |
| 1027 | Arguments:\r |
| 1028 | \r |
| 1029 | Packet - The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET \r |
| 1030 | \r |
| 1031 | Returns:\r |
| 1032 | \r |
| 1033 | EFI_STATUS\r |
| 1034 | \r |
| 1035 | --*/\r |
| 1036 | ;\r |
| 1037 | \r |
| 1038 | EFI_STATUS\r |
| 1039 | CheckExtSCSIRequestPacket (\r |
| 1040 | EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet\r |
| 1041 | )\r |
| 1042 | /*++\r |
| 1043 | \r |
| 1044 | Routine Description:\r |
| 1045 | \r |
| 1046 | Checks the parameters in the SCSI Request Packet to make sure\r |
| 1047 | they are valid for a SCSI Pass Thru request.\r |
| 1048 | \r |
| 1049 | Arguments:\r |
| 1050 | \r |
| 1051 | Packet - The pointer of EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET\r |
| 1052 | \r |
| 1053 | Returns:\r |
| 1054 | \r |
| 1055 | EFI_STATUS\r |
| 1056 | \r |
| 1057 | --*/\r |
| 1058 | ;\r |
| 1059 | \r |
| 1060 | \r |
| 1061 | BOOLEAN\r |
| 1062 | IsExtCommandValid (\r |
| 1063 | EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet\r |
| 1064 | )\r |
| 1065 | /*++\r |
| 1066 | \r |
| 1067 | Routine Description:\r |
| 1068 | \r |
| 1069 | Checks the requested SCSI command: \r |
| 1070 | Is it supported by this driver?\r |
| 1071 | Is the Data transfer direction reasonable?\r |
| 1072 | \r |
| 1073 | Arguments:\r |
| 1074 | \r |
| 1075 | Packet - The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET \r |
| 1076 | \r |
| 1077 | Returns:\r |
| 1078 | \r |
| 1079 | EFI_STATUS\r |
| 1080 | \r |
| 1081 | --*/\r |
| 1082 | ;\r |
| 1083 | \r |
| 1084 | EFI_STATUS\r |
| 1085 | SubmitExtBlockingIoCommand (\r |
| 1086 | ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r |
| 1087 | UINT8 Target,\r |
| 1088 | EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet\r |
| 1089 | )\r |
| 1090 | /*++\r |
| 1091 | \r |
| 1092 | Routine Description:\r |
| 1093 | \r |
| 1094 | Performs blocking I/O request.\r |
| 1095 | \r |
| 1096 | Arguments:\r |
| 1097 | \r |
| 1098 | AtapiScsiPrivate: Private data structure for the specified channel.\r |
| 1099 | Target: The Target ID of the ATAPI device to send the SCSI \r |
| 1100 | Request Packet. To ATAPI devices attached on an IDE\r |
| 1101 | Channel, Target ID 0 indicates Master device;Target\r |
| 1102 | ID 1 indicates Slave device.\r |
| 1103 | Packet: The SCSI Request Packet to send to the ATAPI device \r |
| 1104 | specified by Target.\r |
| 1105 | \r |
| 1106 | Returns: EFI_STATUS \r |
| 1107 | \r |
| 1108 | --*/\r |
| 1109 | ;\r |
| 1110 | \r |
| 1111 | EFI_STATUS\r |
| 1112 | RequestSenseCommand (\r |
| 1113 | ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r |
| 1114 | UINT32 Target,\r |
| 1115 | UINT64 Timeout,\r |
| 1116 | VOID *SenseData,\r |
| 1117 | UINT8 *SenseDataLength\r |
| 1118 | )\r |
| 1119 | /*++\r |
| 1120 | \r |
| 1121 | Routine Description:\r |
| 1122 | \r |
| 1123 | Sumbit request sense command\r |
| 1124 | \r |
| 1125 | Arguments:\r |
| 1126 | \r |
| 1127 | AtapiScsiPrivate - The pionter of ATAPI_SCSI_PASS_THRU_DEV\r |
| 1128 | Target - The target ID\r |
| 1129 | Timeout - The time to complete the command\r |
| 1130 | SenseData - The buffer to fill in sense data\r |
| 1131 | SenseDataLength - The length of buffer\r |
| 1132 | \r |
| 1133 | Returns:\r |
| 1134 | \r |
| 1135 | EFI_STATUS\r |
| 1136 | \r |
| 1137 | --*/\r |
| 1138 | ;\r |
| 1139 | \r |
| 1140 | EFI_STATUS\r |
| 1141 | AtapiPacketCommand (\r |
| 1142 | ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r |
| 1143 | UINT32 Target,\r |
| 1144 | UINT8 *PacketCommand,\r |
| 1145 | VOID *Buffer,\r |
| 1146 | UINT32 *ByteCount,\r |
| 1147 | DATA_DIRECTION Direction,\r |
| 1148 | UINT64 TimeOutInMicroSeconds\r |
| 1149 | )\r |
| 1150 | /*++\r |
| 1151 | \r |
| 1152 | Routine Description:\r |
| 1153 | \r |
| 1154 | Submits ATAPI command packet to the specified ATAPI device.\r |
| 1155 | \r |
| 1156 | Arguments:\r |
| 1157 | \r |
| 1158 | AtapiScsiPrivate: Private data structure for the specified channel.\r |
| 1159 | Target: The Target ID of the ATAPI device to send the SCSI \r |
| 1160 | Request Packet. To ATAPI devices attached on an IDE\r |
| 1161 | Channel, Target ID 0 indicates Master device;Target\r |
| 1162 | ID 1 indicates Slave device.\r |
| 1163 | PacketCommand: Points to the ATAPI command packet.\r |
| 1164 | Buffer: Points to the transferred data.\r |
| 1165 | ByteCount: When input,indicates the buffer size; when output,\r |
| 1166 | indicates the actually transferred data size.\r |
| 1167 | Direction: Indicates the data transfer direction. \r |
| 1168 | TimeoutInMicroSeconds:\r |
| 1169 | The timeout, in micro second units, to use for the \r |
| 1170 | execution of this ATAPI command.\r |
| 1171 | A TimeoutInMicroSeconds value of 0 means that \r |
| 1172 | this function will wait indefinitely for the ATAPI \r |
| 1173 | command to execute.\r |
| 1174 | If TimeoutInMicroSeconds is greater than zero, then \r |
| 1175 | this function will return EFI_TIMEOUT if the time \r |
| 1176 | required to execute the ATAPI command is greater \r |
| 1177 | than TimeoutInMicroSeconds.\r |
| 1178 | \r |
| 1179 | Returns:\r |
| 1180 | \r |
| 1181 | EFI_STATUS\r |
| 1182 | \r |
| 1183 | --*/\r |
| 1184 | ;\r |
| 1185 | \r |
| 1186 | \r |
| 1187 | UINT8\r |
| 1188 | ReadPortB (\r |
| 1189 | IN EFI_PCI_IO_PROTOCOL *PciIo,\r |
| 1190 | IN UINT16 Port\r |
| 1191 | )\r |
| 1192 | /*++\r |
| 1193 | \r |
| 1194 | Routine Description:\r |
| 1195 | \r |
| 1196 | Read one byte from a specified I/O port.\r |
| 1197 | \r |
| 1198 | Arguments:\r |
| 1199 | \r |
| 1200 | PciIo - The pointer of EFI_PCI_IO_PROTOCOL\r |
| 1201 | Port - IO port\r |
| 1202 | \r |
| 1203 | Returns:\r |
| 1204 | \r |
| 1205 | A byte read out\r |
| 1206 | \r |
| 1207 | --*/\r |
| 1208 | ;\r |
| 1209 | \r |
| 1210 | \r |
| 1211 | UINT16\r |
| 1212 | ReadPortW (\r |
| 1213 | IN EFI_PCI_IO_PROTOCOL *PciIo,\r |
| 1214 | IN UINT16 Port\r |
| 1215 | )\r |
| 1216 | /*++\r |
| 1217 | \r |
| 1218 | Routine Description:\r |
| 1219 | \r |
| 1220 | Read one word from a specified I/O port.\r |
| 1221 | \r |
| 1222 | Arguments:\r |
| 1223 | \r |
| 1224 | PciIo - The pointer of EFI_PCI_IO_PROTOCOL\r |
| 1225 | Port - IO port\r |
| 1226 | \r |
| 1227 | Returns: \r |
| 1228 | \r |
| 1229 | A word read out\r |
| 1230 | \r |
| 1231 | --*/\r |
| 1232 | ;\r |
| 1233 | \r |
| 1234 | \r |
| 1235 | VOID\r |
| 1236 | WritePortB (\r |
| 1237 | IN EFI_PCI_IO_PROTOCOL *PciIo,\r |
| 1238 | IN UINT16 Port,\r |
| 1239 | IN UINT8 Data\r |
| 1240 | )\r |
| 1241 | /*++\r |
| 1242 | \r |
| 1243 | Routine Description:\r |
| 1244 | \r |
| 1245 | Write one byte to a specified I/O port.\r |
| 1246 | \r |
| 1247 | Arguments:\r |
| 1248 | \r |
| 1249 | PciIo - The pointer of EFI_PCI_IO_PROTOCOL\r |
| 1250 | Port - IO port\r |
| 1251 | Data - The data to write\r |
| 1252 | \r |
| 1253 | Returns:\r |
| 1254 | \r |
| 1255 | NONE\r |
| 1256 | \r |
| 1257 | --*/\r |
| 1258 | ;\r |
| 1259 | \r |
| 1260 | \r |
| 1261 | VOID\r |
| 1262 | WritePortW (\r |
| 1263 | IN EFI_PCI_IO_PROTOCOL *PciIo,\r |
| 1264 | IN UINT16 Port,\r |
| 1265 | IN UINT16 Data\r |
| 1266 | )\r |
| 1267 | /*++\r |
| 1268 | \r |
| 1269 | Routine Description:\r |
| 1270 | \r |
| 1271 | Write one word to a specified I/O port.\r |
| 1272 | \r |
| 1273 | Arguments:\r |
| 1274 | \r |
| 1275 | PciIo - The pointer of EFI_PCI_IO_PROTOCOL\r |
| 1276 | Port - IO port\r |
| 1277 | Data - The data to write\r |
| 1278 | \r |
| 1279 | Returns:\r |
| 1280 | \r |
| 1281 | NONE\r |
| 1282 | \r |
| 1283 | --*/\r |
| 1284 | ;\r |
| 1285 | \r |
| 1286 | EFI_STATUS\r |
| 1287 | StatusDRQClear (\r |
| 1288 | ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r |
| 1289 | UINT64 TimeOutInMicroSeconds\r |
| 1290 | )\r |
| 1291 | /*++\r |
| 1292 | \r |
| 1293 | Routine Description:\r |
| 1294 | \r |
| 1295 | Check whether DRQ is clear in the Status Register. (BSY must also be cleared)\r |
| 1296 | If TimeoutInMicroSeconds is zero, this routine should wait infinitely for\r |
| 1297 | DRQ clear. Otherwise, it will return EFI_TIMEOUT when specified time is \r |
| 1298 | elapsed.\r |
| 1299 | \r |
| 1300 | Arguments:\r |
| 1301 | \r |
| 1302 | AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r |
| 1303 | TimeoutInMicroSeconds - The time to wait for\r |
| 1304 | \r |
| 1305 | Returns:\r |
| 1306 | \r |
| 1307 | EFI_STATUS\r |
| 1308 | \r |
| 1309 | --*/\r |
| 1310 | ;\r |
| 1311 | \r |
| 1312 | EFI_STATUS\r |
| 1313 | AltStatusDRQClear (\r |
| 1314 | ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r |
| 1315 | UINT64 TimeOutInMicroSeconds\r |
| 1316 | )\r |
| 1317 | /*++\r |
| 1318 | \r |
| 1319 | Routine Description:\r |
| 1320 | \r |
| 1321 | Check whether DRQ is clear in the Alternate Status Register. \r |
| 1322 | (BSY must also be cleared).If TimeoutInMicroSeconds is zero, this routine should \r |
| 1323 | wait infinitely for DRQ clear. Otherwise, it will return EFI_TIMEOUT when specified time is \r |
| 1324 | elapsed.\r |
| 1325 | \r |
| 1326 | Arguments:\r |
| 1327 | \r |
| 1328 | AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r |
| 1329 | TimeoutInMicroSeconds - The time to wait for\r |
| 1330 | \r |
| 1331 | Returns:\r |
| 1332 | \r |
| 1333 | EFI_STATUS\r |
| 1334 | \r |
| 1335 | --*/\r |
| 1336 | ;\r |
| 1337 | \r |
| 1338 | EFI_STATUS\r |
| 1339 | StatusDRQReady (\r |
| 1340 | ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r |
| 1341 | UINT64 TimeOutInMicroSeconds\r |
| 1342 | )\r |
| 1343 | /*++\r |
| 1344 | \r |
| 1345 | Routine Description:\r |
| 1346 | \r |
| 1347 | Check whether DRQ is ready in the Status Register. (BSY must also be cleared)\r |
| 1348 | If TimeoutInMicroSeconds is zero, this routine should wait infinitely for\r |
| 1349 | DRQ ready. Otherwise, it will return EFI_TIMEOUT when specified time is \r |
| 1350 | elapsed.\r |
| 1351 | \r |
| 1352 | Arguments:\r |
| 1353 | \r |
| 1354 | AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r |
| 1355 | TimeoutInMicroSeconds - The time to wait for\r |
| 1356 | \r |
| 1357 | Returns:\r |
| 1358 | \r |
| 1359 | EFI_STATUS\r |
| 1360 | \r |
| 1361 | --*/\r |
| 1362 | ;\r |
| 1363 | \r |
| 1364 | EFI_STATUS\r |
| 1365 | AltStatusDRQReady (\r |
| 1366 | ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r |
| 1367 | UINT64 TimeOutInMicroSeconds\r |
| 1368 | )\r |
| 1369 | /*++\r |
| 1370 | \r |
| 1371 | Routine Description:\r |
| 1372 | \r |
| 1373 | Check whether DRQ is ready in the Alternate Status Register. \r |
| 1374 | (BSY must also be cleared)\r |
| 1375 | If TimeoutInMicroSeconds is zero, this routine should wait infinitely for\r |
| 1376 | DRQ ready. Otherwise, it will return EFI_TIMEOUT when specified time is \r |
| 1377 | elapsed.\r |
| 1378 | \r |
| 1379 | Arguments:\r |
| 1380 | \r |
| 1381 | AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r |
| 1382 | TimeoutInMicroSeconds - The time to wait for\r |
| 1383 | \r |
| 1384 | Returns:\r |
| 1385 | \r |
| 1386 | EFI_STATUS\r |
| 1387 | \r |
| 1388 | --*/\r |
| 1389 | ;\r |
| 1390 | \r |
| 1391 | EFI_STATUS\r |
| 1392 | StatusWaitForBSYClear (\r |
| 1393 | ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r |
| 1394 | UINT64 TimeoutInMicroSeconds\r |
| 1395 | )\r |
| 1396 | /*++\r |
| 1397 | \r |
| 1398 | Routine Description:\r |
| 1399 | \r |
| 1400 | Check whether BSY is clear in the Status Register.\r |
| 1401 | If TimeoutInMicroSeconds is zero, this routine should wait infinitely for\r |
| 1402 | BSY clear. Otherwise, it will return EFI_TIMEOUT when specified time is \r |
| 1403 | elapsed.\r |
| 1404 | \r |
| 1405 | Arguments:\r |
| 1406 | \r |
| 1407 | AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r |
| 1408 | TimeoutInMicroSeconds - The time to wait for\r |
| 1409 | \r |
| 1410 | Returns:\r |
| 1411 | \r |
| 1412 | EFI_STATUS\r |
| 1413 | \r |
| 1414 | --*/\r |
| 1415 | ;\r |
| 1416 | \r |
| 1417 | EFI_STATUS\r |
| 1418 | AltStatusWaitForBSYClear (\r |
| 1419 | ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r |
| 1420 | UINT64 TimeoutInMicroSeconds\r |
| 1421 | )\r |
| 1422 | /*++\r |
| 1423 | \r |
| 1424 | Routine Description:\r |
| 1425 | \r |
| 1426 | Check whether BSY is clear in the Alternate Status Register.\r |
| 1427 | If TimeoutInMicroSeconds is zero, this routine should wait infinitely for\r |
| 1428 | BSY clear. Otherwise, it will return EFI_TIMEOUT when specified time is \r |
| 1429 | elapsed.\r |
| 1430 | \r |
| 1431 | Arguments:\r |
| 1432 | \r |
| 1433 | AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r |
| 1434 | TimeoutInMicroSeconds - The time to wait for\r |
| 1435 | \r |
| 1436 | Returns:\r |
| 1437 | \r |
| 1438 | EFI_STATUS\r |
| 1439 | \r |
| 1440 | --*/\r |
| 1441 | ;\r |
| 1442 | \r |
| 1443 | EFI_STATUS\r |
| 1444 | StatusDRDYReady (\r |
| 1445 | ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r |
| 1446 | UINT64 TimeoutInMicroSeconds\r |
| 1447 | )\r |
| 1448 | /*++\r |
| 1449 | \r |
| 1450 | Routine Description:\r |
| 1451 | \r |
| 1452 | Check whether DRDY is ready in the Status Register. \r |
| 1453 | (BSY must also be cleared)\r |
| 1454 | If TimeoutInMicroSeconds is zero, this routine should wait infinitely for\r |
| 1455 | DRDY ready. Otherwise, it will return EFI_TIMEOUT when specified time is \r |
| 1456 | elapsed.\r |
| 1457 | \r |
| 1458 | Arguments:\r |
| 1459 | \r |
| 1460 | AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r |
| 1461 | TimeoutInMicroSeconds - The time to wait for\r |
| 1462 | \r |
| 1463 | Returns:\r |
| 1464 | \r |
| 1465 | EFI_STATUS\r |
| 1466 | \r |
| 1467 | --*/\r |
| 1468 | ;\r |
| 1469 | \r |
| 1470 | EFI_STATUS\r |
| 1471 | AltStatusDRDYReady (\r |
| 1472 | ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r |
| 1473 | UINT64 TimeoutInMicroSeconds\r |
| 1474 | )\r |
| 1475 | /*++\r |
| 1476 | \r |
| 1477 | Routine Description:\r |
| 1478 | \r |
| 1479 | Check whether DRDY is ready in the Alternate Status Register. \r |
| 1480 | (BSY must also be cleared)\r |
| 1481 | If TimeoutInMicroSeconds is zero, this routine should wait infinitely for\r |
| 1482 | DRDY ready. Otherwise, it will return EFI_TIMEOUT when specified time is \r |
| 1483 | elapsed.\r |
| 1484 | \r |
| 1485 | Arguments:\r |
| 1486 | \r |
| 1487 | AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r |
| 1488 | TimeoutInMicroSeconds - The time to wait for\r |
| 1489 | \r |
| 1490 | Returns:\r |
| 1491 | \r |
| 1492 | EFI_STATUS\r |
| 1493 | \r |
| 1494 | --*/\r |
| 1495 | ;\r |
| 1496 | \r |
| 1497 | EFI_STATUS\r |
| 1498 | AtapiPassThruPioReadWriteData (\r |
| 1499 | ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r |
| 1500 | UINT16 *Buffer,\r |
| 1501 | UINT32 *ByteCount,\r |
| 1502 | DATA_DIRECTION Direction,\r |
| 1503 | UINT64 TimeOutInMicroSeconds\r |
| 1504 | )\r |
| 1505 | /*++\r |
| 1506 | \r |
| 1507 | Routine Description:\r |
| 1508 | \r |
| 1509 | Performs data transfer between ATAPI device and host after the\r |
| 1510 | ATAPI command packet is sent.\r |
| 1511 | \r |
| 1512 | Arguments:\r |
| 1513 | \r |
| 1514 | AtapiScsiPrivate: Private data structure for the specified channel. \r |
| 1515 | Buffer: Points to the transferred data.\r |
| 1516 | ByteCount: When input,indicates the buffer size; when output,\r |
| 1517 | indicates the actually transferred data size.\r |
| 1518 | Direction: Indicates the data transfer direction. \r |
| 1519 | TimeoutInMicroSeconds:\r |
| 1520 | The timeout, in micro second units, to use for the \r |
| 1521 | execution of this ATAPI command.\r |
| 1522 | A TimeoutInMicroSeconds value of 0 means that \r |
| 1523 | this function will wait indefinitely for the ATAPI \r |
| 1524 | command to execute.\r |
| 1525 | If TimeoutInMicroSeconds is greater than zero, then \r |
| 1526 | this function will return EFI_TIMEOUT if the time \r |
| 1527 | required to execute the ATAPI command is greater \r |
| 1528 | than TimeoutInMicroSeconds.\r |
| 1529 | Returns:\r |
| 1530 | \r |
| 1531 | EFI_STATUS\r |
| 1532 | \r |
| 1533 | --*/\r |
| 1534 | ;\r |
| 1535 | \r |
| 1536 | EFI_STATUS\r |
| 1537 | AtapiPassThruCheckErrorStatus (\r |
| 1538 | ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate\r |
| 1539 | )\r |
| 1540 | /*++\r |
| 1541 | \r |
| 1542 | Routine Description:\r |
| 1543 | \r |
| 1544 | Check Error Register for Error Information. \r |
| 1545 | \r |
| 1546 | Arguments:\r |
| 1547 | \r |
| 1548 | AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r |
| 1549 | \r |
| 1550 | Returns:\r |
| 1551 | \r |
| 1552 | EFI_STATUS\r |
| 1553 | \r |
| 1554 | --*/\r |
| 1555 | ;\r |
| 1556 | \r |
| 1557 | \r |
| 1558 | EFI_STATUS\r |
| 1559 | GetIdeRegistersBaseAddr (\r |
| 1560 | IN EFI_PCI_IO_PROTOCOL *PciIo,\r |
| 1561 | OUT IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr\r |
| 1562 | )\r |
| 1563 | /*++\r |
| 1564 | \r |
| 1565 | Routine Description:\r |
| 1566 | Get IDE IO port registers' base addresses by mode. In 'Compatibility' mode,\r |
| 1567 | use fixed addresses. In Native-PCI mode, get base addresses from BARs in\r |
| 1568 | the PCI IDE controller's Configuration Space.\r |
| 1569 | \r |
| 1570 | Arguments:\r |
| 1571 | PciIo - Pointer to the EFI_PCI_IO_PROTOCOL instance\r |
| 1572 | IdeRegsBaseAddr - Pointer to IDE_REGISTERS_BASE_ADDR to \r |
| 1573 | receive IDE IO port registers' base addresses\r |
| 1574 | \r |
| 1575 | Returns:\r |
| 1576 | \r |
| 1577 | EFI_STATUS\r |
| 1578 | \r |
| 1579 | --*/\r |
| 1580 | ;\r |
| 1581 | \r |
| 1582 | \r |
| 1583 | VOID\r |
| 1584 | InitAtapiIoPortRegisters (\r |
| 1585 | IN ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r |
| 1586 | IN IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr\r |
| 1587 | )\r |
| 1588 | /*++\r |
| 1589 | \r |
| 1590 | Routine Description:\r |
| 1591 | \r |
| 1592 | Initialize each Channel's Base Address of CommandBlock and ControlBlock.\r |
| 1593 | \r |
| 1594 | Arguments:\r |
| 1595 | \r |
| 1596 | AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r |
| 1597 | IdeRegsBaseAddr - The pointer of IDE_REGISTERS_BASE_ADDR\r |
| 1598 | \r |
| 1599 | Returns:\r |
| 1600 | \r |
| 1601 | None\r |
| 1602 | \r |
| 1603 | --*/ \r |
| 1604 | ;\r |
| 1605 | \r |
| 1606 | /**\r |
| 1607 | Installs Scsi Pass Thru and/or Ext Scsi Pass Thru \r |
| 1608 | protocols based on feature flags. \r |
| 1609 | \r |
| 1610 | @param Controller The controller handle to \r |
| 1611 | install these protocols on.\r |
| 1612 | @param AtapiScsiPrivate A pointer to the protocol private\r |
| 1613 | data structure.\r |
| 1614 | \r |
| 1615 | @retval EFI_SUCCESS The installation succeeds. \r |
| 1616 | @retval other The installation fails. \r |
| 1617 | \r |
| 1618 | **/\r |
| 1619 | EFI_STATUS\r |
| 1620 | InstallScsiPassThruProtocols (\r |
| 1621 | IN EFI_HANDLE *ControllerHandle,\r |
| 1622 | IN ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate\r |
| 1623 | );\r |
| 1624 | \r |
| 1625 | #endif\r |