xref: /openbmc/linux/arch/sparc/kernel/pci_sun4v.h (revision 6c33a6f4)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* pci_sun4v.h: SUN4V specific PCI controller support.
3  *
4  * Copyright (C) 2006 David S. Miller (davem@davemloft.net)
5  */
6 
7 #ifndef _PCI_SUN4V_H
8 #define _PCI_SUN4V_H
9 
10 long pci_sun4v_iommu_map(unsigned long devhandle,
11 			 unsigned long tsbid,
12 			 unsigned long num_ttes,
13 			 unsigned long io_attributes,
14 			 unsigned long io_page_list_pa);
15 unsigned long pci_sun4v_iommu_demap(unsigned long devhandle,
16 				    unsigned long tsbid,
17 				    unsigned long num_ttes);
18 unsigned long pci_sun4v_iommu_getmap(unsigned long devhandle,
19 				     unsigned long tsbid,
20 				     unsigned long *io_attributes,
21 				     unsigned long *real_address);
22 unsigned long pci_sun4v_config_get(unsigned long devhandle,
23 				   unsigned long pci_device,
24 				   unsigned long config_offset,
25 				   unsigned long size);
26 int pci_sun4v_config_put(unsigned long devhandle,
27 			 unsigned long pci_device,
28 			 unsigned long config_offset,
29 			 unsigned long size,
30 			 unsigned long data);
31 
32 unsigned long pci_sun4v_msiq_conf(unsigned long devhandle,
33 					 unsigned long msiqid,
34 					 unsigned long msiq_paddr,
35 					 unsigned long num_entries);
36 unsigned long pci_sun4v_msiq_info(unsigned long devhandle,
37 				  unsigned long msiqid,
38 				  unsigned long *msiq_paddr,
39 				  unsigned long *num_entries);
40 unsigned long pci_sun4v_msiq_getvalid(unsigned long devhandle,
41 				      unsigned long msiqid,
42 				      unsigned long *valid);
43 unsigned long pci_sun4v_msiq_setvalid(unsigned long devhandle,
44 				      unsigned long msiqid,
45 				      unsigned long valid);
46 unsigned long pci_sun4v_msiq_getstate(unsigned long devhandle,
47 				      unsigned long msiqid,
48 				      unsigned long *state);
49 unsigned long pci_sun4v_msiq_setstate(unsigned long devhandle,
50 				      unsigned long msiqid,
51 				      unsigned long state);
52 unsigned long pci_sun4v_msiq_gethead(unsigned long devhandle,
53 				     unsigned long msiqid,
54 				     unsigned long *head);
55 unsigned long pci_sun4v_msiq_sethead(unsigned long devhandle,
56 				     unsigned long msiqid,
57 				     unsigned long head);
58 unsigned long pci_sun4v_msiq_gettail(unsigned long devhandle,
59 				      unsigned long msiqid,
60 				      unsigned long *head);
61 unsigned long pci_sun4v_msi_getvalid(unsigned long devhandle,
62 				     unsigned long msinum,
63 				     unsigned long *valid);
64 unsigned long pci_sun4v_msi_setvalid(unsigned long devhandle,
65 				     unsigned long msinum,
66 				     unsigned long valid);
67 unsigned long pci_sun4v_msi_getmsiq(unsigned long devhandle,
68 				    unsigned long msinum,
69 				    unsigned long *msiq);
70 unsigned long pci_sun4v_msi_setmsiq(unsigned long devhandle,
71 				    unsigned long msinum,
72 				    unsigned long msiq,
73 				    unsigned long msitype);
74 unsigned long pci_sun4v_msi_getstate(unsigned long devhandle,
75 				     unsigned long msinum,
76 				     unsigned long *state);
77 unsigned long pci_sun4v_msi_setstate(unsigned long devhandle,
78 				     unsigned long msinum,
79 				     unsigned long state);
80 unsigned long pci_sun4v_msg_getmsiq(unsigned long devhandle,
81 				    unsigned long msinum,
82 				    unsigned long *msiq);
83 unsigned long pci_sun4v_msg_setmsiq(unsigned long devhandle,
84 				    unsigned long msinum,
85 				    unsigned long msiq);
86 unsigned long pci_sun4v_msg_getvalid(unsigned long devhandle,
87 				     unsigned long msinum,
88 				     unsigned long *valid);
89 unsigned long pci_sun4v_msg_setvalid(unsigned long devhandle,
90 				     unsigned long msinum,
91 				     unsigned long valid);
92 
93 /* Sun4v HV IOMMU v2 APIs */
94 unsigned long pci_sun4v_iotsb_conf(unsigned long devhandle,
95 				   unsigned long ra,
96 				   unsigned long table_size,
97 				   unsigned long page_size,
98 				   unsigned long dvma_base,
99 				   u64 *iotsb_num);
100 unsigned long pci_sun4v_iotsb_bind(unsigned long devhandle,
101 				   unsigned long iotsb_num,
102 				   unsigned int pci_device);
103 unsigned long pci_sun4v_iotsb_map(unsigned long devhandle,
104 				  unsigned long iotsb_num,
105 				  unsigned long iotsb_index_iottes,
106 				  unsigned long io_attributes,
107 				  unsigned long io_page_list_pa,
108 				  long *mapped);
109 unsigned long pci_sun4v_iotsb_demap(unsigned long devhandle,
110 				    unsigned long iotsb_num,
111 				    unsigned long iotsb_index,
112 				    unsigned long iottes,
113 				    unsigned long *demapped);
114 #endif /* !(_PCI_SUN4V_H) */
115