Changeset dfd77382 in mainline


Ignore:
Timestamp:
2008-11-29T18:09:22Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8d2760f
Parents:
b17186d
Message:

After my effort yesterday, there are two rival psycho drivers.
Merge the two and remove the newer one.

Location:
kernel/arch/sparc64
Files:
2 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/Makefile.inc

    rb17186d rdfd77382  
    107107        arch/$(ARCH)/src/drivers/kbd.c \
    108108        arch/$(ARCH)/src/drivers/scr.c \
    109         arch/$(ARCH)/src/drivers/pci.c \
    110         arch/$(ARCH)/src/drivers/psycho.c
     109        arch/$(ARCH)/src/drivers/pci.c
    111110
    112111ifeq ($(CONFIG_SMP),y)
  • kernel/arch/sparc64/src/drivers/pci.c

    rb17186d rdfd77382  
    4646#include <arch/asm.h>
    4747
    48 #define PCI_SABRE_REGS_REG      0
    49 
    50 #define PCI_SABRE_IMAP_BASE     0x200
    51 #define PCI_SABRE_ICLR_BASE     0x300
    52 
    53 #define PCI_PSYCHO_REGS_REG     2       
    54 
    55 #define PCI_PSYCHO_IMAP_BASE    0x200
    56 #define PCI_PSYCHO_ICLR_BASE    0x300   
     48#define SABRE_INTERNAL_REG      0
     49#define PSYCHO_INTERNAL_REG     2       
     50
     51#define OBIO_IMR_BASE   0x200
     52#define OBIO_IMR(ino)   (OBIO_IMR_BASE + ((ino) & INO_MASK))
     53
     54#define OBIO_CIR_BASE   0x300
     55#define OBIO_CIR(ino)   (OBIO_CIR_BASE + ((ino) & INO_MASK))
     56
     57static void obio_enable_interrupt(pci_t *pci, int inr);
     58static void obio_clear_interrupt(pci_t *pci, int inr);
    5759
    5860static pci_t *pci_sabre_init(ofw_tree_node_t *node);
    59 static void pci_sabre_enable_interrupt(pci_t *pci, int inr);
    60 static void pci_sabre_clear_interrupt(pci_t *pci, int inr);
    61 
    6261static pci_t *pci_psycho_init(ofw_tree_node_t *node);
    63 static void pci_psycho_enable_interrupt(pci_t *pci, int inr);
    64 static void pci_psycho_clear_interrupt(pci_t *pci, int inr);
    6562
    6663/** PCI operations for Sabre model. */
    6764static pci_operations_t pci_sabre_ops = {
    68         .enable_interrupt = pci_sabre_enable_interrupt,
    69         .clear_interrupt = pci_sabre_clear_interrupt
     65        .enable_interrupt = obio_enable_interrupt,
     66        .clear_interrupt = obio_clear_interrupt
    7067};
    7168/** PCI operations for Psycho model. */
    7269static pci_operations_t pci_psycho_ops = {
    73         .enable_interrupt = pci_psycho_enable_interrupt,
    74         .clear_interrupt = pci_psycho_clear_interrupt
     70        .enable_interrupt = obio_enable_interrupt,
     71        .clear_interrupt = obio_clear_interrupt
    7572};
    7673
    7774/** Initialize PCI controller (model Sabre).
    7875 *
    79  * @param node OpenFirmware device tree node of the Sabre.
    80  *
    81  * @return Address of the initialized PCI structure.
     76 * @param node          OpenFirmware device tree node of the Sabre.
     77 *
     78 * @return              Address of the initialized PCI structure.
    8279 */
    8380pci_t *pci_sabre_init(ofw_tree_node_t *node)
     
    9693        count_t regs = prop->size / sizeof(ofw_upa_reg_t);
    9794
    98         if (regs < PCI_SABRE_REGS_REG + 1)
     95        if (regs < SABRE_INTERNAL_REG + 1)
    9996                return NULL;
    10097
    10198        uintptr_t paddr;
    102         if (!ofw_upa_apply_ranges(node->parent, &reg[PCI_SABRE_REGS_REG], &paddr))
     99        if (!ofw_upa_apply_ranges(node->parent, &reg[SABRE_INTERNAL_REG],
     100            &paddr))
    103101                return NULL;
    104102
     
    109107        pci->model = PCI_SABRE;
    110108        pci->op = &pci_sabre_ops;
    111         pci->reg = (uint64_t *) hw_map(paddr, reg[PCI_SABRE_REGS_REG].size);
     109        pci->reg = (uint64_t *) hw_map(paddr, reg[SABRE_INTERNAL_REG].size);
    112110
    113111        return pci;
     
    117115/** Initialize the Psycho PCI controller.
    118116 *
    119  * @param node OpenFirmware device tree node of the Psycho.
    120  *
    121  * @return Address of the initialized PCI structure.
     117 * @param node          OpenFirmware device tree node of the Psycho.
     118 *
     119 * @return              Address of the initialized PCI structure.
    122120 */
    123121pci_t *pci_psycho_init(ofw_tree_node_t *node)
     
    136134        count_t regs = prop->size / sizeof(ofw_upa_reg_t);
    137135
    138         if (regs < PCI_PSYCHO_REGS_REG + 1)
     136        if (regs < PSYCHO_INTERNAL_REG + 1)
    139137                return NULL;
    140138
    141139        uintptr_t paddr;
    142         if (!ofw_upa_apply_ranges(node->parent, &reg[PCI_PSYCHO_REGS_REG], &paddr))
     140        if (!ofw_upa_apply_ranges(node->parent, &reg[PSYCHO_INTERNAL_REG],
     141            &paddr))
    143142                return NULL;
    144143
     
    149148        pci->model = PCI_PSYCHO;
    150149        pci->op = &pci_psycho_ops;
    151         pci->reg = (uint64_t *) hw_map(paddr, reg[PCI_PSYCHO_REGS_REG].size);
     150        pci->reg = (uint64_t *) hw_map(paddr, reg[PSYCHO_INTERNAL_REG].size);
    152151
    153152        return pci;
    154153}
    155154
    156 void pci_sabre_enable_interrupt(pci_t *pci, int inr)
    157 {
    158         pci->reg[PCI_SABRE_IMAP_BASE + (inr & INO_MASK)] |= IMAP_V_MASK;
    159 }
    160 
    161 void pci_sabre_clear_interrupt(pci_t *pci, int inr)
    162 {
    163         pci->reg[PCI_SABRE_ICLR_BASE + (inr & INO_MASK)] = 0;
    164 }
    165 
    166 void pci_psycho_enable_interrupt(pci_t *pci, int inr)
    167 {
    168         pci->reg[PCI_PSYCHO_IMAP_BASE + (inr & INO_MASK)] |= IMAP_V_MASK;
    169 }
    170 
    171 void pci_psycho_clear_interrupt(pci_t *pci, int inr)
    172 {
    173         pci->reg[PCI_PSYCHO_ICLR_BASE + (inr & INO_MASK)] = 0;
     155void obio_enable_interrupt(pci_t *pci, int inr)
     156{
     157        pci->reg[OBIO_IMR(inr & INO_MASK)] |= IMAP_V_MASK;
     158}
     159
     160void obio_clear_interrupt(pci_t *pci, int inr)
     161{
     162        pci->reg[OBIO_CIR(inr & INO_MASK)] = 0; /* set IDLE */
    174163}
    175164
     
    216205void pci_enable_interrupt(pci_t *pci, int inr)
    217206{
    218         ASSERT(pci->model);
    219207        ASSERT(pci->op && pci->op->enable_interrupt);
    220208        pci->op->enable_interrupt(pci, inr);
     
    223211void pci_clear_interrupt(pci_t *pci, int inr)
    224212{
    225         ASSERT(pci->model);
    226213        ASSERT(pci->op && pci->op->clear_interrupt);
    227214        pci->op->clear_interrupt(pci, inr);
Note: See TracChangeset for help on using the changeset viewer.