2023-06-22 02:19:16 -07:00
|
|
|
#pragma once
|
|
|
|
|
2023-11-02 19:28:27 -07:00
|
|
|
#include <glacier/memory/shared_ptr.h>
|
2023-06-26 11:38:17 -07:00
|
|
|
#include <glacier/memory/unique_ptr.h>
|
2023-06-22 02:19:16 -07:00
|
|
|
#include <glacier/status/error_or.h>
|
|
|
|
#include <mammoth/endpoint_server.h>
|
2023-10-25 19:08:00 -07:00
|
|
|
#include <mammoth/mutex.h>
|
2023-06-26 08:41:44 -07:00
|
|
|
#include <mammoth/port_server.h>
|
2023-06-22 02:19:16 -07:00
|
|
|
#include <mammoth/thread.h>
|
2023-11-02 19:28:27 -07:00
|
|
|
#include <victoriafalls/victoriafalls.yunq.client.h>
|
2023-06-22 02:19:16 -07:00
|
|
|
|
2023-06-26 17:01:59 -07:00
|
|
|
#include "hw/pcie.h"
|
2023-10-24 23:49:42 -07:00
|
|
|
#include "lib/yellowstone/yellowstone.yunq.server.h"
|
2023-06-26 17:01:59 -07:00
|
|
|
|
2023-10-24 18:24:26 -07:00
|
|
|
class YellowstoneServer : public YellowstoneServerBase {
|
2023-06-22 02:19:16 -07:00
|
|
|
public:
|
2023-06-26 11:38:17 -07:00
|
|
|
static glcr::ErrorOr<glcr::UniquePtr<YellowstoneServer>> Create();
|
2023-06-22 02:19:16 -07:00
|
|
|
|
2023-10-24 18:24:26 -07:00
|
|
|
glcr::ErrorCode HandleGetAhciInfo(const Empty&, AhciInfo&) override;
|
2023-11-09 11:33:32 -08:00
|
|
|
glcr::ErrorCode HandleGetFramebufferInfo(const Empty&,
|
|
|
|
FramebufferInfo&) override;
|
2023-10-24 18:24:26 -07:00
|
|
|
glcr::ErrorCode HandleGetDenali(const Empty&, DenaliInfo&) override;
|
2023-10-24 23:42:34 -07:00
|
|
|
glcr::ErrorCode HandleRegisterEndpoint(const RegisterEndpointRequest&,
|
|
|
|
Empty&) override;
|
2023-06-22 02:19:16 -07:00
|
|
|
|
2023-10-25 19:08:00 -07:00
|
|
|
glcr::ErrorCode WaitDenaliRegistered();
|
2023-11-02 18:55:05 -07:00
|
|
|
glcr::ErrorCode WaitVictoriaFallsRegistered();
|
2023-10-25 19:08:00 -07:00
|
|
|
|
2023-11-02 19:28:27 -07:00
|
|
|
glcr::SharedPtr<VFSClient> GetVFSClient();
|
|
|
|
|
2023-06-22 02:19:16 -07:00
|
|
|
private:
|
|
|
|
// TODO: Store these in a data structure.
|
|
|
|
z_cap_t denali_cap_ = 0;
|
2023-07-05 16:03:20 -07:00
|
|
|
uint64_t device_id_ = 0;
|
|
|
|
uint64_t lba_offset_ = 0;
|
2023-06-22 02:19:16 -07:00
|
|
|
z_cap_t victoria_falls_cap_ = 0;
|
2023-11-02 19:28:27 -07:00
|
|
|
glcr::SharedPtr<VFSClient> vfs_client_;
|
2023-06-22 02:19:16 -07:00
|
|
|
|
2023-06-26 17:01:59 -07:00
|
|
|
PciReader pci_reader_;
|
|
|
|
|
2023-10-25 19:08:00 -07:00
|
|
|
Mutex has_denali_mutex_;
|
2023-11-02 18:55:05 -07:00
|
|
|
Mutex has_victoriafalls_mutex_;
|
2023-10-25 19:08:00 -07:00
|
|
|
|
2023-11-02 18:55:05 -07:00
|
|
|
YellowstoneServer(z_cap_t endpoint_cap, Mutex&& denali_mutex,
|
|
|
|
Mutex&& victoriafalls_mutex);
|
2023-06-22 02:19:16 -07:00
|
|
|
};
|