]> git.proxmox.com Git - mirror_edk2.git/commit
OvmfPkg/PvScsiDxe: Refactor setup of rings to separate function
authorLiran Alon <liran.alon@oracle.com>
Tue, 31 Mar 2020 22:56:37 +0000 (01:56 +0300)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 1 Apr 2020 14:12:09 +0000 (14:12 +0000)
commite210fc130e5c9738909dca432bbf8bf277ba6e37
tree2986442b32988c567c17fb2f91fbebf71e50e8a7
parent98936dc4f44b4ef47e7221d435de06a0813aa00a
OvmfPkg/PvScsiDxe: Refactor setup of rings to separate function

Previous to this change, PvScsiFreeRings() was not undoing all
operations that was done by PvScsiInitRings().
This is because PvScsiInitRings() was both preparing rings (Allocate
memory and map it for device DMA) and setup the rings against device by
issueing a device command. While PvScsiFreeRings() only unmaps the rings
and free their memory.

Driver do not have a functional error as it makes sure to reset device
before every call site to PvScsiFreeRings(). However, this is not
intuitive.

Therefore, prefer to refactor the setup of the ring against device to a
separate function than PvScsiInitRings().

Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200331225637.123318-1-liran.alon@oracle.com>
[lersek@redhat.com: rename FreeDMACommBuffer label to FreeDmaCommBuffer]
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
OvmfPkg/PvScsiDxe/PvScsi.c