From 877b2cedc7f0475af667db1b79062dd3f541b069 Mon Sep 17 00:00:00 2001 From: Bahadir Balban Date: Sun, 22 Nov 2009 21:34:18 +0200 Subject: [PATCH] Integrated libl4thread with libl4. Added device number to device caps. A 16-bit device number or id further distinguishes a device on the system in addition to the device type. This is meant to be used for the very first identification of the device for further probing. Any further info is available by userspace mapping and probing. --- SConstruct.userlibs | 5 -- conts/libdev/uart/include/pl011_uart.h | 1 + conts/libdev/uart/src/platform_init.c | 2 +- conts/libl4/SConscript | 7 ++- conts/libl4/SConstruct | 4 +- .../l4thread => libl4/include/l4lib}/addr.h | 2 +- .../l4thread => libl4/include/l4lib}/bit.h | 2 + .../l4thread => libl4/include/l4lib}/idpool.h | 3 +- .../l4thread => libl4/include/l4lib}/stack.h | 0 .../l4thread => libl4/include/l4lib}/tcb.h | 0 conts/libl4/include/l4lib/thread.h | 18 ++++++ .../include/l4lib}/utcb-common.h | 0 conts/libl4/include/l4lib/utcb.h | 10 ++++ conts/{libl4thread => libl4}/src/addr.c | 2 +- .../arch-arm => libl4/src/arm}/new_thread.S | 0 conts/{libl4thread => libl4}/src/bit.c | 3 +- conts/{libl4thread => libl4}/src/idpool.c | 2 +- conts/{libl4thread => libl4}/src/stack.c | 4 +- conts/{libl4thread => libl4}/src/tcb.c | 3 +- conts/{libl4thread => libl4}/src/thread.c | 4 +- .../{libl4thread => libl4}/src/utcb-common.c | 4 +- conts/{libl4thread => libl4}/src/utcb.c | 10 ++-- conts/libl4thread/SConscript | 32 ----------- conts/libl4thread/include/l4thread/thread.h | 22 -------- conts/libl4thread/include/l4thread/utcb.h | 17 ------ conts/libl4thread/src/arch | 1 - include/l4/generic/cap-types.h | 17 +++++- src/generic/resource.c | 2 +- src/platform/pb926/platform.c | 56 +++---------------- 29 files changed, 84 insertions(+), 149 deletions(-) rename conts/{libl4thread/include/l4thread => libl4/include/l4lib}/addr.h (96%) rename conts/{libl4thread/include/l4thread => libl4/include/l4lib}/bit.h (97%) rename conts/{libl4thread/include/l4thread => libl4/include/l4lib}/idpool.h (94%) rename conts/{libl4thread/include/l4thread => libl4/include/l4lib}/stack.h (100%) rename conts/{libl4thread/include/l4thread => libl4/include/l4lib}/tcb.h (100%) rename conts/{libl4thread/include/l4thread => libl4/include/l4lib}/utcb-common.h (100%) rename conts/{libl4thread => libl4}/src/addr.c (98%) rename conts/{libl4thread/src/arch-arm => libl4/src/arm}/new_thread.S (100%) rename conts/{libl4thread => libl4}/src/bit.c (97%) rename conts/{libl4thread => libl4}/src/idpool.c (98%) rename conts/{libl4thread => libl4}/src/stack.c (97%) rename conts/{libl4thread => libl4}/src/tcb.c (96%) rename conts/{libl4thread => libl4}/src/thread.c (99%) rename conts/{libl4thread => libl4}/src/utcb-common.c (97%) rename conts/{libl4thread => libl4}/src/utcb.c (97%) delete mode 100644 conts/libl4thread/SConscript delete mode 100644 conts/libl4thread/include/l4thread/thread.h delete mode 100644 conts/libl4thread/include/l4thread/utcb.h delete mode 120000 conts/libl4thread/src/arch diff --git a/SConstruct.userlibs b/SConstruct.userlibs index f671fe4..310a2d2 100644 --- a/SConstruct.userlibs +++ b/SConstruct.userlibs @@ -50,14 +50,9 @@ libmm, libmc, libmalloc = SConscript('conts/libmem/SConscript', \ duplicate = 0, variant_dir = \ join(BUILDDIR, os.path.relpath('conts/libmem', PROJROOT))) -libl4thread = SConscript('conts/libl4thread/SConscript', \ - exports = { 'env' : env }, duplicate = 0, \ - variant_dir = join(BUILDDIR, os.path.relpath('conts/libl4thread', PROJROOT))) - Alias('libl4', libl4) Alias('libdev', libdev) Alias('libc', libc) Alias('libmm', libmm) Alias('libmc', libmc) Alias('libmalloc', libmalloc) -Alias('libl4thread', libl4thread) diff --git a/conts/libdev/uart/include/pl011_uart.h b/conts/libdev/uart/include/pl011_uart.h index d17e979..aaa2ca0 100644 --- a/conts/libdev/uart/include/pl011_uart.h +++ b/conts/libdev/uart/include/pl011_uart.h @@ -375,6 +375,7 @@ static inline void pl011_rx_dma_disable(unsigned int base) write(val, (base +PL011_UARTDMACR)); return; } +int pl011_initialise(struct pl011_uart *uart); #endif /* __PL011__UART__ */ diff --git a/conts/libdev/uart/src/platform_init.c b/conts/libdev/uart/src/platform_init.c index 4234266..2be6941 100644 --- a/conts/libdev/uart/src/platform_init.c +++ b/conts/libdev/uart/src/platform_init.c @@ -16,7 +16,7 @@ struct pl011_uart uart; * Initialises the uart class data structures, and the device. * Terminal-like operation is assumed for default settings. */ -int pl011_initialise(struct pl011_uart * uart) +int pl011_initialise(struct pl011_uart *uart) { uart->frame_errors = 0; uart->parity_errors = 0; diff --git a/conts/libl4/SConscript b/conts/libl4/SConscript index 7d3a5d0..e30695c 100644 --- a/conts/libl4/SConscript +++ b/conts/libl4/SConscript @@ -30,14 +30,19 @@ Import('arch') config = configuration_retrieve() +LIBMEM_RELDIR = 'conts/libmem' +LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR) + env = Environment(CC = config.user_toolchain + 'gcc', - CCFLAGS = ['-g', '-nostdlib', '-ffreestanding'], + CCFLAGS = ['-g', '-std=gnu99', '-nostdlib', '-ffreestanding'], LINKFLAGS = ['-nostdlib'], ASFLAGS = ['-D__ASSEMBLY__'], ENV = {'PATH' : os.environ['PATH']}, LIBS = 'gcc', CPPPATH = ['include', 'include/l4lib/arch', join(PROJROOT, 'include') ]) +env.Append(CPPPATH = [LIBMEM_DIR]) + def create_symlinks(arch): print os.getcwd() prefix = 'conts/libl4/include/l4lib' diff --git a/conts/libl4/SConstruct b/conts/libl4/SConstruct index 14c8ab0..e378e5a 100644 --- a/conts/libl4/SConstruct +++ b/conts/libl4/SConstruct @@ -17,12 +17,12 @@ config = configuration_retrieve() arch = config.arch env = Environment(CC = config.user_toolchain + 'gcc', - CCFLAGS = ['-g', '-nostdlib', '-ffreestanding'], + CCFLAGS = ['-std=gnu99', '-g', '-nostdlib', '-ffreestanding'], LINKFLAGS = ['-nostdlib'], ASFLAGS = ['-D__ASSEMBLY__'], ENV = {'PATH' : os.environ['PATH']}, LIBS = 'gcc', - CPPPATH = ['#include', '#include/l4lib/arch', join(PROJROOT,'include') ]) + CPPPATH = ['#include', '#include/l4lib/arch', join(PROJROOT,'include')]) # TODO: There are errors in this code that -Werror gives problems with. diff --git a/conts/libl4thread/include/l4thread/addr.h b/conts/libl4/include/l4lib/addr.h similarity index 96% rename from conts/libl4thread/include/l4thread/addr.h rename to conts/libl4/include/l4lib/addr.h index 8182ec0..da51119 100644 --- a/conts/libl4thread/include/l4thread/addr.h +++ b/conts/libl4/include/l4lib/addr.h @@ -6,7 +6,7 @@ #ifndef __ADDR_H__ #define __ADDR_H__ -#include +#include /* Address pool to allocate from a range of addresses */ struct address_pool { diff --git a/conts/libl4thread/include/l4thread/bit.h b/conts/libl4/include/l4lib/bit.h similarity index 97% rename from conts/libl4thread/include/l4thread/bit.h rename to conts/libl4/include/l4lib/bit.h index 3ab6822..775fca4 100644 --- a/conts/libl4thread/include/l4thread/bit.h +++ b/conts/libl4/include/l4lib/bit.h @@ -1,6 +1,8 @@ #ifndef __BIT_H__ #define __BIT_H__ +#include + unsigned int __clz(unsigned int bitvector); int find_and_set_first_free_bit(u32 *word, unsigned int lastbit); int find_and_set_first_free_contig_bits(u32 *word, unsigned int limit, diff --git a/conts/libl4thread/include/l4thread/idpool.h b/conts/libl4/include/l4lib/idpool.h similarity index 94% rename from conts/libl4thread/include/l4thread/idpool.h rename to conts/libl4/include/l4lib/idpool.h index 67667c2..103c5e7 100644 --- a/conts/libl4thread/include/l4thread/idpool.h +++ b/conts/libl4/include/l4lib/idpool.h @@ -1,8 +1,9 @@ #ifndef __IDPOOL_H__ #define __IDPOOL_H__ -#include +#include #include +#include #include INC_GLUE(memory.h) struct id_pool { diff --git a/conts/libl4thread/include/l4thread/stack.h b/conts/libl4/include/l4lib/stack.h similarity index 100% rename from conts/libl4thread/include/l4thread/stack.h rename to conts/libl4/include/l4lib/stack.h diff --git a/conts/libl4thread/include/l4thread/tcb.h b/conts/libl4/include/l4lib/tcb.h similarity index 100% rename from conts/libl4thread/include/l4thread/tcb.h rename to conts/libl4/include/l4lib/tcb.h diff --git a/conts/libl4/include/l4lib/thread.h b/conts/libl4/include/l4lib/thread.h index 7c2ed21..408e612 100644 --- a/conts/libl4/include/l4lib/thread.h +++ b/conts/libl4/include/l4lib/thread.h @@ -11,4 +11,22 @@ struct l4_thread_struct { unsigned long stack_start; /* Thread start of stack */ }; + +/* -- Bora start -- */ + +/* A helper macro easing utcb space creation. */ +#define DECLARE_UTCB_SPACE(name, entries) \ + char name[(entries + PAGE_SIZE / UTCB_SIZE) * UTCB_SIZE] ALIGN(PAGE_SIZE); + +int l4_set_stack_params(unsigned long stack_top, + unsigned long stack_bottom, + unsigned long stack_size); +int l4_set_utcb_params(unsigned long utcb_start, unsigned long utcb_end); + +int l4_thread_create(struct task_ids *ids, unsigned int flags, + int (*func)(void *), void *arg); +void l4_thread_exit(int retval); + +/* -- Bora start -- */ + #endif /* __L4_THREAD_H__ */ diff --git a/conts/libl4thread/include/l4thread/utcb-common.h b/conts/libl4/include/l4lib/utcb-common.h similarity index 100% rename from conts/libl4thread/include/l4thread/utcb-common.h rename to conts/libl4/include/l4lib/utcb-common.h diff --git a/conts/libl4/include/l4lib/utcb.h b/conts/libl4/include/l4lib/utcb.h index ece82ab..3dc4ab4 100644 --- a/conts/libl4/include/l4lib/utcb.h +++ b/conts/libl4/include/l4lib/utcb.h @@ -9,4 +9,14 @@ int utcb_init(void); +/* Bora start */ +#include + +/* Checks if l4_set_stack_params is called. */ +#define IS_UTCB_SETUP() (lib_utcb_range_size) + +unsigned long get_utcb_addr(struct tcb *task); +int delete_utcb_addr(struct tcb *task); +/* Bora end */ + #endif /* __UTCB_H__ */ diff --git a/conts/libl4thread/src/addr.c b/conts/libl4/src/addr.c similarity index 98% rename from conts/libl4thread/src/addr.c rename to conts/libl4/src/addr.c index 7318aca..d55d081 100644 --- a/conts/libl4thread/src/addr.c +++ b/conts/libl4/src/addr.c @@ -4,7 +4,7 @@ * * Copyright (C) 2007 Bahadir Balban */ -#include +#include #include /* diff --git a/conts/libl4thread/src/arch-arm/new_thread.S b/conts/libl4/src/arm/new_thread.S similarity index 100% rename from conts/libl4thread/src/arch-arm/new_thread.S rename to conts/libl4/src/arm/new_thread.S diff --git a/conts/libl4thread/src/bit.c b/conts/libl4/src/bit.c similarity index 97% rename from conts/libl4thread/src/bit.c rename to conts/libl4/src/bit.c index 7c0ab4e..1d2328b 100644 --- a/conts/libl4thread/src/bit.c +++ b/conts/libl4/src/bit.c @@ -3,8 +3,9 @@ * * Copyright (C) 2007 Bahadir Balban */ -#include +#include #include +#include #include INC_GLUE(memory.h) /* Emulation of ARM's CLZ (count leading zeroes) instruction */ diff --git a/conts/libl4thread/src/idpool.c b/conts/libl4/src/idpool.c similarity index 98% rename from conts/libl4thread/src/idpool.c rename to conts/libl4/src/idpool.c index 17fd450..3c31d47 100644 --- a/conts/libl4thread/src/idpool.c +++ b/conts/libl4/src/idpool.c @@ -4,7 +4,7 @@ * * Copyright (C) 2009 B Labs Ltd. */ -#include +#include #include #include #include diff --git a/conts/libl4thread/src/stack.c b/conts/libl4/src/stack.c similarity index 97% rename from conts/libl4thread/src/stack.c rename to conts/libl4/src/stack.c index 5fedcba..60b9517 100644 --- a/conts/libl4thread/src/stack.c +++ b/conts/libl4/src/stack.c @@ -4,10 +4,10 @@ * Copyright © 2009 B Labs Ltd. */ #include -#include #include +#include #include -#include +#include /* Extern declarations */ extern struct l4_mutex lib_mutex; diff --git a/conts/libl4thread/src/tcb.c b/conts/libl4/src/tcb.c similarity index 96% rename from conts/libl4thread/src/tcb.c rename to conts/libl4/src/tcb.c index dec4918..ea2b2f7 100644 --- a/conts/libl4thread/src/tcb.c +++ b/conts/libl4/src/tcb.c @@ -7,7 +7,8 @@ #include #include #include -#include +#include +#include /* Global task list. */ struct global_list global_tasks = { diff --git a/conts/libl4thread/src/thread.c b/conts/libl4/src/thread.c similarity index 99% rename from conts/libl4thread/src/thread.c rename to conts/libl4/src/thread.c index 61b0f53..796d187 100644 --- a/conts/libl4thread/src/thread.c +++ b/conts/libl4/src/thread.c @@ -11,8 +11,8 @@ #include #include #include -#include -#include +#include +#include /* Extern declarations */ extern void setup_new_thread(void); diff --git a/conts/libl4thread/src/utcb-common.c b/conts/libl4/src/utcb-common.c similarity index 97% rename from conts/libl4thread/src/utcb-common.c rename to conts/libl4/src/utcb-common.c index 5ad511a..eff2699 100644 --- a/conts/libl4thread/src/utcb-common.c +++ b/conts/libl4/src/utcb-common.c @@ -4,8 +4,8 @@ * Copyright © 2009 B Labs Ltd. */ #include -#include -#include +#include +#include #include /* Globally disjoint utcb virtual region pool */ diff --git a/conts/libl4thread/src/utcb.c b/conts/libl4/src/utcb.c similarity index 97% rename from conts/libl4thread/src/utcb.c rename to conts/libl4/src/utcb.c index 5bed78c..cb62635 100644 --- a/conts/libl4thread/src/utcb.c +++ b/conts/libl4/src/utcb.c @@ -4,13 +4,13 @@ * Copyright (C) 2009 B Labs Ltd. */ #include +#include +#include #include #include -#include -#include -#include -#include -#include +#include +#include +#include /* Extern declarations */ extern struct global_list global_tasks; diff --git a/conts/libl4thread/SConscript b/conts/libl4thread/SConscript deleted file mode 100644 index abcda27..0000000 --- a/conts/libl4thread/SConscript +++ /dev/null @@ -1,32 +0,0 @@ -# -*- mode: python; coding: utf-8; -*- -# -# Codezero -- Virtualization microkernel for embedded systems. -# -# Copyright © 2009 B Labs Ltd - -import os, sys - -# Get global paths -PROJRELROOT = '../..' - -sys.path.append(PROJRELROOT) - -from config.projpaths import * - -Import('env') - -LIBMEM_RELDIR = 'conts/libmem' -LIBMEM_DIR = join(PROJROOT, LIBMEM_RELDIR) - -LIBL4_RELDIR = 'conts/libl4' -LIBL4_DIR = join(PROJROOT, LIBL4_RELDIR) -LIBL4_INCLUDE = join(LIBL4_DIR, 'include') - -e = env.Clone() -e.Append(CPPPATH = ['include/l4thread', LIBMEM_DIR, LIBL4_INCLUDE]) - -source = [Glob('*.[cS]') + Glob('src/*.[cS]') + Glob('src/arch/*.[cS]')] -objects = e.StaticObject(source) -library = e.StaticLibrary('l4thread', objects) - -Return('library') diff --git a/conts/libl4thread/include/l4thread/thread.h b/conts/libl4thread/include/l4thread/thread.h deleted file mode 100644 index 7afe124..0000000 --- a/conts/libl4thread/include/l4thread/thread.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Thread creation userspace helpers - * - * Copyright (C) 2009 B Labs Ltd. - */ -#ifndef __LIB_THREAD_H__ -#define __LIB_THREAD_H__ - -/* A helper macro easing utcb space creation. */ -#define DECLARE_UTCB_SPACE(name, entries) \ - char name[(entries + PAGE_SIZE / UTCB_SIZE) * UTCB_SIZE] ALIGN(PAGE_SIZE); - -int l4_set_stack_params(unsigned long stack_top, - unsigned long stack_bottom, - unsigned long stack_size); -int l4_set_utcb_params(unsigned long utcb_start, unsigned long utcb_end); - -int l4_thread_create(struct task_ids *ids, unsigned int flags, - int (*func)(void *), void *arg); -void l4_thread_exit(int retval); - -#endif /* __LIB_THREAD_H__ */ diff --git a/conts/libl4thread/include/l4thread/utcb.h b/conts/libl4thread/include/l4thread/utcb.h deleted file mode 100644 index 086aa93..0000000 --- a/conts/libl4thread/include/l4thread/utcb.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * UTCB handling helper routines. - * - * Copyright (C) 2009 B Labs Ltd. - */ -#ifndef __LIB_UTCB_H__ -#define __LIB_UTCB_H__ - -#include - -/* Checks if l4_set_stack_params is called. */ -#define IS_UTCB_SETUP() (lib_utcb_range_size) - -unsigned long get_utcb_addr(struct tcb *task); -int delete_utcb_addr(struct tcb *task); - -#endif /* __LIB_UTCB_H__ */ diff --git a/conts/libl4thread/src/arch b/conts/libl4thread/src/arch deleted file mode 120000 index 3e9770f..0000000 --- a/conts/libl4thread/src/arch +++ /dev/null @@ -1 +0,0 @@ -arch-arm/ \ No newline at end of file diff --git a/include/l4/generic/cap-types.h b/include/l4/generic/cap-types.h index c28fceb..657cc58 100644 --- a/include/l4/generic/cap-types.h +++ b/include/l4/generic/cap-types.h @@ -40,8 +40,6 @@ {(c)->type &= ~CAP_RTYPE_MASK; \ (c)->type |= CAP_RTYPE_MASK & rtype;} -#define cap_devmem(c) (c)->uattr - /* * User-defined device-types * (Kept in the user field) @@ -50,7 +48,20 @@ #define CAP_DEVTYPE_UART 2 #define CAP_DEVTYPE_CLCD 3 #define CAP_DEVTYPE_OTHER 0xF -#define CAP_DEVTYPE_MASK 0xF +#define CAP_DEVTYPE_MASK 0xFFFF +#define CAP_DEVNUM_MASK 0xFFFF0000 +#define CAP_DEVNUM_SHIFT 16 + +#define cap_is_devmem(c) (c)->uattr +#define cap_set_devtype(c, devtype) \ + {(c)->uattr &= ~CAP_DEVTYPE_MASK; \ + (c)->uattr |= CAP_DEVTYPE_MASK & devtype;} +#define cap_set_devnum(c, devnum) \ + {(c)->uattr &= ~CAP_DEVNUM_MASK; \ + (c)->uattr |= CAP_DEVNUM_MASK & devnum;} +#define cap_devnum(c) \ + (((c)->uattr & CAP_DEVNUM_MASK) >> CAP_DEVNUM_SHIFT) +#define cap_devtype(c) ((c)->uattr & CAP_DEVTYPE_MASK) /* * Access permissions diff --git a/src/generic/resource.c b/src/generic/resource.c index f99c4fb..3992102 100644 --- a/src/generic/resource.c +++ b/src/generic/resource.c @@ -849,7 +849,7 @@ int process_cap_info(struct cap_info *cap, &kres->virtmem_free, cap->start, cap->end); } else if (cap_type(cap) == CAP_TYPE_MAP_PHYSMEM) { - if (!cap_devmem(cap)) + if (!cap_is_devmem(cap)) memcap_unmap(&kres->physmem_used, &kres->physmem_free, cap->start, cap->end); diff --git a/src/platform/pb926/platform.c b/src/platform/pb926/platform.c index 278d452..1acf411 100644 --- a/src/platform/pb926/platform.c +++ b/src/platform/pb926/platform.c @@ -27,68 +27,29 @@ int platform_setup_device_caps(struct kernel_resources *kres) { struct capability *uart[4], *timer[2]; -// struct capability *irqctrl[2], *sysctrl; -#if 0 - /* Setup kernel capability for uart0 as used */ - uart[0] = alloc_bootmem(sizeof(*uart[0]), 0); - uart[0]->start = __pfn(PB926_UART0_BASE); - uart[0]->end = uart[0]->start + 1; - uart[0]->uattr = CAP_DEVTYPE_UART; - link_init(&uart[0]->list); - cap_list_insert(uart[0], &kres->devmem_used); - - /* Setup timer0 capability as used */ - timer[0] = alloc_bootmem(sizeof(*timer[0]), 0); - timer[0]->start = __pfn(PB926_TIMER01_BASE); - timer[0]->end = timer[0]->start + 1; - timer[0]->uattr = CAP_DEVTYPE_TIMER; - link_init(&timer[0]->list); - cap_list_insert(timer[0], &kres->devmem_used); - - /* Setup irq controller 0 and 1 as used */ - irqctrl[0] = alloc_bootmem(sizeof(*irqctrl[0]), 0); - irqctrl[0]->start = __pfn(PB926_VIC_BASE); - irqctrl[0]->end = irqctrl[0]->start + 1; - irqctrl[0]->uattr = CAP_DEVTYPE_IRQCTRL; - link_init(&irqctrl[0]->list); - cap_list_insert(irqctrl[0], &kres->devmem_used); - - irqctrl[1] = alloc_bootmem(sizeof(*irqctrl[1]), 0); - irqctrl[1]->start = __pfn(PB926_SIC_BASE); - irqctrl[1]->end = irqctrl[1]->start + 1; - irqctrl[1]->uattr = CAP_DEVTYPE_IRQCTRL; - link_init(&irqctrl[1]->list); - cap_list_insert(irqctrl[1], &kres->devmem_used); - - /* Set up system controller as used */ - sysctrl = alloc_bootmem(sizeof(*sysctrl), 0); - sysctrl->start = __pfn(PB926_SYSCTRL_BASE); - sysctrl->end = sysctrl->start + 1; - sysctrl->uattr = CAP_DEVTYPE_SYSCTRL; - link_init(&sysctrl->list); - cap_list_insert(sysctrl, &kres->devmem_used); -#endif - - /* Setup capabilities for other uarts as free */ + /* Setup capabilities for userspace uarts and timers */ 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; + cap_set_devtype(uart[1], CAP_DEVTYPE_UART); + cap_set_devnum(uart[1], 1); 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(PB926_UART2_BASE); uart[2]->end = uart[2]->start + 1; - uart[2]->uattr = CAP_DEVTYPE_UART; + cap_set_devtype(uart[2], CAP_DEVTYPE_UART); + cap_set_devnum(uart[2], 2); link_init(&uart[2]->list); cap_list_insert(uart[2], &kres->devmem_free); uart[3] = alloc_bootmem(sizeof(*uart[3]), 0); uart[3]->start = __pfn(PB926_UART3_BASE); uart[3]->end = uart[3]->start + 1; - uart[3]->uattr = CAP_DEVTYPE_UART; + cap_set_devtype(uart[3], CAP_DEVTYPE_UART); + cap_set_devnum(uart[3], 3); link_init(&uart[3]->list); cap_list_insert(uart[3], &kres->devmem_free); @@ -96,7 +57,8 @@ int platform_setup_device_caps(struct kernel_resources *kres) timer[1] = alloc_bootmem(sizeof(*timer[1]), 0); timer[1]->start = __pfn(PB926_TIMER23_BASE); timer[1]->end = timer[1]->start + 1; - timer[1]->uattr = CAP_DEVTYPE_TIMER; + cap_set_devtype(timer[1], CAP_DEVTYPE_TIMER); + cap_set_devnum(timer[1], 1); link_init(&timer[1]->list); cap_list_insert(timer[1], &kres->devmem_free);