Changeset 666773c in mainline for kernel/arch/ia64/src/ddi/ddi.c
- Timestamp:
- 2008-12-31T15:33:29Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9805cde
- Parents:
- d8c0dc5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia64/src/ddi/ddi.c
rd8c0dc5 r666773c 1 1 /* 2 * Copyright (c) 2006 Jakub Jermar, Jakub vana 2 * Copyright (c) 2006 Jakub Jermar 3 * Copyright (c) 2008 Jakub vana 3 4 * All rights reserved. 4 5 * … … 39 40 #include <errno.h> 40 41 41 #define IO_MEMMAP_PAGES 42 #define PORTS_PER_PAGE 42 #define IO_MEMMAP_PAGES 16384 43 #define PORTS_PER_PAGE 4 43 44 44 45 /** Enable I/O space range for task. … … 46 47 * Interrupts are disabled and task is locked. 47 48 * 48 * @param task 49 * @param ioaddr StartignI/O space address.50 * @param size 49 * @param task Task. 50 * @param ioaddr Starting I/O space address. 51 * @param size Size of the enabled I/O range. 51 52 * 52 53 * @return 0 on success or an error code from errno.h. … … 54 55 int ddi_iospace_enable_arch(task_t *task, uintptr_t ioaddr, size_t size) 55 56 { 57 if (!task->arch.iomap) { 58 uint8_t *map; 56 59 57 if(!task->arch.iomap) 58 { 59 uint8_t *map; 60 task->arch.iomap=malloc(sizeof(bitmap_t),0); 61 map=malloc(BITS2BYTES(IO_MEMMAP_PAGES),0); 60 task->arch.iomap = malloc(sizeof(bitmap_t), 0); 61 map = malloc(BITS2BYTES(IO_MEMMAP_PAGES), 0); 62 62 if(!map) 63 63 return ENOMEM; 64 bitmap_initialize(task->arch.iomap, map,IO_MEMMAP_PAGES);65 bitmap_clear_range(task->arch.iomap, 0,IO_MEMMAP_PAGES);64 bitmap_initialize(task->arch.iomap, map, IO_MEMMAP_PAGES); 65 bitmap_clear_range(task->arch.iomap, 0, IO_MEMMAP_PAGES); 66 66 } 67 67 68 68 uintptr_t iopage = ioaddr / PORTS_PER_PAGE; 69 size = ALIGN_UP (size+ioaddr-4*iopage,PORTS_PER_PAGE); 70 bitmap_set_range(task->arch.iomap,iopage,size/4); 71 69 size = ALIGN_UP(size + ioaddr - 4 * iopage, PORTS_PER_PAGE); 70 bitmap_set_range(task->arch.iomap, iopage, size / 4); 72 71 73 72 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.