stos: bpal: Add framebuffer info request
Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
@@ -11,13 +11,32 @@
|
|||||||
|
|
||||||
#include <stdef.h>
|
#include <stdef.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Represents a framebuffer
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
VOID *Address;
|
||||||
|
UQUAD Width;
|
||||||
|
UQUAD Height;
|
||||||
|
UQUAD Pitch;
|
||||||
|
SHORT Bpp;
|
||||||
|
UCHAR RedMaskSize;
|
||||||
|
UCHAR RedMaskShift;
|
||||||
|
UCHAR GreenMaskSize;
|
||||||
|
UCHAR GreenMaskShift;
|
||||||
|
UCHAR BlueMaskSize;
|
||||||
|
UCHAR BlueMaskShift;
|
||||||
|
} BPAL_FRAMEBUFFER;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Boot protocol abstraction handle
|
* Boot protocol abstraction handle
|
||||||
*
|
*
|
||||||
* @KernelBase: Kernel load base
|
* @KernelBase: Kernel load base
|
||||||
|
* @Framebuffer: Framebuffer info
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UPTR KernelBase;
|
UPTR KernelBase;
|
||||||
|
BPAL_FRAMEBUFFER Framebuffer;
|
||||||
} BPAL_HANDLE;
|
} BPAL_HANDLE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -10,9 +10,18 @@
|
|||||||
#include <ex/trace.h>
|
#include <ex/trace.h>
|
||||||
#include <lib/limine.h>
|
#include <lib/limine.h>
|
||||||
|
|
||||||
|
#define FRAMEBUFFER FbResp->framebuffers[0]
|
||||||
|
|
||||||
#define DTRACE(Fmt, ...) \
|
#define DTRACE(Fmt, ...) \
|
||||||
TRACE("[ BPAL ]: " Fmt, ##__VA_ARGS__)
|
TRACE("[ BPAL ]: " Fmt, ##__VA_ARGS__)
|
||||||
|
|
||||||
|
/* Framebuffer request */
|
||||||
|
static struct limine_framebuffer_response *FbResp = NULL;
|
||||||
|
static struct limine_framebuffer_request FbReq = {
|
||||||
|
.id = LIMINE_FRAMEBUFFER_REQUEST_ID,
|
||||||
|
.revision = 0
|
||||||
|
};
|
||||||
|
|
||||||
/* HHDM request */
|
/* HHDM request */
|
||||||
static struct limine_hhdm_response *HHDMResp = NULL;
|
static struct limine_hhdm_response *HHDMResp = NULL;
|
||||||
static volatile struct limine_hhdm_request HHDMReq = {
|
static volatile struct limine_hhdm_request HHDMReq = {
|
||||||
@@ -34,12 +43,35 @@ static struct limine_bootloader_performance_request LoaderPerReq = {
|
|||||||
.revision = 0
|
.revision = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
VOID
|
||||||
|
BpalInitFramebuffer(BPAL_HANDLE *Handle)
|
||||||
|
{
|
||||||
|
BPAL_FRAMEBUFFER *Framebuffer;
|
||||||
|
|
||||||
|
if (Handle == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Framebuffer = &Handle->Framebuffer;
|
||||||
|
Framebuffer->Address = FRAMEBUFFER->address;
|
||||||
|
Framebuffer->Width = FRAMEBUFFER->width;
|
||||||
|
Framebuffer->Height = FRAMEBUFFER->height;
|
||||||
|
Framebuffer->Pitch = FRAMEBUFFER->pitch;
|
||||||
|
Framebuffer->RedMaskSize = FRAMEBUFFER->red_mask_size;
|
||||||
|
Framebuffer->RedMaskShift = FRAMEBUFFER->red_mask_shift;
|
||||||
|
Framebuffer->GreenMaskSize = FRAMEBUFFER->green_mask_size;
|
||||||
|
Framebuffer->GreenMaskShift = FRAMEBUFFER->green_mask_shift;
|
||||||
|
Framebuffer->BlueMaskSize = FRAMEBUFFER->blue_mask_size;
|
||||||
|
Framebuffer->BlueMaskShift = FRAMEBUFFER->blue_mask_shift;
|
||||||
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
KeBpalLimineInit(BPAL_HANDLE *Handle)
|
KeBpalLimineInit(BPAL_HANDLE *Handle)
|
||||||
{
|
{
|
||||||
LoaderInfoResp = LoaderInfoReq.response;
|
LoaderInfoResp = LoaderInfoReq.response;
|
||||||
LoaderPerfResp = LoaderPerReq.response;
|
LoaderPerfResp = LoaderPerReq.response;
|
||||||
HHDMResp = HHDMReq.response;
|
HHDMResp = HHDMReq.response;
|
||||||
|
FbResp = FbReq.response;
|
||||||
|
|
||||||
DTRACE(
|
DTRACE(
|
||||||
"slut handed control by %s %s\n",
|
"slut handed control by %s %s\n",
|
||||||
@@ -57,5 +89,6 @@ KeBpalLimineInit(BPAL_HANDLE *Handle)
|
|||||||
LoaderPerfResp->exec_usec
|
LoaderPerfResp->exec_usec
|
||||||
);
|
);
|
||||||
|
|
||||||
|
BpalInitFramebuffer(Handle);
|
||||||
Handle->KernelBase = HHDMResp->offset;
|
Handle->KernelBase = HHDMResp->offset;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user