Added the get_boot_item() call similar to what BeOS exports (have a look at
the APM driver to see it at work). The frame buffer console now creates such a boot item to give a potential VESA driver access to the boot frame buffer configuration. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12221 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
7cac40a1f2
commit
d305ab35ac
22
headers/private/kernel/boot_item.h
Normal file
22
headers/private/kernel/boot_item.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _KERNEL_BOOT_ITEM_H
|
||||
#define _KERNEL_BOOT_ITEM_H
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern status_t add_boot_item(const char *name, void *data, size_t size);
|
||||
extern void *get_boot_item(const char *name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _KERNEL_BOOT_ITEM_H */
|
@ -11,6 +11,16 @@ struct kernel_args;
|
||||
|
||||
|
||||
#define FRAME_BUFFER_CONSOLE_MODULE_NAME "console/frame_buffer/v1"
|
||||
#define FRAME_BUFFER_BOOT_INFO "frame_buffer/v1"
|
||||
|
||||
struct frame_buffer_boot_info {
|
||||
area_id area;
|
||||
addr_t frame_buffer;
|
||||
int32 width;
|
||||
int32 height;
|
||||
int32 depth;
|
||||
int32 bytes_per_row;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -17,6 +17,7 @@ if $(OS) != BEOS {
|
||||
}
|
||||
|
||||
KernelMergeObject kernel_core.o :
|
||||
boot_item.cpp
|
||||
cpu.c
|
||||
elf.c
|
||||
faults.c
|
||||
|
62
src/kernel/core/boot_item.cpp
Normal file
62
src/kernel/core/boot_item.cpp
Normal file
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <boot_item.h>
|
||||
#include <util/DoublyLinkedList.h>
|
||||
#include <util/kernel_cpp.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
// ToDo: the boot items are not supposed to be changed after kernel startup
|
||||
// so no locking is done. So for now, we need to be careful with adding
|
||||
// new items.
|
||||
|
||||
struct boot_item : public DoublyLinkedListLinkImpl<boot_item> {
|
||||
const char *name;
|
||||
void *data;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
typedef DoublyLinkedList<boot_item> ItemList;
|
||||
|
||||
|
||||
static ItemList sItemList;
|
||||
|
||||
|
||||
status_t
|
||||
add_boot_item(const char *name, void *data, size_t size)
|
||||
{
|
||||
boot_item *item = new boot_item;
|
||||
if (item == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
item->name = name;
|
||||
item->data = data;
|
||||
item->size = size;
|
||||
|
||||
sItemList.Add(item);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
get_boot_item(const char *name)
|
||||
{
|
||||
if (name == NULL || name[0] == '\0')
|
||||
return NULL;
|
||||
|
||||
// search item
|
||||
for (ItemList::Iterator it = sItemList.GetIterator(); it.HasNext();) {
|
||||
boot_item *item = it.Next();
|
||||
|
||||
if (!strcmp(name, item->name))
|
||||
return item->data;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -5,9 +5,10 @@
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <lock.h>
|
||||
#include <boot_item.h>
|
||||
#include <fs/devfs.h>
|
||||
|
||||
#include <boot/kernel_args.h>
|
||||
|
||||
#include <frame_buffer_console.h>
|
||||
#include "font.h"
|
||||
|
||||
@ -63,6 +64,7 @@ static uint32 sPalette32[] = {
|
||||
};
|
||||
|
||||
static struct console_info sConsole;
|
||||
static struct frame_buffer_boot_info sBootInfo;
|
||||
|
||||
|
||||
static inline uint8
|
||||
@ -313,7 +315,7 @@ frame_buffer_console_init(kernel_args *args)
|
||||
sConsole.area = map_physical_memory("vesa_fb",
|
||||
(void *)args->frame_buffer.physical_buffer.start,
|
||||
args->frame_buffer.physical_buffer.size, B_ANY_KERNEL_ADDRESS,
|
||||
B_READ_AREA | B_WRITE_AREA, &frameBuffer);
|
||||
B_READ_AREA | B_WRITE_AREA | B_USER_CLONEABLE_AREA, &frameBuffer);
|
||||
if (sConsole.area < B_OK)
|
||||
return sConsole.area;
|
||||
|
||||
@ -335,6 +337,13 @@ frame_buffer_console_init(kernel_args *args)
|
||||
frame_buffer_update((addr_t)frameBuffer, args->frame_buffer.width, args->frame_buffer.height,
|
||||
args->frame_buffer.depth, bytesPerRow);
|
||||
|
||||
sBootInfo.frame_buffer = (addr_t)frameBuffer;
|
||||
sBootInfo.width = args->frame_buffer.width;
|
||||
sBootInfo.height = args->frame_buffer.height;
|
||||
sBootInfo.depth = args->frame_buffer.depth;
|
||||
sBootInfo.bytes_per_row = bytesPerRow;
|
||||
add_boot_item(FRAME_BUFFER_BOOT_INFO, &sBootInfo, sizeof(frame_buffer_boot_info));
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user