1b8b572e1SStephen Rothwell #ifndef _POWERPC_PROM_H 2b8b572e1SStephen Rothwell #define _POWERPC_PROM_H 3b8b572e1SStephen Rothwell #ifdef __KERNEL__ 4b8b572e1SStephen Rothwell 5b8b572e1SStephen Rothwell /* 6b8b572e1SStephen Rothwell * Definitions for talking to the Open Firmware PROM on 7b8b572e1SStephen Rothwell * Power Macintosh computers. 8b8b572e1SStephen Rothwell * 9b8b572e1SStephen Rothwell * Copyright (C) 1996-2005 Paul Mackerras. 10b8b572e1SStephen Rothwell * 11b8b572e1SStephen Rothwell * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp. 12b8b572e1SStephen Rothwell * 13b8b572e1SStephen Rothwell * This program is free software; you can redistribute it and/or 14b8b572e1SStephen Rothwell * modify it under the terms of the GNU General Public License 15b8b572e1SStephen Rothwell * as published by the Free Software Foundation; either version 16b8b572e1SStephen Rothwell * 2 of the License, or (at your option) any later version. 17b8b572e1SStephen Rothwell */ 18b8b572e1SStephen Rothwell #include <linux/types.h> 19b8b572e1SStephen Rothwell #include <asm/irq.h> 2060063497SArun Sharma #include <linux/atomic.h> 21b8b572e1SStephen Rothwell 22*5c19c5c6SRob Herring /* These includes should be removed once implicit includes are cleaned up. */ 23*5c19c5c6SRob Herring #include <linux/of.h> 24*5c19c5c6SRob Herring #include <linux/of_fdt.h> 25*5c19c5c6SRob Herring #include <linux/of_address.h> 26*5c19c5c6SRob Herring #include <linux/of_irq.h> 27*5c19c5c6SRob Herring #include <linux/platform_device.h> 28*5c19c5c6SRob Herring 29b8b572e1SStephen Rothwell /* 30b8b572e1SStephen Rothwell * OF address retreival & translation 31b8b572e1SStephen Rothwell */ 32b8b572e1SStephen Rothwell 33b8b572e1SStephen Rothwell /* Parse the ibm,dma-window property of an OF node into the busno, phys and 34b8b572e1SStephen Rothwell * size parameters. 35b8b572e1SStephen Rothwell */ 362083f681SAnton Blanchard void of_parse_dma_window(struct device_node *dn, const __be32 *dma_window, 372083f681SAnton Blanchard unsigned long *busno, unsigned long *phys, 382083f681SAnton Blanchard unsigned long *size); 39b8b572e1SStephen Rothwell 40b8b572e1SStephen Rothwell extern void kdump_move_device_tree(void); 41b8b572e1SStephen Rothwell 42e523f723SNathan Lynch /* cache lookup */ 43e523f723SNathan Lynch struct device_node *of_find_next_cache_node(struct device_node *np); 44e523f723SNathan Lynch 45129ac799SGrant Likely extern void of_instantiate_rtc(void); 46129ac799SGrant Likely 47b37193b7SBenjamin Herrenschmidt extern int of_get_ibm_chip_id(struct device_node *np); 48b37193b7SBenjamin Herrenschmidt 49f5949720SNathan Fontenot /* The of_drconf_cell struct defines the layout of the LMB array 50f5949720SNathan Fontenot * specified in the device tree property 51f5949720SNathan Fontenot * ibm,dynamic-reconfiguration-memory/ibm,dynamic-memory 52f5949720SNathan Fontenot */ 53f5949720SNathan Fontenot struct of_drconf_cell { 54f5949720SNathan Fontenot u64 base_addr; 55f5949720SNathan Fontenot u32 drc_index; 56f5949720SNathan Fontenot u32 reserved; 57f5949720SNathan Fontenot u32 aa_index; 58f5949720SNathan Fontenot u32 flags; 59f5949720SNathan Fontenot }; 60f5949720SNathan Fontenot 61f5949720SNathan Fontenot #define DRCONF_MEM_ASSIGNED 0x00000008 62f5949720SNathan Fontenot #define DRCONF_MEM_AI_INVALID 0x00000040 63f5949720SNathan Fontenot #define DRCONF_MEM_RESERVED 0x00000080 64f5949720SNathan Fontenot 65530b5e14SNathan Fontenot /* 66530b5e14SNathan Fontenot * There are two methods for telling firmware what our capabilities are. 67530b5e14SNathan Fontenot * Newer machines have an "ibm,client-architecture-support" method on the 68530b5e14SNathan Fontenot * root node. For older machines, we have to call the "process-elf-header" 69530b5e14SNathan Fontenot * method in the /packages/elf-loader node, passing it a fake 32-bit 70530b5e14SNathan Fontenot * ELF header containing a couple of PT_NOTE sections that contain 71530b5e14SNathan Fontenot * structures that contain various information. 72530b5e14SNathan Fontenot */ 73530b5e14SNathan Fontenot 74530b5e14SNathan Fontenot /* New method - extensible architecture description vector. */ 75530b5e14SNathan Fontenot 76530b5e14SNathan Fontenot /* Option vector bits - generic bits in byte 1 */ 77530b5e14SNathan Fontenot #define OV_IGNORE 0x80 /* ignore this vector */ 78530b5e14SNathan Fontenot #define OV_CESSATION_POLICY 0x40 /* halt if unsupported option present*/ 79530b5e14SNathan Fontenot 80530b5e14SNathan Fontenot /* Option vector 1: processor architectures supported */ 81530b5e14SNathan Fontenot #define OV1_PPC_2_00 0x80 /* set if we support PowerPC 2.00 */ 82530b5e14SNathan Fontenot #define OV1_PPC_2_01 0x40 /* set if we support PowerPC 2.01 */ 83530b5e14SNathan Fontenot #define OV1_PPC_2_02 0x20 /* set if we support PowerPC 2.02 */ 84530b5e14SNathan Fontenot #define OV1_PPC_2_03 0x10 /* set if we support PowerPC 2.03 */ 85530b5e14SNathan Fontenot #define OV1_PPC_2_04 0x08 /* set if we support PowerPC 2.04 */ 86530b5e14SNathan Fontenot #define OV1_PPC_2_05 0x04 /* set if we support PowerPC 2.05 */ 87530b5e14SNathan Fontenot #define OV1_PPC_2_06 0x02 /* set if we support PowerPC 2.06 */ 88530b5e14SNathan Fontenot #define OV1_PPC_2_07 0x01 /* set if we support PowerPC 2.07 */ 89530b5e14SNathan Fontenot 90530b5e14SNathan Fontenot /* Option vector 2: Open Firmware options supported */ 91530b5e14SNathan Fontenot #define OV2_REAL_MODE 0x20 /* set if we want OF in real mode */ 92530b5e14SNathan Fontenot 93530b5e14SNathan Fontenot /* Option vector 3: processor options supported */ 94530b5e14SNathan Fontenot #define OV3_FP 0x80 /* floating point */ 95530b5e14SNathan Fontenot #define OV3_VMX 0x40 /* VMX/Altivec */ 96530b5e14SNathan Fontenot #define OV3_DFP 0x20 /* decimal FP */ 97530b5e14SNathan Fontenot 98530b5e14SNathan Fontenot /* Option vector 4: IBM PAPR implementation */ 99530b5e14SNathan Fontenot #define OV4_MIN_ENT_CAP 0x01 /* minimum VP entitled capacity */ 100530b5e14SNathan Fontenot 101f0ff7eb4SNathan Fontenot /* Option vector 5: PAPR/OF options supported 102f0ff7eb4SNathan Fontenot * These bits are also used in firmware_has_feature() to validate 103f0ff7eb4SNathan Fontenot * the capabilities reported for vector 5 in the device tree so we 104f0ff7eb4SNathan Fontenot * encode the vector index in the define and use the OV5_FEAT() 105f0ff7eb4SNathan Fontenot * and OV5_INDX() macros to extract the desired information. 106f0ff7eb4SNathan Fontenot */ 107f0ff7eb4SNathan Fontenot #define OV5_FEAT(x) ((x) & 0xff) 108f0ff7eb4SNathan Fontenot #define OV5_INDX(x) ((x) >> 8) 109f0ff7eb4SNathan Fontenot #define OV5_LPAR 0x0280 /* logical partitioning supported */ 110f0ff7eb4SNathan Fontenot #define OV5_SPLPAR 0x0240 /* shared-processor LPAR supported */ 111530b5e14SNathan Fontenot /* ibm,dynamic-reconfiguration-memory property supported */ 112f0ff7eb4SNathan Fontenot #define OV5_DRCONF_MEMORY 0x0220 113f0ff7eb4SNathan Fontenot #define OV5_LARGE_PAGES 0x0210 /* large pages supported */ 114f0ff7eb4SNathan Fontenot #define OV5_DONATE_DEDICATE_CPU 0x0202 /* donate dedicated CPU support */ 115f0ff7eb4SNathan Fontenot #define OV5_MSI 0x0201 /* PCIe/MSI support */ 116f0ff7eb4SNathan Fontenot #define OV5_CMO 0x0480 /* Cooperative Memory Overcommitment */ 117f0ff7eb4SNathan Fontenot #define OV5_XCMO 0x0440 /* Page Coalescing */ 118f0ff7eb4SNathan Fontenot #define OV5_TYPE1_AFFINITY 0x0580 /* Type 1 NUMA affinity */ 1195d88aa85SJesse Larrew #define OV5_PRRN 0x0540 /* Platform Resource Reassignment */ 120f0ff7eb4SNathan Fontenot #define OV5_PFO_HW_RNG 0x0E80 /* PFO Random Number Generator */ 121f0ff7eb4SNathan Fontenot #define OV5_PFO_HW_842 0x0E40 /* PFO Compression Accelerator */ 122f0ff7eb4SNathan Fontenot #define OV5_PFO_HW_ENCR 0x0E20 /* PFO Encryption Accelerator */ 123f0ff7eb4SNathan Fontenot #define OV5_SUB_PROCESSORS 0x0F01 /* 1,2,or 4 Sub-Processors supported */ 124530b5e14SNathan Fontenot 125530b5e14SNathan Fontenot /* Option Vector 6: IBM PAPR hints */ 126530b5e14SNathan Fontenot #define OV6_LINUX 0x02 /* Linux is our OS */ 127530b5e14SNathan Fontenot 128530b5e14SNathan Fontenot /* 129530b5e14SNathan Fontenot * The architecture vector has an array of PVR mask/value pairs, 130530b5e14SNathan Fontenot * followed by # option vectors - 1, followed by the option vectors. 131530b5e14SNathan Fontenot */ 132530b5e14SNathan Fontenot extern unsigned char ibm_architecture_vec[]; 133530b5e14SNathan Fontenot 134b8b572e1SStephen Rothwell #endif /* __KERNEL__ */ 135b8b572e1SStephen Rothwell #endif /* _POWERPC_PROM_H */ 136