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-06-22 02:19:16 -07:00
|
|
|
#include <yellowstone.h>
|
2023-07-05 14:51:24 -07:00
|
|
|
#include <yellowstone_stub.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-07-05 14:51:24 -07:00
|
|
|
YellowstoneStub stub(gInitEndpointCap);
|
|
|
|
ASSIGN_OR_RETURN(MappedMemoryRegion ahci_region, stub.GetAhciConfig());
|
|
|
|
ASSIGN_OR_RETURN(auto driver, AhciDriver::Init(ahci_region));
|
2023-06-26 17:01:59 -07:00
|
|
|
|
2023-06-26 11:38:17 -07:00
|
|
|
ASSIGN_OR_RETURN(glcr::UniquePtr<EndpointServer> endpoint,
|
|
|
|
EndpointServer::Create());
|
2023-06-26 11:54:36 -07:00
|
|
|
ASSIGN_OR_RETURN(glcr::UniquePtr<EndpointClient> client,
|
|
|
|
endpoint->CreateClient());
|
2023-07-05 15:01:29 -07:00
|
|
|
check(stub.Register("denali", *client));
|
2023-06-22 02:19:16 -07:00
|
|
|
|
2023-06-26 17:35:51 -07:00
|
|
|
DenaliServer server(glcr::Move(endpoint), *driver);
|
2023-06-15 16:20:29 -07:00
|
|
|
RET_ERR(server.RunServer());
|
|
|
|
// FIXME: Add thread join.
|
2023-06-12 19:20:51 -07:00
|
|
|
return 0;
|
2023-06-08 02:36:59 -07:00
|
|
|
}
|