Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 #ifndef _POWERPC_PROM_H
0003 #define _POWERPC_PROM_H
0004 #ifdef __KERNEL__
0005 
0006 /*
0007  * Definitions for talking to the Open Firmware PROM on
0008  * Power Macintosh computers.
0009  *
0010  * Copyright (C) 1996-2005 Paul Mackerras.
0011  *
0012  * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
0013  */
0014 #include <linux/types.h>
0015 #include <asm/firmware.h>
0016 
0017 struct device_node;
0018 struct property;
0019 
0020 #define OF_DT_BEGIN_NODE    0x1     /* Start of node, full name */
0021 #define OF_DT_END_NODE      0x2     /* End node */
0022 #define OF_DT_PROP      0x3     /* Property: name off, size,
0023                          * content */
0024 #define OF_DT_NOP       0x4     /* nop */
0025 #define OF_DT_END       0x9
0026 
0027 #define OF_DT_VERSION       0x10
0028 
0029 /*
0030  * This is what gets passed to the kernel by prom_init or kexec
0031  *
0032  * The dt struct contains the device tree structure, full pathes and
0033  * property contents. The dt strings contain a separate block with just
0034  * the strings for the property names, and is fully page aligned and
0035  * self contained in a page, so that it can be kept around by the kernel,
0036  * each property name appears only once in this page (cheap compression)
0037  *
0038  * the mem_rsvmap contains a map of reserved ranges of physical memory,
0039  * passing it here instead of in the device-tree itself greatly simplifies
0040  * the job of everybody. It's just a list of u64 pairs (base/size) that
0041  * ends when size is 0
0042  */
0043 struct boot_param_header {
0044     __be32  magic;          /* magic word OF_DT_HEADER */
0045     __be32  totalsize;      /* total size of DT block */
0046     __be32  off_dt_struct;      /* offset to structure */
0047     __be32  off_dt_strings;     /* offset to strings */
0048     __be32  off_mem_rsvmap;     /* offset to memory reserve map */
0049     __be32  version;        /* format version */
0050     __be32  last_comp_version;  /* last compatible version */
0051     /* version 2 fields below */
0052     __be32  boot_cpuid_phys;    /* Physical CPU id we're booting on */
0053     /* version 3 fields below */
0054     __be32  dt_strings_size;    /* size of the DT strings block */
0055     /* version 17 fields below */
0056     __be32  dt_struct_size;     /* size of the DT structure block */
0057 };
0058 
0059 /*
0060  * OF address retreival & translation
0061  */
0062 
0063 /* Parse the ibm,dma-window property of an OF node into the busno, phys and
0064  * size parameters.
0065  */
0066 void of_parse_dma_window(struct device_node *dn, const __be32 *dma_window,
0067              unsigned long *busno, unsigned long *phys,
0068              unsigned long *size);
0069 
0070 extern void of_instantiate_rtc(void);
0071 
0072 extern int of_get_ibm_chip_id(struct device_node *np);
0073 
0074 struct of_drc_info {
0075     char *drc_type;
0076     char *drc_name_prefix;
0077     u32 drc_index_start;
0078     u32 drc_name_suffix_start;
0079     u32 num_sequential_elems;
0080     u32 sequential_inc;
0081     u32 drc_power_domain;
0082     u32 last_drc_index;
0083 };
0084 
0085 extern int of_read_drc_info_cell(struct property **prop,
0086             const __be32 **curval, struct of_drc_info *data);
0087 
0088 
0089 /*
0090  * There are two methods for telling firmware what our capabilities are.
0091  * Newer machines have an "ibm,client-architecture-support" method on the
0092  * root node.  For older machines, we have to call the "process-elf-header"
0093  * method in the /packages/elf-loader node, passing it a fake 32-bit
0094  * ELF header containing a couple of PT_NOTE sections that contain
0095  * structures that contain various information.
0096  */
0097 
0098 /* New method - extensible architecture description vector. */
0099 
0100 /* Option vector bits - generic bits in byte 1 */
0101 #define OV_IGNORE       0x80    /* ignore this vector */
0102 #define OV_CESSATION_POLICY 0x40    /* halt if unsupported option present*/
0103 
0104 /* Option vector 1: processor architectures supported */
0105 #define OV1_PPC_2_00        0x80    /* set if we support PowerPC 2.00 */
0106 #define OV1_PPC_2_01        0x40    /* set if we support PowerPC 2.01 */
0107 #define OV1_PPC_2_02        0x20    /* set if we support PowerPC 2.02 */
0108 #define OV1_PPC_2_03        0x10    /* set if we support PowerPC 2.03 */
0109 #define OV1_PPC_2_04        0x08    /* set if we support PowerPC 2.04 */
0110 #define OV1_PPC_2_05        0x04    /* set if we support PowerPC 2.05 */
0111 #define OV1_PPC_2_06        0x02    /* set if we support PowerPC 2.06 */
0112 #define OV1_PPC_2_07        0x01    /* set if we support PowerPC 2.07 */
0113 
0114 #define OV1_PPC_3_00        0x80    /* set if we support PowerPC 3.00 */
0115 #define OV1_PPC_3_1         0x40    /* set if we support PowerPC 3.1 */
0116 
0117 /* Option vector 2: Open Firmware options supported */
0118 #define OV2_REAL_MODE       0x20    /* set if we want OF in real mode */
0119 
0120 /* Option vector 3: processor options supported */
0121 #define OV3_FP          0x80    /* floating point */
0122 #define OV3_VMX         0x40    /* VMX/Altivec */
0123 #define OV3_DFP         0x20    /* decimal FP */
0124 
0125 /* Option vector 4: IBM PAPR implementation */
0126 #define OV4_MIN_ENT_CAP     0x01    /* minimum VP entitled capacity */
0127 
0128 /* Option vector 5: PAPR/OF options supported
0129  * These bits are also used in firmware_has_feature() to validate
0130  * the capabilities reported for vector 5 in the device tree so we
0131  * encode the vector index in the define and use the OV5_FEAT()
0132  * and OV5_INDX() macros to extract the desired information.
0133  */
0134 #define OV5_FEAT(x) ((x) & 0xff)
0135 #define OV5_INDX(x) ((x) >> 8)
0136 #define OV5_LPAR        0x0280  /* logical partitioning supported */
0137 #define OV5_SPLPAR      0x0240  /* shared-processor LPAR supported */
0138 /* ibm,dynamic-reconfiguration-memory property supported */
0139 #define OV5_DRCONF_MEMORY   0x0220
0140 #define OV5_LARGE_PAGES     0x0210  /* large pages supported */
0141 #define OV5_DONATE_DEDICATE_CPU 0x0202  /* donate dedicated CPU support */
0142 #define OV5_MSI         0x0201  /* PCIe/MSI support */
0143 #define OV5_CMO         0x0480  /* Cooperative Memory Overcommitment */
0144 #define OV5_XCMO        0x0440  /* Page Coalescing */
0145 #define OV5_FORM1_AFFINITY  0x0580  /* FORM1 NUMA affinity */
0146 #define OV5_PRRN        0x0540  /* Platform Resource Reassignment */
0147 #define OV5_FORM2_AFFINITY  0x0520  /* Form2 NUMA affinity */
0148 #define OV5_HP_EVT      0x0604  /* Hot Plug Event support */
0149 #define OV5_RESIZE_HPT      0x0601  /* Hash Page Table resizing */
0150 #define OV5_PFO_HW_RNG      0x1180  /* PFO Random Number Generator */
0151 #define OV5_PFO_HW_842      0x1140  /* PFO Compression Accelerator */
0152 #define OV5_PFO_HW_ENCR     0x1120  /* PFO Encryption Accelerator */
0153 #define OV5_SUB_PROCESSORS  0x1501  /* 1,2,or 4 Sub-Processors supported */
0154 #define OV5_DRMEM_V2        0x1680  /* ibm,dynamic-reconfiguration-v2 */
0155 #define OV5_XIVE_SUPPORT    0x17C0  /* XIVE Exploitation Support Mask */
0156 #define OV5_XIVE_LEGACY     0x1700  /* XIVE legacy mode Only */
0157 #define OV5_XIVE_EXPLOIT    0x1740  /* XIVE exploitation mode Only */
0158 #define OV5_XIVE_EITHER     0x1780  /* XIVE legacy or exploitation mode */
0159 /* MMU Base Architecture */
0160 #define OV5_MMU_SUPPORT     0x18C0  /* MMU Mode Support Mask */
0161 #define OV5_MMU_HASH        0x1800  /* Hash MMU Only */
0162 #define OV5_MMU_RADIX       0x1840  /* Radix MMU Only */
0163 #define OV5_MMU_EITHER      0x1880  /* Hash or Radix Supported */
0164 #define OV5_MMU_DYNAMIC     0x18C0  /* Hash or Radix Can Switch Later */
0165 #define OV5_NMMU        0x1820  /* Nest MMU Available */
0166 /* Hash Table Extensions */
0167 #define OV5_HASH_SEG_TBL    0x1980  /* In Memory Segment Tables Available */
0168 #define OV5_HASH_GTSE       0x1940  /* Guest Translation Shoot Down Avail */
0169 /* Radix Table Extensions */
0170 #define OV5_RADIX_GTSE      0x1A40  /* Guest Translation Shoot Down Avail */
0171 #define OV5_DRC_INFO        0x1640  /* Redef Prop Structures: drc-info   */
0172 
0173 /* Option Vector 6: IBM PAPR hints */
0174 #define OV6_LINUX       0x02    /* Linux is our OS */
0175 
0176 #endif /* __KERNEL__ */
0177 #endif /* _POWERPC_PROM_H */