Changeset 8d2760f in mainline for kernel/genarch/src/ofw


Ignore:
Timestamp:
2008-11-29T20:24:47Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
57e76cb
Parents:
dfd77382
Message:

Add additional members to the irq_t structure so that an interrupt-driven driver
does not need to know how to clear the level interrupt. The z8530 was modified
in this way and is much more generic. The ns16550 driver has also been modified,
but awaits testing. The sparc64 interrupt mapping and dispatch code is now using
the new info and calls the clear-interrupt-routine itself.

Location:
kernel/genarch/src/ofw
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/ofw/ebus.c

    rdfd77382 r8d2760f  
    4545
    4646/** 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)
     47bool
     48ofw_ebus_apply_ranges(ofw_tree_node_t *node, ofw_ebus_reg_t *reg, uintptr_t *pa)
    4849{
    4950        ofw_tree_property_t *prop;
     
    6364                if (reg->space != range[i].child_space)
    6465                        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)) {
    6668                        ofw_pci_reg_t pci_reg;
    6769                       
    6870                        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);
    7073                        pci_reg.size = reg->size;
    7174                       
     
    7780}
    7881
    79 bool ofw_ebus_map_interrupt(ofw_tree_node_t *node, ofw_ebus_reg_t *reg, uint32_t interrupt, int *inr)
     82bool
     83ofw_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)
    8085{
    8186        ofw_tree_property_t *prop;
     
    105110        unsigned int i;
    106111        for (i = 0; i < count; i++) {
    107                 if ((intr_map[i].space == space) && (intr_map[i].addr == addr)
    108                         && (intr_map[i].intr == intr))
     112                if ((intr_map[i].space == space) &&
     113                    (intr_map[i].addr == addr) && (intr_map[i].intr == intr))
    109114                        goto found;
    110115        }
     
    114119        /*
    115120         * 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.
    117123         */
    118124
    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);
    120127        if (!controller)
    121128                return false;
     
    131138         * Let the PCI do the next step in mapping the interrupt.
    132139         */
    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))
    134142                return false;
    135143
  • kernel/genarch/src/ofw/fhc.c

    rdfd77382 r8d2760f  
    110110}
    111111
    112 bool ofw_fhc_map_interrupt(ofw_tree_node_t *node, ofw_fhc_reg_t *reg, uint32_t interrupt, int *inr)
     112bool
     113ofw_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)
    113115{
    114116        fhc_t *fhc = NULL;
     
    127129       
    128130        *inr = interrupt;
     131        *cir = fhc_clear_interrupt;
     132        *cir_arg = fhc;
    129133        return true;
    130134}
  • kernel/genarch/src/ofw/pci.c

    rdfd77382 r8d2760f  
    5050#define PCI_IGN                 0x1f
    5151
    52 bool ofw_pci_apply_ranges(ofw_tree_node_t *node, ofw_pci_reg_t *reg, uintptr_t *pa)
     52bool
     53ofw_pci_apply_ranges(ofw_tree_node_t *node, ofw_pci_reg_t *reg, uintptr_t *pa)
    5354{
    5455        ofw_tree_property_t *prop;
     
    6970       
    7071        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))
    7274                        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);
    7579                        return true;
    7680                }
     
    8084}
    8185
    82 bool ofw_pci_reg_absolutize(ofw_tree_node_t *node, ofw_pci_reg_t *reg, ofw_pci_reg_t *out)
     86bool
     87ofw_pci_reg_absolutize(ofw_tree_node_t *node, ofw_pci_reg_t *reg,
     88    ofw_pci_reg_t *out)
    8389{
    8490        if (reg->space & PCI_ABS_MASK) {
     
    104110       
    105111        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)) {
    107114                        out->space = assigned_address[i].space;
    108115                        out->addr = reg->addr + assigned_address[i].addr;
     
    120127 * to a PCI bridge.
    121128 */
    122 bool ofw_pci_map_interrupt(ofw_tree_node_t *node, ofw_pci_reg_t *reg, int ino, int *inr)
     129bool
     130ofw_pci_map_interrupt(ofw_tree_node_t *node, ofw_pci_reg_t *reg, int ino,
     131    int *inr, cir_t *cir, void **cir_arg)
    123132{
    124133        pci_t *pci = node->device;
     
    133142
    134143        *inr = (PCI_IGN << IGN_SHIFT) | ino;
     144        *cir = pci_clear_interrupt;
     145        *cir_arg = pci;
    135146
    136147        return true;
Note: See TracChangeset for help on using the changeset viewer.