mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 19:03:15 +01:00
Basic codezero support for clcd device capability added.
1. We are not making a new clcd service container, as we dont want to keep separate container for each device, ultimately we will have one container managing all devices. 2. CLCD driver needs to be added.
This commit is contained in:
@@ -23,6 +23,25 @@
|
||||
#include <l4/generic/capability.h>
|
||||
#include <l4/generic/cap-types.h>
|
||||
|
||||
/*
|
||||
* FIXME: This is not a platform specific
|
||||
* call, we will move this out later
|
||||
*/
|
||||
void device_cap_init(struct kernel_resources *kres, int devtype,
|
||||
int devnum, unsigned long base)
|
||||
{
|
||||
struct capability *cap;
|
||||
|
||||
cap = alloc_bootmem(sizeof(*cap), 0);
|
||||
cap_set_devtype(cap, devtype);
|
||||
cap_set_devnum(cap, devnum);
|
||||
cap->start = __pfn(base);
|
||||
cap->end = cap->start + 1;
|
||||
cap->size = cap->end - cap->start;
|
||||
link_init(&cap->list);
|
||||
cap_list_insert(cap, &kres->devmem_free);
|
||||
}
|
||||
|
||||
/*
|
||||
* The devices that are used by the kernel are mapped
|
||||
* independent of these capabilities, but these provide a
|
||||
@@ -30,66 +49,13 @@
|
||||
*/
|
||||
int platform_setup_device_caps(struct kernel_resources *kres)
|
||||
{
|
||||
struct capability *uart[3], *timer[1],
|
||||
*keyboard[1], *mouse[1];
|
||||
|
||||
/* Setup capabilities for userspace uarts and timers */
|
||||
uart[0] = alloc_bootmem(sizeof(*uart[0]), 0);
|
||||
uart[0]->start = __pfn(PLATFORM_UART1_BASE);
|
||||
uart[0]->end = uart[0]->start + 1;
|
||||
uart[0]->size = uart[0]->end - uart[1]->start;
|
||||
cap_set_devtype(uart[0], CAP_DEVTYPE_UART);
|
||||
cap_set_devnum(uart[0], 1);
|
||||
link_init(&uart[0]->list);
|
||||
cap_list_insert(uart[0], &kres->devmem_free);
|
||||
|
||||
uart[1] = alloc_bootmem(sizeof(*uart[1]), 0);
|
||||
uart[1]->start = __pfn(PLATFORM_UART2_BASE);
|
||||
uart[1]->end = uart[1]->start + 1;
|
||||
uart[1]->size = uart[1]->end - uart[1]->start;
|
||||
cap_set_devtype(uart[1], CAP_DEVTYPE_UART);
|
||||
cap_set_devnum(uart[1], 2);
|
||||
link_init(&uart[1]->list);
|
||||
cap_list_insert(uart[1], &kres->devmem_free);
|
||||
|
||||
uart[2] = alloc_bootmem(sizeof(*uart[2]), 0);
|
||||
uart[2]->start = __pfn(PLATFORM_UART3_BASE);
|
||||
uart[2]->end = uart[2]->start + 1;
|
||||
uart[2]->size = uart[2]->end - uart[2]->start;
|
||||
cap_set_devtype(uart[2], CAP_DEVTYPE_UART);
|
||||
cap_set_devnum(uart[2], 3);
|
||||
link_init(&uart[2]->list);
|
||||
cap_list_insert(uart[2], &kres->devmem_free);
|
||||
|
||||
/* Setup timer1 capability as free */
|
||||
timer[0] = alloc_bootmem(sizeof(*timer[0]), 0);
|
||||
timer[0]->start = __pfn(PLATFORM_TIMER1_BASE);
|
||||
timer[0]->end = timer[0]->start + 1;
|
||||
timer[0]->size = timer[0]->end - timer[0]->start;
|
||||
cap_set_devtype(timer[0], CAP_DEVTYPE_TIMER);
|
||||
cap_set_devnum(timer[0], 1);
|
||||
link_init(&timer[0]->list);
|
||||
cap_list_insert(timer[0], &kres->devmem_free);
|
||||
|
||||
/* Setup keyboard capability as free */
|
||||
keyboard[0] = alloc_bootmem(sizeof(*keyboard[0]), 0);
|
||||
keyboard[0]->start = __pfn(PLATFORM_KEYBOARD0_BASE);
|
||||
keyboard[0]->end = keyboard[0]->start + 1;
|
||||
keyboard[0]->size = keyboard[0]->end - keyboard[0]->start;
|
||||
cap_set_devtype(keyboard[0], CAP_DEVTYPE_KEYBOARD);
|
||||
cap_set_devnum(keyboard[0], 0);
|
||||
link_init(&keyboard[0]->list);
|
||||
cap_list_insert(keyboard[0], &kres->devmem_free);
|
||||
|
||||
/* Setup mouse capability as free */
|
||||
mouse[0] = alloc_bootmem(sizeof(*mouse[0]), 0);
|
||||
mouse[0]->start = __pfn(PLATFORM_MOUSE0_BASE);
|
||||
mouse[0]->end = mouse[0]->start + 1;
|
||||
mouse[0]->size = mouse[0]->end - mouse[0]->start;
|
||||
cap_set_devtype(mouse[0], CAP_DEVTYPE_MOUSE);
|
||||
cap_set_devnum(mouse[0], 0);
|
||||
link_init(&mouse[0]->list);
|
||||
cap_list_insert(mouse[0], &kres->devmem_free);
|
||||
device_cap_init(kres, CAP_DEVTYPE_UART, 1, PLATFORM_UART1_BASE);
|
||||
device_cap_init(kres, CAP_DEVTYPE_UART, 2, PLATFORM_UART2_BASE);
|
||||
device_cap_init(kres, CAP_DEVTYPE_UART, 3, PLATFORM_UART3_BASE);
|
||||
device_cap_init(kres, CAP_DEVTYPE_TIMER, 1, PLATFORM_TIMER1_BASE);
|
||||
device_cap_init(kres, CAP_DEVTYPE_KEYBOARD, 0, PLATFORM_KEYBOARD0_BASE);
|
||||
device_cap_init(kres, CAP_DEVTYPE_MOUSE, 0, PLATFORM_MOUSE0_BASE);
|
||||
device_cap_init(kres, CAP_DEVTYPE_CLCD, 0, PLATFORM_CLCD0_BASE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -152,6 +118,9 @@ void init_platform_devices()
|
||||
add_boot_mapping(PLATFORM_MOUSE0_BASE, PLATFORM_MOUSE0_VBASE,
|
||||
PAGE_SIZE, MAP_IO_DEFAULT);
|
||||
|
||||
/* CLCD */
|
||||
add_boot_mapping(PLATFORM_CLCD0_BASE, PLATFORM_CLCD0_VBASE,
|
||||
PAGE_SIZE, MAP_IO_DEFAULT);
|
||||
}
|
||||
|
||||
/* If these bits are off, 32Khz OSC source is used */
|
||||
|
||||
Reference in New Issue
Block a user