2023-06-16 23:51:49 -07:00
|
|
|
#include "mammoth/init.h"
|
|
|
|
|
2023-06-21 18:28:54 -07:00
|
|
|
#include <glacier/status/error.h>
|
2023-06-17 01:45:53 -07:00
|
|
|
#include <ztypes.h>
|
2023-06-16 23:51:49 -07:00
|
|
|
|
|
|
|
#include "mammoth/debug.h"
|
2023-06-26 08:41:44 -07:00
|
|
|
#include "mammoth/port_server.h"
|
2023-06-16 23:51:49 -07:00
|
|
|
|
|
|
|
uint64_t gSelfProcCap = 0;
|
|
|
|
uint64_t gSelfVmasCap = 0;
|
|
|
|
|
2023-06-21 23:14:42 -07:00
|
|
|
uint64_t gInitEndpointCap = 0;
|
2023-06-17 01:30:47 -07:00
|
|
|
|
2023-06-16 23:51:49 -07:00
|
|
|
uint64_t gBootDenaliVmmoCap = 0;
|
2023-06-22 00:22:59 -07:00
|
|
|
uint64_t gBootVictoriaFallsVmmoCap = 0;
|
2023-08-01 17:13:16 -07:00
|
|
|
uint64_t gBootPciVmmoCap = 0;
|
2023-06-16 23:51:49 -07:00
|
|
|
|
|
|
|
z_err_t ParseInitPort(uint64_t init_port_cap) {
|
2023-06-26 08:41:44 -07:00
|
|
|
PortServer port = PortServer::AdoptCap(init_port_cap);
|
2023-06-16 23:51:49 -07:00
|
|
|
z_err_t ret;
|
|
|
|
uint64_t init_sig, init_cap;
|
2023-06-21 18:28:54 -07:00
|
|
|
while ((ret = port.PollForIntCap(&init_sig, &init_cap)) != glcr::EMPTY) {
|
2023-06-16 23:51:49 -07:00
|
|
|
RET_ERR(ret);
|
|
|
|
switch (init_sig) {
|
2023-06-17 00:17:43 -07:00
|
|
|
case Z_INIT_SELF_PROC:
|
2023-06-16 23:51:49 -07:00
|
|
|
gSelfProcCap = init_cap;
|
|
|
|
break;
|
2023-06-17 00:17:43 -07:00
|
|
|
case Z_INIT_SELF_VMAS:
|
2023-06-16 23:51:49 -07:00
|
|
|
gSelfVmasCap = init_cap;
|
|
|
|
break;
|
2023-06-21 23:14:42 -07:00
|
|
|
case Z_INIT_ENDPOINT:
|
|
|
|
gInitEndpointCap = init_cap;
|
2023-06-17 01:30:47 -07:00
|
|
|
break;
|
2023-06-16 23:51:49 -07:00
|
|
|
case Z_BOOT_DENALI_VMMO:
|
|
|
|
gBootDenaliVmmoCap = init_cap;
|
|
|
|
break;
|
2023-06-22 00:22:59 -07:00
|
|
|
case Z_BOOT_VICTORIA_FALLS_VMMO:
|
|
|
|
gBootVictoriaFallsVmmoCap = init_cap;
|
|
|
|
break;
|
2023-08-01 17:13:16 -07:00
|
|
|
case Z_BOOT_PCI_VMMO:
|
|
|
|
gBootPciVmmoCap = init_cap;
|
|
|
|
break;
|
2023-06-16 23:51:49 -07:00
|
|
|
default:
|
2023-11-03 02:48:21 -07:00
|
|
|
dbgln("Unexpected init type {}, continuing.", init_sig);
|
2023-06-16 23:51:49 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-21 18:28:54 -07:00
|
|
|
return glcr::OK;
|
2023-06-16 23:51:49 -07:00
|
|
|
}
|