Changeset 5d684e4 in mainline for kernel/genarch/src/ofw/pci.c


Ignore:
Timestamp:
2006-09-23T13:12:10Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6ff1f1e
Parents:
28ecadb
Message:

Convert sparc64 framebuffer code to configure from the OpenFirmware device tree memory representation.

File:
1 edited

Legend:

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

    r28ecadb r5d684e4  
    4242#include <macros.h>
    4343
    44 #define PCI_SPACE_MASK  0x03000000
     44#define PCI_SPACE_MASK          0x03000000
     45#define PCI_ABS_MASK            0x80000000     
     46#define PCI_REG_MASK            0x000000ff
    4547
    4648bool ofw_pci_apply_ranges(ofw_tree_node_t *node, ofw_pci_reg_t *reg, uintptr_t *pa)
     
    7476}
    7577
     78bool ofw_pci_reg_absolutize(ofw_tree_node_t *node, ofw_pci_reg_t *reg, ofw_pci_reg_t *out)
     79{
     80        if (reg->space & PCI_ABS_MASK) {
     81                /* already absolute */
     82                out->space = reg->space;
     83                out->addr = reg->addr;
     84                out->size = reg->size;
     85                return true;
     86        }
     87       
     88        ofw_tree_property_t *prop;
     89        ofw_pci_reg_t *assigned_address;
     90        count_t assigned_addresses;
     91       
     92        prop = ofw_tree_getprop(node, "assigned-addresses");
     93        if (!prop)
     94                panic("Can't find \"assigned-addresses\" property.\n");
     95       
     96        assigned_addresses = prop->size / sizeof(ofw_pci_reg_t);
     97        assigned_address = prop->value;
     98       
     99        int i;
     100       
     101        for (i = 0; i < assigned_addresses; i++) {
     102                if ((assigned_address[i].space & PCI_REG_MASK) == (reg->space & PCI_REG_MASK)) {
     103                        out->space = assigned_address[i].space;
     104                        out->addr = reg->addr + assigned_address[i].addr;
     105                        out->size = reg->size;
     106                        return true;
     107                }
     108        }
     109       
     110        return false;
     111}
     112
    76113/** @}
    77114 */
Note: See TracChangeset for help on using the changeset viewer.