stivale: Add support for extended colour information
This commit is contained in:
parent
2f486fae65
commit
6ab44cb04c
@ -179,7 +179,16 @@ struct stivale_struct {
|
||||
uint64_t epoch; // UNIX epoch at boot, read from system RTC
|
||||
uint64_t flags; // Flags
|
||||
// bit 0: 1 if booted with BIOS, 0 if booted with UEFI
|
||||
// bit 1: 1 if extended colour information passed, 0 if not
|
||||
// All other bits undefined.
|
||||
// Extended colour information follows, only access if bit 1 of flags is set.
|
||||
uint8_t fb_memory_model; // Memory model: 1=RGB, all other values undefined
|
||||
uint8_t fb_red_mask_size; // RGB mask sizes and left shifts
|
||||
uint8_t fb_red_mask_shift;
|
||||
uint8_t fb_green_mask_size;
|
||||
uint8_t fb_green_mask_shift;
|
||||
uint8_t fb_blue_mask_size;
|
||||
uint8_t fb_blue_mask_shift;
|
||||
} __attribute__((packed));
|
||||
```
|
||||
|
||||
|
BIN
limine-pxe.bin
BIN
limine-pxe.bin
Binary file not shown.
BIN
limine.bin
BIN
limine.bin
Binary file not shown.
BIN
stage2.map
BIN
stage2.map
Binary file not shown.
@ -28,6 +28,7 @@ struct stivale_struct stivale_struct = {0};
|
||||
|
||||
void stivale_load(char *config, char *cmdline) {
|
||||
stivale_struct.flags |= (1 << 0); // set bit 0 since we are BIOS and not UEFI
|
||||
stivale_struct.flags |= (1 << 1); // we give colour information
|
||||
|
||||
struct file_handle *kernel = conv_mem_alloc(sizeof(struct file_handle));
|
||||
|
||||
@ -183,13 +184,21 @@ void stivale_load(char *config, char *cmdline) {
|
||||
parse_resolution(&req_width, &req_height, &req_bpp, resolution);
|
||||
|
||||
struct vbe_framebuffer_info fbinfo;
|
||||
init_vbe(&fbinfo, req_width, req_height, req_bpp);
|
||||
if (!init_vbe(&fbinfo, req_width, req_height, req_bpp))
|
||||
panic("stivale: Unable to set video mode");
|
||||
|
||||
stivale_struct.framebuffer_addr = (uint64_t)fbinfo.framebuffer_addr;
|
||||
stivale_struct.framebuffer_width = fbinfo.framebuffer_width;
|
||||
stivale_struct.framebuffer_height = fbinfo.framebuffer_height;
|
||||
stivale_struct.framebuffer_bpp = fbinfo.framebuffer_bpp;
|
||||
stivale_struct.framebuffer_pitch = fbinfo.framebuffer_pitch;
|
||||
stivale_struct.framebuffer_addr = (uint64_t)fbinfo.framebuffer_addr;
|
||||
stivale_struct.framebuffer_width = fbinfo.framebuffer_width;
|
||||
stivale_struct.framebuffer_height = fbinfo.framebuffer_height;
|
||||
stivale_struct.framebuffer_bpp = fbinfo.framebuffer_bpp;
|
||||
stivale_struct.framebuffer_pitch = fbinfo.framebuffer_pitch;
|
||||
stivale_struct.fb_memory_model = STIVALE_FBUF_MMODEL_RGB;
|
||||
stivale_struct.fb_red_mask_size = fbinfo.red_mask_size;
|
||||
stivale_struct.fb_red_mask_shift = fbinfo.red_mask_shift;
|
||||
stivale_struct.fb_green_mask_size = fbinfo.green_mask_size;
|
||||
stivale_struct.fb_green_mask_shift = fbinfo.green_mask_shift;
|
||||
stivale_struct.fb_blue_mask_size = fbinfo.blue_mask_size;
|
||||
stivale_struct.fb_blue_mask_shift = fbinfo.blue_mask_shift;
|
||||
}
|
||||
|
||||
bool want_5lv = level5pg && (stivale_hdr.flags & (1 << 1));
|
||||
|
@ -41,6 +41,10 @@ struct stivale_mmap_entry {
|
||||
uint32_t unused;
|
||||
} __attribute__((packed));
|
||||
|
||||
enum {
|
||||
STIVALE_FBUF_MMODEL_RGB = 1
|
||||
};
|
||||
|
||||
struct stivale_struct {
|
||||
uint64_t cmdline;
|
||||
uint64_t memory_map_addr;
|
||||
@ -55,6 +59,14 @@ struct stivale_struct {
|
||||
uint64_t modules;
|
||||
uint64_t epoch;
|
||||
uint64_t flags; // bit 0: 1 if booted with BIOS, 0 if booted with UEFI
|
||||
// bit 1: 1 if extended colour information passed, 0 if not
|
||||
uint8_t fb_memory_model;
|
||||
uint8_t fb_red_mask_size;
|
||||
uint8_t fb_red_mask_shift;
|
||||
uint8_t fb_green_mask_size;
|
||||
uint8_t fb_green_mask_shift;
|
||||
uint8_t fb_blue_mask_size;
|
||||
uint8_t fb_blue_mask_shift;
|
||||
} __attribute__((packed));
|
||||
|
||||
#endif
|
||||
|
@ -33,6 +33,17 @@ void stivale_main(struct stivale_struct *info) {
|
||||
e9_printf("\tWidth: %d", info->framebuffer_width);
|
||||
e9_printf("\tHeight: %d", info->framebuffer_height);
|
||||
e9_printf("\tBPP: %d", info->framebuffer_bpp);
|
||||
if (info->flags & (1 << 1)) {
|
||||
e9_printf("\tExtended colour information passed:");
|
||||
e9_printf("\t\tMemory model: %d", info->fb_memory_model);
|
||||
e9_printf("\t\tRed mask size: %d", info->fb_red_mask_size);
|
||||
e9_printf("\t\tRed mask shift: %d", info->fb_red_mask_shift);
|
||||
e9_printf("\t\tGreen mask size: %d", info->fb_green_mask_size);
|
||||
e9_printf("\t\tGreen mask shift: %d", info->fb_green_mask_shift);
|
||||
e9_printf("\t\tBlue mask size: %d", info->fb_blue_mask_size);
|
||||
e9_printf("\t\tBlue mask shift: %d", info->fb_blue_mask_shift);
|
||||
}
|
||||
|
||||
e9_printf("RSDP at %x", info->rsdp);
|
||||
|
||||
e9_printf("Module map at %x with modules:", info->modules);
|
||||
|
Loading…
Reference in New Issue
Block a user