aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sparc64/pbm.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-04-27 00:08:21 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-27 00:08:21 -0400
commit16ce82d846f2e6b652a064f91c5019cfe8682be4 (patch)
tree9100d2baface8ec8d5b7911e00e093fd177cb9e4 /include/asm-sparc64/pbm.h
parentee5ac9ddf2ea13be2418ac7d0ce5a930e78af013 (diff)
[SPARC64]: Convert PCI over to generic struct iommu/strbuf.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/asm-sparc64/pbm.h')
-rw-r--r--include/asm-sparc64/pbm.h90
1 files changed, 7 insertions, 83 deletions
diff --git a/include/asm-sparc64/pbm.h b/include/asm-sparc64/pbm.h
index 4a0ed2ea950c..c008cecca149 100644
--- a/include/asm-sparc64/pbm.h
+++ b/include/asm-sparc64/pbm.h
@@ -1,7 +1,6 @@
1/* $Id: pbm.h,v 1.27 2001/08/12 13:18:23 davem Exp $ 1/* pbm.h: UltraSparc PCI controller software state.
2 * pbm.h: UltraSparc PCI controller software state.
3 * 2 *
4 * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@redhat.com) 3 * Copyright (C) 1997, 1998, 1999, 2007 David S. Miller (davem@davemloft.net)
5 */ 4 */
6 5
7#ifndef __SPARC64_PBM_H 6#ifndef __SPARC64_PBM_H
@@ -30,84 +29,7 @@
30 * PCI bus. 29 * PCI bus.
31 */ 30 */
32 31
33struct pci_controller_info; 32extern void pci_iommu_table_init(struct iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask);
34
35/* This contains the software state necessary to drive a PCI
36 * controller's IOMMU.
37 */
38struct pci_iommu {
39 /* This protects the controller's IOMMU and all
40 * streaming buffers underneath.
41 */
42 spinlock_t lock;
43
44 struct iommu_arena arena;
45
46 /* IOMMU page table, a linear array of ioptes. */
47 iopte_t *page_table; /* The page table itself. */
48
49 /* Base PCI memory space address where IOMMU mappings
50 * begin.
51 */
52 u32 page_table_map_base;
53
54 /* IOMMU Controller Registers */
55 unsigned long iommu_control; /* IOMMU control register */
56 unsigned long iommu_tsbbase; /* IOMMU page table base register */
57 unsigned long iommu_flush; /* IOMMU page flush register */
58 unsigned long iommu_ctxflush; /* IOMMU context flush register */
59
60 /* This is a register in the PCI controller, which if
61 * read will have no side-effects but will guarantee
62 * completion of all previous writes into IOMMU/STC.
63 */
64 unsigned long write_complete_reg;
65
66 /* In order to deal with some buggy third-party PCI bridges that
67 * do wrong prefetching, we never mark valid mappings as invalid.
68 * Instead we point them at this dummy page.
69 */
70 unsigned long dummy_page;
71 unsigned long dummy_page_pa;
72
73 /* CTX allocation. */
74 unsigned long ctx_lowest_free;
75 DECLARE_BITMAP(ctx_bitmap, IOMMU_NUM_CTXS);
76
77 /* Here a PCI controller driver describes the areas of
78 * PCI memory space where DMA to/from physical memory
79 * are addressed. Drivers interrogate the PCI layer
80 * if their device has addressing limitations. They
81 * do so via pci_dma_supported, and pass in a mask of
82 * DMA address bits their device can actually drive.
83 *
84 * The test for being usable is:
85 * (device_mask & dma_addr_mask) == dma_addr_mask
86 */
87 u32 dma_addr_mask;
88};
89
90extern void pci_iommu_table_init(struct pci_iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask);
91
92/* This describes a PCI bus module's streaming buffer. */
93struct pci_strbuf {
94 int strbuf_enabled; /* Present and using it? */
95
96 /* Streaming Buffer Control Registers */
97 unsigned long strbuf_control; /* STC control register */
98 unsigned long strbuf_pflush; /* STC page flush register */
99 unsigned long strbuf_fsync; /* STC flush synchronization reg */
100 unsigned long strbuf_ctxflush; /* STC context flush register */
101 unsigned long strbuf_ctxmatch_base; /* STC context flush match reg */
102 unsigned long strbuf_flushflag_pa; /* Physical address of flush flag */
103 volatile unsigned long *strbuf_flushflag; /* The flush flag itself */
104
105 /* And this is the actual flush flag area.
106 * We allocate extra because the chips require
107 * a 64-byte aligned area.
108 */
109 volatile unsigned long __flushflag_buf[(64 + (64 - 1)) / sizeof(long)];
110};
111 33
112#define PCI_STC_FLUSHFLAG_INIT(STC) \ 34#define PCI_STC_FLUSHFLAG_INIT(STC) \
113 (*((STC)->strbuf_flushflag) = 0UL) 35 (*((STC)->strbuf_flushflag) = 0UL)
@@ -120,6 +42,8 @@ struct pci_strbuf {
120#define PROM_PCIRNG_MAX 64 42#define PROM_PCIRNG_MAX 64
121#define PROM_PCIIMAP_MAX 64 43#define PROM_PCIIMAP_MAX 64
122 44
45struct pci_controller_info;
46
123struct pci_pbm_info { 47struct pci_pbm_info {
124 /* PCI controller we sit under. */ 48 /* PCI controller we sit under. */
125 struct pci_controller_info *parent; 49 struct pci_controller_info *parent;
@@ -186,10 +110,10 @@ struct pci_pbm_info {
186#endif /* !(CONFIG_PCI_MSI) */ 110#endif /* !(CONFIG_PCI_MSI) */
187 111
188 /* This PBM's streaming buffer. */ 112 /* This PBM's streaming buffer. */
189 struct pci_strbuf stc; 113 struct strbuf stc;
190 114
191 /* IOMMU state, potentially shared by both PBM segments. */ 115 /* IOMMU state, potentially shared by both PBM segments. */
192 struct pci_iommu *iommu; 116 struct iommu *iommu;
193 117
194 /* Now things for the actual PCI bus probes. */ 118 /* Now things for the actual PCI bus probes. */
195 unsigned int pci_first_busno; 119 unsigned int pci_first_busno;