TianoCore EDK2 master
Loading...
Searching...
No Matches
PeiAtapi.c File Reference
#include "UsbBotPeim.h"
#include "BotPeim.h"

Go to the source code of this file.

Macros

#define MAXSENSEKEY   5
 

Functions

EFI_STATUS PeiUsbInquiry (IN EFI_PEI_SERVICES **PeiServices, IN PEI_BOT_DEVICE *PeiBotDevice)
 
EFI_STATUS PeiUsbTestUnitReady (IN EFI_PEI_SERVICES **PeiServices, IN PEI_BOT_DEVICE *PeiBotDevice)
 
EFI_STATUS PeiUsbRequestSense (IN EFI_PEI_SERVICES **PeiServices, IN PEI_BOT_DEVICE *PeiBotDevice, OUT UINTN *SenseCounts, IN UINT8 *SenseKeyBuffer)
 
EFI_STATUS PeiUsbReadCapacity (IN EFI_PEI_SERVICES **PeiServices, IN PEI_BOT_DEVICE *PeiBotDevice)
 
EFI_STATUS PeiUsbReadFormattedCapacity (IN EFI_PEI_SERVICES **PeiServices, IN PEI_BOT_DEVICE *PeiBotDevice)
 
EFI_STATUS PeiUsbRead10 (IN EFI_PEI_SERVICES **PeiServices, IN PEI_BOT_DEVICE *PeiBotDevice, IN VOID *Buffer, IN EFI_PEI_LBA Lba, IN UINTN NumberOfBlocks)
 
BOOLEAN IsNoMedia (IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts)
 
BOOLEAN IsMediaError (IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts)
 
BOOLEAN IsMediaChange (IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts)
 

Detailed Description

Pei USB ATAPI command implementations.

Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.
Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file PeiAtapi.c.

Macro Definition Documentation

◆ MAXSENSEKEY

#define MAXSENSEKEY   5

Definition at line 14 of file PeiAtapi.c.

Function Documentation

◆ IsMediaChange()

BOOLEAN IsMediaChange ( IN ATAPI_REQUEST_SENSE_DATA SenseData,
IN UINTN  SenseCounts 
)

Check if media is changed according to sense data.

Parameters
SenseDataPointer to sense data.
SenseCountsCount of sense data.
Return values
TRUEThere is media change event.
FALSEmedia is NOT changed.

Definition at line 603 of file PeiAtapi.c.

◆ IsMediaError()

BOOLEAN IsMediaError ( IN ATAPI_REQUEST_SENSE_DATA SenseData,
IN UINTN  SenseCounts 
)

Check if there is media error according to sense data.

Parameters
SenseDataPointer to sense data.
SenseCountsCount of sense data.
Return values
TRUEMedia error
FALSENo media error

Definition at line 526 of file PeiAtapi.c.

◆ IsNoMedia()

BOOLEAN IsNoMedia ( IN ATAPI_REQUEST_SENSE_DATA SenseData,
IN UINTN  SenseCounts 
)

Check if there is media according to sense data.

Parameters
SenseDataPointer to sense data.
SenseCountsCount of sense data.
Return values
TRUENo media
FALSEMedia exists

Definition at line 476 of file PeiAtapi.c.

◆ PeiUsbInquiry()

EFI_STATUS PeiUsbInquiry ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_BOT_DEVICE PeiBotDevice 
)

Sends out ATAPI Inquiry Packet Command to the specified device. This command will return INQUIRY data of the device.

Parameters
PeiServicesThe pointer of EFI_PEI_SERVICES.
PeiBotDeviceThe pointer to PEI_BOT_DEVICE instance.
Return values
EFI_SUCCESSInquiry command completes successfully.
EFI_DEVICE_ERRORInquiry command failed.

Definition at line 28 of file PeiAtapi.c.

◆ PeiUsbRead10()

EFI_STATUS PeiUsbRead10 ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_BOT_DEVICE PeiBotDevice,
IN VOID *  Buffer,
IN EFI_PEI_LBA  Lba,
IN UINTN  NumberOfBlocks 
)

Execute Read(10) ATAPI command on a specific SCSI target.

Executes the ATAPI Read(10) command on the ATAPI target specified by PeiBotDevice.

Parameters
PeiServicesThe pointer of EFI_PEI_SERVICES.
PeiBotDeviceThe pointer to PEI_BOT_DEVICE instance.
BufferThe pointer to data buffer.
LbaThe start logic block address of reading.
NumberOfBlocksThe block number of reading.
Return values
EFI_SUCCESSCommand executed successfully.
EFI_DEVICE_ERRORSome device errors happen.

Definition at line 375 of file PeiAtapi.c.

◆ PeiUsbReadCapacity()

EFI_STATUS PeiUsbReadCapacity ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_BOT_DEVICE PeiBotDevice 
)

Sends out ATAPI Read Capacity Packet Command to the specified device. This command will return the information regarding the capacity of the media in the device.

Parameters
PeiServicesThe pointer of EFI_PEI_SERVICES.
PeiBotDeviceThe pointer to PEI_BOT_DEVICE instance.
Return values
EFI_SUCCESSCommand executed successfully.
EFI_DEVICE_ERRORSome device errors happen.

Definition at line 237 of file PeiAtapi.c.

◆ PeiUsbReadFormattedCapacity()

EFI_STATUS PeiUsbReadFormattedCapacity ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_BOT_DEVICE PeiBotDevice 
)

Sends out ATAPI Read Format Capacity Data Command to the specified device. This command will return the information regarding the capacity of the media in the device.

Parameters
PeiServicesThe pointer of EFI_PEI_SERVICES.
PeiBotDeviceThe pointer to PEI_BOT_DEVICE instance.
Return values
EFI_SUCCESSCommand executed successfully.
EFI_DEVICE_ERRORSome device errors happen.

Definition at line 298 of file PeiAtapi.c.

◆ PeiUsbRequestSense()

EFI_STATUS PeiUsbRequestSense ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_BOT_DEVICE PeiBotDevice,
OUT UINTN SenseCounts,
IN UINT8 *  SenseKeyBuffer 
)

Sends out ATAPI Request Sense Packet Command to the specified device.

Parameters
PeiServicesThe pointer of EFI_PEI_SERVICES.
PeiBotDeviceThe pointer to PEI_BOT_DEVICE instance.
SenseCountsLength of sense buffer.
SenseKeyBufferPointer to sense buffer.
Return values
EFI_SUCCESSCommand executed successfully.
EFI_DEVICE_ERRORSome device errors happen.

Definition at line 144 of file PeiAtapi.c.

◆ PeiUsbTestUnitReady()

EFI_STATUS PeiUsbTestUnitReady ( IN EFI_PEI_SERVICES **  PeiServices,
IN PEI_BOT_DEVICE PeiBotDevice 
)

Sends out ATAPI Test Unit Ready Packet Command to the specified device to find out whether device is accessible.

Parameters
PeiServicesThe pointer of EFI_PEI_SERVICES.
PeiBotDeviceThe pointer to PEI_BOT_DEVICE instance.
Return values
EFI_SUCCESSTestUnit command executed successfully.
EFI_DEVICE_ERRORDevice cannot be executed TestUnit command successfully.

Definition at line 96 of file PeiAtapi.c.