diff --git a/include/l4/platform/pb926/platform.h b/include/l4/platform/pb926/platform.h index a6a5d6a..9cf2ed1 100644 --- a/include/l4/platform/pb926/platform.h +++ b/include/l4/platform/pb926/platform.h @@ -9,6 +9,9 @@ #include INC_PLAT(offsets.h) #include INC_GLUE(memlayout.h) +#include +#include +#include #define PLATFORM_CONSOLE0_BASE PB926_UART0_VBASE @@ -27,6 +30,7 @@ #define PLATFORM_TIMER2 2 #define PLATFORM_TIMER3 3 +int platform_setup_device_caps(struct kernel_resources *kres); void platform_irq_enable(int irq); void platform_irq_disable(int irq); void timer_start(void); diff --git a/src/generic/resource.c b/src/generic/resource.c index 5ef70aa..15c3149 100644 --- a/src/generic/resource.c +++ b/src/generic/resource.c @@ -12,6 +12,7 @@ #include #include INC_GLUE(memory.h) #include INC_ARCH(linker.h) +#include INC_PLAT(platform.h) #include struct kernel_resources kernel_resources; @@ -290,7 +291,7 @@ int memcap_unmap(struct cap_list *used_list, /* Check for intersection */ if (set_intersection(unmap_start, unmap_end, cap->start, cap->end)) { - if ((err = memcap_unmap_range(cap, cap_list, + if ((ret = memcap_unmap_range(cap, cap_list, unmap_start, unmap_end))) { goto out_err; @@ -330,19 +331,21 @@ out_err: int memcap_request_device(struct cap_list *cap_list, struct cap_info *devcap) { + struct capability *cap, *n; + list_foreach_removable_struct(cap, n, &cap_list->caps, list) { if (cap->start == devcap->start && cap->end == devcap->end && cap->uattr == devcap->uattr) { /* Unlink only. This is boot memory */ - list_remove(&cap); + list_remove(&cap->list); return 0; } } printk("%s: FATAL: Device memory requested " "does not match any available device " "capabilities start=0x%lx, end=0x%lx " - "uattr=0x%lx\n", __KERNELNAME__, + "uattr=0x%x\n", __KERNELNAME__, __pfn_to_addr(devcap->start), __pfn_to_addr(devcap->end), devcap->uattr); BUG(); @@ -842,12 +845,12 @@ int process_cap_info(struct cap_info *cap, if (cap_type(cap) == CAP_TYPE_MAP_VIRTMEM) { memcap_unmap(&kres->virtmem_used, &kres->virtmem_free, - cap->start, cap->end) + cap->start, cap->end); } else if (cap_type(cap) == CAP_TYPE_MAP_PHYSMEM) { if (!cap_devmem(cap)) memcap_unmap(&kres->physmem_used, &kres->physmem_free, - cap->start, cap->end) + cap->start, cap->end); else /* Delete device from free list */ memcap_request_device(&kres->devmem_free, cap); } diff --git a/src/platform/pb926/platform.c b/src/platform/pb926/platform.c index 9741b0b..278d452 100644 --- a/src/platform/pb926/platform.c +++ b/src/platform/pb926/platform.c @@ -3,11 +3,10 @@ * * Copyright (C) 2007 Bahadir Balban */ -#include -#include #include #include #include +#include #include INC_ARCH(linker.h) #include INC_PLAT(printascii.h) #include INC_SUBARCH(mm.h) @@ -27,7 +26,8 @@ */ int platform_setup_device_caps(struct kernel_resources *kres) { - struct capability *uart[4], *timer[2], *irqctrl[2], *sysctrl; + struct capability *uart[4], *timer[2]; +// struct capability *irqctrl[2], *sysctrl; #if 0 /* Setup kernel capability for uart0 as used */ @@ -71,7 +71,7 @@ int platform_setup_device_caps(struct kernel_resources *kres) #endif /* Setup capabilities for other uarts as free */ - uart[1] = alloc_bootmem(sizeof(*uart[i]), 0); + uart[1] = alloc_bootmem(sizeof(*uart[1]), 0); uart[1]->start = __pfn(PB926_UART1_BASE); uart[1]->end = uart[1]->start + 1; uart[1]->uattr = CAP_DEVTYPE_UART; @@ -94,11 +94,13 @@ int platform_setup_device_caps(struct kernel_resources *kres) /* Setup timer1 capability as free */ timer[1] = alloc_bootmem(sizeof(*timer[1]), 0); - timer[1]->start = __pfn(PB926_TIMER12_BASE); + timer[1]->start = __pfn(PB926_TIMER23_BASE); timer[1]->end = timer[1]->start + 1; timer[1]->uattr = CAP_DEVTYPE_TIMER; link_init(&timer[1]->list); cap_list_insert(timer[1], &kres->devmem_free); + + return 0; } /* We will use UART0 for kernel as well as user tasks, so map it to kernel and user space */