Liran Alon
b654edec03
OvmfPkg/PvScsiDxe: Setup requests and completions rings
...
These rings are shared memory buffers between host and device in which
a cyclic buffer is managed to send request descriptors from host to
device and receive completion descriptors from device to host.
Note that because device may be constrained by IOMMU or guest may be run
under AMD SEV, we make sure to map these rings to device by using
PciIo->Map().
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Signed-off-by: Liran Alon <liran.alon@oracle.com >
Message-Id: <20200328200100.60786-14-liran.alon@oracle.com >
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com >
Reviewed-by: Laszlo Ersek <lersek@redhat.com >
2020-03-30 16:45:07 +00:00
Liran Alon
5269c26e07
OvmfPkg/PvScsiDxe: Reset adapter on init
...
The following commits will complete the implementation of
device initialization.
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com >
Signed-off-by: Liran Alon <liran.alon@oracle.com >
Message-Id: <20200328200100.60786-13-liran.alon@oracle.com >
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com >
2020-03-30 16:45:07 +00:00
Liran Alon
6672b3cff2
OvmfPkg/PvScsiDxe: Enable MMIO-Space & Bus-Mastering in PCI attributes
...
Enable MMIO-Space & Bus-Mastering PCI attributes when device is started.
Note that original PCI attributes are restored when device is stopped.
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com >
Signed-off-by: Liran Alon <liran.alon@oracle.com >
Message-Id: <20200328200100.60786-11-liran.alon@oracle.com >
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com >
2020-03-30 16:45:07 +00:00
Liran Alon
45098e8a9a
OvmfPkg/PvScsiDxe: Backup/Restore PCI attributes on Init/UnInit
...
This commit doesn't change semantics.
It is done as a preparation for future commits which will modify
PCI attributes.
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com >
Signed-off-by: Liran Alon <liran.alon@oracle.com >
Message-Id: <20200328200100.60786-10-liran.alon@oracle.com >
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com >
2020-03-30 16:45:07 +00:00
Liran Alon
c08eaaaf37
OvmfPkg/PvScsiDxe: Open PciIo protocol for later use
...
This will give us an exclusive access to the PciIo of this device
after it was started and until it will be stopped.
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com >
Signed-off-by: Liran Alon <liran.alon@oracle.com >
Message-Id: <20200328200100.60786-9-liran.alon@oracle.com >
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com >
2020-03-30 16:45:07 +00:00
Liran Alon
9c2d8281af
OvmfPkg/PvScsiDxe: Translate Target & LUN to/from DevicePath
...
Implement EXT_SCSI_PASS_THRU.BuildDevicePath() and
EXT_SCSI_PASS_THRU.GetTargetLun().
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com >
Signed-off-by: Liran Alon <liran.alon@oracle.com >
Message-Id: <20200328200100.60786-8-liran.alon@oracle.com >
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com >
2020-03-30 16:45:07 +00:00
Liran Alon
7efce2e59c
OvmfPkg/PvScsiDxe: Report the number of targets and LUNs
...
Implement EXT_SCSI_PASS_THRU.GetNextTarget() and
EXT_SCSI_PASS_THRU.GetNextTargetLun().
ScsiBusDxe scans all MaxTarget * MaxLun possible devices.
This can take unnecessarily long for large number of targets.
To deal with this, VirtioScsiDxe has defined PCDs to limit the
MaxTarget & MaxLun to desired values which gives sufficient
performance. It is very important in virtio-scsi as it can have
very big MaxTarget & MaxLun.
Even though a common PVSCSI device has a default MaxTarget=64 and
MaxLun=0, we implement similar mechanism as virtio-scsi for completeness.
This may be useful in the future when PVSCSI will have bigger values
for MaxTarget and MaxLun.
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com >
Signed-off-by: Liran Alon <liran.alon@oracle.com >
Message-Id: <20200328200100.60786-7-liran.alon@oracle.com >
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com >
2020-03-30 16:45:07 +00:00
Liran Alon
e497432c2c
OvmfPkg/PvScsiDxe: Install stubbed EXT_SCSI_PASS_THRU
...
Support dynamic insertion and removal of the protocol.
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com >
Signed-off-by: Liran Alon <liran.alon@oracle.com >
Message-Id: <20200328200100.60786-6-liran.alon@oracle.com >
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com >
2020-03-30 16:45:07 +00:00
Liran Alon
a9f9d5cf56
OvmfPkg/PvScsiDxe: Probe PCI devices and look for PvScsi
...
PvScsiControllerSupported() is called on handles passed in
by the ConnectController() boot service and if the handle is the
PVSCSI controller, the function would return success. A success
return value will attach our driver to the device.
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com >
Signed-off-by: Liran Alon <liran.alon@oracle.com >
Message-Id: <20200328200100.60786-5-liran.alon@oracle.com >
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com >
2020-03-30 16:45:07 +00:00
Liran Alon
419b30d642
OvmfPkg/PvScsiDxe: Report name of driver
...
Install Component Name protocols to have a nice display name for the
driver in places such as UEFI shell.
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com >
Signed-off-by: Liran Alon <liran.alon@oracle.com >
Message-Id: <20200328200100.60786-4-liran.alon@oracle.com >
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com >
2020-03-30 16:45:07 +00:00
Liran Alon
ed08c57113
OvmfPkg/PvScsiDxe: Install DriverBinding protocol
...
In order to probe and connect to the PvScsi device we need this
protocol. Currently it does nothing.
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com >
Signed-off-by: Liran Alon <liran.alon@oracle.com >
Message-Id: <20200328200100.60786-3-liran.alon@oracle.com >
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com >
2020-03-30 16:45:07 +00:00
Liran Alon
478c07d483
OvmfPkg/PvScsiDxe: Create empty driver
...
In preparation for support booting from PvScsi devices, create a
basic scaffolding for a driver.
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2567
Reviewed-by: Laszlo Ersek <lersek@redhat.com >
Signed-off-by: Liran Alon <liran.alon@oracle.com >
Message-Id: <20200328200100.60786-2-liran.alon@oracle.com >
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com >
2020-03-30 16:45:07 +00:00