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 225c19c5c6SRob Herring /* These includes should be removed once implicit includes are cleaned up. */ 235c19c5c6SRob Herring #include <linux/of.h> 245c19c5c6SRob Herring #include <linux/of_fdt.h> 255c19c5c6SRob Herring #include <linux/of_address.h> 265c19c5c6SRob Herring #include <linux/of_irq.h> 275c19c5c6SRob Herring #include <linux/platform_device.h> 28b8b572e1SStephen Rothwell 29c3fc952dSRob Herring #define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */ 30c3fc952dSRob Herring #define OF_DT_END_NODE 0x2 /* End node */ 31c3fc952dSRob Herring #define OF_DT_PROP 0x3 /* Property: name off, size, 32c3fc952dSRob Herring * content */ 33c3fc952dSRob Herring #define OF_DT_NOP 0x4 /* nop */ 34c3fc952dSRob Herring #define OF_DT_END 0x9 35c3fc952dSRob Herring 36c3fc952dSRob Herring #define OF_DT_VERSION 0x10 37c3fc952dSRob Herring 38c3fc952dSRob Herring /* 39c3fc952dSRob Herring * This is what gets passed to the kernel by prom_init or kexec 40c3fc952dSRob Herring * 41c3fc952dSRob Herring * The dt struct contains the device tree structure, full pathes and 42c3fc952dSRob Herring * property contents. The dt strings contain a separate block with just 43c3fc952dSRob Herring * the strings for the property names, and is fully page aligned and 44c3fc952dSRob Herring * self contained in a page, so that it can be kept around by the kernel, 45c3fc952dSRob Herring * each property name appears only once in this page (cheap compression) 46c3fc952dSRob Herring * 47c3fc952dSRob Herring * the mem_rsvmap contains a map of reserved ranges of physical memory, 48c3fc952dSRob Herring * passing it here instead of in the device-tree itself greatly simplifies 49c3fc952dSRob Herring * the job of everybody. It's just a list of u64 pairs (base/size) that 50c3fc952dSRob Herring * ends when size is 0 51c3fc952dSRob Herring */ 52c3fc952dSRob Herring struct boot_param_header { 53c3fc952dSRob Herring __be32 magic; /* magic word OF_DT_HEADER */ 54c3fc952dSRob Herring __be32 totalsize; /* total size of DT block */ 55c3fc952dSRob Herring __be32 off_dt_struct; /* offset to structure */ 56c3fc952dSRob Herring __be32 off_dt_strings; /* offset to strings */ 57c3fc952dSRob Herring __be32 off_mem_rsvmap; /* offset to memory reserve map */ 58c3fc952dSRob Herring __be32 version; /* format version */ 59c3fc952dSRob Herring __be32 last_comp_version; /* last compatible version */ 60c3fc952dSRob Herring /* version 2 fields below */ 61c3fc952dSRob Herring __be32 boot_cpuid_phys; /* Physical CPU id we're booting on */ 62c3fc952dSRob Herring /* version 3 fields below */ 63c3fc952dSRob Herring __be32 dt_strings_size; /* size of the DT strings block */ 64c3fc952dSRob Herring /* version 17 fields below */ 65c3fc952dSRob Herring __be32 dt_struct_size; /* size of the DT structure block */ 66c3fc952dSRob Herring }; 67c3fc952dSRob Herring 68b8b572e1SStephen Rothwell /* 69b8b572e1SStephen Rothwell * OF address retreival & translation 70b8b572e1SStephen Rothwell */ 71b8b572e1SStephen Rothwell 72b8b572e1SStephen Rothwell /* Parse the ibm,dma-window property of an OF node into the busno, phys and 73b8b572e1SStephen Rothwell * size parameters. 74b8b572e1SStephen Rothwell */ 752083f681SAnton Blanchard void of_parse_dma_window(struct device_node *dn, const __be32 *dma_window, 762083f681SAnton Blanchard unsigned long *busno, unsigned long *phys, 772083f681SAnton Blanchard unsigned long *size); 78b8b572e1SStephen Rothwell 79129ac799SGrant Likely extern void of_instantiate_rtc(void); 80129ac799SGrant Likely 81b37193b7SBenjamin Herrenschmidt extern int of_get_ibm_chip_id(struct device_node *np); 82b37193b7SBenjamin Herrenschmidt 83530b5e14SNathan Fontenot /* 84530b5e14SNathan Fontenot * There are two methods for telling firmware what our capabilities are. 85530b5e14SNathan Fontenot * Newer machines have an "ibm,client-architecture-support" method on the 86530b5e14SNathan Fontenot * root node. For older machines, we have to call the "process-elf-header" 87530b5e14SNathan Fontenot * method in the /packages/elf-loader node, passing it a fake 32-bit 88530b5e14SNathan Fontenot * ELF header containing a couple of PT_NOTE sections that contain 89530b5e14SNathan Fontenot * structures that contain various information. 90530b5e14SNathan Fontenot */ 91530b5e14SNathan Fontenot 92530b5e14SNathan Fontenot /* New method - extensible architecture description vector. */ 93530b5e14SNathan Fontenot 94530b5e14SNathan Fontenot /* Option vector bits - generic bits in byte 1 */ 95530b5e14SNathan Fontenot #define OV_IGNORE 0x80 /* ignore this vector */ 96530b5e14SNathan Fontenot #define OV_CESSATION_POLICY 0x40 /* halt if unsupported option present*/ 97530b5e14SNathan Fontenot 98530b5e14SNathan Fontenot /* Option vector 1: processor architectures supported */ 99530b5e14SNathan Fontenot #define OV1_PPC_2_00 0x80 /* set if we support PowerPC 2.00 */ 100530b5e14SNathan Fontenot #define OV1_PPC_2_01 0x40 /* set if we support PowerPC 2.01 */ 101530b5e14SNathan Fontenot #define OV1_PPC_2_02 0x20 /* set if we support PowerPC 2.02 */ 102530b5e14SNathan Fontenot #define OV1_PPC_2_03 0x10 /* set if we support PowerPC 2.03 */ 103530b5e14SNathan Fontenot #define OV1_PPC_2_04 0x08 /* set if we support PowerPC 2.04 */ 104530b5e14SNathan Fontenot #define OV1_PPC_2_05 0x04 /* set if we support PowerPC 2.05 */ 105530b5e14SNathan Fontenot #define OV1_PPC_2_06 0x02 /* set if we support PowerPC 2.06 */ 106530b5e14SNathan Fontenot #define OV1_PPC_2_07 0x01 /* set if we support PowerPC 2.07 */ 107530b5e14SNathan Fontenot 108cc3d2940SPaul Mackerras #define OV1_PPC_3_00 0x80 /* set if we support PowerPC 3.00 */ 109cc3d2940SPaul Mackerras 110530b5e14SNathan Fontenot /* Option vector 2: Open Firmware options supported */ 111530b5e14SNathan Fontenot #define OV2_REAL_MODE 0x20 /* set if we want OF in real mode */ 112530b5e14SNathan Fontenot 113530b5e14SNathan Fontenot /* Option vector 3: processor options supported */ 114530b5e14SNathan Fontenot #define OV3_FP 0x80 /* floating point */ 115530b5e14SNathan Fontenot #define OV3_VMX 0x40 /* VMX/Altivec */ 116530b5e14SNathan Fontenot #define OV3_DFP 0x20 /* decimal FP */ 117530b5e14SNathan Fontenot 118530b5e14SNathan Fontenot /* Option vector 4: IBM PAPR implementation */ 119530b5e14SNathan Fontenot #define OV4_MIN_ENT_CAP 0x01 /* minimum VP entitled capacity */ 120530b5e14SNathan Fontenot 121f0ff7eb4SNathan Fontenot /* Option vector 5: PAPR/OF options supported 122f0ff7eb4SNathan Fontenot * These bits are also used in firmware_has_feature() to validate 123f0ff7eb4SNathan Fontenot * the capabilities reported for vector 5 in the device tree so we 124f0ff7eb4SNathan Fontenot * encode the vector index in the define and use the OV5_FEAT() 125f0ff7eb4SNathan Fontenot * and OV5_INDX() macros to extract the desired information. 126f0ff7eb4SNathan Fontenot */ 127f0ff7eb4SNathan Fontenot #define OV5_FEAT(x) ((x) & 0xff) 128f0ff7eb4SNathan Fontenot #define OV5_INDX(x) ((x) >> 8) 129f0ff7eb4SNathan Fontenot #define OV5_LPAR 0x0280 /* logical partitioning supported */ 130f0ff7eb4SNathan Fontenot #define OV5_SPLPAR 0x0240 /* shared-processor LPAR supported */ 131530b5e14SNathan Fontenot /* ibm,dynamic-reconfiguration-memory property supported */ 132f0ff7eb4SNathan Fontenot #define OV5_DRCONF_MEMORY 0x0220 133f0ff7eb4SNathan Fontenot #define OV5_LARGE_PAGES 0x0210 /* large pages supported */ 134f0ff7eb4SNathan Fontenot #define OV5_DONATE_DEDICATE_CPU 0x0202 /* donate dedicated CPU support */ 135f0ff7eb4SNathan Fontenot #define OV5_MSI 0x0201 /* PCIe/MSI support */ 136f0ff7eb4SNathan Fontenot #define OV5_CMO 0x0480 /* Cooperative Memory Overcommitment */ 137f0ff7eb4SNathan Fontenot #define OV5_XCMO 0x0440 /* Page Coalescing */ 138f0ff7eb4SNathan Fontenot #define OV5_TYPE1_AFFINITY 0x0580 /* Type 1 NUMA affinity */ 1395d88aa85SJesse Larrew #define OV5_PRRN 0x0540 /* Platform Resource Reassignment */ 1403dbbaf20SMichael Roth #define OV5_HP_EVT 0x0604 /* Hot Plug Event support */ 1410de0fb09SDavid Gibson #define OV5_RESIZE_HPT 0x0601 /* Hash Page Table resizing */ 1423f4ab2f8SPaul Mackerras #define OV5_PFO_HW_RNG 0x1180 /* PFO Random Number Generator */ 1433f4ab2f8SPaul Mackerras #define OV5_PFO_HW_842 0x1140 /* PFO Compression Accelerator */ 1443f4ab2f8SPaul Mackerras #define OV5_PFO_HW_ENCR 0x1120 /* PFO Encryption Accelerator */ 1453f4ab2f8SPaul Mackerras #define OV5_SUB_PROCESSORS 0x1501 /* 1,2,or 4 Sub-Processors supported */ 146*0c38ed6fSNathan Fontenot #define OV5_DRMEM_V2 0x1680 /* ibm,dynamic-reconfiguration-v2 */ 147ac5e5a54SCédric Le Goater #define OV5_XIVE_SUPPORT 0x17C0 /* XIVE Exploitation Support Mask */ 148ac5e5a54SCédric Le Goater #define OV5_XIVE_LEGACY 0x1700 /* XIVE legacy mode Only */ 149ac5e5a54SCédric Le Goater #define OV5_XIVE_EXPLOIT 0x1740 /* XIVE exploitation mode Only */ 150ac5e5a54SCédric Le Goater #define OV5_XIVE_EITHER 0x1780 /* XIVE legacy or exploitation mode */ 151014d02cbSSuraj Jitindar Singh /* MMU Base Architecture */ 152014d02cbSSuraj Jitindar Singh #define OV5_MMU_SUPPORT 0x18C0 /* MMU Mode Support Mask */ 153014d02cbSSuraj Jitindar Singh #define OV5_MMU_HASH 0x1800 /* Hash MMU Only */ 154014d02cbSSuraj Jitindar Singh #define OV5_MMU_RADIX 0x1840 /* Radix MMU Only */ 155014d02cbSSuraj Jitindar Singh #define OV5_MMU_EITHER 0x1880 /* Hash or Radix Supported */ 156014d02cbSSuraj Jitindar Singh #define OV5_MMU_DYNAMIC 0x18C0 /* Hash or Radix Can Switch Later */ 157014d02cbSSuraj Jitindar Singh #define OV5_NMMU 0x1820 /* Nest MMU Available */ 158014d02cbSSuraj Jitindar Singh /* Hash Table Extensions */ 159014d02cbSSuraj Jitindar Singh #define OV5_HASH_SEG_TBL 0x1980 /* In Memory Segment Tables Available */ 160014d02cbSSuraj Jitindar Singh #define OV5_HASH_GTSE 0x1940 /* Guest Translation Shoot Down Avail */ 161014d02cbSSuraj Jitindar Singh /* Radix Table Extensions */ 162014d02cbSSuraj Jitindar Singh #define OV5_RADIX_GTSE 0x1A40 /* Guest Translation Shoot Down Avail */ 163530b5e14SNathan Fontenot 164530b5e14SNathan Fontenot /* Option Vector 6: IBM PAPR hints */ 165530b5e14SNathan Fontenot #define OV6_LINUX 0x02 /* Linux is our OS */ 166530b5e14SNathan Fontenot 167b8b572e1SStephen Rothwell #endif /* __KERNEL__ */ 168b8b572e1SStephen Rothwell #endif /* _POWERPC_PROM_H */ 169