TianoCore EDK2 master
|
#include <IndustryStandard/VirtioScsi.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/VirtioLib.h>
#include "VirtioScsi.h"
Go to the source code of this file.
Macros | |
#define | VIRTIO_CFG_WRITE(Dev, Field, Value) |
#define | VIRTIO_CFG_READ(Dev, Field, Pointer) |
This driver produces Extended SCSI Pass Thru Protocol instances for virtio-scsi devices.
The implementation is basic:
Copyright (C) 2012, Red Hat, Inc. Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
Copyright (c) 2017, AMD Inc, All rights reserved.
Copyright (c) 2024, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file VirtioScsi.c.
#define VIRTIO_CFG_READ | ( | Dev, | |
Field, | |||
Pointer | |||
) |
Definition at line 80 of file VirtioScsi.c.
#define VIRTIO_CFG_WRITE | ( | Dev, | |
Field, | |||
Value | |||
) |
Convenience macros to read and write configuration elements of the virtio-scsi VirtIo device.
The following macros make it possible to specify only the "core parameters" for such accesses and to derive the rest. By the time VIRTIO_CFG_WRITE() returns, the transaction will have been completed.
[in] | Dev | Pointer to the VSCSI_DEV structure. |
[in] | Field | A field name from VSCSI_HDR, identifying the virtio-scsi configuration item to access. |
[in] | Value | (VIRTIO_CFG_WRITE() only.) The value to write to the selected configuration item. |
[out] | Pointer | (VIRTIO_CFG_READ() only.) The object to receive the value read from the configuration item. Its type must be one of UINT8, UINT16, UINT32, UINT64. |
Definition at line 73 of file VirtioScsi.c.
STATIC EFI_STATUS EFIAPI ParseResponse | ( | IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET * | Packet, |
IN CONST volatile VIRTIO_SCSI_RESP * | Response | ||
) |
Parse the virtio-scsi device's response, translate it to an EFI status code, and update the Extended SCSI Pass Thru Protocol packet, to be returned by the EFI_EXT_SCSI_PASS_THRU_PROTOCOL.PassThru() implementation.
[in,out] | Packet | The Extended SCSI Pass Thru Protocol packet that has been translated to a virtio-scsi request with PopulateRequest(), and processed by the host. On output this parameter is updated with response or error contents. |
[in] | Response | The virtio-scsi response structure to parse. We expect it to come from a virtio ring, thus it is qualified volatile. |
Definition at line 290 of file VirtioScsi.c.
STATIC EFI_STATUS EFIAPI PopulateRequest | ( | IN CONST VSCSI_DEV * | Dev, |
IN UINT16 | Target, | ||
IN UINT64 | Lun, | ||
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET * | Packet, | ||
OUT volatile VIRTIO_SCSI_REQ * | Request | ||
) |
Populate a virtio-scsi request from the Extended SCSI Pass Thru Protocol packet.
The caller is responsible for pre-zeroing the virtio-scsi request. The Extended SCSI Pass Thru Protocol packet is modified, to be forwarded outwards by VirtioScsiPassThru(), if invalid or unsupported parameters are detected.
[in] | Dev | The virtio-scsi host device the packet targets. |
[in] | Target | The SCSI target controlled by the virtio-scsi host device. |
[in] | Lun | The Logical Unit Number under the SCSI target. |
[in,out] | Packet | The Extended SCSI Pass Thru Protocol packet the function translates to a virtio-scsi request. On failure this parameter relays error contents. |
[out] | Request | The pre-zeroed virtio-scsi request to populate. This parameter is volatile-qualified because we expect the caller to append it to a virtio ring, thus assignments to Request must be visible when the function returns. |
EFI_SUCCESS | The Extended SCSI Pass Thru Protocol packet was valid, Request has been populated. |
Definition at line 148 of file VirtioScsi.c.
STATIC EFI_STATUS ReportHostAdapterError | ( | OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET * | Packet | ) |
The function can be used to create a fake host adapter error.
When VirtioScsiPassThru() is failed due to some reasons then this function can be called to construct a host adapter error.
[out] | Packet | The Extended SCSI Pass Thru Protocol packet that the host adapter error shall be placed in. |
EFI_DEVICE_ERROR | The function returns this status code unconditionally, to be propagated by VirtioScsiPassThru(). |
Definition at line 402 of file VirtioScsi.c.
EFI_STATUS EFIAPI VirtioScsiBuildDevicePath | ( | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL * | This, |
IN UINT8 * | Target, | ||
IN UINT64 | Lun, | ||
IN OUT EFI_DEVICE_PATH_PROTOCOL ** | DevicePath | ||
) |
Definition at line 776 of file VirtioScsi.c.
EFI_STATUS EFIAPI VirtioScsiDriverBindingStart | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | DeviceHandle, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | RemainingDevicePath | ||
) |
Definition at line 1322 of file VirtioScsi.c.
EFI_STATUS EFIAPI VirtioScsiDriverBindingStop | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | DeviceHandle, | ||
IN UINTN | NumberOfChildren, | ||
IN EFI_HANDLE * | ChildHandleBuffer | ||
) |
Definition at line 1406 of file VirtioScsi.c.
EFI_STATUS EFIAPI VirtioScsiDriverBindingSupported | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | DeviceHandle, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | RemainingDevicePath | ||
) |
Definition at line 1275 of file VirtioScsi.c.
EFI_STATUS EFIAPI VirtioScsiEntryPoint | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
Definition at line 1544 of file VirtioScsi.c.
Definition at line 1239 of file VirtioScsi.c.
EFI_STATUS EFIAPI VirtioScsiGetDeviceName | ( | IN EFI_COMPONENT_NAME_PROTOCOL * | This, |
IN EFI_HANDLE | DeviceHandle, | ||
IN EFI_HANDLE | ChildHandle, | ||
IN CHAR8 * | Language, | ||
OUT CHAR16 ** | ControllerName | ||
) |
Definition at line 1514 of file VirtioScsi.c.
EFI_STATUS EFIAPI VirtioScsiGetDriverName | ( | IN EFI_COMPONENT_NAME_PROTOCOL * | This, |
IN CHAR8 * | Language, | ||
OUT CHAR16 ** | DriverName | ||
) |
Definition at line 1497 of file VirtioScsi.c.
EFI_STATUS EFIAPI VirtioScsiGetNextTarget | ( | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL * | This, |
IN OUT UINT8 ** | TargetPointer | ||
) |
Definition at line 881 of file VirtioScsi.c.
EFI_STATUS EFIAPI VirtioScsiGetNextTargetLun | ( | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL * | This, |
IN OUT UINT8 ** | TargetPointer, | ||
IN OUT UINT64 * | Lun | ||
) |
Definition at line 718 of file VirtioScsi.c.
EFI_STATUS EFIAPI VirtioScsiGetTargetLun | ( | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL * | This, |
IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath, | ||
OUT UINT8 ** | TargetPointer, | ||
OUT UINT64 * | Lun | ||
) |
Definition at line 815 of file VirtioScsi.c.
STATIC EFI_STATUS EFIAPI VirtioScsiInit | ( | IN OUT VSCSI_DEV * | Dev | ) |
Definition at line 932 of file VirtioScsi.c.
EFI_STATUS EFIAPI VirtioScsiPassThru | ( | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL * | This, |
IN UINT8 * | Target, | ||
IN UINT64 | Lun, | ||
IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET * | Packet, | ||
IN EFI_EVENT Event | OPTIONAL | ||
) |
Definition at line 423 of file VirtioScsi.c.
EFI_STATUS EFIAPI VirtioScsiResetChannel | ( | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL * | This | ) |
Definition at line 861 of file VirtioScsi.c.
EFI_STATUS EFIAPI VirtioScsiResetTargetLun | ( | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL * | This, |
IN UINT8 * | Target, | ||
IN UINT64 | Lun | ||
) |
Definition at line 870 of file VirtioScsi.c.
Definition at line 1209 of file VirtioScsi.c.
STATIC EFI_COMPONENT_NAME_PROTOCOL gComponentName |
Definition at line 1493 of file VirtioScsi.c.
STATIC EFI_COMPONENT_NAME2_PROTOCOL gComponentName2 |
Definition at line 1533 of file VirtioScsi.c.
STATIC EFI_DRIVER_BINDING_PROTOCOL gDriverBinding |
Definition at line 1464 of file VirtioScsi.c.
STATIC EFI_UNICODE_STRING_TABLE mDriverNameTable[] |
Definition at line 1487 of file VirtioScsi.c.