[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 {
using yellowstone::Endpoint;
using yellowstone::GetEndpointRequest;
using yellowstone::YellowstoneClient;
VFSClient* gVfsClient = nullptr;
void GetVfsClientIfNeeded() {

View File

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

View File

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

View File

@ -8,6 +8,7 @@
DenaliClient::~DenaliClient() {
if (endpoint_ != 0) {
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"
class DenaliClient {
public:
DenaliClient(z_cap_t Denali_cap) : endpoint_(Denali_cap) {}
@ -33,3 +34,4 @@ class DenaliClient {
uint64_t kCapBufferSize = 0x10;
glcr::CapBuffer cap_buffer_{kCapBufferSize};
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -16,7 +16,7 @@
class Ext2BlockReader {
public:
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.
Superblock* GetSuperblock();

View File

@ -3,7 +3,8 @@
#include <glacier/string/string.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,
Ext2BlockReader::Init(glcr::Move(denali_info)));

View File

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

View File

@ -8,6 +8,7 @@
VFSClient::~VFSClient() {
if (endpoint_ != 0) {
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"
class VFSClient {
public:
VFSClient(z_cap_t VFS_cap) : endpoint_(VFS_cap) {}
@ -33,3 +34,4 @@ class VFSClient {
uint64_t kCapBufferSize = 0x10;
glcr::CapBuffer cap_buffer_{kCapBufferSize};
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,6 +7,9 @@
#include <zcall.h>
namespace yellowstone {
YellowstoneClient::~YellowstoneClient() {
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"
namespace yellowstone {
class YellowstoneClient {
public:
YellowstoneClient(z_cap_t Yellowstone_cap) : endpoint_(Yellowstone_cap) {}
@ -45,3 +48,6 @@ class YellowstoneClient {
uint64_t kCapBufferSize = 0x10;
glcr::CapBuffer cap_buffer_{kCapBufferSize};
};
} // namepace yellowstone

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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