Changeset 33b1903 in mainline


Ignore:
Timestamp:
2006-10-07T11:24:19Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8d4a577
Parents:
e2cc9a0
Message:

Separate mapping of EBUS interrupts into two parts: EBUS and PCI.

Location:
kernel
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/drivers/kbd.c

    re2cc9a0 r33b1903  
    109109                        return;
    110110                }
    111                 if (!ofw_fhc_map_interrupts(node->parent, ((ofw_fhc_reg_t *) prop->value), interrupts, &inr)) {
    112                         printf("Failed to determine keyboard interrupts.\n");
     111                if (!ofw_fhc_map_interrupt(node->parent, ((ofw_fhc_reg_t *) prop->value), interrupts, &inr)) {
     112                        printf("Failed to determine keyboard interrupt.\n");
    113113                        return;
    114114                }
     
    120120                        return;
    121121                }
    122                 if (!ofw_ebus_map_interrupts(node->parent, ((ofw_ebus_reg_t *) prop->value), interrupts, &inr)) {
    123                         printf("Failed to determine keyboard interrupts.\n");
     122                if (!ofw_ebus_map_interrupt(node->parent, ((ofw_ebus_reg_t *) prop->value), interrupts, &inr)) {
     123                        printf("Failed to determine keyboard interrupt.\n");
    124124                        return;
    125125                }
  • kernel/genarch/include/ofw/ofw_tree.h

    re2cc9a0 r33b1903  
    116116        uint32_t intr;
    117117        uint32_t controller_handle;
    118         uint32_t controller_inr;
     118        uint32_t controller_ino;
    119119} __attribute__ ((packed));
    120120typedef struct ofw_ebus_intr_map ofw_ebus_intr_map_t;
     
    166166extern bool ofw_pci_reg_absolutize(ofw_tree_node_t *node, ofw_pci_reg_t *reg, ofw_pci_reg_t *out);
    167167
    168 extern bool ofw_fhc_map_interrupts(ofw_tree_node_t *node, ofw_fhc_reg_t *reg, uint32_t interrupt, int *inr);
    169 extern bool ofw_ebus_map_interrupts(ofw_tree_node_t *node, ofw_ebus_reg_t *reg, uint32_t interrupt, int *inr);
     168extern bool ofw_fhc_map_interrupt(ofw_tree_node_t *node, ofw_fhc_reg_t *reg, uint32_t interrupt, int *inr);
     169extern bool ofw_ebus_map_interrupt(ofw_tree_node_t *node, ofw_ebus_reg_t *reg, uint32_t interrupt, int *inr);
     170extern bool ofw_pci_map_interrupt(ofw_tree_node_t *node, ofw_pci_reg_t *reg, int ino, int *inr);
    170171
    171172#endif
  • kernel/genarch/src/ofw/ebus.c

    re2cc9a0 r33b1903  
    3737
    3838#include <genarch/ofw/ofw_tree.h>
    39 #include <arch/drivers/pci.h>
    4039#include <arch/memstr.h>
    4140#include <arch/trap/interrupt.h>
     
    7877}
    7978
    80 bool ofw_ebus_map_interrupts(ofw_tree_node_t *node, ofw_ebus_reg_t *reg, uint32_t interrupt, int *inr)
     79bool ofw_ebus_map_interrupt(ofw_tree_node_t *node, ofw_ebus_reg_t *reg, uint32_t interrupt, int *inr)
    8180{
    8281        ofw_tree_property_t *prop;
     
    115114        /*
    116115         * We found the device that functions as an interrupt controller
    117          * for the interrupt. We also found mapping from interrupt to INR.
    118          * What needs to be done now is to verify that this indeed is a PCI
    119          * node.
     116         * for the interrupt. We also found partial mapping from interrupt to INO.
    120117         */
    121118
     
    131128        }
    132129
    133         pci_t *pci = controller->device;
    134         if (!pci) {
    135                 pci = pci_init(controller);
    136                 if (!pci)
    137                         return false;
    138                 controller->device = pci;
    139                
    140         }
    141         pci_enable_interrupt(pci, intr_map[i].controller_inr);
     130        /*
     131         * Let the PCI do the next step in mapping the interrupt.
     132         */
     133        if (!ofw_pci_map_interrupt(controller, NULL, intr_map[i].controller_ino, inr))
     134                return false;
    142135
    143         *inr = intr_map[i].controller_inr;
    144         *inr |= 0x1f << IGN_SHIFT;              /* 0x1f is hardwired IGN */
    145        
    146136        return true;
    147137}
  • kernel/genarch/src/ofw/fhc.c

    re2cc9a0 r33b1903  
    110110}
    111111
    112 bool ofw_fhc_map_interrupts(ofw_tree_node_t *node, ofw_fhc_reg_t *reg, uint32_t interrupt, int *inr)
     112bool ofw_fhc_map_interrupt(ofw_tree_node_t *node, ofw_fhc_reg_t *reg, uint32_t interrupt, int *inr)
    113113{
    114114        fhc_t *fhc = NULL;
  • kernel/genarch/src/ofw/pci.c

    re2cc9a0 r33b1903  
    3737
    3838#include <genarch/ofw/ofw_tree.h>
     39#include <arch/drivers/pci.h>
     40#include <arch/trap/interrupt.h>
    3941#include <arch/memstr.h>
    4042#include <func.h>
     
    4547#define PCI_ABS_MASK            0x80000000     
    4648#define PCI_REG_MASK            0x000000ff
     49
     50#define PCI_IGN                 0x1f
    4751
    4852bool ofw_pci_apply_ranges(ofw_tree_node_t *node, ofw_pci_reg_t *reg, uintptr_t *pa)
     
    111115}
    112116
     117/** Map PCI interrupt.
     118 *
     119 * So far, we only know how to map interrupts of non-PCI devices connected
     120 * to a PCI bridge.
     121 */
     122bool ofw_pci_map_interrupt(ofw_tree_node_t *node, ofw_pci_reg_t *reg, int ino, int *inr)
     123{
     124        pci_t *pci = node->device;
     125        if (!pci) {
     126                pci = pci_init(node);
     127                if (!pci)
     128                        return false;
     129                node->device = pci;
     130        }
     131
     132        pci_enable_interrupt(pci, ino);
     133
     134        *inr = (PCI_IGN << IGN_SHIFT) | ino;
     135
     136        return true;
     137}
     138
    113139/** @}
    114140 */
Note: See TracChangeset for help on using the changeset viewer.