xref: /openbmc/linux/arch/powerpc/include/asm/prom.h (revision 530b5e1475e5bab5d5e5d03438004ad609068146)
19d24c888SGrant Likely #include <linux/of.h>	/* linux/of.h gets to determine #include ordering */
2b8b572e1SStephen Rothwell #ifndef _POWERPC_PROM_H
3b8b572e1SStephen Rothwell #define _POWERPC_PROM_H
4b8b572e1SStephen Rothwell #ifdef __KERNEL__
5b8b572e1SStephen Rothwell 
6b8b572e1SStephen Rothwell /*
7b8b572e1SStephen Rothwell  * Definitions for talking to the Open Firmware PROM on
8b8b572e1SStephen Rothwell  * Power Macintosh computers.
9b8b572e1SStephen Rothwell  *
10b8b572e1SStephen Rothwell  * Copyright (C) 1996-2005 Paul Mackerras.
11b8b572e1SStephen Rothwell  *
12b8b572e1SStephen Rothwell  * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
13b8b572e1SStephen Rothwell  *
14b8b572e1SStephen Rothwell  * This program is free software; you can redistribute it and/or
15b8b572e1SStephen Rothwell  * modify it under the terms of the GNU General Public License
16b8b572e1SStephen Rothwell  * as published by the Free Software Foundation; either version
17b8b572e1SStephen Rothwell  * 2 of the License, or (at your option) any later version.
18b8b572e1SStephen Rothwell  */
19b8b572e1SStephen Rothwell #include <linux/types.h>
20b8b572e1SStephen Rothwell #include <asm/irq.h>
2160063497SArun Sharma #include <linux/atomic.h>
22b8b572e1SStephen Rothwell 
23b8b572e1SStephen Rothwell #define HAVE_ARCH_DEVTREE_FIXUPS
24b8b572e1SStephen Rothwell 
25b8b572e1SStephen Rothwell /*
26b8b572e1SStephen Rothwell  * OF address retreival & translation
27b8b572e1SStephen Rothwell  */
28b8b572e1SStephen Rothwell 
29b8b572e1SStephen Rothwell /* Translate a DMA address from device space to CPU space */
30b8b572e1SStephen Rothwell extern u64 of_translate_dma_address(struct device_node *dev,
310131d897SSebastian Andrzej Siewior 				    const __be32 *in_addr);
32b8b572e1SStephen Rothwell 
331f5bef30SGrant Likely #ifdef CONFIG_PCI
341f5bef30SGrant Likely extern unsigned long pci_address_to_pio(phys_addr_t address);
3522ae782fSGrant Likely #define pci_address_to_pio pci_address_to_pio
361f5bef30SGrant Likely #endif	/* CONFIG_PCI */
371f5bef30SGrant Likely 
38b8b572e1SStephen Rothwell /* Parse the ibm,dma-window property of an OF node into the busno, phys and
39b8b572e1SStephen Rothwell  * size parameters.
40b8b572e1SStephen Rothwell  */
41b8b572e1SStephen Rothwell void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
42b8b572e1SStephen Rothwell 		unsigned long *busno, unsigned long *phys, unsigned long *size);
43b8b572e1SStephen Rothwell 
44b8b572e1SStephen Rothwell extern void kdump_move_device_tree(void);
45b8b572e1SStephen Rothwell 
46b8b572e1SStephen Rothwell /* CPU OF node matching */
47b8b572e1SStephen Rothwell struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
48b8b572e1SStephen Rothwell 
49e523f723SNathan Lynch /* cache lookup */
50e523f723SNathan Lynch struct device_node *of_find_next_cache_node(struct device_node *np);
51e523f723SNathan Lynch 
52559e2b7eSGrant Likely #ifdef CONFIG_NUMA
53559e2b7eSGrant Likely extern int of_node_to_nid(struct device_node *device);
54559e2b7eSGrant Likely #else
55559e2b7eSGrant Likely static inline int of_node_to_nid(struct device_node *device) { return 0; }
56559e2b7eSGrant Likely #endif
57559e2b7eSGrant Likely #define of_node_to_nid of_node_to_nid
58559e2b7eSGrant Likely 
59129ac799SGrant Likely extern void of_instantiate_rtc(void);
60129ac799SGrant Likely 
61f5949720SNathan Fontenot /* The of_drconf_cell struct defines the layout of the LMB array
62f5949720SNathan Fontenot  * specified in the device tree property
63f5949720SNathan Fontenot  * ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory
64f5949720SNathan Fontenot  */
65f5949720SNathan Fontenot struct of_drconf_cell {
66f5949720SNathan Fontenot 	u64	base_addr;
67f5949720SNathan Fontenot 	u32	drc_index;
68f5949720SNathan Fontenot 	u32	reserved;
69f5949720SNathan Fontenot 	u32	aa_index;
70f5949720SNathan Fontenot 	u32	flags;
71f5949720SNathan Fontenot };
72f5949720SNathan Fontenot 
73f5949720SNathan Fontenot #define DRCONF_MEM_ASSIGNED	0x00000008
74f5949720SNathan Fontenot #define DRCONF_MEM_AI_INVALID	0x00000040
75f5949720SNathan Fontenot #define DRCONF_MEM_RESERVED	0x00000080
76f5949720SNathan Fontenot 
77*530b5e14SNathan Fontenot /*
78*530b5e14SNathan Fontenot  * There are two methods for telling firmware what our capabilities are.
79*530b5e14SNathan Fontenot  * Newer machines have an "ibm,client-architecture-support" method on the
80*530b5e14SNathan Fontenot  * root node.  For older machines, we have to call the "process-elf-header"
81*530b5e14SNathan Fontenot  * method in the /packages/elf-loader node, passing it a fake 32-bit
82*530b5e14SNathan Fontenot  * ELF header containing a couple of PT_NOTE sections that contain
83*530b5e14SNathan Fontenot  * structures that contain various information.
84*530b5e14SNathan Fontenot  */
85*530b5e14SNathan Fontenot 
86*530b5e14SNathan Fontenot /* New method - extensible architecture description vector. */
87*530b5e14SNathan Fontenot 
88*530b5e14SNathan Fontenot /* Option vector bits - generic bits in byte 1 */
89*530b5e14SNathan Fontenot #define OV_IGNORE		0x80	/* ignore this vector */
90*530b5e14SNathan Fontenot #define OV_CESSATION_POLICY	0x40	/* halt if unsupported option present*/
91*530b5e14SNathan Fontenot 
92*530b5e14SNathan Fontenot /* Option vector 1: processor architectures supported */
93*530b5e14SNathan Fontenot #define OV1_PPC_2_00		0x80	/* set if we support PowerPC 2.00 */
94*530b5e14SNathan Fontenot #define OV1_PPC_2_01		0x40	/* set if we support PowerPC 2.01 */
95*530b5e14SNathan Fontenot #define OV1_PPC_2_02		0x20	/* set if we support PowerPC 2.02 */
96*530b5e14SNathan Fontenot #define OV1_PPC_2_03		0x10	/* set if we support PowerPC 2.03 */
97*530b5e14SNathan Fontenot #define OV1_PPC_2_04		0x08	/* set if we support PowerPC 2.04 */
98*530b5e14SNathan Fontenot #define OV1_PPC_2_05		0x04	/* set if we support PowerPC 2.05 */
99*530b5e14SNathan Fontenot #define OV1_PPC_2_06		0x02	/* set if we support PowerPC 2.06 */
100*530b5e14SNathan Fontenot #define OV1_PPC_2_07		0x01	/* set if we support PowerPC 2.07 */
101*530b5e14SNathan Fontenot 
102*530b5e14SNathan Fontenot /* Option vector 2: Open Firmware options supported */
103*530b5e14SNathan Fontenot #define OV2_REAL_MODE		0x20	/* set if we want OF in real mode */
104*530b5e14SNathan Fontenot 
105*530b5e14SNathan Fontenot /* Option vector 3: processor options supported */
106*530b5e14SNathan Fontenot #define OV3_FP			0x80	/* floating point */
107*530b5e14SNathan Fontenot #define OV3_VMX			0x40	/* VMX/Altivec */
108*530b5e14SNathan Fontenot #define OV3_DFP			0x20	/* decimal FP */
109*530b5e14SNathan Fontenot 
110*530b5e14SNathan Fontenot /* Option vector 4: IBM PAPR implementation */
111*530b5e14SNathan Fontenot #define OV4_MIN_ENT_CAP		0x01	/* minimum VP entitled capacity */
112*530b5e14SNathan Fontenot 
113*530b5e14SNathan Fontenot /* Option vector 5: PAPR/OF options supported */
114*530b5e14SNathan Fontenot #define OV5_LPAR		0x80	/* logical partitioning supported */
115*530b5e14SNathan Fontenot #define OV5_SPLPAR		0x40	/* shared-processor LPAR supported */
116*530b5e14SNathan Fontenot /* ibm,dynamic-reconfiguration-memory property supported */
117*530b5e14SNathan Fontenot #define OV5_DRCONF_MEMORY	0x20
118*530b5e14SNathan Fontenot #define OV5_LARGE_PAGES		0x10	/* large pages supported */
119*530b5e14SNathan Fontenot #define OV5_DONATE_DEDICATE_CPU	0x02	/* donate dedicated CPU support */
120*530b5e14SNathan Fontenot /* PCIe/MSI support.  Without MSI full PCIe is not supported */
121*530b5e14SNathan Fontenot #ifdef CONFIG_PCI_MSI
122*530b5e14SNathan Fontenot #define OV5_MSI			0x01	/* PCIe/MSI support */
123*530b5e14SNathan Fontenot #else
124*530b5e14SNathan Fontenot #define OV5_MSI			0x00
125*530b5e14SNathan Fontenot #endif /* CONFIG_PCI_MSI */
126*530b5e14SNathan Fontenot #ifdef CONFIG_PPC_SMLPAR
127*530b5e14SNathan Fontenot #define OV5_CMO			0x80	/* Cooperative Memory Overcommitment */
128*530b5e14SNathan Fontenot #define OV5_XCMO		0x40	/* Page Coalescing */
129*530b5e14SNathan Fontenot #else
130*530b5e14SNathan Fontenot #define OV5_CMO			0x00
131*530b5e14SNathan Fontenot #define OV5_XCMO		0x00
132*530b5e14SNathan Fontenot #endif
133*530b5e14SNathan Fontenot #define OV5_TYPE1_AFFINITY	0x80	/* Type 1 NUMA affinity */
134*530b5e14SNathan Fontenot #define OV5_PFO_HW_RNG		0x80	/* PFO Random Number Generator */
135*530b5e14SNathan Fontenot #define OV5_PFO_HW_842		0x40	/* PFO Compression Accelerator */
136*530b5e14SNathan Fontenot #define OV5_PFO_HW_ENCR		0x20	/* PFO Encryption Accelerator */
137*530b5e14SNathan Fontenot #define OV5_SUB_PROCESSORS	0x01	/* 1,2,or 4 Sub-Processors supported */
138*530b5e14SNathan Fontenot 
139*530b5e14SNathan Fontenot /* Option Vector 6: IBM PAPR hints */
140*530b5e14SNathan Fontenot #define OV6_LINUX		0x02	/* Linux is our OS */
141*530b5e14SNathan Fontenot 
142*530b5e14SNathan Fontenot /*
143*530b5e14SNathan Fontenot  * The architecture vector has an array of PVR mask/value pairs,
144*530b5e14SNathan Fontenot  * followed by # option vectors - 1, followed by the option vectors.
145*530b5e14SNathan Fontenot  */
146*530b5e14SNathan Fontenot extern unsigned char ibm_architecture_vec[];
147*530b5e14SNathan Fontenot 
14822ae782fSGrant Likely /* These includes are put at the bottom because they may contain things
14922ae782fSGrant Likely  * that are overridden by this file.  Ideally they shouldn't be included
15022ae782fSGrant Likely  * by this file, but there are a bunch of .c files that currently depend
15122ae782fSGrant Likely  * on it.  Eventually they will be cleaned up. */
15222ae782fSGrant Likely #include <linux/of_fdt.h>
15322ae782fSGrant Likely #include <linux/of_address.h>
15422ae782fSGrant Likely #include <linux/of_irq.h>
15522ae782fSGrant Likely #include <linux/platform_device.h>
15622ae782fSGrant Likely 
157b8b572e1SStephen Rothwell #endif /* __KERNEL__ */
158b8b572e1SStephen Rothwell #endif /* _POWERPC_PROM_H */
159