virtio-mmio: add initialization for legacy mode (version 1)
Change-Id: I4dcfca8cfabafad592b638b28215225b1cca35d2 Reviewed-on: https://review.haiku-os.org/c/haiku/+/4657 Reviewed-by: Jérôme Duval <[email protected]> Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
committed by
Jérôme Duval
parent
f0adfe2a54
commit
c1e0007eea
@@ -91,9 +91,11 @@ VirtioQueue::Init()
|
|||||||
phys_addr_t availPhys = (addr_t)fAvail - (addr_t)queueMem + pe.address;
|
phys_addr_t availPhys = (addr_t)fAvail - (addr_t)queueMem + pe.address;
|
||||||
phys_addr_t usedPhys = (addr_t)fUsed - (addr_t)queueMem + pe.address;
|
phys_addr_t usedPhys = (addr_t)fUsed - (addr_t)queueMem + pe.address;
|
||||||
|
|
||||||
SetLowHi(fDev->fRegs->queueDescLow, fDev->fRegs->queueDescHi, descsPhys);
|
if (fDev->fRegs->version != 1) {
|
||||||
SetLowHi(fDev->fRegs->queueAvailLow, fDev->fRegs->queueAvailHi, availPhys);
|
SetLowHi(fDev->fRegs->queueDescLow, fDev->fRegs->queueDescHi, descsPhys);
|
||||||
SetLowHi(fDev->fRegs->queueUsedLow, fDev->fRegs->queueUsedHi, usedPhys);
|
SetLowHi(fDev->fRegs->queueAvailLow, fDev->fRegs->queueAvailHi, availPhys);
|
||||||
|
SetLowHi(fDev->fRegs->queueUsedLow, fDev->fRegs->queueUsedHi, usedPhys);
|
||||||
|
}
|
||||||
|
|
||||||
fFreeDescs.SetTo(new(std::nothrow) uint32[(fQueueLen + 31) / 32]);
|
fFreeDescs.SetTo(new(std::nothrow) uint32[(fQueueLen + 31) / 32]);
|
||||||
if (!fFreeDescs.IsSet())
|
if (!fFreeDescs.IsSet())
|
||||||
@@ -104,7 +106,13 @@ VirtioQueue::Init()
|
|||||||
if (!fCookies.IsSet())
|
if (!fCookies.IsSet())
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
fDev->fRegs->queueReady = 1;
|
if (fDev->fRegs->version == 1) {
|
||||||
|
uint32_t pfn = descsPhys / B_PAGE_SIZE;
|
||||||
|
fDev->fRegs->queueAlign = B_PAGE_SIZE;
|
||||||
|
fDev->fRegs->queuePfn = pfn;
|
||||||
|
} else {
|
||||||
|
fDev->fRegs->queueReady = 1;
|
||||||
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user