[denali] Get Ahci device address from yellowstone.

This commit is contained in:
Drew Galbraith 2023-06-26 17:01:59 -07:00
parent 02e6b49d90
commit 16dd675828
11 changed files with 125 additions and 52 deletions

View file

@ -11,18 +11,28 @@
uint64_t main(uint64_t init_port_cap) {
check(ParseInitPort(init_port_cap));
AhciDriver driver;
RET_ERR(driver.Init());
glcr::UniquePtr<EndpointClient> yellowstone =
EndpointClient::AdoptEndpoint(gInitEndpointCap);
YellowstoneGetReq ahci_req{
.type = kYellowstoneGetAhci,
};
auto resp_or =
yellowstone->CallEndpoint<YellowstoneGetReq, YellowstoneGetAhciResp>(
ahci_req);
if (!resp_or.ok()) {
check(resp_or.error());
}
uint64_t ahci_addr = resp_or.value().ahci_phys_offset;
AhciDriver driver(ahci_addr);
RET_ERR(driver.Init());
YellowstoneGetReq req{
.type = kYellowstoneGetRegistration,
};
auto resp_cap_or =
yellowstone
->CallEndpoint<YellowstoneGetReq, YellowstoneGetRegistrationResp>(
req);
yellowstone->CallEndpointGetCap<YellowstoneGetReq,
YellowstoneGetRegistrationResp>(req);
if (!resp_cap_or.ok()) {
dbgln("Bad call");
check(resp_cap_or.error());