From 0707376a546b139474c1b7068cb55132df41e2d5 Mon Sep 17 00:00:00 2001 From: Amit Mahajan Date: Thu, 26 Nov 2009 16:17:55 +0530 Subject: [PATCH] Added start/end/size attributes for devices in caps.py instead of resource.c --- config/caps.py | 12 ++++++++---- include/l4/platform/pb926/platform.h | 20 ++++++++++++++------ scripts/kernel/generate_kernel_cinfo.py | 1 + src/generic/resource.c | 22 +++++++--------------- 4 files changed, 30 insertions(+), 25 deletions(-) diff --git a/config/caps.py b/config/caps.py index db9d5f6..b447cc2 100644 --- a/config/caps.py +++ b/config/caps.py @@ -148,7 +148,9 @@ cap_strings = { 'ipc' : \ \t\t\t\t.type = CAP_TYPE_MAP_PHYSMEM | CAP_RTYPE_CONTAINER, \t\t\t\t.access = CAP_MAP_READ | CAP_MAP_WRITE | CAP_MAP_EXEC | \t\t\t\t\tCAP_MAP_CACHED | CAP_MAP_UNCACHED | CAP_MAP_UNMAP | CAP_MAP_UTCB, -\t\t\t\t.start = 0, .end = 0, .size = 0, +\t\t\t\t.start = __pfn(PLATFORM_CONSOLE${devnum}_PHY_BASE), +\t\t\t\t.end = __pfn(PLATFORM_CONSOLE${devnum}_PHY_BASE) + 1, +\t\t\t\t.size = 1, \t\t\t}, ''' , 'timer' : \ @@ -160,12 +162,13 @@ cap_strings = { 'ipc' : \ \t\t\t\t.type = CAP_TYPE_MAP_PHYSMEM | CAP_RTYPE_CONTAINER, \t\t\t\t.access = CAP_MAP_READ | CAP_MAP_WRITE | CAP_MAP_EXEC | \t\t\t\t\tCAP_MAP_CACHED | CAP_MAP_UNCACHED | CAP_MAP_UNMAP | CAP_MAP_UTCB, -\t\t\t\t.start = 0, .end = 0, .size = 0, +\t\t\t\t.start = __pfn(PLATFORM_TIMER${devnum}_PHY_BASE), +\t\t\t\t.end = __pfn(PLATFORM_TIMER${devnum}_PHY_BASE) + 1, +\t\t\t\t.size = 1, \t\t\t}, ''' } - # # These are carefully crafted functions, touch with care. # @@ -232,7 +235,8 @@ def prepare_typed_capability(cont, param, val): # If device, amend current container id and devnum as default if 'DEVICE' in params: - cont.caps[captype] = templ.safe_substitute(cid = cont.id, devnum = devid) + cont.caps[captype] = \ + templ.safe_substitute(cid = cont.id, devnum = devid) # Fill in the blank size field elif 'SIZE' in params: diff --git a/include/l4/platform/pb926/platform.h b/include/l4/platform/pb926/platform.h index a6db8ee..7a9b42c 100644 --- a/include/l4/platform/pb926/platform.h +++ b/include/l4/platform/pb926/platform.h @@ -13,16 +13,14 @@ #include #include -#define PLATFORM_CONSOLE0_BASE PB926_UART0_VBASE +#define PLATFORM_CONSOLE0_BASE PB926_UART0_VBASE /* SP804 timer has TIMER1 at TIMER0 + 0x20 address */ -#define PLATFORM_TIMER0_BASE PB926_TIMER01_VBASE - -#define PLATFORM_TIMER_REL_OFFSET 0x20 +#define PLATFORM_TIMER0_BASE PB926_TIMER01_VBASE #define PLATFORM_SP810_BASE PB926_SYSCTRL_VBASE -#define PLATFORM_IRQCTRL_BASE PB926_VIC_VBASE -#define PLATFORM_SIRQCTRL_BASE PB926_SIC_VBASE +#define PLATFORM_IRQCTRL_BASE PB926_VIC_VBASE +#define PLATFORM_SIRQCTRL_BASE PB926_SIC_VBASE /* Total number of timers present in this platform */ #define TOTAL_TIMERS 4 @@ -32,6 +30,16 @@ #define PLATFORM_TIMER2 2 #define PLATFORM_TIMER3 3 +/* Wrapping Plaform specific Physical Device Addresses */ +#define PLATFORM_CONSOLE0_PHY_BASE PB926_UART0_BASE +#define PLATFORM_CONSOLE1_PHY_BASE PB926_UART1_BASE +#define PLATFORM_CONSOLE2_PHY_BASE PB926_UART2_BASE +#define PLATFORM_CONSOLE3_PHY_BASE PB926_UART3_BASE + +#define PLATFORM_TIMER0_PHY_BASE PB926_TIMER01_BASE +#define PLATFORM_TIMER1_PHY_BASE PB926_TIMER23_BASE + + int platform_setup_device_caps(struct kernel_resources *kres); void platform_irq_enable(int irq); void platform_irq_disable(int irq); diff --git a/scripts/kernel/generate_kernel_cinfo.py b/scripts/kernel/generate_kernel_cinfo.py index fb8429e..9faecfb 100755 --- a/scripts/kernel/generate_kernel_cinfo.py +++ b/scripts/kernel/generate_kernel_cinfo.py @@ -29,6 +29,7 @@ cinfo_file_start = \ #include #include #include +#include INC_PLAT(platform.h) %s diff --git a/src/generic/resource.c b/src/generic/resource.c index be6e2ff..7cff3e8 100644 --- a/src/generic/resource.c +++ b/src/generic/resource.c @@ -334,21 +334,13 @@ int memcap_request_device(struct cap_list *cap_list, struct capability *cap, *n; list_foreach_removable_struct(cap, n, &cap_list->caps, list) { - if (cap->uattr[0] == devcap->uattr[0]) { - - /* - * We dont want the user to provide, start end addresses, - * just selecting the type of device to be used is fine - */ - devcap->start = cap->start; - devcap->end = cap->end; - devcap->size = cap->size; - - /* Unlink only. This is boot memory */ - list_remove(&cap->list); - return 0; - } - + if (cap->start == devcap->start && + cap->end == devcap->end && + cap_is_devmem(cap)) { + /* Unlink only. This is boot memory */ + list_remove(&cap->list); + return 0; + } } printk("%s: FATAL: Device memory requested " "does not match any available device "