[zion] Add a method for duplicating and scoping down VMMOs.

Use the AHCI section of the PCI config as an example POC of this.

We can now pass a memory capability instead of just the physical
address.
This commit is contained in:
Drew Galbraith 2023-08-01 17:46:26 -07:00
parent 8f84f8c3ca
commit 48c6e5b3a4
12 changed files with 62 additions and 18 deletions

View file

@ -4,12 +4,6 @@
#include "include/yellowstone.h"
namespace {
const uint64_t kPciSize = 0x1000;
} // namespace
YellowstoneStub::YellowstoneStub(z_cap_t yellowstone_cap)
: yellowstone_stub_(EndpointClient::AdoptEndpoint(yellowstone_cap)) {}
@ -18,10 +12,10 @@ glcr::ErrorOr<MappedMemoryRegion> YellowstoneStub::GetAhciConfig() {
.type = kYellowstoneGetAhci,
};
ASSIGN_OR_RETURN(
YellowstoneGetAhciResp resp,
(yellowstone_stub_
->CallEndpoint<YellowstoneGetReq, YellowstoneGetAhciResp>(req)));
return MappedMemoryRegion::DirectPhysical(resp.ahci_phys_offset, kPciSize);
auto resp_cap_pair,
(yellowstone_stub_->CallEndpointGetCap<YellowstoneGetReq,
YellowstoneGetAhciResp>(req)));
return MappedMemoryRegion::FromCapability(resp_cap_pair.second());
}
glcr::ErrorOr<ScopedDenaliClient> YellowstoneStub::GetDenali() {