Changeset 8d2760f in mainline for kernel/genarch/src
- Timestamp:
- 2008-11-29T20:24:47Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 57e76cb
- Parents:
- dfd77382
- Location:
- kernel/genarch/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/kbd/ns16550.c
rdfd77382 r8d2760f 108 108 /** Initialize ns16550. 109 109 * 110 * @param devno Device number. 111 * @param inr Interrupt number. 112 * @param vaddr Virtual address of device's registers. 113 */ 114 void ns16550_init(devno_t devno, inr_t inr, ioport_t port) 110 * @param devno Device number. 111 * @param port Virtual/IO address of device's registers. 112 * @param inr Interrupt number. 113 * @param cir Clear interrupt function. 114 * @param cir_arg First argument to cir. 115 */ 116 void 117 ns16550_init(devno_t devno, ioport_t port, inr_t inr, cir_t cir, void *cir_arg) 115 118 { 116 119 chardev_initialize("ns16550_kbd", &kbrd, &ops); … … 125 128 ns16550_irq.claim = ns16550_claim; 126 129 ns16550_irq.handler = ns16550_irq_handler; 130 ns16550_irq.cir = cir; 131 ns16550_irq.cir_arg = cir_arg; 127 132 irq_register(&ns16550_irq); 128 133 -
kernel/genarch/src/kbd/z8530.c
rdfd77382 r8d2760f 44 44 #include <arch/interrupt.h> 45 45 #include <arch/drivers/kbd.h> 46 #include <arch/drivers/fhc.h>47 46 #include <cpu.h> 48 47 #include <arch/asm.h> … … 84 83 z8530_write_a(&z8530, WR0, WR0_TX_IP_RST); 85 84 86 z8530_write_a(&z8530, WR1, WR1_IARCSC); /* interrupt on all characters */ 85 /* interrupt on all characters */ 86 z8530_write_a(&z8530, WR1, WR1_IARCSC); 87 87 88 88 /* 8 bits per character and enable receiver */ 89 89 z8530_write_a(&z8530, WR3, WR3_RX8BITSCH | WR3_RX_ENABLE); 90 90 91 z8530_write_a(&z8530, WR9, WR9_MIE); /* Master Interrupt Enable. */ 91 /* Master Interrupt Enable. */ 92 z8530_write_a(&z8530, WR9, WR9_MIE); 92 93 93 94 spinlock_lock(&z8530_irq.lock); … … 109 110 110 111 /** Initialize z8530. */ 111 void z8530_init(devno_t devno, inr_t inr, uintptr_t vaddr) 112 void 113 z8530_init(devno_t devno, uintptr_t vaddr, inr_t inr, cir_t cir, void *cir_arg) 112 114 { 113 115 chardev_initialize("z8530_kbd", &kbrd, &ops); … … 122 124 z8530_irq.claim = z8530_claim; 123 125 z8530_irq.handler = z8530_irq_handler; 126 z8530_irq.cir = cir; 127 z8530_irq.cir_arg = cir_arg; 124 128 irq_register(&z8530_irq); 125 129 … … 198 202 void z8530_irq_handler(irq_t *irq, void *arg, ...) 199 203 { 200 /*201 * So far, we know we got this interrupt through the FHC.202 * Since we don't have enough documentation about the FHC203 * and because the interrupt looks like level sensitive,204 * we cannot handle it by scheduling one of the level205 * interrupt traps. Process the interrupt directly.206 */207 204 if (irq->notif_cfg.notify && irq->notif_cfg.answerbox) 208 205 ipc_irq_send_notif(irq); 209 206 else 210 207 z8530_interrupt(); 211 fhc_clear_interrupt(central_fhc, irq->inr);212 208 } 213 209 -
kernel/genarch/src/ofw/ebus.c
rdfd77382 r8d2760f 45 45 46 46 /** Apply EBUS ranges to EBUS register. */ 47 bool ofw_ebus_apply_ranges(ofw_tree_node_t *node, ofw_ebus_reg_t *reg, uintptr_t *pa) 47 bool 48 ofw_ebus_apply_ranges(ofw_tree_node_t *node, ofw_ebus_reg_t *reg, uintptr_t *pa) 48 49 { 49 50 ofw_tree_property_t *prop; … … 63 64 if (reg->space != range[i].child_space) 64 65 continue; 65 if (overlaps(reg->addr, reg->size, range[i].child_base, range[i].size)) { 66 if (overlaps(reg->addr, reg->size, range[i].child_base, 67 range[i].size)) { 66 68 ofw_pci_reg_t pci_reg; 67 69 68 70 pci_reg.space = range[i].parent_space; 69 pci_reg.addr = range[i].parent_base + (reg->addr - range[i].child_base); 71 pci_reg.addr = range[i].parent_base + 72 (reg->addr - range[i].child_base); 70 73 pci_reg.size = reg->size; 71 74 … … 77 80 } 78 81 79 bool ofw_ebus_map_interrupt(ofw_tree_node_t *node, ofw_ebus_reg_t *reg, uint32_t interrupt, int *inr) 82 bool 83 ofw_ebus_map_interrupt(ofw_tree_node_t *node, ofw_ebus_reg_t *reg, 84 uint32_t interrupt, int *inr, cir_t *cir, void **cir_arg) 80 85 { 81 86 ofw_tree_property_t *prop; … … 105 110 unsigned int i; 106 111 for (i = 0; i < count; i++) { 107 if ((intr_map[i].space == space) && (intr_map[i].addr == addr)108 112 if ((intr_map[i].space == space) && 113 (intr_map[i].addr == addr) && (intr_map[i].intr == intr)) 109 114 goto found; 110 115 } … … 114 119 /* 115 120 * We found the device that functions as an interrupt controller 116 * for the interrupt. We also found partial mapping from interrupt to INO. 121 * for the interrupt. We also found partial mapping from interrupt to 122 * INO. 117 123 */ 118 124 119 controller = ofw_tree_find_node_by_handle(ofw_tree_lookup("/"), intr_map[i].controller_handle); 125 controller = ofw_tree_find_node_by_handle(ofw_tree_lookup("/"), 126 intr_map[i].controller_handle); 120 127 if (!controller) 121 128 return false; … … 131 138 * Let the PCI do the next step in mapping the interrupt. 132 139 */ 133 if (!ofw_pci_map_interrupt(controller, NULL, intr_map[i].controller_ino, inr)) 140 if (!ofw_pci_map_interrupt(controller, NULL, intr_map[i].controller_ino, 141 inr, cir, cir_arg)) 134 142 return false; 135 143 -
kernel/genarch/src/ofw/fhc.c
rdfd77382 r8d2760f 110 110 } 111 111 112 bool ofw_fhc_map_interrupt(ofw_tree_node_t *node, ofw_fhc_reg_t *reg, uint32_t interrupt, int *inr) 112 bool 113 ofw_fhc_map_interrupt(ofw_tree_node_t *node, ofw_fhc_reg_t *reg, 114 uint32_t interrupt, int *inr, cir_t *cir, void **cir_arg) 113 115 { 114 116 fhc_t *fhc = NULL; … … 127 129 128 130 *inr = interrupt; 131 *cir = fhc_clear_interrupt; 132 *cir_arg = fhc; 129 133 return true; 130 134 } -
kernel/genarch/src/ofw/pci.c
rdfd77382 r8d2760f 50 50 #define PCI_IGN 0x1f 51 51 52 bool ofw_pci_apply_ranges(ofw_tree_node_t *node, ofw_pci_reg_t *reg, uintptr_t *pa) 52 bool 53 ofw_pci_apply_ranges(ofw_tree_node_t *node, ofw_pci_reg_t *reg, uintptr_t *pa) 53 54 { 54 55 ofw_tree_property_t *prop; … … 69 70 70 71 for (i = 0; i < ranges; i++) { 71 if ((reg->space & PCI_SPACE_MASK) != (range[i].space & PCI_SPACE_MASK)) 72 if ((reg->space & PCI_SPACE_MASK) != 73 (range[i].space & PCI_SPACE_MASK)) 72 74 continue; 73 if (overlaps(reg->addr, reg->size, range[i].child_base, range[i].size)) { 74 *pa = range[i].parent_base + (reg->addr - range[i].child_base); 75 if (overlaps(reg->addr, reg->size, range[i].child_base, 76 range[i].size)) { 77 *pa = range[i].parent_base + 78 (reg->addr - range[i].child_base); 75 79 return true; 76 80 } … … 80 84 } 81 85 82 bool ofw_pci_reg_absolutize(ofw_tree_node_t *node, ofw_pci_reg_t *reg, ofw_pci_reg_t *out) 86 bool 87 ofw_pci_reg_absolutize(ofw_tree_node_t *node, ofw_pci_reg_t *reg, 88 ofw_pci_reg_t *out) 83 89 { 84 90 if (reg->space & PCI_ABS_MASK) { … … 104 110 105 111 for (i = 0; i < assigned_addresses; i++) { 106 if ((assigned_address[i].space & PCI_REG_MASK) == (reg->space & PCI_REG_MASK)) { 112 if ((assigned_address[i].space & PCI_REG_MASK) == 113 (reg->space & PCI_REG_MASK)) { 107 114 out->space = assigned_address[i].space; 108 115 out->addr = reg->addr + assigned_address[i].addr; … … 120 127 * to a PCI bridge. 121 128 */ 122 bool ofw_pci_map_interrupt(ofw_tree_node_t *node, ofw_pci_reg_t *reg, int ino, int *inr) 129 bool 130 ofw_pci_map_interrupt(ofw_tree_node_t *node, ofw_pci_reg_t *reg, int ino, 131 int *inr, cir_t *cir, void **cir_arg) 123 132 { 124 133 pci_t *pci = node->device; … … 133 142 134 143 *inr = (PCI_IGN << IGN_SHIFT) | ino; 144 *cir = pci_clear_interrupt; 145 *cir_arg = pci; 135 146 136 147 return true;
Note:
See TracChangeset
for help on using the changeset viewer.