Blame view

arch/sparc/kernel/pci_impl.h 5.29 KB
9fd8b6476   David S. Miller   [SPARC64]: Consol...
1
  /* pci_impl.h: Helper definitions for PCI controller support.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
   *
9fd8b6476   David S. Miller   [SPARC64]: Consol...
3
   * Copyright (C) 1999, 2007 David S. Miller (davem@davemloft.net)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
4
5
6
7
8
9
10
   */
  
  #ifndef PCI_IMPL_H
  #define PCI_IMPL_H
  
  #include <linux/types.h>
  #include <linux/spinlock.h>
c57c2ffb1   David S. Miller   [SPARC64]: Kill a...
11
12
  #include <linux/pci.h>
  #include <linux/msi.h>
22fecbae4   David S. Miller   sparc64: Record O...
13
  #include <linux/of_device.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
14
  #include <asm/io.h>
de8d28b16   David S. Miller   [SPARC64]: Conver...
15
  #include <asm/prom.h>
c57c2ffb1   David S. Miller   [SPARC64]: Kill a...
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  #include <asm/iommu.h>
  
  /* The abstraction used here is that there are PCI controllers,
   * each with one (Sabre) or two (PSYCHO/SCHIZO) PCI bus modules
   * underneath.  Each PCI bus module uses an IOMMU (shared by both
   * PBMs of a controller, or per-PBM), and if a streaming buffer
   * is present, each PCI bus module has it's own. (ie. the IOMMU
   * might be shared between PBMs, the STC is never shared)
   * Furthermore, each PCI bus module controls it's own autonomous
   * PCI bus.
   */
  
  #define PCI_STC_FLUSHFLAG_INIT(STC) \
  	(*((STC)->strbuf_flushflag) = 0UL)
  #define PCI_STC_FLUSHFLAG_SET(STC) \
  	(*((STC)->strbuf_flushflag) != 0UL)
759f89e03   David S. Miller   [SPARC64]: Consol...
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  #ifdef CONFIG_PCI_MSI
  struct pci_pbm_info;
  struct sparc64_msiq_ops {
  	int (*get_head)(struct pci_pbm_info *pbm, unsigned long msiqid,
  			unsigned long *head);
  	int (*dequeue_msi)(struct pci_pbm_info *pbm, unsigned long msiqid,
  			   unsigned long *head, unsigned long *msi);
  	int (*set_head)(struct pci_pbm_info *pbm, unsigned long msiqid,
  			unsigned long head);
  	int (*msi_setup)(struct pci_pbm_info *pbm, unsigned long msiqid,
  			 unsigned long msi, int is_msi64);
  	int (*msi_teardown)(struct pci_pbm_info *pbm, unsigned long msi);
  	int (*msiq_alloc)(struct pci_pbm_info *pbm);
  	void (*msiq_free)(struct pci_pbm_info *pbm);
  	int (*msiq_build_irq)(struct pci_pbm_info *pbm, unsigned long msiqid,
  			      unsigned long devino);
  };
2e74a74f2   Sam Ravnborg   sparc: drop use o...
49
50
  void sparc64_pbm_msi_init(struct pci_pbm_info *pbm,
  			  const struct sparc64_msiq_ops *ops);
759f89e03   David S. Miller   [SPARC64]: Consol...
51
52
53
54
55
56
  
  struct sparc64_msiq_cookie {
  	struct pci_pbm_info *pbm;
  	unsigned long msiqid;
  };
  #endif
c57c2ffb1   David S. Miller   [SPARC64]: Kill a...
57
58
  struct pci_pbm_info {
  	struct pci_pbm_info		*next;
d3ae4b5bc   David S. Miller   sparc64: Get rid ...
59
  	struct pci_pbm_info		*sibling;
c57c2ffb1   David S. Miller   [SPARC64]: Kill a...
60
  	int				index;
c57c2ffb1   David S. Miller   [SPARC64]: Kill a...
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
  	/* Physical address base of controller registers. */
  	unsigned long			controller_regs;
  
  	/* Physical address base of PBM registers. */
  	unsigned long			pbm_regs;
  
  	/* Physical address of DMA sync register, if any.  */
  	unsigned long			sync_reg;
  
  	/* Opaque 32-bit system bus Port ID. */
  	u32				portid;
  
  	/* Opaque 32-bit handle used for hypervisor calls.  */
  	u32				devhandle;
  
  	/* Chipset version information. */
  	int				chip_type;
  #define PBM_CHIP_TYPE_SABRE		1
  #define PBM_CHIP_TYPE_PSYCHO		2
  #define PBM_CHIP_TYPE_SCHIZO		3
  #define PBM_CHIP_TYPE_SCHIZO_PLUS	4
  #define PBM_CHIP_TYPE_TOMATILLO		5
  	int				chip_version;
  	int				chip_revision;
  
  	/* Name used for top-level resources. */
c22618a11   Grant Likely   drivers/of: Const...
87
  	const char			*name;
c57c2ffb1   David S. Miller   [SPARC64]: Kill a...
88
89
  
  	/* OBP specific information. */
cd4cd7306   Grant Likely   sparc: remove ref...
90
  	struct platform_device		*op;
c57c2ffb1   David S. Miller   [SPARC64]: Kill a...
91
92
93
94
95
  	u64				ino_bitmap;
  
  	/* PBM I/O and Memory space resources. */
  	struct resource			io_space;
  	struct resource			mem_space;
af86fa400   Yinghai Lu   sparc/PCI: Add me...
96
  	struct resource			mem64_space;
3f1b540d4   Yinghai Lu   sparc/PCI: regist...
97
  	struct resource			busn;
c57c2ffb1   David S. Miller   [SPARC64]: Kill a...
98
99
100
  
  	/* Base of PCI Config space, can be per-PBM or shared. */
  	unsigned long			config_space;
ca3dd88e4   David S. Miller   [SPARC64] PCI: Co...
101
102
  	/* This will be 12 on PCI-E controllers, 8 elsewhere.  */
  	unsigned long			config_space_reg_bits;
d3ae4b5bc   David S. Miller   sparc64: Get rid ...
103
104
105
  	unsigned long			pci_afsr;
  	unsigned long			pci_afar;
  	unsigned long			pci_csr;
c57c2ffb1   David S. Miller   [SPARC64]: Kill a...
106
107
108
109
110
111
112
113
114
115
  	/* State of 66MHz capabilities on this PBM. */
  	int				is_66mhz_capable;
  	int				all_devs_66mhz;
  
  #ifdef CONFIG_PCI_MSI
  	/* MSI info.  */
  	u32				msiq_num;
  	u32				msiq_ent_count;
  	u32				msiq_first;
  	u32				msiq_first_devino;
759f89e03   David S. Miller   [SPARC64]: Consol...
116
117
  	u32				msiq_rotor;
  	struct sparc64_msiq_cookie	*msiq_irq_cookies;
c57c2ffb1   David S. Miller   [SPARC64]: Kill a...
118
119
120
121
122
123
124
125
126
127
  	u32				msi_num;
  	u32				msi_first;
  	u32				msi_data_mask;
  	u32				msix_data_width;
  	u64				msi32_start;
  	u64				msi64_start;
  	u32				msi32_len;
  	u32				msi64_len;
  	void				*msi_queues;
  	unsigned long			*msi_bitmap;
759f89e03   David S. Miller   [SPARC64]: Consol...
128
  	unsigned int			*msi_irq_table;
44ed3c0c4   Sam Ravnborg   sparc64: rename v...
129
  	int (*setup_msi_irq)(unsigned int *irq_p, struct pci_dev *pdev,
c57c2ffb1   David S. Miller   [SPARC64]: Kill a...
130
  			     struct msi_desc *entry);
44ed3c0c4   Sam Ravnborg   sparc64: rename v...
131
  	void (*teardown_msi_irq)(unsigned int irq, struct pci_dev *pdev);
759f89e03   David S. Miller   [SPARC64]: Consol...
132
  	const struct sparc64_msiq_ops	*msi_ops;
c57c2ffb1   David S. Miller   [SPARC64]: Kill a...
133
134
135
136
137
138
139
140
141
142
143
144
  #endif /* !(CONFIG_PCI_MSI) */
  
  	/* This PBM's streaming buffer. */
  	struct strbuf			stc;
  
  	/* IOMMU state, potentially shared by both PBM segments. */
  	struct iommu			*iommu;
  
  	/* Now things for the actual PCI bus probes. */
  	unsigned int			pci_first_busno;
  	unsigned int			pci_last_busno;
  	struct pci_bus			*pci_bus;
c57c2ffb1   David S. Miller   [SPARC64]: Kill a...
145
  	struct pci_ops			*pci_ops;
c1b1a5f1f   David S. Miller   [SPARC64]: NUMA d...
146
147
  
  	int				numa_node;
c57c2ffb1   David S. Miller   [SPARC64]: Kill a...
148
  };
34768bc83   David S. Miller   [SPARC64] PCI: Us...
149
  extern struct pci_pbm_info *pci_pbm_root;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
150

6c108f129   David S. Miller   [SPARC64]: Move i...
151
  extern int pci_num_pbms;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
152
153
  
  /* PCI bus scanning and fixup support. */
2e74a74f2   Sam Ravnborg   sparc: drop use o...
154
155
156
157
  void pci_get_pbm_props(struct pci_pbm_info *pbm);
  struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm,
  				 struct device *parent);
  void pci_determine_mem_io_space(struct pci_pbm_info *pbm);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
158
159
  
  /* Error reporting support. */
2e74a74f2   Sam Ravnborg   sparc: drop use o...
160
161
162
  void pci_scan_for_target_abort(struct pci_pbm_info *, struct pci_bus *);
  void pci_scan_for_master_abort(struct pci_pbm_info *, struct pci_bus *);
  void pci_scan_for_parity_error(struct pci_pbm_info *, struct pci_bus *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
163
164
  
  /* Configuration space access. */
2e74a74f2   Sam Ravnborg   sparc: drop use o...
165
166
167
168
169
170
  void pci_config_read8(u8 *addr, u8 *ret);
  void pci_config_read16(u16 *addr, u16 *ret);
  void pci_config_read32(u32 *addr, u32 *ret);
  void pci_config_write8(u8 *addr, u8 val);
  void pci_config_write16(u16 *addr, u16 val);
  void pci_config_write32(u32 *addr, u32 val);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
171

ca3dd88e4   David S. Miller   [SPARC64] PCI: Co...
172
173
  extern struct pci_ops sun4u_pci_ops;
  extern struct pci_ops sun4v_pci_ops;
77d10d0e6   David S. Miller   sparc64: Fix spar...
174
175
176
  extern volatile int pci_poke_in_progress;
  extern volatile int pci_poke_cpu;
  extern volatile int pci_poke_faulted;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
177
  #endif /* !(PCI_IMPL_H) */