Changes in / [0a208110:b9bbaad] in mainline
- Files:
-
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
abi/include/ddi/irq.h
r0a208110 rb9bbaad 36 36 #define ABI_DDI_IRQ_H_ 37 37 38 typedef struct {39 uintptr_t base;40 size_t size;41 } irq_pio_range_t;42 43 38 typedef enum { 44 39 /** Read 1 byte from the I/O space. */ … … 72 67 CMD_PIO_WRITE_A_32, 73 68 69 /** Read 1 byte from the memory space. */ 70 CMD_MEM_READ_8, 71 /** Read 2 bytes from the memory space. */ 72 CMD_MEM_READ_16, 73 /** Read 4 bytes from the memory space. */ 74 CMD_MEM_READ_32, 75 76 /** Write 1 byte to the memory space. */ 77 CMD_MEM_WRITE_8, 78 /** Write 2 bytes to the memory space. */ 79 CMD_MEM_WRITE_16, 80 /** Write 4 bytes to the memory space. */ 81 CMD_MEM_WRITE_32, 82 83 /** Write 1 byte from the source argument to the memory space. */ 84 CMD_MEM_WRITE_A_8, 85 /** Write 2 bytes from the source argument to the memory space. */ 86 CMD_MEM_WRITE_A_16, 87 /** Write 4 bytes from the source argument to the memory space. */ 88 CMD_MEM_WRITE_A_32, 89 74 90 /** 75 91 * Perform a bit masking on the source argument … … 102 118 103 119 typedef struct { 104 size_t rangecount;105 irq_pio_range_t *ranges;106 120 size_t cmdcount; 107 121 irq_cmd_t *cmds; -
boot/arch/ia64/src/pal_asm.S
r0a208110 rb9bbaad 32 32 33 33 pal_static_call: 34 alloc loc0 = ar.pfs, 7, 6, 0, 0 35 36 mov loc1 = psr ;; 37 mov psr.l = r0 ;; 38 srlz.i 39 srlz.d 34 alloc loc0 = ar.pfs, 7, 5, 0, 0 40 35 41 mov loc 2= gp42 mov loc 3= rp36 mov loc1 = gp 37 mov loc2 = rp 43 38 44 addl loc 4= @gprel(pal_proc), gp45 39 addl loc3 = @gprel(pal_proc), gp 40 46 41 mov r28 = in0 47 42 mov r29 = in1 … … 49 44 mov r31 = in3 ;; 50 45 51 ld8 loc 4 = [loc4]52 movl loc 5= 0f ;;46 ld8 loc3 = [loc3] 47 movl loc4 = 0f ;; 53 48 54 mov b6 = loc 455 mov rp = loc 5;;49 mov b6 = loc3 50 mov rp = loc4 ;; 56 51 br.cond.sptk.many b6 57 52 58 53 0: 59 mov psr.l = loc1 ;;60 srlz.i61 srlz.d62 63 54 cmp.ne p7,p0 = 0, in4 64 55 cmp.ne p8,p0 = 0, in5 … … 69 60 (p9) st8 [in6] = r11 70 61 71 mov gp = loc 272 mov rp = loc 3;;62 mov gp = loc1 63 mov rp = loc2 ;; 73 64 74 65 mov ar.pfs = loc0 -
boot/arch/ia64/src/sal_asm.S
r0a208110 rb9bbaad 29 29 .explicit 30 30 31 #define STACK_SCRATCH_AREA 1632 #define STACK_IN8 (0 + STACK_SCRATCH_AREA)33 #define STACK_IN9 (8 + STACK_SCRATCH_AREA)34 #define STACK_IN10 (16 + STACK_SCRATCH_AREA)35 36 31 .global sal_call 37 32 … … 44 39 # 45 40 sal_call: 46 alloc loc0 = ar.pfs, 8, 8, 8, 041 alloc loc0 = ar.pfs, 11, 5, 8, 0 47 42 48 adds sp = -STACK_SCRATCH_AREA, sp49 50 43 mov loc1 = gp 51 44 mov loc2 = rp … … 64 57 65 58 ld8 loc3 = [loc3] 66 ld8 gp = [loc4] 67 68 adds r14 = STACK_IN8 + STACK_SCRATCH_AREA, sp 69 adds r15 = STACK_IN9 + STACK_SCRATCH_AREA, sp 70 adds r16 = STACK_IN10 + STACK_SCRATCH_AREA, sp ;; 71 72 ld8 loc5 = [r14] 73 ld8 loc6 = [r15] 74 ld8 loc7 = [r16] 59 ld8 gp = [loc4] ;; 75 60 76 61 mov b6 = loc3 ;; 77 62 br.call.sptk.many rp = b6 78 63 79 cmp.ne p7,p0 = 0, loc580 cmp.ne p8,p0 = 0, loc681 cmp.ne p9,p0 = 0, loc7;;64 cmp.ne p7,p0 = 0, in8 65 cmp.ne p8,p0 = 0, in9 66 cmp.ne p9,p0 = 0, in10 ;; 82 67 83 (p7) st8 [ loc5] = r984 (p8) st8 [ loc6] = r1085 (p9) st8 [ loc7] = r1168 (p7) st8 [in8] = r9 69 (p8) st8 [in9] = r10 70 (p9) st8 [in10] = r11 86 71 87 72 mov gp = loc1 88 mov rp = loc2 89 90 adds sp = STACK_SCRATCH_AREA, sp ;; 73 mov rp = loc2 ;; 91 74 92 75 mov ar.pfs = loc0 93 76 br.ret.sptk.many rp 94 -
kernel/arch/arm32/src/mach/integratorcp/integratorcp.c
r0a208110 rb9bbaad 332 332 sysinfo_set_item_val("kbd", NULL, true); 333 333 sysinfo_set_item_val("kbd.inr", NULL, ICP_KBD_IRQ); 334 sysinfo_set_item_val("kbd.address.physical", NULL, 335 ICP_KBD); 334 sysinfo_set_item_val("kbd.address.status", NULL, 335 (uintptr_t) icp_hw_map.kbd_stat); 336 sysinfo_set_item_val("kbd.address.data", NULL, 337 (uintptr_t) icp_hw_map.kbd_data); 336 338 337 339 } -
kernel/arch/arm32/src/mach/testarm/testarm.c
r0a208110 rb9bbaad 128 128 sysinfo_set_item_val("kbd", NULL, true); 129 129 sysinfo_set_item_val("kbd.inr", NULL, GXEMUL_KBD_IRQ); 130 sysinfo_set_item_val("kbd.address.physical", NULL, 131 GXEMUL_KBD_ADDRESS); 130 sysinfo_set_item_val("kbd.address.virtual", NULL, (sysarg_t) gxemul_kbd); 132 131 #endif 133 132 } -
kernel/arch/ia64/include/asm.h
r0a208110 rb9bbaad 61 61 asm volatile ( 62 62 "mf\n" 63 "mf.a\n"64 63 ::: "memory" 65 64 ); … … 75 74 asm volatile ( 76 75 "mf\n" 77 "mf.a\n"78 76 ::: "memory" 79 77 ); … … 89 87 asm volatile ( 90 88 "mf\n" 91 "mf.a\n"92 89 ::: "memory" 93 90 ); … … 107 104 else 108 105 v = *port; 109 110 asm volatile (111 "mf.a\n"112 ::: "memory"113 );114 106 115 107 return v; … … 129 121 else 130 122 v = *port; 131 132 asm volatile (133 "mf.a\n"134 ::: "memory"135 );136 123 137 124 return v; … … 151 138 else 152 139 v = *port; 153 154 asm volatile (155 "mf.a\n"156 ::: "memory"157 );158 140 159 141 return v; -
kernel/arch/ia64/src/ia64.c
r0a208110 rb9bbaad 144 144 #endif 145 145 #ifdef MACHINE_i460GX 146 platform = " pc";146 platform = "i460GX"; 147 147 #endif 148 148 sysinfo_set_item_data("platform", NULL, (void *) platform, … … 187 187 sysinfo_set_item_val("kbd.type", NULL, KBD_NS16550); 188 188 sysinfo_set_item_val("kbd.address.physical", NULL, 189 (uintptr_t) NS16550_BASE); 190 sysinfo_set_item_val("kbd.address.kernel", NULL, 189 191 (uintptr_t) NS16550_BASE); 190 192 #endif -
kernel/arch/mips32/src/mips32.c
r0a208110 rb9bbaad 196 196 sysinfo_set_item_val("kbd", NULL, true); 197 197 sysinfo_set_item_val("kbd.inr", NULL, MSIM_KBD_IRQ); 198 sysinfo_set_item_val("kbd.address.physical", NULL, 199 PA2KA(MSIM_KBD_ADDRESS)); 198 sysinfo_set_item_val("kbd.address.virtual", NULL, MSIM_KBD_ADDRESS); 200 199 #endif 201 200 } -
kernel/arch/ppc32/src/ppc32.c
r0a208110 rb9bbaad 232 232 sysinfo_set_item_val("cuda.inr", NULL, IRQ_CUDA); 233 233 sysinfo_set_item_val("cuda.address.physical", NULL, pa); 234 sysinfo_set_item_val("cuda.address.kernel", NULL, 235 (uintptr_t) cuda); 234 236 #endif 235 237 } -
kernel/arch/sparc64/src/drivers/kbd.c
r0a208110 rb9bbaad 133 133 sysinfo_set_item_val("kbd", NULL, true); 134 134 sysinfo_set_item_val("kbd.inr", NULL, inr); 135 sysinfo_set_item_val("kbd.address.kernel", NULL, 136 (uintptr_t) ns16550); 135 137 sysinfo_set_item_val("kbd.address.physical", NULL, pa); 136 138 sysinfo_set_item_val("kbd.type.ns16550", NULL, true); -
kernel/generic/include/ddi/irq.h
r0a208110 rb9bbaad 134 134 /** Notification configuration structure. */ 135 135 ipc_notif_cfg_t notif_cfg; 136 137 as_t *driver_as; 136 138 } irq_t; 137 139 -
kernel/generic/include/ipc/irq.h
r0a208110 rb9bbaad 36 36 #define KERN_IPC_IRQ_H_ 37 37 38 /** Maximum number of IPC IRQ programmed I/O ranges. */ 39 #define IRQ_MAX_RANGE_COUNT 8 40 41 /** Maximum length of IPC IRQ program. */ 38 /** Maximum length of IPC IRQ program */ 42 39 #define IRQ_MAX_PROG_SIZE 20 43 40 -
kernel/generic/include/macros.h
r0a208110 rb9bbaad 69 69 uint64_t sz2) 70 70 { 71 uint64_t e1; 72 uint64_t e2; 73 74 /* Handle the two corner cases when either sz1 or sz2 are zero. */ 75 if (sz1 == 0) 76 return (s1 == s2) && (sz2 == 0); 77 e1 = s1 + sz1 - 1; 78 if (sz2 == 0) 79 return (s1 <= s2) && (s2 <= e1); 80 e2 = s2 + sz2 - 1; 81 82 /* e1 and e2 are end addresses, the sum is imune to overflow */ 71 uint64_t e1 = s1 + sz1; 72 uint64_t e2 = s2 + sz2; 73 83 74 return ((s1 <= s2) && (e1 >= e2)); 84 75 } -
kernel/generic/src/ipc/irq.c
r0a208110 rb9bbaad 74 74 #include <arch.h> 75 75 #include <mm/slab.h> 76 #include <mm/page.h>77 #include <mm/km.h>78 76 #include <errno.h> 79 77 #include <ddi/irq.h> … … 83 81 #include <console/console.h> 84 82 #include <print.h> 85 #include <macros.h>86 87 static void ranges_unmap(irq_pio_range_t *ranges, size_t rangecount)88 {89 size_t i;90 91 for (i = 0; i < rangecount; i++) {92 #ifdef IO_SPACE_BOUNDARY93 if ((void *) ranges[i].base >= IO_SPACE_BOUNDARY)94 #endif95 km_unmap(ranges[i].base, ranges[i].size);96 }97 }98 99 static int ranges_map_and_apply(irq_pio_range_t *ranges, size_t rangecount,100 irq_cmd_t *cmds, size_t cmdcount)101 {102 uintptr_t *pbase;103 size_t i, j;104 105 /* Copy the physical base addresses aside. */106 pbase = malloc(rangecount * sizeof(uintptr_t), 0);107 for (i = 0; i < rangecount; i++)108 pbase[i] = ranges[i].base;109 110 /* Map the PIO ranges into the kernel virtual address space. */111 for (i = 0; i < rangecount; i++) {112 #ifdef IO_SPACE_BOUNDARY113 if ((void *) ranges[i].base < IO_SPACE_BOUNDARY)114 continue;115 #endif116 ranges[i].base = km_map(pbase[i], ranges[i].size,117 PAGE_READ | PAGE_WRITE | PAGE_KERNEL | PAGE_NOT_CACHEABLE);118 if (!ranges[i].base) {119 ranges_unmap(ranges, i);120 free(pbase);121 return ENOMEM;122 }123 }124 125 /* Rewrite the pseudocode addresses from physical to kernel virtual. */126 for (i = 0; i < cmdcount; i++) {127 uintptr_t addr;128 size_t size;129 130 /* Process only commands that use an address. */131 switch (cmds[i].cmd) {132 case CMD_PIO_READ_8:133 case CMD_PIO_WRITE_8:134 case CMD_PIO_WRITE_A_8:135 size = 1;136 break;137 case CMD_PIO_READ_16:138 case CMD_PIO_WRITE_16:139 case CMD_PIO_WRITE_A_16:140 size = 2;141 break;142 case CMD_PIO_READ_32:143 case CMD_PIO_WRITE_32:144 case CMD_PIO_WRITE_A_32:145 size = 4;146 break;147 default:148 /* Move onto the next command. */149 continue;150 }151 152 addr = (uintptr_t) cmds[i].addr;153 154 for (j = 0; j < rangecount; j++) {155 156 /* Find the matching range. */157 if (!iswithin(pbase[j], ranges[j].size, addr, size))158 continue;159 160 /* Switch the command to a kernel virtual address. */161 addr -= pbase[j];162 addr += ranges[j].base;163 164 cmds[i].addr = (void *) addr;165 break;166 }167 168 if (j == rangecount) {169 /*170 * The address used in this command is outside of all171 * defined ranges.172 */173 ranges_unmap(ranges, rangecount);174 free(pbase);175 return EINVAL;176 }177 }178 179 free(pbase);180 return EOK;181 }182 83 183 84 /** Free the top-half pseudocode. … … 189 90 { 190 91 if (code) { 191 ranges_unmap(code->ranges, code->rangecount);192 free(code->ranges);193 92 free(code->cmds); 194 93 free(code); … … 205 104 static irq_code_t *code_from_uspace(irq_code_t *ucode) 206 105 { 207 irq_pio_range_t *ranges = NULL;208 irq_cmd_t *cmds = NULL;209 210 106 irq_code_t *code = malloc(sizeof(*code), 0); 211 107 int rc = copy_from_uspace(code, ucode, sizeof(*code)); 212 if (rc != EOK) 213 goto error; 214 215 if ((code->rangecount > IRQ_MAX_RANGE_COUNT) || 216 (code->cmdcount > IRQ_MAX_PROG_SIZE)) 217 goto error; 218 219 ranges = malloc(sizeof(code->ranges[0]) * code->rangecount, 0); 220 rc = copy_from_uspace(ranges, code->ranges, 221 sizeof(code->ranges[0]) * code->rangecount); 222 if (rc != EOK) 223 goto error; 224 225 cmds = malloc(sizeof(code->cmds[0]) * code->cmdcount, 0); 226 rc = copy_from_uspace(cmds, code->cmds, 108 if (rc != 0) { 109 free(code); 110 return NULL; 111 } 112 113 if (code->cmdcount > IRQ_MAX_PROG_SIZE) { 114 free(code); 115 return NULL; 116 } 117 118 irq_cmd_t *ucmds = code->cmds; 119 code->cmds = malloc(sizeof(code->cmds[0]) * code->cmdcount, 0); 120 rc = copy_from_uspace(code->cmds, ucmds, 227 121 sizeof(code->cmds[0]) * code->cmdcount); 228 if (rc != EOK) 229 goto error; 230 231 rc = ranges_map_and_apply(ranges, code->rangecount, cmds, 232 code->cmdcount); 233 if (rc != EOK) 234 goto error; 235 236 code->ranges = ranges; 237 code->cmds = cmds; 238 122 if (rc != 0) { 123 free(code->cmds); 124 free(code); 125 return NULL; 126 } 127 239 128 return code; 240 241 error:242 if (cmds)243 free(cmds);244 if (ranges)245 free(ranges);246 free(code);247 return NULL;248 129 } 249 130 … … 293 174 irq->notif_cfg.code = code; 294 175 irq->notif_cfg.counter = 0; 176 irq->driver_as = AS; 295 177 296 178 /* … … 483 365 return IRQ_DECLINE; 484 366 367 as_t *current_as = AS; 368 if (current_as != irq->driver_as) 369 as_switch(AS, irq->driver_as); 370 485 371 for (size_t i = 0; i < code->cmdcount; i++) { 486 372 uint32_t dstval; 373 void *va; 374 uint8_t val8; 375 uint16_t val16; 376 uint32_t val32; 487 377 488 378 uintptr_t srcarg = code->cmds[i].srcarg; … … 541 431 } 542 432 break; 433 case CMD_MEM_READ_8: 434 va = code->cmds[i].addr; 435 memcpy_from_uspace(&val8, va, sizeof(val8)); 436 if (dstarg) 437 scratch[dstarg] = val8; 438 break; 439 case CMD_MEM_READ_16: 440 va = code->cmds[i].addr; 441 memcpy_from_uspace(&val16, va, sizeof(val16)); 442 if (dstarg) 443 scratch[dstarg] = val16; 444 break; 445 case CMD_MEM_READ_32: 446 va = code->cmds[i].addr; 447 memcpy_from_uspace(&val32, va, sizeof(val32)); 448 if (dstarg) 449 scratch[dstarg] = val32; 450 break; 451 case CMD_MEM_WRITE_8: 452 val8 = code->cmds[i].value; 453 va = code->cmds[i].addr; 454 memcpy_to_uspace(va, &val8, sizeof(val8)); 455 break; 456 case CMD_MEM_WRITE_16: 457 val16 = code->cmds[i].value; 458 va = code->cmds[i].addr; 459 memcpy_to_uspace(va, &val16, sizeof(val16)); 460 break; 461 case CMD_MEM_WRITE_32: 462 val32 = code->cmds[i].value; 463 va = code->cmds[i].addr; 464 memcpy_to_uspace(va, &val32, sizeof(val32)); 465 break; 466 case CMD_MEM_WRITE_A_8: 467 if (srcarg) { 468 val8 = scratch[srcarg]; 469 va = code->cmds[i].addr; 470 memcpy_to_uspace(va, &val8, sizeof(val8)); 471 } 472 break; 473 case CMD_MEM_WRITE_A_16: 474 if (srcarg) { 475 val16 = scratch[srcarg]; 476 va = code->cmds[i].addr; 477 memcpy_to_uspace(va, &val16, sizeof(val16)); 478 } 479 break; 480 case CMD_MEM_WRITE_A_32: 481 if (srcarg) { 482 val32 = scratch[srcarg]; 483 va = code->cmds[i].addr; 484 memcpy_to_uspace(va, &val32, sizeof(val32)); 485 } 486 break; 543 487 case CMD_BTEST: 544 488 if ((srcarg) && (dstarg)) { … … 554 498 break; 555 499 case CMD_ACCEPT: 500 if (AS != current_as) 501 as_switch(AS, current_as); 556 502 return IRQ_ACCEPT; 557 503 case CMD_DECLINE: 558 504 default: 505 if (AS != current_as) 506 as_switch(AS, current_as); 559 507 return IRQ_DECLINE; 560 508 } 561 509 } 510 511 if (AS != current_as) 512 as_switch(AS, current_as); 562 513 563 514 return IRQ_DECLINE; -
kernel/generic/src/main/main.c
r0a208110 rb9bbaad 257 257 for (i = 0; i < init.cnt; i++) 258 258 LOG("init[%zu].addr=%p, init[%zu].size=%zu", 259 i, (void *) init.tasks[i]. paddr, i, init.tasks[i].size);259 i, (void *) init.tasks[i].addr, i, init.tasks[i].size); 260 260 } else 261 261 printf("No init binaries found.\n"); -
kernel/generic/src/mm/km.c
r0a208110 rb9bbaad 134 134 ASSERT(ALIGN_UP(size, FRAME_SIZE) == size); 135 135 136 /* Enforce natural or at least PAGE_SIZE alignment. */137 136 align = ispwr2(size) ? size : (1U << (fnzb(size) + 1)); 138 137 vaddr = km_page_alloc(size, max(PAGE_SIZE, align)); -
kernel/generic/src/mm/page.c
r0a208110 rb9bbaad 168 168 int page_find_mapping(uintptr_t virt, void **phys) 169 169 { 170 page_table_lock(AS, true);170 mutex_lock(&AS->lock); 171 171 172 172 pte_t *pte = page_mapping_find(AS, virt, false); 173 173 if ((!PTE_VALID(pte)) || (!PTE_PRESENT(pte))) { 174 page_table_unlock(AS, true);174 mutex_unlock(&AS->lock); 175 175 return ENOENT; 176 176 } … … 179 179 (virt - ALIGN_DOWN(virt, PAGE_SIZE)); 180 180 181 page_table_unlock(AS, true);181 mutex_unlock(&AS->lock); 182 182 183 183 return EOK; -
kernel/generic/src/syscall/copy.c
r0a208110 rb9bbaad 56 56 * @param size Size of the data to be copied. 57 57 * 58 * @return EOKon success or error code from @ref errno.h.58 * @return 0 on success or error code from @ref errno.h. 59 59 */ 60 60 int copy_from_uspace(void *dst, const void *uspace_src, size_t size) … … 94 94 95 95 interrupts_restore(ipl); 96 return !rc ? EPERM : EOK;96 return !rc ? EPERM : 0; 97 97 } 98 98 -
uspace/drv/bus/usb/ohci/hc.c
r0a208110 rb9bbaad 47 47 (I_SO | I_WDH | I_UE | I_RHSC) 48 48 49 static const irq_pio_range_t ohci_pio_ranges[] = { 50 { 51 .base = 0, /* filled later */ 52 .size = sizeof(ohci_regs_t) 53 } 54 }; 55 56 static const irq_cmd_t ohci_irq_commands[] = { 57 { .cmd = CMD_PIO_READ_32, .dstarg = 1, .addr = NULL /* filled later */ }, 58 { .cmd = CMD_BTEST, .srcarg = 1, .dstarg = 2, .value = OHCI_USED_INTERRUPTS }, 49 static const irq_cmd_t ohci_irq_commands[] = 50 { 51 { .cmd = CMD_MEM_READ_32, .dstarg = 1, .addr = NULL /*filled later*/ }, 52 { .cmd = CMD_BTEST, .srcarg = 1, .dstarg = 2, .value = 0 /*filled later*/}, 59 53 { .cmd = CMD_PREDICATE, .srcarg = 2, .value = 2 }, 60 { .cmd = CMD_ PIO_WRITE_A_32, .srcarg = 1, .addr = NULL /* filled later*/ },54 { .cmd = CMD_MEM_WRITE_A_32, .srcarg = 1, .addr = NULL /*filled later*/ }, 61 55 { .cmd = CMD_ACCEPT }, 62 56 }; … … 69 63 static int hc_schedule(hcd_t *hcd, usb_transfer_batch_t *batch); 70 64 /*----------------------------------------------------------------------------*/ 71 /** Get number of PIO ranges used in IRQ code.72 * @return Number of ranges.73 */74 size_t hc_irq_pio_range_count(void)75 {76 return sizeof(ohci_pio_ranges) / sizeof(irq_pio_range_t);77 }78 /*----------------------------------------------------------------------------*/79 /*----------------------------------------------------------------------------*/80 65 /** Get number of commands used in IRQ code. 81 66 * @return Number of commands. … … 86 71 } 87 72 /*----------------------------------------------------------------------------*/ 88 /** Generate IRQ code. 89 * @param[out] ranges PIO ranges buffer. 90 * @param[in] ranges_size Size of the ranges buffer (bytes). 91 * @param[out] cmds Commands buffer. 92 * @param[in] cmds_size Size of the commands buffer (bytes). 73 /** Generate IRQ code commands. 74 * @param[out] cmds Place to store the commands. 75 * @param[in] cmd_size Size of the place (bytes). 93 76 * @param[in] regs Physical address of device's registers. 94 77 * @param[in] reg_size Size of the register area (bytes). … … 96 79 * @return Error code. 97 80 */ 98 int 99 hc_get_irq_code(irq_pio_range_t ranges[], size_t ranges_size, irq_cmd_t cmds[], 100 size_t cmds_size, uintptr_t regs, size_t reg_size) 101 { 102 if ((ranges_size < sizeof(ohci_pio_ranges)) || 103 (cmds_size < sizeof(ohci_irq_commands)) || 104 (reg_size < sizeof(ohci_regs_t))) 81 int hc_get_irq_commands( 82 irq_cmd_t cmds[], size_t cmd_size, uintptr_t regs, size_t reg_size) 83 { 84 if (cmd_size < sizeof(ohci_irq_commands) 85 || reg_size < sizeof(ohci_regs_t)) 105 86 return EOVERFLOW; 106 87 107 memcpy(ranges, ohci_pio_ranges, sizeof(ohci_pio_ranges)); 108 ranges[0].base = regs; 88 /* Create register mapping to use in IRQ handler. 89 * This mapping should be present in kernel only. 90 * Remove it from here when kernel knows how to create mappings 91 * and accepts physical addresses in IRQ code. 92 * TODO: remove */ 93 ohci_regs_t *registers; 94 const int ret = pio_enable((void*)regs, reg_size, (void**)®isters); 95 if (ret != EOK) 96 return ret; 97 98 /* Some bogus access to force create mapping. DO NOT remove, 99 * unless whole virtual addresses in irq is replaced 100 * NOTE: Compiler won't remove this as ohci_regs_t members 101 * are declared volatile. 102 * 103 * Introducing CMD_MEM set of IRQ code commands broke 104 * assumption that IRQ code does not cause page faults. 105 * If this happens during idling (THREAD == NULL) 106 * it causes kernel panic. 107 */ 108 registers->revision; 109 109 110 110 memcpy(cmds, ohci_irq_commands, sizeof(ohci_irq_commands)); 111 ohci_regs_t *registers = (ohci_regs_t *) regs; 112 cmds[0].addr = (void *) ®isters->interrupt_status; 111 112 void *address = (void*)®isters->interrupt_status; 113 cmds[0].addr = address; 113 114 cmds[1].value = OHCI_USED_INTERRUPTS; 114 cmds[3].addr = (void *) ®isters->interrupt_status; 115 115 cmds[3].addr = address; 116 116 return EOK; 117 117 } -
uspace/drv/bus/usb/ohci/hc.h
r0a208110 rb9bbaad 74 74 } hc_t; 75 75 76 size_t hc_irq_pio_range_count(void);77 76 size_t hc_irq_cmd_count(void); 78 int hc_get_irq_co de(irq_pio_range_t [], size_t, irq_cmd_t [], size_t, uintptr_t,79 size_t);77 int hc_get_irq_commands( 78 irq_cmd_t cmds[], size_t cmd_size, uintptr_t regs, size_t reg_size); 80 79 int hc_register_hub(hc_t *instance, ddf_fun_t *hub_fun); 81 80 int hc_init(hc_t *instance, uintptr_t regs, size_t reg_size, bool interrupts); -
uspace/drv/bus/usb/ohci/ohci.c
r0a208110 rb9bbaad 187 187 (void *) reg_base, reg_size, irq); 188 188 189 const size_t ranges_count = hc_irq_pio_range_count(); 190 const size_t cmds_count = hc_irq_cmd_count(); 191 irq_pio_range_t irq_ranges[ranges_count]; 192 irq_cmd_t irq_cmds[cmds_count]; 193 irq_code_t irq_code = { 194 .rangecount = ranges_count, 195 .ranges = irq_ranges, 196 .cmdcount = cmds_count, 197 .cmds = irq_cmds 198 }; 199 200 ret = hc_get_irq_code(irq_ranges, sizeof(irq_ranges), irq_cmds, 201 sizeof(irq_cmds), reg_base, reg_size); 202 CHECK_RET_DEST_FREE_RETURN(ret, 203 "Failed to generate IRQ code: %s.\n", str_error(ret)); 189 const size_t cmd_count = hc_irq_cmd_count(); 190 irq_cmd_t irq_cmds[cmd_count]; 191 irq_code_t irq_code = { .cmdcount = cmd_count, .cmds = irq_cmds }; 192 193 ret = 194 hc_get_irq_commands(irq_cmds, sizeof(irq_cmds), reg_base, reg_size); 195 CHECK_RET_DEST_FREE_RETURN(ret, 196 "Failed to generate IRQ commands: %s.\n", str_error(ret)); 204 197 205 198 -
uspace/drv/bus/usb/uhci/hc.c
r0a208110 rb9bbaad 48 48 (UHCI_STATUS_INTERRUPT | UHCI_STATUS_ERROR_INTERRUPT) 49 49 50 static const irq_pio_range_t uhci_irq_pio_ranges[] = { 51 { 52 .base = 0, /* filled later */ 53 .size = sizeof(uhci_regs_t) 54 } 55 }; 56 57 static const irq_cmd_t uhci_irq_commands[] = { 50 51 static const irq_cmd_t uhci_irq_commands[] = 52 { 58 53 { .cmd = CMD_PIO_READ_16, .dstarg = 1, .addr = NULL/*filled later*/}, 59 54 { .cmd = CMD_BTEST, .srcarg = 1, .dstarg = 2, … … 73 68 74 69 /*----------------------------------------------------------------------------*/ 75 /** Get number of PIO ranges used in IRQ code.76 * @return Number of ranges.77 */78 size_t hc_irq_pio_range_count(void)79 {80 return sizeof(uhci_irq_pio_ranges) / sizeof(irq_pio_range_t);81 }82 /*----------------------------------------------------------------------------*/83 70 /** Get number of commands used in IRQ code. 84 71 * @return Number of commands. … … 89 76 } 90 77 /*----------------------------------------------------------------------------*/ 91 /** Generate IRQ code. 92 * @param[out] ranges PIO ranges buffer. 93 * @param[in] ranges_size Size of the ranges buffer (bytes). 94 * @param[out] cmds Commands buffer. 95 * @param[in] cmds_size Size of the commands buffer (bytes). 78 /** Generate IRQ code commands. 79 * @param[out] cmds Place to store the commands. 80 * @param[in] cmd_size Size of the place (bytes). 96 81 * @param[in] regs Physical address of device's registers. 97 82 * @param[in] reg_size Size of the register area (bytes). … … 99 84 * @return Error code. 100 85 */ 101 int 102 hc_get_irq_code(irq_pio_range_t ranges[], size_t ranges_size, irq_cmd_t cmds[], 103 size_t cmds_size, uintptr_t regs, size_t reg_size) 104 { 105 if ((ranges_size < sizeof(uhci_irq_pio_ranges)) || 106 (cmds_size < sizeof(uhci_irq_commands)) || 107 (reg_size < sizeof(uhci_regs_t))) 86 int hc_get_irq_commands( 87 irq_cmd_t cmds[], size_t cmd_size, uintptr_t regs, size_t reg_size) 88 { 89 if (cmd_size < sizeof(uhci_irq_commands) 90 || reg_size < sizeof(uhci_regs_t)) 108 91 return EOVERFLOW; 109 92 110 memcpy(ranges, uhci_irq_pio_ranges, sizeof(uhci_irq_pio_ranges)); 111 ranges[0].base = regs; 93 uhci_regs_t *registers = (uhci_regs_t*)regs; 112 94 113 95 memcpy(cmds, uhci_irq_commands, sizeof(uhci_irq_commands)); 114 uhci_regs_t *registers = (uhci_regs_t *) regs; 115 cmds[0].addr = ®isters->usbsts; 116 cmds[3].addr = ®isters->usbsts; 117 96 97 cmds[0].addr = (void*)®isters->usbsts; 98 cmds[3].addr = (void*)®isters->usbsts; 118 99 return EOK; 119 100 } -
uspace/drv/bus/usb/uhci/hc.h
r0a208110 rb9bbaad 121 121 } hc_t; 122 122 123 size_t hc_irq_pio_range_count(void);124 123 size_t hc_irq_cmd_count(void); 125 int hc_get_irq_co de(irq_pio_range_t [], size_t, irq_cmd_t [], size_t, uintptr_t,126 size_t);124 int hc_get_irq_commands( 125 irq_cmd_t cmds[], size_t cmd_size, uintptr_t regs, size_t reg_size); 127 126 void hc_interrupt(hc_t *instance, uint16_t status); 128 127 int hc_init(hc_t *instance, void *regs, size_t reg_size, bool interupts); -
uspace/drv/bus/usb/uhci/uhci.c
r0a208110 rb9bbaad 198 198 "Failed to disable legacy USB: %s.\n", str_error(ret)); 199 199 200 const size_t ranges_count = hc_irq_pio_range_count(); 201 const size_t cmds_count = hc_irq_cmd_count(); 202 irq_pio_range_t irq_ranges[ranges_count]; 203 irq_cmd_t irq_cmds[cmds_count]; 204 ret = hc_get_irq_code(irq_ranges, sizeof(irq_ranges), irq_cmds, 205 sizeof(irq_cmds), reg_base, reg_size); 200 const size_t cmd_count = hc_irq_cmd_count(); 201 irq_cmd_t irq_cmds[cmd_count]; 202 ret = 203 hc_get_irq_commands(irq_cmds, sizeof(irq_cmds), reg_base, reg_size); 206 204 CHECK_RET_DEST_FREE_RETURN(ret, 207 205 "Failed to generate IRQ commands: %s.\n", str_error(ret)); 208 206 209 irq_code_t irq_code = { 210 .rangecount = ranges_count, 211 .ranges = irq_ranges, 212 .cmdcount = cmds_count, 213 .cmds = irq_cmds 214 }; 207 irq_code_t irq_code = { .cmdcount = cmd_count, .cmds = irq_cmds }; 215 208 216 209 /* Register handler to avoid interrupt lockup */ -
uspace/drv/char/i8042/i8042.c
r0a208110 rb9bbaad 105 105 }; 106 106 107 static const irq_pio_range_t i8042_ranges[] = {108 {109 .base = 0,110 .size = sizeof(i8042_regs_t)111 }112 };113 114 107 /** i8042 Interrupt pseudo-code. */ 115 108 static const irq_cmd_t i8042_cmds[] = { … … 246 239 while (pio_read_8(&dev->regs->status) & i8042_OUTPUT_FULL) 247 240 (void) pio_read_8(&dev->regs->data); 248 249 const size_t range_count = sizeof(i8042_ranges) / 250 sizeof(irq_pio_range_t); 251 irq_pio_range_t ranges[range_count]; 252 memcpy(ranges, i8042_ranges, sizeof(i8042_ranges)); 253 ranges[0].base = (uintptr_t) regs; 254 241 255 242 const size_t cmd_count = sizeof(i8042_cmds) / sizeof(irq_cmd_t); 256 243 irq_cmd_t cmds[cmd_count]; 257 244 memcpy(cmds, i8042_cmds, sizeof(i8042_cmds)); 258 cmds[0].addr = (void *) & (((i8042_regs_t *) regs)->status);259 cmds[3].addr = (void *) & (((i8042_regs_t *) regs)->data);260 245 cmds[0].addr = (void *) &dev->regs->status; 246 cmds[3].addr = (void *) &dev->regs->data; 247 261 248 irq_code_t irq_code = { 262 .rangecount = range_count,263 .ranges = ranges,264 249 .cmdcount = cmd_count, 265 250 .cmds = cmds -
uspace/drv/infrastructure/root/root.c
r0a208110 rb9bbaad 158 158 if (asprintf(&match_id, PLATFORM_FUN_MATCH_ID_FMT, platform) == -1) { 159 159 ddf_msg(LVL_ERROR, "Memory allocation failed."); 160 free(platform); 161 return ENOMEM; 162 } 163 164 free(platform); 160 return ENOMEM; 161 } 165 162 166 163 /* Add function. */ … … 172 169 if (fun == NULL) { 173 170 ddf_msg(LVL_ERROR, "Error creating function %s", name); 174 free(match_id);175 171 return ENOMEM; 176 172 } … … 180 176 ddf_msg(LVL_ERROR, "Failed adding match IDs to function %s", 181 177 name); 182 free(match_id);183 178 ddf_fun_destroy(fun); 184 179 return rc; … … 213 208 * vital for the system. 214 209 */ 215 (void)add_virtual_root_fun(dev);210 add_virtual_root_fun(dev); 216 211 217 212 /* Register root device's children. */ -
uspace/drv/nic/e1k/e1k.c
r0a208110 rb9bbaad 228 228 static void e1000_send_frame(nic_t *, void *, size_t); 229 229 230 /** PIO ranges used in the IRQ code. */231 irq_pio_range_t e1000_irq_pio_ranges[] = {232 {233 .base = 0,234 .size = PAGE_SIZE, /* XXX */235 }236 };237 238 230 /** Commands to deal with interrupt 239 231 * … … 264 256 /** Interrupt code definition */ 265 257 irq_code_t e1000_irq_code = { 266 .rangecount = sizeof(e1000_irq_pio_ranges) /267 sizeof(irq_pio_range_t),268 .ranges = e1000_irq_pio_ranges,269 258 .cmdcount = sizeof(e1000_irq_commands) / sizeof(irq_cmd_t), 270 259 .cmds = e1000_irq_commands … … 1263 1252 fibril_mutex_lock(&irq_reg_mutex); 1264 1253 1265 e1000_irq_code.ranges[0].base = (uintptr_t) e1000->reg_base_phys; 1266 e1000_irq_code.cmds[0].addr = e1000->reg_base_phys + E1000_ICR; 1267 e1000_irq_code.cmds[2].addr = e1000->reg_base_phys + E1000_IMC; 1254 e1000_irq_code.cmds[0].addr = e1000->reg_base_virt + E1000_ICR; 1255 e1000_irq_code.cmds[2].addr = e1000->reg_base_virt + E1000_IMC; 1268 1256 1269 1257 int rc = register_interrupt_handler(nic_get_ddf_dev(nic), -
uspace/drv/nic/ne2k/ne2k.c
r0a208110 rb9bbaad 64 64 #define NE2K(device) ((ne2k_t *) nic_get_specific(DRIVER_DATA(device))) 65 65 66 static irq_pio_range_t ne2k_ranges_prototype[] = {67 {68 .base = 0,69 .size = NE2K_IO_SIZE,70 }71 };72 73 66 /** NE2000 kernel interrupt command sequence. 74 67 * … … 129 122 130 123 if (ne2k->code.cmdcount == 0) { 131 irq_pio_range_t *ne2k_ranges; 132 irq_cmd_t *ne2k_cmds; 133 134 ne2k_ranges = malloc(sizeof(ne2k_ranges_prototype)); 135 if (!ne2k_ranges) 136 return ENOMEM; 137 memcpy(ne2k_ranges, ne2k_ranges_prototype, 138 sizeof(ne2k_ranges_prototype)); 139 ne2k_ranges[0].base = (uintptr_t) ne2k->base_port; 140 141 ne2k_cmds = malloc(sizeof(ne2k_cmds_prototype)); 142 if (!ne2k_cmds) { 143 free(ne2k_ranges); 124 irq_cmd_t *ne2k_cmds = malloc(sizeof(ne2k_cmds_prototype)); 125 if (ne2k_cmds == NULL) { 144 126 return ENOMEM; 145 127 } 146 memcpy(ne2k_cmds, ne2k_cmds_prototype, 147 sizeof(ne2k_cmds_prototype)); 148 ne2k_cmds[0].addr = ne2k->base_port + DP_ISR; 149 ne2k_cmds[3].addr = ne2k->base_port + DP_IMR; 128 memcpy(ne2k_cmds, ne2k_cmds_prototype, sizeof (ne2k_cmds_prototype)); 129 ne2k_cmds[0].addr = ne2k->port + DP_ISR; 130 ne2k_cmds[3].addr = ne2k->port + DP_IMR; 150 131 ne2k_cmds[4].addr = ne2k_cmds[0].addr; 151 ne2k_cmds[5].addr = ne2k->base_port + DP_TSR; 152 153 ne2k->code.rangecount = sizeof(ne2k_ranges_prototype) / 154 sizeof(irq_pio_range_t); 155 ne2k->code.ranges = ne2k_ranges; 156 157 ne2k->code.cmdcount = sizeof(ne2k_cmds_prototype) / 158 sizeof(irq_cmd_t); 132 ne2k_cmds[5].addr = ne2k->port + DP_TSR; 133 134 ne2k->code.cmdcount = sizeof(ne2k_cmds_prototype) / sizeof(irq_cmd_t); 159 135 ne2k->code.cmds = ne2k_cmds; 160 136 } … … 172 148 ne2k_t *ne2k = NE2K(dev); 173 149 if (ne2k) { 174 free(ne2k->code.ranges);175 150 free(ne2k->code.cmds); 176 151 } -
uspace/drv/nic/rtl8139/driver.c
r0a208110 rb9bbaad 661 661 662 662 663 irq_pio_range_t rtl8139_irq_pio_ranges[] = {664 {665 .base = 0,666 .size = RTL8139_IO_SIZE667 }668 };669 663 670 664 /** Commands to deal with interrupt … … 676 670 */ 677 671 irq_cmd_t rtl8139_irq_commands[] = { 678 {679 /* Get the interrupt status */680 .cmd = CMD_PIO_READ_16,681 .addr = NULL,682 .dstarg = 2683 },684 {685 .cmd = CMD_PREDICATE,686 .value = 3,687 .srcarg = 2688 },689 {690 /* Mark interrupts as solved */691 .cmd = CMD_PIO_WRITE_16,692 .addr = NULL,693 .value = 0xFFFF694 },695 {696 /* Disable interrupts until interrupt routine is finished */697 .cmd = CMD_PIO_WRITE_16,698 .addr = NULL,699 .value = 0x0000700 },701 {702 .cmd = CMD_ACCEPT703 }672 { 673 /* Get the interrupt status */ 674 .cmd = CMD_PIO_READ_16, 675 .addr = NULL, 676 .dstarg = 2 677 }, 678 { 679 .cmd = CMD_PREDICATE, 680 .value = 3, 681 .srcarg = 2 682 }, 683 { 684 /* Mark interrupts as solved */ 685 .cmd = CMD_PIO_WRITE_16, 686 .addr = NULL, 687 .value = 0xFFFF 688 }, 689 { 690 /* Disable interrupts until interrupt routine is finished */ 691 .cmd = CMD_PIO_WRITE_16, 692 .addr = NULL, 693 .value = 0x0000 694 }, 695 { 696 .cmd = CMD_ACCEPT 697 } 704 698 }; 705 699 706 700 /** Interrupt code definition */ 707 701 irq_code_t rtl8139_irq_code = { 708 .rangecount = sizeof(rtl8139_irq_pio_ranges) / sizeof(irq_pio_range_t), 709 .ranges = rtl8139_irq_pio_ranges, 710 .cmdcount = sizeof(rtl8139_irq_commands) / sizeof(irq_cmd_t), 702 .cmdcount = sizeof(rtl8139_irq_commands)/sizeof(irq_cmd_t), 711 703 .cmds = rtl8139_irq_commands 712 704 }; … … 898 890 RTL8139_IRQ_STRUCT_LOCK(); 899 891 900 rtl8139_irq_code.ranges[0].base = (uintptr_t) rtl8139->io_addr; 901 rtl8139_irq_code.cmds[0].addr = rtl8139->io_addr + ISR; 902 rtl8139_irq_code.cmds[2].addr = rtl8139->io_addr + ISR; 903 rtl8139_irq_code.cmds[3].addr = rtl8139->io_addr + IMR; 892 rtl8139_irq_code.cmds[0].addr = rtl8139->io_port + ISR; 893 rtl8139_irq_code.cmds[2].addr = rtl8139->io_port + ISR; 894 rtl8139_irq_code.cmds[3].addr = rtl8139->io_port + IMR; 904 895 int rc = register_interrupt_handler(nic_get_ddf_dev(nic_data), 905 896 rtl8139->irq, rtl8139_interrupt_handler, &rtl8139_irq_code); 906 897 907 898 RTL8139_IRQ_STRUCT_UNLOCK(); -
uspace/lib/c/arch/ia64/include/ddi.h
r0a208110 rb9bbaad 62 62 63 63 asm volatile ("mf\n" ::: "memory"); 64 asm volatile ("mf.a\n" ::: "memory");65 64 } 66 65 … … 77 76 78 77 asm volatile ("mf\n" ::: "memory"); 79 asm volatile ("mf.a\n" ::: "memory");80 78 } 81 79 … … 92 90 93 91 asm volatile ("mf\n" ::: "memory"); 94 asm volatile ("mf.a\n" ::: "memory");95 92 } 96 93 … … 109 106 v = *port; 110 107 } 111 112 asm volatile ("mf.a\n" ::: "memory");113 108 114 109 return v; … … 130 125 } 131 126 132 asm volatile ("mf.a\n" ::: "memory");133 134 127 return v; 135 128 } … … 141 134 asm volatile ("mf\n" ::: "memory"); 142 135 143 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {136 if (port < (ioport32_t *) port) { 144 137 uintptr_t prt = (uintptr_t) port; 145 138 … … 150 143 } 151 144 152 asm volatile ("mf.a\n" ::: "memory");153 154 145 return v; 155 146 } -
uspace/lib/drv/generic/interrupt.c
r0a208110 rb9bbaad 68 68 69 69 static irq_code_t default_pseudocode = { 70 0,71 NULL,72 70 sizeof(default_cmds) / sizeof(irq_cmd_t), 73 71 default_cmds -
uspace/srv/hid/input/port/gxemul.c
r0a208110 rb9bbaad 57 57 static kbd_dev_t *kbd_dev; 58 58 59 static irq_pio_range_t gxemul_ranges[] = {60 {61 .base = 0,62 .size = 163 }64 };65 66 59 static irq_cmd_t gxemul_cmds[] = { 67 60 { … … 76 69 77 70 static irq_code_t gxemul_kbd = { 78 sizeof(gxemul_ranges) / sizeof(irq_pio_range_t),79 gxemul_ranges,80 71 sizeof(gxemul_cmds) / sizeof(irq_cmd_t), 81 72 gxemul_cmds … … 90 81 91 82 sysarg_t addr; 92 if (sysinfo_get_value("kbd.address. physical", &addr) != EOK)83 if (sysinfo_get_value("kbd.address.virtual", &addr) != EOK) 93 84 return -1; 94 85 … … 98 89 99 90 async_set_interrupt_received(gxemul_irq_handler); 100 gxemul_ranges[0].base = addr;101 91 gxemul_cmds[0].addr = (void *) addr; 102 92 irq_register(inr, device_assign_devno(), 0, &gxemul_kbd); -
uspace/srv/hid/input/port/msim.c
r0a208110 rb9bbaad 57 57 static kbd_dev_t *kbd_dev; 58 58 59 static irq_pio_range_t msim_ranges[] = {60 {61 .base = 0,62 .size = 163 }64 };65 66 59 static irq_cmd_t msim_cmds[] = { 67 60 { … … 76 69 77 70 static irq_code_t msim_kbd = { 78 sizeof(msim_ranges) / sizeof(irq_pio_range_t),79 msim_ranges,80 71 sizeof(msim_cmds) / sizeof(irq_cmd_t), 81 72 msim_cmds … … 88 79 kbd_dev = kdev; 89 80 90 sysarg_t paddr;91 if (sysinfo_get_value("kbd.address. physical", &paddr) != EOK)81 sysarg_t vaddr; 82 if (sysinfo_get_value("kbd.address.virtual", &vaddr) != EOK) 92 83 return -1; 93 84 … … 96 87 return -1; 97 88 98 msim_ranges[0].base = paddr; 99 msim_cmds[0].addr = (void *) paddr; 89 msim_cmds[0].addr = (void *) vaddr; 100 90 async_set_interrupt_received(msim_irq_handler); 101 91 irq_register(inr, device_assign_devno(), 0, &msim_kbd); -
uspace/srv/hid/input/port/ns16550.c
r0a208110 rb9bbaad 70 70 #define LSR_DATA_READY 0x01 71 71 72 static irq_pio_range_t ns16550_ranges[] = {73 {74 .base = 0,75 .size = 876 }77 };78 79 72 static irq_cmd_t ns16550_cmds[] = { 80 73 { … … 105 98 106 99 irq_code_t ns16550_kbd = { 107 sizeof(ns16550_ranges) / sizeof(irq_pio_range_t),108 ns16550_ranges,109 100 sizeof(ns16550_cmds) / sizeof(irq_cmd_t), 110 101 ns16550_cmds … … 114 105 115 106 static uintptr_t ns16550_physical; 107 static uintptr_t ns16550_kernel; 116 108 117 109 static kbd_dev_t *kbd_dev; … … 132 124 return -1; 133 125 126 if (sysinfo_get_value("kbd.address.kernel", &ns16550_kernel) != EOK) 127 return -1; 128 134 129 sysarg_t inr; 135 130 if (sysinfo_get_value("kbd.inr", &inr) != EOK) 136 131 return -1; 137 132 138 ns16550_kbd.ranges[0].base = ns16550_physical; 139 ns16550_kbd.cmds[0].addr = (void *) (ns16550_physical + LSR_REG); 140 ns16550_kbd.cmds[3].addr = (void *) (ns16550_physical + RBR_REG); 133 ns16550_kbd.cmds[0].addr = (void *) (ns16550_kernel + LSR_REG); 134 ns16550_kbd.cmds[3].addr = (void *) (ns16550_kernel + RBR_REG); 141 135 142 136 async_set_interrupt_received(ns16550_irq_handler); -
uspace/srv/hid/input/port/pl050.c
r0a208110 rb9bbaad 61 61 static kbd_dev_t *kbd_dev; 62 62 63 #define PL050_STAT 464 #define PL050_DATA 865 66 63 #define PL050_STAT_RXFULL (1 << 4) 67 68 static irq_pio_range_t pl050_ranges[] = {69 {70 .base = 0,71 .size = 9,72 }73 };74 64 75 65 static irq_cmd_t pl050_cmds[] = { … … 101 91 102 92 static irq_code_t pl050_kbd = { 103 sizeof(pl050_ranges) / sizeof(irq_pio_range_t),104 pl050_ranges,105 93 sizeof(pl050_cmds) / sizeof(irq_cmd_t), 106 94 pl050_cmds … … 114 102 115 103 sysarg_t addr; 116 if (sysinfo_get_value("kbd.address. physical", &addr) != EOK)104 if (sysinfo_get_value("kbd.address.status", &addr) != EOK) 117 105 return -1; 118 106 119 pl050_kbd.ranges[0].base = addr; 120 pl050_kbd.cmds[0].addr = (void *) addr + PL050_STAT; 121 pl050_kbd.cmds[3].addr = (void *) addr + PL050_DATA; 107 pl050_kbd.cmds[0].addr = (void *) addr; 108 109 if (sysinfo_get_value("kbd.address.data", &addr) != EOK) 110 return -1; 111 112 pl050_kbd.cmds[3].addr = (void *) addr; 122 113 123 114 sysarg_t inr; -
uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c
r0a208110 rb9bbaad 62 62 63 63 static irq_code_t ts_irq_code = { 64 0,65 NULL,66 64 sizeof(ts_irq_cmds) / sizeof(irq_cmd_t), 67 65 ts_irq_cmds -
uspace/srv/hw/bus/cuda_adb/cuda_adb.c
r0a208110 rb9bbaad 104 104 enum { 105 105 ADB_MAX_ADDR = 16 106 };107 108 static irq_pio_range_t cuda_ranges[] = {109 {110 .base = 0,111 .size = sizeof(cuda_t)112 }113 106 }; 114 107 … … 137 130 138 131 static irq_code_t cuda_irq_code = { 139 sizeof(cuda_ranges) / sizeof(irq_pio_range_t),140 cuda_ranges,141 132 sizeof(cuda_cmds) / sizeof(irq_cmd_t), 142 133 cuda_cmds … … 264 255 return -1; 265 256 257 if (sysinfo_get_value("cuda.address.kernel", &(instance->cuda_kernel)) != EOK) 258 return -1; 259 266 260 void *vaddr; 267 261 if (pio_enable((void *) instance->cuda_physical, sizeof(cuda_t), &vaddr) != 0) … … 280 274 pio_write_8(&dev->ier, IER_CLR | ALL_INT); 281 275 282 cuda_irq_code.ranges[0].base = (uintptr_t) instance->cuda_physical; 283 cuda_irq_code.cmds[0].addr = (void *) &((cuda_t *) instance->cuda_physical)->ifr; 276 cuda_irq_code.cmds[0].addr = (void *) &((cuda_t *) instance->cuda_kernel)->ifr; 284 277 async_set_interrupt_received(cuda_irq_handler); 285 278 irq_register(10, device_assign_devno(), 0, &cuda_irq_code); -
uspace/srv/hw/bus/cuda_adb/cuda_adb.h
r0a208110 rb9bbaad 111 111 cuda_t *cuda; 112 112 uintptr_t cuda_physical; 113 uintptr_t cuda_kernel; 113 114 114 115 uint8_t rcv_buf[CUDA_RCV_BUF_SIZE]; -
uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.c
r0a208110 rb9bbaad 60 60 61 61 static irq_code_t uart_irq_code = { 62 0,63 NULL,64 62 sizeof(uart_irq_cmds) / sizeof(irq_cmd_t), 65 63 uart_irq_cmds
Note:
See TracChangeset
for help on using the changeset viewer.