2023-06-22 02:19:16 -07:00
|
|
|
#pragma once
|
|
|
|
|
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-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-06-26 17:01:59 -07:00
|
|
|
#include "hw/pcie.h"
|
|
|
|
|
2023-06-22 02:19:16 -07:00
|
|
|
class YellowstoneServer {
|
|
|
|
public:
|
2023-06-26 11:38:17 -07:00
|
|
|
static glcr::ErrorOr<glcr::UniquePtr<YellowstoneServer>> Create();
|
2023-06-22 02:19:16 -07:00
|
|
|
|
|
|
|
Thread RunServer();
|
|
|
|
Thread RunRegistration();
|
|
|
|
|
|
|
|
void ServerThread();
|
|
|
|
void RegistrationThread();
|
|
|
|
|
2023-06-26 11:54:36 -07:00
|
|
|
glcr::ErrorOr<glcr::UniquePtr<EndpointClient>> GetServerClient();
|
2023-06-22 02:19:16 -07:00
|
|
|
|
|
|
|
private:
|
2023-06-26 11:38:17 -07:00
|
|
|
glcr::UniquePtr<EndpointServer> server_;
|
2023-06-26 08:41:44 -07:00
|
|
|
PortServer register_port_;
|
2023-06-22 02:19:16 -07:00
|
|
|
|
|
|
|
static const uint64_t kBufferSize = 128;
|
|
|
|
uint8_t server_buffer_[kBufferSize];
|
|
|
|
char registration_buffer_[kBufferSize];
|
|
|
|
|
|
|
|
// 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-06-26 17:01:59 -07:00
|
|
|
PciReader pci_reader_;
|
|
|
|
|
2023-06-26 11:38:17 -07:00
|
|
|
YellowstoneServer(glcr::UniquePtr<EndpointServer> server, PortServer port);
|
2023-06-22 02:19:16 -07:00
|
|
|
};
|