pcihost_fdtvar.h revision 1.1.4.2 1 1.1.4.2 christos /* $NetBSD: pcihost_fdtvar.h,v 1.1.4.2 2019/06/10 22:05:53 christos Exp $ */
2 1.1.4.2 christos
3 1.1.4.2 christos /*-
4 1.1.4.2 christos * Copyright (c) 2018 Jared D. McNeill <jmcneill (at) invisible.ca>
5 1.1.4.2 christos * All rights reserved.
6 1.1.4.2 christos *
7 1.1.4.2 christos * Redistribution and use in source and binary forms, with or without
8 1.1.4.2 christos * modification, are permitted provided that the following conditions
9 1.1.4.2 christos * are met:
10 1.1.4.2 christos * 1. Redistributions of source code must retain the above copyright
11 1.1.4.2 christos * notice, this list of conditions and the following disclaimer.
12 1.1.4.2 christos * 2. Redistributions in binary form must reproduce the above copyright
13 1.1.4.2 christos * notice, this list of conditions and the following disclaimer in the
14 1.1.4.2 christos * documentation and/or other materials provided with the distribution.
15 1.1.4.2 christos *
16 1.1.4.2 christos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 1.1.4.2 christos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 1.1.4.2 christos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 1.1.4.2 christos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 1.1.4.2 christos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 1.1.4.2 christos * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 1.1.4.2 christos * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 1.1.4.2 christos * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 1.1.4.2 christos * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 1.1.4.2 christos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 1.1.4.2 christos * SUCH DAMAGE.
27 1.1.4.2 christos */
28 1.1.4.2 christos
29 1.1.4.2 christos /* Physical address format bit definitions */
30 1.1.4.2 christos #define PHYS_HI_RELO __BIT(31)
31 1.1.4.2 christos #define PHYS_HI_PREFETCH __BIT(30)
32 1.1.4.2 christos #define PHYS_HI_ALIASED __BIT(29)
33 1.1.4.2 christos #define PHYS_HI_SPACE __BITS(25,24)
34 1.1.4.2 christos #define PHYS_HI_SPACE_CFG 0
35 1.1.4.2 christos #define PHYS_HI_SPACE_IO 1
36 1.1.4.2 christos #define PHYS_HI_SPACE_MEM32 2
37 1.1.4.2 christos #define PHYS_HI_SPACE_MEM64 3
38 1.1.4.2 christos #define PHYS_HI_BUS __BITS(23,16)
39 1.1.4.2 christos #define PHYS_HI_DEVICE __BITS(15,11)
40 1.1.4.2 christos #define PHYS_HI_FUNCTION __BITS(10,8)
41 1.1.4.2 christos #define PHYS_HI_REGISTER __BITS(7,0)
42 1.1.4.2 christos
43 1.1.4.2 christos extern int pcihost_segment;
44 1.1.4.2 christos
45 1.1.4.2 christos enum pcihost_type {
46 1.1.4.2 christos PCIHOST_CAM = 1,
47 1.1.4.2 christos PCIHOST_ECAM,
48 1.1.4.2 christos };
49 1.1.4.2 christos
50 1.1.4.2 christos struct pcih_bus_space {
51 1.1.4.2 christos struct bus_space bst;
52 1.1.4.2 christos
53 1.1.4.2 christos int (*map)(void *, bus_addr_t, bus_size_t,
54 1.1.4.2 christos int, bus_space_handle_t *);
55 1.1.4.2 christos struct space_range {
56 1.1.4.2 christos bus_addr_t bpci;
57 1.1.4.2 christos bus_addr_t bbus;
58 1.1.4.2 christos bus_size_t size;
59 1.1.4.2 christos } ranges[4];
60 1.1.4.2 christos size_t nranges;
61 1.1.4.2 christos };
62 1.1.4.2 christos
63 1.1.4.2 christos struct pcihost_softc {
64 1.1.4.2 christos device_t sc_dev;
65 1.1.4.2 christos bus_dma_tag_t sc_dmat;
66 1.1.4.2 christos bus_space_tag_t sc_bst;
67 1.1.4.2 christos bus_space_handle_t sc_bsh;
68 1.1.4.2 christos int sc_phandle;
69 1.1.4.2 christos
70 1.1.4.2 christos enum pcihost_type sc_type;
71 1.1.4.2 christos
72 1.1.4.2 christos u_int sc_seg;
73 1.1.4.2 christos u_int sc_bus_min;
74 1.1.4.2 christos u_int sc_bus_max;
75 1.1.4.2 christos
76 1.1.4.2 christos struct arm32_pci_chipset sc_pc;
77 1.1.4.2 christos
78 1.1.4.2 christos struct pcih_bus_space sc_io;
79 1.1.4.2 christos struct pcih_bus_space sc_mem;
80 1.1.4.2 christos };
81 1.1.4.2 christos
82 1.1.4.2 christos void pcihost_init2(struct pcihost_softc *);
83 1.1.4.2 christos void pcihost_init(pci_chipset_tag_t, void *);
84