Add a yellowstone stub and partially migrate denali

This commit is contained in:
Drew Galbraith 2023-07-05 14:51:24 -07:00
parent 318356e54c
commit 72483a3437
6 changed files with 57 additions and 29 deletions

View file

@ -4,7 +4,8 @@ add_executable(yellowstone
yellowstone.cpp
yellowstone_server.cpp
)
target_include_directories(yellowstone
target_include_directories(yellowstone
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(yellowstone
@ -27,6 +28,10 @@ target_include_directories(yellowstone_stub
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
target_link_libraries(yellowstone_stub
mammoth
)
set_target_properties(yellowstone_stub PROPERTIES
COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${BASE_COMPILE_FLAGS}"
LINK_FLAGS "${CMAKE_EXE_LINK_FLAGS} ${BASE_LINK_FLAGS}"

View file

@ -0,0 +1,15 @@
#pragma once
#include <mammoth/endpoint_client.h>
#include <mammoth/memory_region.h>
#include <ztypes.h>
class YellowstoneStub {
public:
explicit YellowstoneStub(z_cap_t yellowstone_cap);
glcr::ErrorOr<MappedMemoryRegion> GetAhciConfig();
private:
glcr::UniquePtr<EndpointClient> yellowstone_stub_;
};

View file

@ -1,3 +1,23 @@
// PLACEHOLDER
#include <stdint.h>
uint64_t a = 0;
#include "include/yellowstone_stub.h"
#include "include/yellowstone.h"
namespace {
const uint64_t kPciSize = 0x1000;
} // namespace
YellowstoneStub::YellowstoneStub(z_cap_t yellowstone_cap)
: yellowstone_stub_(EndpointClient::AdoptEndpoint(yellowstone_cap)) {}
glcr::ErrorOr<MappedMemoryRegion> YellowstoneStub::GetAhciConfig() {
YellowstoneGetReq req{
.type = kYellowstoneGetAhci,
};
ASSIGN_OR_RETURN(
YellowstoneGetAhciResp resp,
(yellowstone_stub_
->CallEndpoint<YellowstoneGetReq, YellowstoneGetAhciResp>(req)));
return MappedMemoryRegion::DirectPhysical(resp.ahci_phys_offset, kPciSize);
}