[Yellowstone] Move yellowstone yunq to namespace "yellowstone"

This commit is contained in:
Drew Galbraith 2023-11-30 08:50:43 -08:00
parent f1e09b2ae6
commit 6212aef336
40 changed files with 141 additions and 16 deletions

View File

@ -11,6 +11,10 @@
namespace mmth { namespace mmth {
namespace { namespace {
using yellowstone::Endpoint;
using yellowstone::GetEndpointRequest;
using yellowstone::YellowstoneClient;
VFSClient* gVfsClient = nullptr; VFSClient* gVfsClient = nullptr;
void GetVfsClientIfNeeded() { void GetVfsClientIfNeeded() {

View File

@ -9,6 +9,10 @@
namespace mmth { namespace mmth {
namespace { namespace {
using yellowstone::Endpoint;
using yellowstone::GetEndpointRequest;
using yellowstone::YellowstoneClient;
void KeyboardListenerEntry(void* keyboard_base) { void KeyboardListenerEntry(void* keyboard_base) {
reinterpret_cast<KeyboardListenerBase*>(keyboard_base)->ListenLoop(); reinterpret_cast<KeyboardListenerBase*>(keyboard_base)->ListenLoop();
} }

View File

@ -7,6 +7,10 @@
#include "ahci/ahci_driver.h" #include "ahci/ahci_driver.h"
#include "denali_server.h" #include "denali_server.h"
using yellowstone::AhciInfo;
using yellowstone::RegisterEndpointRequest;
using yellowstone::YellowstoneClient;
uint64_t main(uint64_t init_port_cap) { uint64_t main(uint64_t init_port_cap) {
check(ParseInitPort(init_port_cap)); check(ParseInitPort(init_port_cap));

View File

@ -8,6 +8,7 @@
DenaliClient::~DenaliClient() { DenaliClient::~DenaliClient() {
if (endpoint_ != 0) { if (endpoint_ != 0) {
check(ZCapRelease(endpoint_)); check(ZCapRelease(endpoint_));
@ -93,3 +94,5 @@ glcr::ErrorCode DenaliClient::ReadMany(const ReadManyRequest& request, ReadRespo
} }

View File

@ -8,6 +8,7 @@
#include "denali.yunq.h" #include "denali.yunq.h"
class DenaliClient { class DenaliClient {
public: public:
DenaliClient(z_cap_t Denali_cap) : endpoint_(Denali_cap) {} DenaliClient(z_cap_t Denali_cap) : endpoint_(Denali_cap) {}
@ -33,3 +34,4 @@ class DenaliClient {
uint64_t kCapBufferSize = 0x10; uint64_t kCapBufferSize = 0x10;
glcr::CapBuffer cap_buffer_{kCapBufferSize}; glcr::CapBuffer cap_buffer_{kCapBufferSize};
}; };

View File

@ -1,6 +1,7 @@
// Generated file -- DO NOT MODIFY. // Generated file -- DO NOT MODIFY.
#include "denali.yunq.h" #include "denali.yunq.h"
namespace { namespace {
const uint64_t header_size = 24; // 4x uint32, 1x uint64 const uint64_t header_size = 24; // 4x uint32, 1x uint64
@ -248,4 +249,5 @@ uint64_t ReadResponse::SerializeToBytes(glcr::ByteBuffer& bytes, uint64_t offset
WriteHeader(bytes, offset, core_size, next_extension); WriteHeader(bytes, offset, core_size, next_extension);
return next_extension; return next_extension;
} }

View File

@ -6,6 +6,8 @@
#include <glacier/container/vector.h> #include <glacier/container/vector.h>
#include <glacier/string/string.h> #include <glacier/string/string.h>
#include <ztypes.h> #include <ztypes.h>
class ReadRequest { class ReadRequest {
public: public:
ReadRequest() {} ReadRequest() {}
@ -83,4 +85,5 @@ class ReadResponse {
// Parses everything except for caps. // Parses everything except for caps.
void ParseFromBytesInternal(const glcr::ByteBuffer&, uint64_t offset); void ParseFromBytesInternal(const glcr::ByteBuffer&, uint64_t offset);
}; };

View File

@ -4,6 +4,7 @@
#include <mammoth/util/debug.h> #include <mammoth/util/debug.h>
#include <zcall.h> #include <zcall.h>
namespace { namespace {
const uint32_t kSentinel = 0xBEEFDEAD; const uint32_t kSentinel = 0xBEEFDEAD;
@ -144,3 +145,5 @@ glcr::ErrorCode DenaliServerBase::HandleRequest(const glcr::ByteBuffer& request,
} }
return glcr::OK; return glcr::OK;
} }

View File

@ -10,6 +10,8 @@
class DenaliServerBase { class DenaliServerBase {
public: public:
DenaliServerBase(z_cap_t Denali_cap) : endpoint_(Denali_cap) {} DenaliServerBase(z_cap_t Denali_cap) : endpoint_(Denali_cap) {}
@ -43,3 +45,5 @@ class DenaliServerBase {
glcr::CapBuffer& resp_caps); glcr::CapBuffer& resp_caps);
}; };

View File

@ -1,6 +1,6 @@
#include "framebuffer/framebuffer.h" #include "framebuffer/framebuffer.h"
Framebuffer::Framebuffer(const FramebufferInfo& info) Framebuffer::Framebuffer(const yellowstone::FramebufferInfo& info)
: fb_info_(info), cursor_pos_(0) { : fb_info_(info), cursor_pos_(0) {
uint64_t buff_size_bytes = fb_info_.height() * fb_info_.pitch(); uint64_t buff_size_bytes = fb_info_.height() * fb_info_.pitch();
fb_memory_ = mmth::OwnedMemoryRegion::DirectPhysical(fb_info_.address_phys(), fb_memory_ = mmth::OwnedMemoryRegion::DirectPhysical(fb_info_.address_phys(),

View File

@ -5,7 +5,7 @@
class Framebuffer { class Framebuffer {
public: public:
Framebuffer(const FramebufferInfo& info); Framebuffer(const yellowstone::FramebufferInfo& info);
void DrawPixel(uint32_t row, uint32_t col, uint32_t pixel); void DrawPixel(uint32_t row, uint32_t col, uint32_t pixel);
@ -17,7 +17,7 @@ class Framebuffer {
private: private:
// FIXME: Implement Yunq copy or move so we // FIXME: Implement Yunq copy or move so we
// don't have to store a reference here. // don't have to store a reference here.
const FramebufferInfo& fb_info_; const yellowstone::FramebufferInfo& fb_info_;
mmth::OwnedMemoryRegion fb_memory_; mmth::OwnedMemoryRegion fb_memory_;
uint32_t* fb_; uint32_t* fb_;

View File

@ -9,6 +9,9 @@
#include "framebuffer/psf.h" #include "framebuffer/psf.h"
#include "terminal.h" #include "terminal.h"
using yellowstone::FramebufferInfo;
using yellowstone::YellowstoneClient;
uint64_t main(uint64_t init_port) { uint64_t main(uint64_t init_port) {
ParseInitPort(init_port); ParseInitPort(init_port);

View File

@ -3,7 +3,7 @@
#include <mammoth/util/debug.h> #include <mammoth/util/debug.h>
glcr::ErrorOr<glcr::SharedPtr<Ext2BlockReader>> Ext2BlockReader::Init( glcr::ErrorOr<glcr::SharedPtr<Ext2BlockReader>> Ext2BlockReader::Init(
const DenaliInfo& denali_info) { const yellowstone::DenaliInfo& denali_info) {
// Read 1024 bytes from 1024 offset. // Read 1024 bytes from 1024 offset.
// FIXME: Don't assume 512 byte sectors somehow. // FIXME: Don't assume 512 byte sectors somehow.
DenaliClient client(denali_info.denali_endpoint()); DenaliClient client(denali_info.denali_endpoint());

View File

@ -16,7 +16,7 @@
class Ext2BlockReader { class Ext2BlockReader {
public: public:
static glcr::ErrorOr<glcr::SharedPtr<Ext2BlockReader>> Init( static glcr::ErrorOr<glcr::SharedPtr<Ext2BlockReader>> Init(
const DenaliInfo& denali_info); const yellowstone::DenaliInfo& denali_info);
// TODO: Consider creating a new class wrapper with these computations. // TODO: Consider creating a new class wrapper with these computations.
Superblock* GetSuperblock(); Superblock* GetSuperblock();

View File

@ -3,7 +3,8 @@
#include <glacier/string/string.h> #include <glacier/string/string.h>
#include <mammoth/util/debug.h> #include <mammoth/util/debug.h>
glcr::ErrorOr<Ext2Driver> Ext2Driver::Init(const DenaliInfo& denali_info) { glcr::ErrorOr<Ext2Driver> Ext2Driver::Init(
const yellowstone::DenaliInfo& denali_info) {
ASSIGN_OR_RETURN(glcr::SharedPtr<Ext2BlockReader> reader, ASSIGN_OR_RETURN(glcr::SharedPtr<Ext2BlockReader> reader,
Ext2BlockReader::Init(glcr::Move(denali_info))); Ext2BlockReader::Init(glcr::Move(denali_info)));

View File

@ -10,7 +10,8 @@
class Ext2Driver { class Ext2Driver {
public: public:
static glcr::ErrorOr<Ext2Driver> Init(const DenaliInfo& denali_info); static glcr::ErrorOr<Ext2Driver> Init(
const yellowstone::DenaliInfo& denali_info);
glcr::ErrorCode ProbePartition(); glcr::ErrorCode ProbePartition();

View File

@ -8,6 +8,7 @@
VFSClient::~VFSClient() { VFSClient::~VFSClient() {
if (endpoint_ != 0) { if (endpoint_ != 0) {
check(ZCapRelease(endpoint_)); check(ZCapRelease(endpoint_));
@ -93,3 +94,5 @@ glcr::ErrorCode VFSClient::GetDirectory(const GetDirectoryRequest& request, Dire
} }

View File

@ -8,6 +8,7 @@
#include "victoriafalls.yunq.h" #include "victoriafalls.yunq.h"
class VFSClient { class VFSClient {
public: public:
VFSClient(z_cap_t VFS_cap) : endpoint_(VFS_cap) {} VFSClient(z_cap_t VFS_cap) : endpoint_(VFS_cap) {}
@ -33,3 +34,4 @@ class VFSClient {
uint64_t kCapBufferSize = 0x10; uint64_t kCapBufferSize = 0x10;
glcr::CapBuffer cap_buffer_{kCapBufferSize}; glcr::CapBuffer cap_buffer_{kCapBufferSize};
}; };

View File

@ -1,6 +1,7 @@
// Generated file -- DO NOT MODIFY. // Generated file -- DO NOT MODIFY.
#include "victoriafalls.yunq.h" #include "victoriafalls.yunq.h"
namespace { namespace {
const uint64_t header_size = 24; // 4x uint32, 1x uint64 const uint64_t header_size = 24; // 4x uint32, 1x uint64
@ -283,4 +284,5 @@ uint64_t Directory::SerializeToBytes(glcr::ByteBuffer& bytes, uint64_t offset, g
WriteHeader(bytes, offset, core_size, next_extension); WriteHeader(bytes, offset, core_size, next_extension);
return next_extension; return next_extension;
} }

View File

@ -6,6 +6,8 @@
#include <glacier/container/vector.h> #include <glacier/container/vector.h>
#include <glacier/string/string.h> #include <glacier/string/string.h>
#include <ztypes.h> #include <ztypes.h>
class OpenFileRequest { class OpenFileRequest {
public: public:
OpenFileRequest() {} OpenFileRequest() {}
@ -91,4 +93,5 @@ class Directory {
// Parses everything except for caps. // Parses everything except for caps.
void ParseFromBytesInternal(const glcr::ByteBuffer&, uint64_t offset); void ParseFromBytesInternal(const glcr::ByteBuffer&, uint64_t offset);
}; };

View File

@ -4,6 +4,7 @@
#include <mammoth/util/debug.h> #include <mammoth/util/debug.h>
#include <zcall.h> #include <zcall.h>
namespace { namespace {
const uint32_t kSentinel = 0xBEEFDEAD; const uint32_t kSentinel = 0xBEEFDEAD;
@ -144,3 +145,5 @@ glcr::ErrorCode VFSServerBase::HandleRequest(const glcr::ByteBuffer& request,
} }
return glcr::OK; return glcr::OK;
} }

View File

@ -10,6 +10,8 @@
class VFSServerBase { class VFSServerBase {
public: public:
VFSServerBase(z_cap_t VFS_cap) : endpoint_(VFS_cap) {} VFSServerBase(z_cap_t VFS_cap) : endpoint_(VFS_cap) {}
@ -43,3 +45,5 @@ class VFSServerBase {
glcr::CapBuffer& resp_caps); glcr::CapBuffer& resp_caps);
}; };

View File

@ -5,6 +5,10 @@
#include "fs/ext2/ext2_driver.h" #include "fs/ext2/ext2_driver.h"
#include "victoriafalls_server.h" #include "victoriafalls_server.h"
using yellowstone::DenaliInfo;
using yellowstone::RegisterEndpointRequest;
using yellowstone::YellowstoneClient;
uint64_t main(uint64_t init_cap) { uint64_t main(uint64_t init_cap) {
ParseInitPort(init_cap); ParseInitPort(init_cap);

View File

@ -8,6 +8,7 @@
VoyageursClient::~VoyageursClient() { VoyageursClient::~VoyageursClient() {
if (endpoint_ != 0) { if (endpoint_ != 0) {
check(ZCapRelease(endpoint_)); check(ZCapRelease(endpoint_));
@ -52,3 +53,5 @@ glcr::ErrorCode VoyageursClient::RegisterKeyboardListener(const KeyboardListener
} }

View File

@ -8,6 +8,7 @@
#include "voyageurs.yunq.h" #include "voyageurs.yunq.h"
class VoyageursClient { class VoyageursClient {
public: public:
VoyageursClient(z_cap_t Voyageurs_cap) : endpoint_(Voyageurs_cap) {} VoyageursClient(z_cap_t Voyageurs_cap) : endpoint_(Voyageurs_cap) {}
@ -29,3 +30,4 @@ class VoyageursClient {
uint64_t kCapBufferSize = 0x10; uint64_t kCapBufferSize = 0x10;
glcr::CapBuffer cap_buffer_{kCapBufferSize}; glcr::CapBuffer cap_buffer_{kCapBufferSize};
}; };

View File

@ -1,6 +1,7 @@
// Generated file -- DO NOT MODIFY. // Generated file -- DO NOT MODIFY.
#include "voyageurs.yunq.h" #include "voyageurs.yunq.h"
namespace { namespace {
const uint64_t header_size = 24; // 4x uint32, 1x uint64 const uint64_t header_size = 24; // 4x uint32, 1x uint64
@ -74,4 +75,5 @@ uint64_t KeyboardListener::SerializeToBytes(glcr::ByteBuffer& bytes, uint64_t of
WriteHeader(bytes, offset, core_size, next_extension); WriteHeader(bytes, offset, core_size, next_extension);
return next_extension; return next_extension;
} }

View File

@ -6,6 +6,8 @@
#include <glacier/container/vector.h> #include <glacier/container/vector.h>
#include <glacier/string/string.h> #include <glacier/string/string.h>
#include <ztypes.h> #include <ztypes.h>
class KeyboardListener { class KeyboardListener {
public: public:
KeyboardListener() {} KeyboardListener() {}
@ -25,4 +27,5 @@ class KeyboardListener {
// Parses everything except for caps. // Parses everything except for caps.
void ParseFromBytesInternal(const glcr::ByteBuffer&, uint64_t offset); void ParseFromBytesInternal(const glcr::ByteBuffer&, uint64_t offset);
}; };

View File

@ -4,6 +4,7 @@
#include <mammoth/util/debug.h> #include <mammoth/util/debug.h>
#include <zcall.h> #include <zcall.h>
namespace { namespace {
const uint32_t kSentinel = 0xBEEFDEAD; const uint32_t kSentinel = 0xBEEFDEAD;
@ -122,3 +123,5 @@ glcr::ErrorCode VoyageursServerBase::HandleRequest(const glcr::ByteBuffer& reque
} }
return glcr::OK; return glcr::OK;
} }

View File

@ -10,6 +10,8 @@
class VoyageursServerBase { class VoyageursServerBase {
public: public:
VoyageursServerBase(z_cap_t Voyageurs_cap) : endpoint_(Voyageurs_cap) {} VoyageursServerBase(z_cap_t Voyageurs_cap) : endpoint_(Voyageurs_cap) {}
@ -39,3 +41,5 @@ class VoyageursServerBase {
glcr::CapBuffer& resp_caps); glcr::CapBuffer& resp_caps);
}; };

View File

@ -6,6 +6,9 @@
#include "keyboard/keyboard_driver.h" #include "keyboard/keyboard_driver.h"
#include "voyageurs_server.h" #include "voyageurs_server.h"
using yellowstone::RegisterEndpointRequest;
using yellowstone::YellowstoneClient;
uint64_t main(uint64_t init_port) { uint64_t main(uint64_t init_port) {
ParseInitPort(init_port); ParseInitPort(init_port);

View File

@ -1,3 +1,5 @@
package yellowstone;
interface Yellowstone { interface Yellowstone {
method RegisterEndpoint(RegisterEndpointRequest) -> (); method RegisterEndpoint(RegisterEndpointRequest) -> ();
method GetEndpoint(GetEndpointRequest) -> (Endpoint); method GetEndpoint(GetEndpointRequest) -> (Endpoint);

View File

@ -7,6 +7,9 @@
#include <zcall.h> #include <zcall.h>
namespace yellowstone {
YellowstoneClient::~YellowstoneClient() { YellowstoneClient::~YellowstoneClient() {
if (endpoint_ != 0) { if (endpoint_ != 0) {
@ -208,3 +211,7 @@ glcr::ErrorCode YellowstoneClient::GetDenali(DenaliInfo& response) {
} }
} // namepace yellowstone

View File

@ -8,6 +8,9 @@
#include "yellowstone.yunq.h" #include "yellowstone.yunq.h"
namespace yellowstone {
class YellowstoneClient { class YellowstoneClient {
public: public:
YellowstoneClient(z_cap_t Yellowstone_cap) : endpoint_(Yellowstone_cap) {} YellowstoneClient(z_cap_t Yellowstone_cap) : endpoint_(Yellowstone_cap) {}
@ -45,3 +48,6 @@ class YellowstoneClient {
uint64_t kCapBufferSize = 0x10; uint64_t kCapBufferSize = 0x10;
glcr::CapBuffer cap_buffer_{kCapBufferSize}; glcr::CapBuffer cap_buffer_{kCapBufferSize};
}; };
} // namepace yellowstone

View File

@ -1,6 +1,9 @@
// Generated file -- DO NOT MODIFY. // Generated file -- DO NOT MODIFY.
#include "yellowstone.yunq.h" #include "yellowstone.yunq.h"
namespace yellowstone {
namespace { namespace {
const uint64_t header_size = 24; // 4x uint32, 1x uint64 const uint64_t header_size = 24; // 4x uint32, 1x uint64
@ -426,4 +429,7 @@ uint64_t DenaliInfo::SerializeToBytes(glcr::ByteBuffer& bytes, uint64_t offset,
WriteHeader(bytes, offset, core_size, next_extension); WriteHeader(bytes, offset, core_size, next_extension);
return next_extension; return next_extension;
} }
} // namepace yellowstone

View File

@ -6,6 +6,10 @@
#include <glacier/container/vector.h> #include <glacier/container/vector.h>
#include <glacier/string/string.h> #include <glacier/string/string.h>
#include <ztypes.h> #include <ztypes.h>
namespace yellowstone {
class RegisterEndpointRequest { class RegisterEndpointRequest {
public: public:
RegisterEndpointRequest() {} RegisterEndpointRequest() {}
@ -170,4 +174,7 @@ class DenaliInfo {
// Parses everything except for caps. // Parses everything except for caps.
void ParseFromBytesInternal(const glcr::ByteBuffer&, uint64_t offset); void ParseFromBytesInternal(const glcr::ByteBuffer&, uint64_t offset);
}; };
} // namepace yellowstone

View File

@ -4,6 +4,9 @@
#include <mammoth/util/debug.h> #include <mammoth/util/debug.h>
#include <zcall.h> #include <zcall.h>
namespace yellowstone {
namespace { namespace {
const uint32_t kSentinel = 0xBEEFDEAD; const uint32_t kSentinel = 0xBEEFDEAD;
@ -193,3 +196,7 @@ glcr::ErrorCode YellowstoneServerBase::HandleRequest(const glcr::ByteBuffer& req
} }
return glcr::OK; return glcr::OK;
} }
} // namepace yellowstone

View File

@ -9,6 +9,10 @@
#include "yellowstone.yunq.client.h" #include "yellowstone.yunq.client.h"
namespace yellowstone {
class YellowstoneServerBase { class YellowstoneServerBase {
public: public:
@ -55,3 +59,7 @@ class YellowstoneServerBase {
glcr::CapBuffer& resp_caps); glcr::CapBuffer& resp_caps);
}; };
} // namepace yellowstone

View File

@ -22,7 +22,7 @@ uint64_t main(uint64_t port_cap) {
check(ParseInitPort(port_cap)); check(ParseInitPort(port_cap));
dbgln("Yellowstone Initializing."); dbgln("Yellowstone Initializing.");
ASSIGN_OR_RETURN(auto server, YellowstoneServer::Create()); ASSIGN_OR_RETURN(auto server, yellowstone::YellowstoneServer::Create());
Thread server_thread = server->RunServer(); Thread server_thread = server->RunServer();
ASSIGN_OR_RETURN(uint64_t client_cap, server->CreateClientCap()); ASSIGN_OR_RETURN(uint64_t client_cap, server->CreateClientCap());

View File

@ -11,6 +11,7 @@
#include "hw/gpt.h" #include "hw/gpt.h"
#include "hw/pcie.h" #include "hw/pcie.h"
namespace yellowstone {
namespace { namespace {
struct PartitionInfo { struct PartitionInfo {
@ -125,3 +126,5 @@ void YellowstoneServer::WaitDenaliRegistered() { has_denali_semaphore_.Wait(); }
void YellowstoneServer::WaitVictoriaFallsRegistered() { void YellowstoneServer::WaitVictoriaFallsRegistered() {
has_victoriafalls_semaphore_.Wait(); has_victoriafalls_semaphore_.Wait();
} }
} // namespace yellowstone

View File

@ -10,6 +10,8 @@
#include "hw/pcie.h" #include "hw/pcie.h"
#include "lib/yellowstone/yellowstone.yunq.server.h" #include "lib/yellowstone/yellowstone.yunq.server.h"
namespace yellowstone {
class YellowstoneServer : public YellowstoneServerBase { class YellowstoneServer : public YellowstoneServerBase {
public: public:
static glcr::ErrorOr<glcr::UniquePtr<YellowstoneServer>> Create(); static glcr::ErrorOr<glcr::UniquePtr<YellowstoneServer>> Create();
@ -39,3 +41,5 @@ class YellowstoneServer : public YellowstoneServerBase {
YellowstoneServer(z_cap_t endpoint_cap); YellowstoneServer(z_cap_t endpoint_cap);
}; };
} // namespace yellowstone