source: rtems/c/src/lib/libbsp/powerpc/mvme5500/pci/pci_interface.c @ 72510eb2

4.104.115
Last change on this file since 72510eb2 was 72510eb2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/08/09 at 18:12:31

2009-05-08 Kate Feng <feng1@…>

  • include/bsp.h, start/start.S, startup/bspstart.c: added CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK in bsp.h. removed BSP_INIT_STACK_SIZE in bsp.h -- it uses stack defined by the linker script (shared/startup/linkcmds) for the initial stack. replaced rtems_end+4096 with stack in start.S Removed legacy code in bspstart.c (inherited from old mvme2307 BSP but not relevant to this one) that tested trapping into PPCBug. Changed ConfVPD_buff[] to be static and added ReadConfVPD_buf() in bspstart.c
  • Property mode set to 100644
File size: 2.9 KB
Line 
1/* pci_interface.c
2 *
3 * Copyright 2004, 2006, 2007 All rights reserved. (NDA items)
4 *      Brookhaven National Laboratory and Shuchen Kate Feng <feng1@bnl.gov>
5 *
6 * The license and distribution terms for this file may be
7 * found in the file LICENSE in this distribution.
8 *
9 * 8/17/2006 : S. Kate Feng
10 *             uses in_le32()/out_le32(), instead of inl()/outl() for compatibility.
11 *
12 * 11/2008 : Enable "PCI Read Agressive Prefetch",
13 *           "PCI Read Line Agressive Prefetch", and
14 *           "PCI Read Multiple Agressive Prefetch" to improve the
15 *           performance of the PCI based applications (e.g. 1GHz NIC).
16 */
17
18#include <libcpu/io.h>
19#include <rtems/bspIo.h>            /* printk */
20
21#include <bsp.h>
22#include <bsp/pci.h>
23#include <bsp/gtreg.h>
24#include <bsp/gtpcireg.h>
25
26#define PCI_DEBUG     0
27
28#if 0
29#define CPU2PCI_ORDER
30#define PCI2CPU_ORDER
31#endif
32
33/* PCI Read Agressive Prefetch Enable (1<<16 ),
34 * PCI Read Line Agressive Prefetch Enable( 1<<17),
35 * PCI Read Multiple Agressive Prefetch Enable (1<<18).
36 */
37#ifdef PCI2CPU_ORDER
38#define PCI_ACCCTLBASEL_VALUE          0x01079000
39#else
40#define PCI_ACCCTLBASEL_VALUE          0x01071000
41#endif
42
43
44#define ConfSBDis     0x10000000  /* 1: disable, 0: enable */
45#define IOSBDis       0x20000000  /* 1: disable, 0: enable */
46#define ConfIOSBDis   0x30000000
47#define CpuPipeline   0x00002000  /* optional, 1:enable, 0:disable */
48
49/* CPU to PCI ordering register */
50#define DLOCK_ORDER_REG    0x2D0  /* Deadlock and Ordering register */
51#define PCI0OrEn      0x00000001
52#define PCI1OrEn      0x00000020
53#define PCIOrEn       0x40000000
54#define PCIOrEnMASK   0x40000021
55
56#define CNT_SYNC_REG       0x2E0  /* Counters and Sync Barrier register */
57#define L0SyncBar     0x00001000
58#define L1SyncBar     0x00002000
59#define DSyncBar      0x00004000
60#define SyncBarMode   0x00008000
61#define SyncBarMASK   0x0000f000
62
63#define WRTBK_PRIO_BUFFER  0x2d8  /* writback priority and buffer depth */
64
65#define ADDR_PIPELINE 0x00020000
66
67void  pciAccessInit(void);
68
69void pci_interface(void)
70{
71
72#ifdef CPU2PCI_ORDER
73    /* MOTLOad deafult : 0x07ff8600 */
74    out_le32((volatile unsigned int *)(GT64x60_REG_BASE+CNT_SYNC_REG), 0x07fff600);
75#endif
76    /* asserts SERR upon various detection */
77    out_le32((volatile unsigned int *)(GT64x60_REG_BASE+0xc28), 0x3fffff);
78    pciAccessInit();
79}
80
81void pciAccessInit(void)
82{
83  unsigned int PciLocal, data;
84
85  for (PciLocal=0; PciLocal < 2; PciLocal++) {
86    data = in_le32((volatile unsigned int *)(GT64x60_REG_BASE+PCI0_ACCESS_CNTL_BASE0_LOW+(PciLocal * 0x80)));
87#if 0
88    printk("PCI%d_ACCESS_CNTL_BASE0_LOW was 0x%x\n",PciLocal,data);
89#endif
90    data |= PCI_ACCCTLBASEL_VALUE;
91    data &= ~0x300000;
92    out_le32((volatile unsigned int *)(GT64x60_REG_BASE+PCI0_ACCESS_CNTL_BASE0_LOW+(PciLocal * 0x80)), data);
93#if 0
94      printf("PCI%d_ACCESS_CNTL_BASE0_LOW now 0x%x\n",PciLocal,in_le32((volatile unsigned int *)(GT64x60_REG_BASE+PCI0_ACCESS_CNTL_BASE0_LOW+(PciLocal * 0x80))));
95#endif
96  }
97}
98
Note: See TracBrowser for help on using the repository browser.