Initial xloong code
[xloong.git] / Targets / EV64420 / pci / pci_machdep.h
blobf464b0eb792d55d9ccf9b0dbd9def7268a733468
1 /* $Id: pci_machdep.h,v 1.1.1.1 2006/09/14 01:59:08 root Exp $ */
3 /*
4 * Copyright (c) 2001 Opsycon AB (www.opsycon.se)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Opsycon AB.
17 * 4. The name of the author may not be used to endorse or promote products
18 * derived from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
21 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
34 #include <target/pmon_target.h>
36 #include <pmon.h>
39 * Types provided to machine-independent PCI code
41 typedef struct arch_pci_chipset *pci_chipset_tag_t;
42 typedef u_long pcitag_t;
43 typedef u_long pci_intr_handle_t;
45 void _pci_flush __P((void));
46 int _pci_hwinit __P((int, bus_space_tag_t, bus_space_tag_t));
47 void _pci_hwreinit __P((void));
48 pcitag_t _pci_make_tag __P((int, int, int));
49 void _pci_break_tag __P((pcitag_t, int *, int *, int *));
50 pcireg_t _pci_conf_read __P((pcitag_t, int));
51 pcireg_t _pci_conf_readn __P((pcitag_t, int, int));
52 void _pci_conf_write __P((pcitag_t, int, pcireg_t));
53 void _pci_conf_writen __P((pcitag_t, int, pcireg_t,int));
54 int _pci_map_port __P((pcitag_t, int, unsigned int *));
55 int _pci_map_io __P((pcitag_t, int, vm_offset_t *, vm_offset_t *));
56 int _pci_map_mem __P((pcitag_t, int, vm_offset_t *, vm_offset_t *));
57 void *_pci_map_int __P((pcitag_t, int, int (*)(void *), void *));
58 void _pci_devinfo __P((pcireg_t, pcireg_t, int *, char *));
59 void _pci_businit __P((int));
60 void _pci_devinit __P((int));
61 vm_offset_t _pci_cpumap __P((vm_offset_t, unsigned int));
62 vm_offset_t _pci_dmamap __P((vm_offset_t, unsigned int));
64 void _pci_bdfprintf (int bus, int device, int function, const char *fmt, ...);
65 void _pci_tagprintf (pcitag_t tag, const char *fmt, ...);
66 int _pci_canscan __P((pcitag_t tag));
68 /* sigh... compatibility */
69 #define pci_hwinit _pci_hwinit
70 #define pci_hwreinit _pci_hwreinit
71 #define pci_make_tag _pci_make_tag
72 #define pci_break_tag _pci_break_tag
73 #define pci_conf_read(a, b, c) _pci_conf_read(b, c)
74 #define pci_conf_write(a, b, c, d) _pci_conf_write(b, c, d)
75 #define pci_map_port _pci_map_port
76 #define pci_map_io _pci_map_io
77 #define pci_map_mem _pci_map_mem
78 #define pci_map_int _pci_map_int
79 #define pci_devinfo _pci_devinfo
80 #define pci_configure _pci_configure
81 #define pci_allocate_mem _pci_allocate_mem
82 #define pci_allocate_io _pci_allocate_io
83 #define vtophys(p) _pci_dmamap((vm_offset_t)p, 1)
84 #define pci_decompose_tag(a, b, c, d, e) _pci_break_tag(b, c, d, e)
86 #define pci_intr_map(a, b, c, d, e) (*e = -1, 0)
87 #define pci_intr_string(a,b) ("generic poll")
88 #define pci_intr_establish(a, b, c, d, e, f) tgt_poll_register((c), (d), (e))
89 #define pci_attach_hook(parent, self, pba)
90 #define pci_bus_maxdevs(c, b) 32
92 int pci_ether_hw_addr __P((void *sc, u_int8_t *, u_int8_t, u_int8_t));
93 void pci_sync_cache __P((void *, vm_offset_t, size_t, int));
95 #define CACHESYNC(a, l, h) pci_sync_cache((void *)NULL, (vm_offset_t)a, l ,h)
97 #define NEED_PCI_SYNC_CACHE_FUNC
99 #define SYNC_R 0 /* Sync caches for reading data */
100 #define SYNC_W 1 /* Sync caches for writing data */
102 #define PCI_FIRST_DEVICE 1 /* Which device to scan first */
103 #define PCI_FIRST_BUS 0
104 #define PCI_INT_0 0
105 #define PCI_INT_A 11
106 #define PCI_INT_B 10
107 #define PCI_INT_C 9
108 #define PCI_INT_D 8
109 #define PCI_CACHE_LINE_SIZE 8 /* expressed in 32 bit words */
111 #define NEWPCIROOT
112 extern struct pci_device *_pci_bus[];
115 * Any physical to virtual conversion CPU
117 #define VA_TO_PA(x) UNCACHED_TO_PHYS(x)
118 #define PA_TO_VA(x) PHYS_TO_CACHED(x)