[zion] Remove temp PCI Memory Object create function.
Pass the PCI memory space to the yellowstone init process instead.
This commit is contained in:
parent
c70b5b0753
commit
8f84f8c3ca
|
@ -13,6 +13,7 @@ uint64_t gInitEndpointCap = 0;
|
|||
|
||||
uint64_t gBootDenaliVmmoCap = 0;
|
||||
uint64_t gBootVictoriaFallsVmmoCap = 0;
|
||||
uint64_t gBootPciVmmoCap = 0;
|
||||
|
||||
z_err_t ParseInitPort(uint64_t init_port_cap) {
|
||||
PortServer port = PortServer::AdoptCap(init_port_cap);
|
||||
|
@ -40,6 +41,10 @@ z_err_t ParseInitPort(uint64_t init_port_cap) {
|
|||
dbgln("received victoria falls");
|
||||
gBootVictoriaFallsVmmoCap = init_cap;
|
||||
break;
|
||||
case Z_BOOT_PCI_VMMO:
|
||||
dbgln("received pci");
|
||||
gBootPciVmmoCap = init_cap;
|
||||
break;
|
||||
default:
|
||||
dbgln("Unexpected init type %x, continuing.", init_sig);
|
||||
}
|
||||
|
|
|
@ -15,13 +15,9 @@ PciDeviceHeader* PciHeader(uint64_t base, uint64_t bus, uint64_t dev,
|
|||
} // namespace
|
||||
|
||||
PciReader::PciReader() {
|
||||
dbgln("Creating PCI obj");
|
||||
uint64_t vmmo_cap, vmmo_size;
|
||||
check(ZTempPcieConfigObjectCreate(&vmmo_cap, &vmmo_size));
|
||||
|
||||
dbgln("Creating addr space");
|
||||
uint64_t vaddr;
|
||||
check(ZAddressSpaceMap(gSelfVmasCap, 0, vmmo_cap, &vaddr));
|
||||
check(ZAddressSpaceMap(gSelfVmasCap, 0, gBootPciVmmoCap, &vaddr));
|
||||
dbgln("Addr %lx", vaddr);
|
||||
|
||||
dbgln("Dumping PCI");
|
||||
|
|
|
@ -106,7 +106,6 @@ SYS3(MemoryObjectCreatePhysical, uint64_t, paddr, uint64_t, size, z_cap_t*,
|
|||
vmmo_cap);
|
||||
SYS3(MemoryObjectCreateContiguous, uint64_t, size, z_cap_t*, vmmo_cap,
|
||||
uint64_t*, paddr);
|
||||
SYS2(TempPcieConfigObjectCreate, z_cap_t*, vmmo_cap, uint64_t*, vmmo_size);
|
||||
|
||||
SYS2(ChannelCreate, z_cap_t*, channel1, z_cap_t*, channel2);
|
||||
SYS5(ChannelSend, z_cap_t, chan_cap, uint64_t, num_bytes, const void*, data,
|
||||
|
|
|
@ -9,3 +9,4 @@ extern uint64_t gInitEndpointCap;
|
|||
|
||||
extern uint64_t gBootDenaliVmmoCap;
|
||||
extern uint64_t gBootVictoriaFallsVmmoCap;
|
||||
extern uint64_t gBootPciVmmoCap;
|
||||
|
|
|
@ -27,8 +27,6 @@ const uint64_t kZionMemoryObjectCreate = 0x30;
|
|||
const uint64_t kZionMemoryObjectCreatePhysical = 0x31;
|
||||
const uint64_t kZionMemoryObjectCreateContiguous = 0x32;
|
||||
|
||||
const uint64_t kZionTempPcieConfigObjectCreate = 0x3F;
|
||||
|
||||
// IPC Calls
|
||||
const uint64_t kZionChannelCreate = 0x40;
|
||||
const uint64_t kZionChannelSend = 0x41;
|
||||
|
@ -90,3 +88,4 @@ typedef uint64_t z_cap_t;
|
|||
|
||||
#define Z_BOOT_DENALI_VMMO 0x4200'0000
|
||||
#define Z_BOOT_VICTORIA_FALLS_VMMO 0x4200'0001
|
||||
#define Z_BOOT_PCI_VMMO 0x4200'0002
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <glacier/memory/ref_ptr.h>
|
||||
#include <glacier/string/string.h>
|
||||
|
||||
#include "boot/acpi.h"
|
||||
#include "boot/boot_info.h"
|
||||
#include "debug/debug.h"
|
||||
#include "include/zcall.h"
|
||||
|
@ -127,6 +128,16 @@ void WriteInitProgram(glcr::RefPtr<Port> port, glcr::String name, uint64_t id) {
|
|||
MakeRefCounted<Capability>(prog_vmmo, ZC_READ | ZC_WRITE));
|
||||
}
|
||||
|
||||
glcr::ErrorCode WritePciVmmo(glcr::RefPtr<Port> port, uint64_t id) {
|
||||
ASSIGN_OR_RETURN(PcieConfiguration config, GetPciExtendedConfiguration());
|
||||
auto vmmo =
|
||||
glcr::MakeRefCounted<FixedMemoryObject>(config.base, config.offset);
|
||||
|
||||
port->WriteKernel(id, MakeRefCounted<Capability>(vmmo, ZC_READ | ZC_WRITE));
|
||||
|
||||
return glcr::OK;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void LoadInitProgram() {
|
||||
|
@ -147,6 +158,10 @@ void LoadInitProgram() {
|
|||
WriteInitProgram(port, "/sys/denali", Z_BOOT_DENALI_VMMO);
|
||||
WriteInitProgram(port, "/sys/victoriafalls", Z_BOOT_VICTORIA_FALLS_VMMO);
|
||||
|
||||
if (WritePciVmmo(port, Z_BOOT_PCI_VMMO) != glcr::OK) {
|
||||
panic("Failed to provide PCI info to init.");
|
||||
}
|
||||
|
||||
// Start process.
|
||||
const limine_file& init_prog = GetInitProgram("/sys/yellowstone");
|
||||
uint64_t entry = LoadElfProgram(
|
||||
|
|
|
@ -29,14 +29,3 @@ z_err_t MemoryObjectCreateContiguous(ZMemoryObjectCreateContiguousReq* req) {
|
|||
*req->paddr = paddr;
|
||||
return glcr::OK;
|
||||
}
|
||||
|
||||
z_err_t TempPcieConfigObjectCreate(ZTempPcieConfigObjectCreateReq* req) {
|
||||
auto& curr_proc = gScheduler->CurrentProcess();
|
||||
ASSIGN_OR_RETURN(PcieConfiguration config, GetPciExtendedConfiguration());
|
||||
auto vmmo_ref =
|
||||
glcr::MakeRefCounted<FixedMemoryObject>(config.base, config.offset);
|
||||
*req->vmmo_cap = curr_proc.AddNewCapability(
|
||||
StaticCastRefPtr<MemoryObject>(vmmo_ref), ZC_WRITE);
|
||||
*req->vmmo_size = config.offset;
|
||||
return glcr::OK;
|
||||
}
|
||||
|
|
|
@ -5,4 +5,3 @@
|
|||
z_err_t MemoryObjectCreate(ZMemoryObjectCreateReq* req);
|
||||
z_err_t MemoryObjectCreatePhysical(ZMemoryObjectCreatePhysicalReq* req);
|
||||
z_err_t MemoryObjectCreateContiguous(ZMemoryObjectCreateContiguousReq* req);
|
||||
z_err_t TempPcieConfigObjectCreate(ZTempPcieConfigObjectCreateReq* req);
|
||||
|
|
|
@ -63,7 +63,6 @@ extern "C" z_err_t SyscallHandler(uint64_t call_id, void* req) {
|
|||
CASE(MemoryObjectCreate);
|
||||
CASE(MemoryObjectCreatePhysical);
|
||||
CASE(MemoryObjectCreateContiguous);
|
||||
CASE(TempPcieConfigObjectCreate);
|
||||
// syscall/ipc.h
|
||||
CASE(ChannelCreate);
|
||||
CASE(ChannelSend);
|
||||
|
|
Loading…
Reference in New Issue