/trunk/kernel/genarch/include/ofw/ofw_tree.h |
---|
115,7 → 115,7 |
uint32_t addr; |
uint32_t intr; |
uint32_t controller_handle; |
uint32_t controller_inr; |
uint32_t controller_ino; |
} __attribute__ ((packed)); |
typedef struct ofw_ebus_intr_map ofw_ebus_intr_map_t; |
165,7 → 165,8 |
extern bool ofw_pci_reg_absolutize(ofw_tree_node_t *node, ofw_pci_reg_t *reg, ofw_pci_reg_t *out); |
extern bool ofw_fhc_map_interrupts(ofw_tree_node_t *node, ofw_fhc_reg_t *reg, uint32_t interrupt, int *inr); |
extern bool ofw_ebus_map_interrupts(ofw_tree_node_t *node, ofw_ebus_reg_t *reg, uint32_t interrupt, int *inr); |
extern bool ofw_fhc_map_interrupt(ofw_tree_node_t *node, ofw_fhc_reg_t *reg, uint32_t interrupt, int *inr); |
extern bool ofw_ebus_map_interrupt(ofw_tree_node_t *node, ofw_ebus_reg_t *reg, uint32_t interrupt, int *inr); |
extern bool ofw_pci_map_interrupt(ofw_tree_node_t *node, ofw_pci_reg_t *reg, int ino, int *inr); |
#endif |
/trunk/kernel/genarch/src/ofw/ebus.c |
---|
36,7 → 36,6 |
*/ |
#include <genarch/ofw/ofw_tree.h> |
#include <arch/drivers/pci.h> |
#include <arch/memstr.h> |
#include <arch/trap/interrupt.h> |
#include <func.h> |
77,7 → 76,7 |
return false; |
} |
bool ofw_ebus_map_interrupts(ofw_tree_node_t *node, ofw_ebus_reg_t *reg, uint32_t interrupt, int *inr) |
bool ofw_ebus_map_interrupt(ofw_tree_node_t *node, ofw_ebus_reg_t *reg, uint32_t interrupt, int *inr) |
{ |
ofw_tree_property_t *prop; |
ofw_tree_node_t *controller; |
114,9 → 113,7 |
found: |
/* |
* We found the device that functions as an interrupt controller |
* for the interrupt. We also found mapping from interrupt to INR. |
* What needs to be done now is to verify that this indeed is a PCI |
* node. |
* for the interrupt. We also found partial mapping from interrupt to INO. |
*/ |
controller = ofw_tree_find_node_by_handle(ofw_tree_lookup("/"), intr_map[i].controller_handle); |
130,19 → 127,12 |
return false; |
} |
pci_t *pci = controller->device; |
if (!pci) { |
pci = pci_init(controller); |
if (!pci) |
return false; |
controller->device = pci; |
} |
pci_enable_interrupt(pci, intr_map[i].controller_inr); |
/* |
* Let the PCI do the next step in mapping the interrupt. |
*/ |
if (!ofw_pci_map_interrupt(controller, NULL, intr_map[i].controller_ino, inr)) |
return false; |
*inr = intr_map[i].controller_inr; |
*inr |= 0x1f << IGN_SHIFT; /* 0x1f is hardwired IGN */ |
return true; |
} |
/trunk/kernel/genarch/src/ofw/fhc.c |
---|
109,7 → 109,7 |
return false; |
} |
bool ofw_fhc_map_interrupts(ofw_tree_node_t *node, ofw_fhc_reg_t *reg, uint32_t interrupt, int *inr) |
bool ofw_fhc_map_interrupt(ofw_tree_node_t *node, ofw_fhc_reg_t *reg, uint32_t interrupt, int *inr) |
{ |
fhc_t *fhc = NULL; |
if (!node->device) { |
/trunk/kernel/genarch/src/ofw/pci.c |
---|
36,6 → 36,8 |
*/ |
#include <genarch/ofw/ofw_tree.h> |
#include <arch/drivers/pci.h> |
#include <arch/trap/interrupt.h> |
#include <arch/memstr.h> |
#include <func.h> |
#include <panic.h> |
45,6 → 47,8 |
#define PCI_ABS_MASK 0x80000000 |
#define PCI_REG_MASK 0x000000ff |
#define PCI_IGN 0x1f |
bool ofw_pci_apply_ranges(ofw_tree_node_t *node, ofw_pci_reg_t *reg, uintptr_t *pa) |
{ |
ofw_tree_property_t *prop; |
110,5 → 114,27 |
return false; |
} |
/** Map PCI interrupt. |
* |
* So far, we only know how to map interrupts of non-PCI devices connected |
* to a PCI bridge. |
*/ |
bool ofw_pci_map_interrupt(ofw_tree_node_t *node, ofw_pci_reg_t *reg, int ino, int *inr) |
{ |
pci_t *pci = node->device; |
if (!pci) { |
pci = pci_init(node); |
if (!pci) |
return false; |
node->device = pci; |
} |
pci_enable_interrupt(pci, ino); |
*inr = (PCI_IGN << IGN_SHIFT) | ino; |
return true; |
} |
/** @} |
*/ |
/trunk/kernel/arch/sparc64/src/drivers/kbd.c |
---|
108,8 → 108,8 |
printf("Failed to determine keyboard address.\n"); |
return; |
} |
if (!ofw_fhc_map_interrupts(node->parent, ((ofw_fhc_reg_t *) prop->value), interrupts, &inr)) { |
printf("Failed to determine keyboard interrupts.\n"); |
if (!ofw_fhc_map_interrupt(node->parent, ((ofw_fhc_reg_t *) prop->value), interrupts, &inr)) { |
printf("Failed to determine keyboard interrupt.\n"); |
return; |
} |
break; |
119,8 → 119,8 |
printf("Failed to determine keyboard address.\n"); |
return; |
} |
if (!ofw_ebus_map_interrupts(node->parent, ((ofw_ebus_reg_t *) prop->value), interrupts, &inr)) { |
printf("Failed to determine keyboard interrupts.\n"); |
if (!ofw_ebus_map_interrupt(node->parent, ((ofw_ebus_reg_t *) prop->value), interrupts, &inr)) { |
printf("Failed to determine keyboard interrupt.\n"); |
return; |
} |
break; |