Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:53

0001 /*
0002  *  PCI defines and function prototypes
0003  *
0004  *  For more information, please consult the following manuals (look at
0005  *  http://www.pcisig.com/ for how to get them):
0006  *
0007  *    PCI BIOS Specification
0008  *    PCI Local Bus Specification
0009  *    PCI to PCI Bridge Specification
0010  *    PCI System Design Guide
0011  */
0012 
0013 /*
0014  *  Copyright 1994, Drew Eckhardt
0015  *  Copyright 1997, 1998 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
0016  */
0017 
0018 #ifndef BSP_POWERPC_PCI_H
0019 #define BSP_POWERPC_PCI_H
0020 
0021 #include <rtems/pci.h>
0022 #include <stdio.h>
0023 
0024 struct _pin_routes
0025 {
0026   int pin;
0027   int int_name[4];
0028 };
0029 struct _int_map
0030 {
0031   int bus;
0032   int slot;
0033   int opts;
0034   struct _pin_routes pin_route[5];
0035 };
0036 
0037 /* If there's a conflict between a name in the routing table and
0038  * what's already set on the device, reprogram the device setting
0039  * to reflect int_name[0] for the routing table entry
0040  */
0041 #define PCI_FIXUP_OPT_OVERRIDE_NAME  (1<<0)
0042 
0043 /*
0044  * This is assumed to be provided by the BSP.
0045  */
0046 void detect_host_bridge(void);
0047 
0048 void FixupPCI( const struct _int_map *, int (*swizzler)(int,int) );
0049 
0050 /* FIXME: This probably belongs into rtems/pci.h */
0051 extern unsigned char pci_bus_count(void);
0052 
0053 /* FIXME: This also is generic and could go into rtems/pci.h */
0054 
0055 /* Scan pci config space and run a user callback on each
0056  * device present; the user callback may return 0 to
0057  * continue the scan or a value > 0 to abort the scan.
0058  * Return values < 0 are reserved and must not be used.
0059  *
0060  * RETURNS: a (opaque) handle pointing to the bus/slot/fn-triple
0061  *          just after where the scan was aborted by a callback
0062  *          returning 1 (see above) or NULL if all devices were
0063  *          scanned.
0064  *          The handle may be passed to this routine to resume the
0065  *          scan continuing with the device after the one causing the
0066  *          abort.
0067  *          Pass a NULL 'handle' argument to start scanning from
0068  *          the beginning (bus/slot/fn = 0/0/0).
0069  */
0070 typedef void *BSP_PciScanHandle;
0071 typedef int (*BSP_PciScannerCb)(int bus, int slot, int fun, void *uarg);
0072 
0073 BSP_PciScanHandle
0074 BSP_pciScan(BSP_PciScanHandle handle, BSP_PciScannerCb cb, void *uarg);
0075 
0076 /* Dump basic config. space info to a file. The argument may
0077  * be NULL in which case 'stdout' is used.
0078  * NOTE: the C-library must be functional before you can use
0079  *       this routine.
0080  */
0081 void
0082 BSP_pciConfigDump(FILE *fp);
0083 
0084 #endif /* BSP_POWERPC_PCI_H */