[yellowstone] Add registration to yellowstone stub.
This commit is contained in:
parent
72483a3437
commit
c057da88ad
5 changed files with 27 additions and 16 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <mammoth/endpoint_client.h>
|
||||
#include <mammoth/memory_region.h>
|
||||
#include <mammoth/port_client.h>
|
||||
#include <ztypes.h>
|
||||
|
||||
class YellowstoneStub {
|
||||
|
|
@ -10,6 +11,10 @@ class YellowstoneStub {
|
|||
|
||||
glcr::ErrorOr<MappedMemoryRegion> GetAhciConfig();
|
||||
|
||||
[[nodiscard]] glcr::ErrorCode Register(glcr::String name,
|
||||
const EndpointClient& client);
|
||||
|
||||
private:
|
||||
glcr::UniquePtr<EndpointClient> yellowstone_stub_;
|
||||
PortClient register_port_;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,3 +21,19 @@ glcr::ErrorOr<MappedMemoryRegion> YellowstoneStub::GetAhciConfig() {
|
|||
->CallEndpoint<YellowstoneGetReq, YellowstoneGetAhciResp>(req)));
|
||||
return MappedMemoryRegion::DirectPhysical(resp.ahci_phys_offset, kPciSize);
|
||||
}
|
||||
|
||||
glcr::ErrorCode YellowstoneStub::Register(glcr::String name,
|
||||
const EndpointClient& client) {
|
||||
if (register_port_.empty()) {
|
||||
YellowstoneGetReq req{
|
||||
.type = kYellowstoneGetRegistration,
|
||||
};
|
||||
ASSIGN_OR_RETURN(
|
||||
auto resp_cap,
|
||||
(yellowstone_stub_->CallEndpointGetCap<
|
||||
YellowstoneGetReq, YellowstoneGetRegistrationResp>(req)));
|
||||
register_port_ = PortClient::AdoptPort(resp_cap.second());
|
||||
}
|
||||
|
||||
return register_port_.WriteString(name, client.GetCap());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue