OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-sparc64/] [pbm.h] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1276 phoenix
/* $Id: pbm.h,v 1.1.1.1 2004-04-15 03:00:57 phoenix Exp $
2
 * pbm.h: UltraSparc PCI controller software state.
3
 *
4
 * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@redhat.com)
5
 */
6
 
7
#ifndef __SPARC64_PBM_H
8
#define __SPARC64_PBM_H
9
 
10
#include <linux/types.h>
11
#include <linux/pci.h>
12
#include <linux/ioport.h>
13
#include <linux/spinlock.h>
14
 
15
#include <asm/io.h>
16
#include <asm/page.h>
17
#include <asm/oplib.h>
18
 
19
/* The abstraction used here is that there are PCI controllers,
20
 * each with one (Sabre) or two (PSYCHO/SCHIZO) PCI bus modules
21
 * underneath.  Each PCI bus module uses an IOMMU (shared by both
22
 * PBMs of a controller, or per-PBM), and if a streaming buffer
23
 * is present, each PCI bus module has it's own. (ie. the IOMMU
24
 * might be shared between PBMs, the STC is never shared)
25
 * Furthermore, each PCI bus module controls it's own autonomous
26
 * PCI bus.
27
 */
28
 
29
#define PBM_LOGCLUSTERS 3
30
#define PBM_NCLUSTERS (1 << PBM_LOGCLUSTERS)
31
 
32
struct pci_controller_info;
33
 
34
/* This contains the software state necessary to drive a PCI
35
 * controller's IOMMU.
36
 */
37
struct pci_iommu {
38
        /* This protects the controller's IOMMU and all
39
         * streaming buffers underneath.
40
         */
41
        spinlock_t      lock;
42
 
43
        /* Context allocator. */
44
        unsigned int    iommu_cur_ctx;
45
 
46
        /* IOMMU page table, a linear array of ioptes. */
47
        iopte_t         *page_table;            /* The page table itself. */
48
        int             page_table_sz_bits;     /* log2 of ow many pages does it map? */
49
 
50
        /* Base PCI memory space address where IOMMU mappings
51
         * begin.
52
         */
53
        u32             page_table_map_base;
54
 
55
        /* IOMMU Controller Registers */
56
        unsigned long   iommu_control;          /* IOMMU control register */
57
        unsigned long   iommu_tsbbase;          /* IOMMU page table base register */
58
        unsigned long   iommu_flush;            /* IOMMU page flush register */
59
        unsigned long   iommu_ctxflush;         /* IOMMU context flush register */
60
 
61
        /* This is a register in the PCI controller, which if
62
         * read will have no side-effects but will guarentee
63
         * completion of all previous writes into IOMMU/STC.
64
         */
65
        unsigned long   write_complete_reg;
66
 
67
        /* The lowest used consistent mapping entry.  Since
68
         * we allocate consistent maps out of cluster 0 this
69
         * is relative to the beginning of closter 0.
70
         */
71
        u32             lowest_consistent_map;
72
 
73
        /* If PBM_NCLUSTERS is ever decreased to 4 or lower,
74
         * or if largest supported page_table_sz * 8K goes above
75
         * 2GB, you must increase the size of the type of
76
         * these counters.  You have been duly warned. -DaveM
77
         */
78
        struct {
79
                u16     next;
80
                u16     flush;
81
        } alloc_info[PBM_NCLUSTERS];
82
 
83
        /* Here a PCI controller driver describes the areas of
84
         * PCI memory space where DMA to/from physical memory
85
         * are addressed.  Drivers interrogate the PCI layer
86
         * if their device has addressing limitations.  They
87
         * do so via pci_dma_supported, and pass in a mask of
88
         * DMA address bits their device can actually drive.
89
         *
90
         * The test for being usable is:
91
         *      (device_mask & dma_addr_mask) == dma_addr_mask
92
         */
93
        u32 dma_addr_mask;
94
};
95
 
96
/* This describes a PCI bus module's streaming buffer. */
97
struct pci_strbuf {
98
        int             strbuf_enabled;         /* Present and using it? */
99
 
100
        /* Streaming Buffer Control Registers */
101
        unsigned long   strbuf_control;         /* STC control register */
102
        unsigned long   strbuf_pflush;          /* STC page flush register */
103
        unsigned long   strbuf_fsync;           /* STC flush synchronization reg */
104
        unsigned long   strbuf_ctxflush;        /* STC context flush register */
105
        unsigned long   strbuf_ctxmatch_base;   /* STC context flush match reg */
106
        unsigned long   strbuf_flushflag_pa;    /* Physical address of flush flag */
107
        volatile unsigned long *strbuf_flushflag; /* The flush flag itself */
108
 
109
        /* And this is the actual flush flag area.
110
         * We allocate extra because the chips require
111
         * a 64-byte aligned area.
112
         */
113
        volatile unsigned long  __flushflag_buf[(64 + (64 - 1)) / sizeof(long)];
114
};
115
 
116
#define PCI_STC_FLUSHFLAG_INIT(STC) \
117
        (*((STC)->strbuf_flushflag) = 0UL)
118
#define PCI_STC_FLUSHFLAG_SET(STC) \
119
        (*((STC)->strbuf_flushflag) != 0UL)
120
 
121
/* There can be quite a few ranges and interrupt maps on a PCI
122
 * segment.  Thus...
123
 */
124
#define PROM_PCIRNG_MAX         64
125
#define PROM_PCIIMAP_MAX        64
126
 
127
struct pci_pbm_info {
128
        /* PCI controller we sit under. */
129
        struct pci_controller_info      *parent;
130
 
131
        /* Physical address base of controller registers. */
132
        unsigned long                   controller_regs;
133
 
134
        /* Physical address base of PBM registers. */
135
        unsigned long                   pbm_regs;
136
 
137
        /* Opaque 32-bit system bus Port ID. */
138
        u32                             portid;
139
 
140
        /* Chipset version information. */
141
        int                             chip_type;
142
#define PBM_CHIP_TYPE_SABRE             1
143
#define PBM_CHIP_TYPE_PSYCHO            2
144
#define PBM_CHIP_TYPE_SCHIZO            3
145
#define PBM_CHIP_TYPE_SCHIZO_PLUS       4
146
#define PBM_CHIP_TYPE_TOMATILLO         5
147
        int                             chip_version;
148
        int                             chip_revision;
149
 
150
        /* Name used for top-level resources. */
151
        char                            name[64];
152
 
153
        /* OBP specific information. */
154
        int                             prom_node;
155
        char                            prom_name[64];
156
        struct linux_prom_pci_ranges    pbm_ranges[PROM_PCIRNG_MAX];
157
        int                             num_pbm_ranges;
158
        struct linux_prom_pci_intmap    pbm_intmap[PROM_PCIIMAP_MAX];
159
        int                             num_pbm_intmap;
160
        struct linux_prom_pci_intmask   pbm_intmask;
161
        u64                             ino_bitmap;
162
 
163
        /* PBM I/O and Memory space resources. */
164
        struct resource                 io_space;
165
        struct resource                 mem_space;
166
 
167
        /* Base of PCI Config space, can be per-PBM or shared. */
168
        unsigned long                   config_space;
169
 
170
        /* State of 66MHz capabilities on this PBM. */
171
        int                             is_66mhz_capable;
172
        int                             all_devs_66mhz;
173
 
174
        /* This PBM's streaming buffer. */
175
        struct pci_strbuf               stc;
176
 
177
        /* IOMMU state, potentially shared by both PBM segments. */
178
        struct pci_iommu                *iommu;
179
 
180
        /* PCI slot mapping. */
181
        unsigned int                    pci_first_slot;
182
 
183
        /* Now things for the actual PCI bus probes. */
184
        unsigned int                    pci_first_busno;
185
        unsigned int                    pci_last_busno;
186
        struct pci_bus                  *pci_bus;
187
};
188
 
189
struct pci_controller_info {
190
        /* List of all PCI controllers. */
191
        struct pci_controller_info      *next;
192
 
193
        /* Each controller gets a unique index, used mostly for
194
         * error logging purposes.
195
         */
196
        int                             index;
197
 
198
        /* Do the PBMs both exist in the same PCI domain? */
199
        int                             pbms_same_domain;
200
 
201
        /* The PCI bus modules controlled by us. */
202
        struct pci_pbm_info             pbm_A;
203
        struct pci_pbm_info             pbm_B;
204
 
205
        /* Operations which are controller specific. */
206
        void (*scan_bus)(struct pci_controller_info *);
207
        unsigned int (*irq_build)(struct pci_pbm_info *, struct pci_dev *, unsigned int);
208
        void (*base_address_update)(struct pci_dev *, int);
209
        void (*resource_adjust)(struct pci_dev *, struct resource *, struct resource *);
210
 
211
        /* Now things for the actual PCI bus probes. */
212
        struct pci_ops                  *pci_ops;
213
        unsigned int                    pci_first_busno;
214
        unsigned int                    pci_last_busno;
215
 
216
        void                            *starfire_cookie;
217
};
218
 
219
/* PCI devices which are not bridges have this placed in their pci_dev
220
 * sysdata member.  This makes OBP aware PCI device drivers easier to
221
 * code.
222
 */
223
struct pcidev_cookie {
224
        struct pci_pbm_info             *pbm;
225
        char                            prom_name[64];
226
        int                             prom_node;
227
        struct linux_prom_pci_registers prom_regs[PROMREG_MAX];
228
        int num_prom_regs;
229
        struct linux_prom_pci_registers prom_assignments[PROMREG_MAX];
230
        int num_prom_assignments;
231
};
232
 
233
/* Currently these are the same across all PCI controllers
234
 * we support.  Someday they may not be...
235
 */
236
#define PCI_IRQ_IGN     0x000007c0      /* Interrupt Group Number */
237
#define PCI_IRQ_INO     0x0000003f      /* Interrupt Number */
238
 
239
#endif /* !(__SPARC64_PBM_H) */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.