2023-06-15 16:20:29 -07:00
|
|
|
#include <denali/denali.h>
|
|
|
|
#include <mammoth/channel.h>
|
2023-06-07 00:04:53 -07:00
|
|
|
#include <mammoth/debug.h>
|
2023-06-16 23:51:49 -07:00
|
|
|
#include <mammoth/init.h>
|
2023-06-07 00:04:53 -07:00
|
|
|
#include <mammoth/process.h>
|
2023-06-07 00:19:15 -07:00
|
|
|
#include <zcall.h>
|
2023-06-16 23:51:49 -07:00
|
|
|
#include <zinit.h>
|
2023-05-30 20:55:03 -07:00
|
|
|
|
2023-06-07 22:45:42 -07:00
|
|
|
#include "hw/pcie.h"
|
|
|
|
|
2023-06-16 23:15:41 -07:00
|
|
|
uint64_t main(uint64_t port_cap) {
|
2023-06-07 11:18:35 -07:00
|
|
|
dbgln("Yellowstone Initializing.");
|
2023-06-16 23:51:49 -07:00
|
|
|
check(ParseInitPort(port_cap));
|
|
|
|
|
2023-06-07 00:19:15 -07:00
|
|
|
uint64_t vaddr;
|
2023-06-17 00:17:43 -07:00
|
|
|
check(ZAddressSpaceMap(gSelfVmasCap, 0, gBootDenaliVmmoCap, &vaddr));
|
2023-06-15 16:20:29 -07:00
|
|
|
|
|
|
|
Channel local;
|
|
|
|
check(SpawnProcessFromElfRegion(vaddr, local));
|
2023-06-16 01:31:23 -07:00
|
|
|
|
|
|
|
DenaliRead read{
|
|
|
|
.device_id = 0,
|
|
|
|
.lba = 0,
|
|
|
|
.size = 1,
|
|
|
|
};
|
|
|
|
check(ZChannelSend(local.cap(), DENALI_READ, sizeof(DenaliRead),
|
|
|
|
reinterpret_cast<uint8_t*>(&read), 0, nullptr));
|
|
|
|
|
|
|
|
DenaliReadResponse resp;
|
2023-06-16 23:51:49 -07:00
|
|
|
uint64_t mem_cap, type, bytes, caps;
|
2023-06-16 01:31:23 -07:00
|
|
|
|
|
|
|
check(ZChannelRecv(local.cap(), sizeof(resp),
|
|
|
|
reinterpret_cast<uint8_t*>(&resp), 1, &mem_cap, &type,
|
|
|
|
&bytes, &caps));
|
|
|
|
|
|
|
|
dbgln("Resp: %u", type);
|
|
|
|
|
2023-06-17 00:17:43 -07:00
|
|
|
check(ZAddressSpaceMap(gSelfVmasCap, 0, mem_cap, &vaddr));
|
2023-06-16 01:31:23 -07:00
|
|
|
uint32_t* mbr = reinterpret_cast<uint32_t*>(vaddr + 0x1FE);
|
|
|
|
dbgln("MBR: %x", *mbr);
|
2023-06-07 11:18:35 -07:00
|
|
|
|
2023-06-07 22:45:42 -07:00
|
|
|
DumpPciEDevices();
|
|
|
|
|
2023-06-07 11:18:35 -07:00
|
|
|
dbgln("Yellowstone Finished Successfully.");
|
2023-05-29 00:32:54 -07:00
|
|
|
return 0;
|
|
|
|
}
|