xref: /openbmc/linux/arch/powerpc/include/asm/prom.h (revision 12eb4683)
1 #ifndef _POWERPC_PROM_H
2 #define _POWERPC_PROM_H
3 #ifdef __KERNEL__
4 
5 /*
6  * Definitions for talking to the Open Firmware PROM on
7  * Power Macintosh computers.
8  *
9  * Copyright (C) 1996-2005 Paul Mackerras.
10  *
11  * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version
16  * 2 of the License, or (at your option) any later version.
17  */
18 #include <linux/types.h>
19 #include <asm/irq.h>
20 #include <linux/atomic.h>
21 
22 /* These includes should be removed once implicit includes are cleaned up. */
23 #include <linux/of.h>
24 #include <linux/of_fdt.h>
25 #include <linux/of_address.h>
26 #include <linux/of_irq.h>
27 #include <linux/platform_device.h>
28 
29 /*
30  * OF address retreival & translation
31  */
32 
33 /* Parse the ibm,dma-window property of an OF node into the busno, phys and
34  * size parameters.
35  */
36 void of_parse_dma_window(struct device_node *dn, const __be32 *dma_window,
37 			 unsigned long *busno, unsigned long *phys,
38 			 unsigned long *size);
39 
40 extern void kdump_move_device_tree(void);
41 
42 extern void of_instantiate_rtc(void);
43 
44 extern int of_get_ibm_chip_id(struct device_node *np);
45 
46 /* The of_drconf_cell struct defines the layout of the LMB array
47  * specified in the device tree property
48  * ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory
49  */
50 struct of_drconf_cell {
51 	u64	base_addr;
52 	u32	drc_index;
53 	u32	reserved;
54 	u32	aa_index;
55 	u32	flags;
56 };
57 
58 #define DRCONF_MEM_ASSIGNED	0x00000008
59 #define DRCONF_MEM_AI_INVALID	0x00000040
60 #define DRCONF_MEM_RESERVED	0x00000080
61 
62 /*
63  * There are two methods for telling firmware what our capabilities are.
64  * Newer machines have an "ibm,client-architecture-support" method on the
65  * root node.  For older machines, we have to call the "process-elf-header"
66  * method in the /packages/elf-loader node, passing it a fake 32-bit
67  * ELF header containing a couple of PT_NOTE sections that contain
68  * structures that contain various information.
69  */
70 
71 /* New method - extensible architecture description vector. */
72 
73 /* Option vector bits - generic bits in byte 1 */
74 #define OV_IGNORE		0x80	/* ignore this vector */
75 #define OV_CESSATION_POLICY	0x40	/* halt if unsupported option present*/
76 
77 /* Option vector 1: processor architectures supported */
78 #define OV1_PPC_2_00		0x80	/* set if we support PowerPC 2.00 */
79 #define OV1_PPC_2_01		0x40	/* set if we support PowerPC 2.01 */
80 #define OV1_PPC_2_02		0x20	/* set if we support PowerPC 2.02 */
81 #define OV1_PPC_2_03		0x10	/* set if we support PowerPC 2.03 */
82 #define OV1_PPC_2_04		0x08	/* set if we support PowerPC 2.04 */
83 #define OV1_PPC_2_05		0x04	/* set if we support PowerPC 2.05 */
84 #define OV1_PPC_2_06		0x02	/* set if we support PowerPC 2.06 */
85 #define OV1_PPC_2_07		0x01	/* set if we support PowerPC 2.07 */
86 
87 /* Option vector 2: Open Firmware options supported */
88 #define OV2_REAL_MODE		0x20	/* set if we want OF in real mode */
89 
90 /* Option vector 3: processor options supported */
91 #define OV3_FP			0x80	/* floating point */
92 #define OV3_VMX			0x40	/* VMX/Altivec */
93 #define OV3_DFP			0x20	/* decimal FP */
94 
95 /* Option vector 4: IBM PAPR implementation */
96 #define OV4_MIN_ENT_CAP		0x01	/* minimum VP entitled capacity */
97 
98 /* Option vector 5: PAPR/OF options supported
99  * These bits are also used in firmware_has_feature() to validate
100  * the capabilities reported for vector 5 in the device tree so we
101  * encode the vector index in the define and use the OV5_FEAT()
102  * and OV5_INDX() macros to extract the desired information.
103  */
104 #define OV5_FEAT(x)	((x) & 0xff)
105 #define OV5_INDX(x)	((x) >> 8)
106 #define OV5_LPAR		0x0280	/* logical partitioning supported */
107 #define OV5_SPLPAR		0x0240	/* shared-processor LPAR supported */
108 /* ibm,dynamic-reconfiguration-memory property supported */
109 #define OV5_DRCONF_MEMORY	0x0220
110 #define OV5_LARGE_PAGES		0x0210	/* large pages supported */
111 #define OV5_DONATE_DEDICATE_CPU	0x0202	/* donate dedicated CPU support */
112 #define OV5_MSI			0x0201	/* PCIe/MSI support */
113 #define OV5_CMO			0x0480	/* Cooperative Memory Overcommitment */
114 #define OV5_XCMO		0x0440	/* Page Coalescing */
115 #define OV5_TYPE1_AFFINITY	0x0580	/* Type 1 NUMA affinity */
116 #define OV5_PRRN		0x0540	/* Platform Resource Reassignment */
117 #define OV5_PFO_HW_RNG		0x0E80	/* PFO Random Number Generator */
118 #define OV5_PFO_HW_842		0x0E40	/* PFO Compression Accelerator */
119 #define OV5_PFO_HW_ENCR		0x0E20	/* PFO Encryption Accelerator */
120 #define OV5_SUB_PROCESSORS	0x0F01	/* 1,2,or 4 Sub-Processors supported */
121 
122 /* Option Vector 6: IBM PAPR hints */
123 #define OV6_LINUX		0x02	/* Linux is our OS */
124 
125 /*
126  * The architecture vector has an array of PVR mask/value pairs,
127  * followed by # option vectors - 1, followed by the option vectors.
128  */
129 extern unsigned char ibm_architecture_vec[];
130 
131 #endif /* __KERNEL__ */
132 #endif /* _POWERPC_PROM_H */
133