[Zion] Pass the framebuffer info to yellowstone init process.
This commit is contained in:
parent
8d10f19312
commit
fa6a5949b2
|
@ -14,6 +14,7 @@ uint64_t gInitEndpointCap = 0;
|
|||
uint64_t gBootDenaliVmmoCap = 0;
|
||||
uint64_t gBootVictoriaFallsVmmoCap = 0;
|
||||
uint64_t gBootPciVmmoCap = 0;
|
||||
uint64_t gBootFramebufferVmmoCap = 0;
|
||||
|
||||
z_err_t ParseInitPort(uint64_t init_port_cap) {
|
||||
PortServer port = PortServer::AdoptCap(init_port_cap);
|
||||
|
@ -40,6 +41,8 @@ z_err_t ParseInitPort(uint64_t init_port_cap) {
|
|||
case Z_BOOT_PCI_VMMO:
|
||||
gBootPciVmmoCap = init_cap;
|
||||
break;
|
||||
case Z_BOOT_FRAMEBUFFER_INFO_VMMO:
|
||||
gBootFramebufferVmmoCap = init_cap;
|
||||
default:
|
||||
dbgln("Unexpected init type {}, continuing.", init_sig);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <mammoth/memory_region.h>
|
||||
#include <mammoth/process.h>
|
||||
#include <zcall.h>
|
||||
#include <ztypes.h>
|
||||
|
||||
#include "hw/gpt.h"
|
||||
#include "hw/pcie.h"
|
||||
|
@ -48,6 +49,13 @@ uint64_t main(uint64_t port_cap) {
|
|||
|
||||
dbgln("Test: '{}'", file.cstr());
|
||||
|
||||
MappedMemoryRegion region =
|
||||
MappedMemoryRegion::FromCapability(gBootFramebufferVmmoCap);
|
||||
|
||||
ZFramebufferInfo* fb = reinterpret_cast<ZFramebufferInfo*>(region.vaddr());
|
||||
|
||||
dbgln("FB Addr: {x}", fb->address_phys);
|
||||
|
||||
check(server_thread.Join());
|
||||
dbgln("Yellowstone Finished Successfully.");
|
||||
return 0;
|
||||
|
|
|
@ -47,4 +47,19 @@ void* GetRsdpAddr() {
|
|||
return gRsdpRequest.response->address;
|
||||
}
|
||||
|
||||
static volatile struct limine_framebuffer_request gFramebufferRequest {
|
||||
.id = LIMINE_FRAMEBUFFER_REQUEST, .revision = 0, .response = 0,
|
||||
};
|
||||
|
||||
const limine_framebuffer& GetFramebuffer() {
|
||||
if (!gFramebufferRequest.response) {
|
||||
panic("No framebuffer response from limine");
|
||||
}
|
||||
if (gFramebufferRequest.response->framebuffer_count < 1) {
|
||||
panic("No framebuffers in response from limine.");
|
||||
}
|
||||
|
||||
return *gFramebufferRequest.response->framebuffers[0];
|
||||
}
|
||||
|
||||
} // namespace boot
|
||||
|
|
|
@ -11,4 +11,6 @@ const limine_module_response& GetModules();
|
|||
|
||||
void* GetRsdpAddr();
|
||||
|
||||
const limine_framebuffer& GetFramebuffer();
|
||||
|
||||
} // namespace boot
|
||||
|
|
|
@ -10,3 +10,4 @@ extern uint64_t gInitEndpointCap;
|
|||
extern uint64_t gBootDenaliVmmoCap;
|
||||
extern uint64_t gBootVictoriaFallsVmmoCap;
|
||||
extern uint64_t gBootPciVmmoCap;
|
||||
extern uint64_t gBootFramebufferVmmoCap;
|
||||
|
|
|
@ -109,3 +109,19 @@ const z_perm_t kZionPerm_All = -1;
|
|||
#define Z_BOOT_DENALI_VMMO 0x4200'0000
|
||||
#define Z_BOOT_VICTORIA_FALLS_VMMO 0x4200'0001
|
||||
#define Z_BOOT_PCI_VMMO 0x4200'0002
|
||||
#define Z_BOOT_FRAMEBUFFER_INFO_VMMO 0x4200'0003
|
||||
|
||||
struct ZFramebufferInfo {
|
||||
uint64_t address_phys;
|
||||
uint64_t width;
|
||||
uint64_t height;
|
||||
uint64_t pitch;
|
||||
uint16_t bpp;
|
||||
uint8_t memory_model;
|
||||
uint8_t red_mask_size;
|
||||
uint8_t red_mask_shift;
|
||||
uint8_t green_mask_size;
|
||||
uint8_t green_mask_shift;
|
||||
uint8_t blue_mask_size;
|
||||
uint8_t blue_mask_shift;
|
||||
};
|
||||
|
|
|
@ -137,6 +137,30 @@ glcr::ErrorCode WritePciVmmo(glcr::RefPtr<Port> port, uint64_t id) {
|
|||
return glcr::OK;
|
||||
}
|
||||
|
||||
void WriteFramebufferVmmo(glcr::RefPtr<Port> port) {
|
||||
const limine_framebuffer& buf = boot::GetFramebuffer();
|
||||
ZFramebufferInfo ubuf{
|
||||
.address_phys = reinterpret_cast<uint64_t>(buf.address) -
|
||||
boot::GetHigherHalfDirectMap(),
|
||||
.width = buf.width,
|
||||
.height = buf.height,
|
||||
.pitch = buf.pitch,
|
||||
.bpp = buf.bpp,
|
||||
.memory_model = buf.memory_model,
|
||||
.red_mask_size = buf.red_mask_size,
|
||||
.red_mask_shift = buf.red_mask_shift,
|
||||
.green_mask_size = buf.green_mask_size,
|
||||
.green_mask_shift = buf.green_mask_shift,
|
||||
.blue_mask_size = buf.blue_mask_size,
|
||||
.blue_mask_shift = buf.blue_mask_shift,
|
||||
};
|
||||
glcr::RefPtr<MemoryObject> ubuf_vmmo =
|
||||
glcr::MakeRefCounted<MemoryObject>(sizeof(ubuf));
|
||||
ubuf_vmmo->CopyBytesToObject(reinterpret_cast<uint64_t>(&ubuf), sizeof(ubuf));
|
||||
port->WriteKernel(Z_BOOT_FRAMEBUFFER_INFO_VMMO,
|
||||
MakeRefCounted<Capability>(ubuf_vmmo));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void LoadInitProgram() {
|
||||
|
@ -154,6 +178,8 @@ void LoadInitProgram() {
|
|||
WriteInitProgram(port, "/sys/denali", Z_BOOT_DENALI_VMMO);
|
||||
WriteInitProgram(port, "/sys/victoriafalls", Z_BOOT_VICTORIA_FALLS_VMMO);
|
||||
|
||||
WriteFramebufferVmmo(port);
|
||||
|
||||
if (WritePciVmmo(port, Z_BOOT_PCI_VMMO) != glcr::OK) {
|
||||
panic("Failed to provide PCI info to init.");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue