2023-06-22 02:19:16 -07:00
|
|
|
#pragma once
|
|
|
|
|
2023-11-21 19:14:02 -08:00
|
|
|
#include <glacier/container/hash_map.h>
|
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>
|
2023-11-22 13:45:04 -08:00
|
|
|
#include <mammoth/sync/semaphore.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-11-21 19:14:02 -08:00
|
|
|
glcr::ErrorCode HandleGetEndpoint(const GetEndpointRequest&,
|
|
|
|
Endpoint&) override;
|
2023-06-22 02:19:16 -07:00
|
|
|
|
2023-11-22 13:30:59 -08:00
|
|
|
void WaitDenaliRegistered();
|
|
|
|
void WaitVictoriaFallsRegistered();
|
2023-10-25 19:08:00 -07:00
|
|
|
|
2023-06-22 02:19:16 -07:00
|
|
|
private:
|
2023-11-21 19:14:02 -08:00
|
|
|
glcr::HashMap<glcr::String, z_cap_t> endpoint_map_;
|
|
|
|
|
2023-07-05 16:03:20 -07:00
|
|
|
uint64_t device_id_ = 0;
|
|
|
|
uint64_t lba_offset_ = 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-11-22 14:59:41 -08:00
|
|
|
mmth::Semaphore has_denali_semaphore_;
|
|
|
|
mmth::Semaphore has_victoriafalls_semaphore_;
|
2023-10-25 19:08:00 -07:00
|
|
|
|
2023-11-22 13:30:59 -08:00
|
|
|
YellowstoneServer(z_cap_t endpoint_cap);
|
2023-06-22 02:19:16 -07:00
|
|
|
};
|