Rev 1897 | Rev 2071 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1897 | Rev 1912 | ||
---|---|---|---|
Line 34... | Line 34... | ||
34 | * @brief PCI 'reg' and 'ranges' properties handling. |
34 | * @brief PCI 'reg' and 'ranges' properties handling. |
35 | * |
35 | * |
36 | */ |
36 | */ |
37 | 37 | ||
38 | #include <genarch/ofw/ofw_tree.h> |
38 | #include <genarch/ofw/ofw_tree.h> |
- | 39 | #include <arch/drivers/pci.h> |
|
- | 40 | #include <arch/trap/interrupt.h> |
|
39 | #include <arch/memstr.h> |
41 | #include <arch/memstr.h> |
40 | #include <func.h> |
42 | #include <func.h> |
41 | #include <panic.h> |
43 | #include <panic.h> |
42 | #include <macros.h> |
44 | #include <macros.h> |
43 | 45 | ||
44 | #define PCI_SPACE_MASK 0x03000000 |
46 | #define PCI_SPACE_MASK 0x03000000 |
45 | #define PCI_ABS_MASK 0x80000000 |
47 | #define PCI_ABS_MASK 0x80000000 |
46 | #define PCI_REG_MASK 0x000000ff |
48 | #define PCI_REG_MASK 0x000000ff |
47 | 49 | ||
- | 50 | #define PCI_IGN 0x1f |
|
- | 51 | ||
48 | bool ofw_pci_apply_ranges(ofw_tree_node_t *node, ofw_pci_reg_t *reg, uintptr_t *pa) |
52 | bool ofw_pci_apply_ranges(ofw_tree_node_t *node, ofw_pci_reg_t *reg, uintptr_t *pa) |
49 | { |
53 | { |
50 | ofw_tree_property_t *prop; |
54 | ofw_tree_property_t *prop; |
51 | ofw_pci_range_t *range; |
55 | ofw_pci_range_t *range; |
52 | count_t ranges; |
56 | count_t ranges; |
Line 108... | Line 112... | ||
108 | } |
112 | } |
109 | 113 | ||
110 | return false; |
114 | return false; |
111 | } |
115 | } |
112 | 116 | ||
- | 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 | */ |
|
- | 122 | bool 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 | ||
113 | /** @} |
139 | /** @} |
114 | */ |
140 | */ |