2023-06-21 23:14:42 -07:00
|
|
|
|
2023-06-12 19:20:51 -07:00
|
|
|
#include <mammoth/debug.h>
|
2023-06-21 23:14:42 -07:00
|
|
|
#include <mammoth/endpoint_server.h>
|
2023-06-17 01:30:47 -07:00
|
|
|
#include <mammoth/init.h>
|
2023-06-26 08:59:28 -07:00
|
|
|
#include <mammoth/port_client.h>
|
2023-06-08 02:36:59 -07:00
|
|
|
#include <stdint.h>
|
2023-10-24 18:24:26 -07:00
|
|
|
#include <yellowstone/yellowstone.yunq.client.h>
|
2023-06-08 02:36:59 -07:00
|
|
|
|
|
|
|
#include "ahci/ahci_driver.h"
|
2023-06-15 16:20:29 -07:00
|
|
|
#include "denali_server.h"
|
2023-06-08 02:36:59 -07:00
|
|
|
|
2023-06-17 01:30:47 -07:00
|
|
|
uint64_t main(uint64_t init_port_cap) {
|
|
|
|
check(ParseInitPort(init_port_cap));
|
2023-06-26 11:54:36 -07:00
|
|
|
glcr::UniquePtr<EndpointClient> yellowstone =
|
|
|
|
EndpointClient::AdoptEndpoint(gInitEndpointCap);
|
2023-06-26 17:01:59 -07:00
|
|
|
|
2023-10-24 18:24:26 -07:00
|
|
|
YellowstoneClient stub(gInitEndpointCap);
|
|
|
|
Empty empty;
|
|
|
|
AhciInfo ahci;
|
|
|
|
RET_ERR(stub.GetAhciInfo(empty, ahci));
|
|
|
|
MappedMemoryRegion ahci_region =
|
|
|
|
MappedMemoryRegion::FromCapability(ahci.ahci_region());
|
2023-07-05 14:51:24 -07:00
|
|
|
ASSIGN_OR_RETURN(auto driver, AhciDriver::Init(ahci_region));
|
2023-06-26 17:01:59 -07:00
|
|
|
|
2023-08-01 15:52:08 -07:00
|
|
|
ASSIGN_OR_RETURN(glcr::UniquePtr<DenaliServer> server,
|
|
|
|
DenaliServer::Create(*driver));
|
|
|
|
|
2023-10-25 20:28:28 -07:00
|
|
|
ASSIGN_OR_RETURN(DenaliClient client, server->CreateClient());
|
2023-10-24 18:24:26 -07:00
|
|
|
|
2023-08-01 16:08:34 -07:00
|
|
|
Thread server_thread = server->RunServer();
|
|
|
|
|
2023-10-24 23:42:34 -07:00
|
|
|
RegisterEndpointRequest req;
|
|
|
|
req.set_endpoint_name("denali");
|
2023-10-25 20:28:28 -07:00
|
|
|
req.set_endpoint_capability(client.Capability());
|
2023-10-24 23:42:34 -07:00
|
|
|
check(stub.RegisterEndpoint(req, empty));
|
|
|
|
|
2023-08-01 16:08:34 -07:00
|
|
|
check(server_thread.Join());
|
2023-06-12 19:20:51 -07:00
|
|
|
return 0;
|
2023-06-08 02:36:59 -07:00
|
|
|
}
|