source: rtems/c/src/lib/libbsp/powerpc/mvme3100/pci/detect_host_bridge.c @ 6987eecc

4.104.115
Last change on this file since 6987eecc was 6987eecc, checked in by Till Straumann <strauman@…>, on 03/05/09 at 21:07:01

2009-03-05 Till Straumann <strauman@…>

  • startup/misc.c, flash/flashcfg.c, irq/irq_init.c, pci/detect_host_bridge.c: changed function arguments to silence compiler warnings.
  • Property mode set to 100644
File size: 3.7 KB
Line 
1/* $Id$ */
2
3/* PCI Initialization */
4
5/*
6 * Authorship
7 * ----------
8 * This software ('mvme3100' RTEMS BSP) was created by
9 *
10 *     Till Straumann <strauman@slac.stanford.edu>, 2005-2007,
11 *         Stanford Linear Accelerator Center, Stanford University.
12 *
13 * Acknowledgement of sponsorship
14 * ------------------------------
15 * The 'mvme3100' BSP was produced by
16 *     the Stanford Linear Accelerator Center, Stanford University,
17 *         under Contract DE-AC03-76SFO0515 with the Department of Energy.
18 *
19 * Government disclaimer of liability
20 * ----------------------------------
21 * Neither the United States nor the United States Department of Energy,
22 * nor any of their employees, makes any warranty, express or implied, or
23 * assumes any legal liability or responsibility for the accuracy,
24 * completeness, or usefulness of any data, apparatus, product, or process
25 * disclosed, or represents that its use would not infringe privately owned
26 * rights.
27 *
28 * Stanford disclaimer of liability
29 * --------------------------------
30 * Stanford University makes no representations or warranties, express or
31 * implied, nor assumes any liability for the use of this software.
32 *
33 * Stanford disclaimer of copyright
34 * --------------------------------
35 * Stanford University, owner of the copyright, hereby disclaims its
36 * copyright and all other rights in this software.  Hence, anyone may
37 * freely use it for any purpose without restriction. 
38 *
39 * Maintenance of notices
40 * ----------------------
41 * In the interest of clarity regarding the origin and status of this
42 * SLAC software, this and all the preceding Stanford University notices
43 * are to remain affixed to any copy or derivative of this software made
44 * or distributed by the recipient and are to be affixed to any copy of
45 * software made or distributed by the recipient that contains a copy or
46 * derivative of this software.
47 *
48 * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
49 */
50
51#include <bsp.h>
52#include <bsp/pci.h>
53#include <bsp/irq.h>
54#include <bsp/openpic.h>
55#include <inttypes.h>
56
57/* Motload configures PCI interrupts to start at 16 and up but
58 * we'd rather have them starting at 0.
59 * Use this callback to fix them up.
60 */
61static int
62fixup_irq_line(int bus, int slot, int fun, void *uarg)
63{
64unsigned char line;
65        pci_read_config_byte( bus, slot, fun, PCI_INTERRUPT_LINE, &line);
66        if ( line >= BSP_EXT_IRQ_NUMBER ) {
67                pci_write_config_byte( bus, slot, fun, PCI_INTERRUPT_LINE, line - BSP_EXT_IRQ_NUMBER );
68        }
69
70        return 0;
71}
72
73void BSP_motload_pci_fixup(void)
74{
75  BSP_pciScan(0, fixup_irq_line, 0);
76}
77
78void detect_host_bridge(void)
79{
80  OpenPIC = (volatile struct OpenPIC *) (BSP_8540_CCSR_BASE + BSP_OPEN_PIC_BASE_OFFSET);
81}
82
83static int
84dump_dev_cb(
85   int bus,
86   int dev,
87   int fun,
88   void *uarg
89)
90{
91  uint16_t vi,di;
92  uint16_t cd,st;
93  uint32_t b1,b2;
94  uint8_t  il,ip;
95
96        pci_read_config_word (bus, dev, fun, PCI_VENDOR_ID,      &vi);
97        pci_read_config_word (bus, dev, fun, PCI_DEVICE_ID,      &di);
98        pci_read_config_word (bus, dev, fun, PCI_COMMAND,        &cd);
99        pci_read_config_word (bus, dev, fun, PCI_STATUS,         &st);
100        pci_read_config_dword(bus, dev, fun, PCI_BASE_ADDRESS_0, &b1);
101        pci_read_config_dword(bus, dev, fun, PCI_BASE_ADDRESS_1, &b2);
102        pci_read_config_byte (bus, dev, fun, PCI_INTERRUPT_LINE, &il);
103        pci_read_config_byte (bus, dev, fun, PCI_INTERRUPT_PIN,  &ip);
104
105    printk("%3d:0x%02x:%d    0x%04x-0x%04x:  0x%04x 0x%04x 0x%08x 0x%08x       %d -> %3d (=0x%02x)\n",
106                bus, dev, fun, vi, di, cd, st, b1, b2, ip, il, il);
107        return 0;
108}
109
110void
111BSP_pciConfigDump_early(void)
112{
113        printk("BUS:SLOT:FUN  VENDOR-DEV_ID: COMMAND STATUS BASE_ADDR0 BASE_ADDR1 IRQ_PIN -> IRQ_LINE\n");
114        BSP_pciScan(0, dump_dev_cb, 0);
115}
Note: See TracBrowser for help on using the repository browser.