prom.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. #ifndef _POWERPC_PROM_H
  3. #define _POWERPC_PROM_H
  4. #ifdef __KERNEL__
  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. #include <linux/types.h>
  14. #include <asm/firmware.h>
  15. struct device_node;
  16. struct property;
  17. #define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */
  18. #define OF_DT_END_NODE 0x2 /* End node */
  19. #define OF_DT_PROP 0x3 /* Property: name off, size,
  20. * content */
  21. #define OF_DT_NOP 0x4 /* nop */
  22. #define OF_DT_END 0x9
  23. #define OF_DT_VERSION 0x10
  24. /*
  25. * This is what gets passed to the kernel by prom_init or kexec
  26. *
  27. * The dt struct contains the device tree structure, full pathes and
  28. * property contents. The dt strings contain a separate block with just
  29. * the strings for the property names, and is fully page aligned and
  30. * self contained in a page, so that it can be kept around by the kernel,
  31. * each property name appears only once in this page (cheap compression)
  32. *
  33. * the mem_rsvmap contains a map of reserved ranges of physical memory,
  34. * passing it here instead of in the device-tree itself greatly simplifies
  35. * the job of everybody. It's just a list of u64 pairs (base/size) that
  36. * ends when size is 0
  37. */
  38. struct boot_param_header {
  39. __be32 magic; /* magic word OF_DT_HEADER */
  40. __be32 totalsize; /* total size of DT block */
  41. __be32 off_dt_struct; /* offset to structure */
  42. __be32 off_dt_strings; /* offset to strings */
  43. __be32 off_mem_rsvmap; /* offset to memory reserve map */
  44. __be32 version; /* format version */
  45. __be32 last_comp_version; /* last compatible version */
  46. /* version 2 fields below */
  47. __be32 boot_cpuid_phys; /* Physical CPU id we're booting on */
  48. /* version 3 fields below */
  49. __be32 dt_strings_size; /* size of the DT strings block */
  50. /* version 17 fields below */
  51. __be32 dt_struct_size; /* size of the DT structure block */
  52. };
  53. /*
  54. * OF address retreival & translation
  55. */
  56. /* Parse the ibm,dma-window property of an OF node into the busno, phys and
  57. * size parameters.
  58. */
  59. void of_parse_dma_window(struct device_node *dn, const __be32 *dma_window,
  60. unsigned long *busno, unsigned long *phys,
  61. unsigned long *size);
  62. extern void of_instantiate_rtc(void);
  63. extern int of_get_ibm_chip_id(struct device_node *np);
  64. struct of_drc_info {
  65. char *drc_type;
  66. char *drc_name_prefix;
  67. u32 drc_index_start;
  68. u32 drc_name_suffix_start;
  69. u32 num_sequential_elems;
  70. u32 sequential_inc;
  71. u32 drc_power_domain;
  72. u32 last_drc_index;
  73. };
  74. extern int of_read_drc_info_cell(struct property **prop,
  75. const __be32 **curval, struct of_drc_info *data);
  76. /*
  77. * There are two methods for telling firmware what our capabilities are.
  78. * Newer machines have an "ibm,client-architecture-support" method on the
  79. * root node. For older machines, we have to call the "process-elf-header"
  80. * method in the /packages/elf-loader node, passing it a fake 32-bit
  81. * ELF header containing a couple of PT_NOTE sections that contain
  82. * structures that contain various information.
  83. */
  84. /* New method - extensible architecture description vector. */
  85. /* Option vector bits - generic bits in byte 1 */
  86. #define OV_IGNORE 0x80 /* ignore this vector */
  87. #define OV_CESSATION_POLICY 0x40 /* halt if unsupported option present*/
  88. /* Option vector 1: processor architectures supported */
  89. #define OV1_PPC_2_00 0x80 /* set if we support PowerPC 2.00 */
  90. #define OV1_PPC_2_01 0x40 /* set if we support PowerPC 2.01 */
  91. #define OV1_PPC_2_02 0x20 /* set if we support PowerPC 2.02 */
  92. #define OV1_PPC_2_03 0x10 /* set if we support PowerPC 2.03 */
  93. #define OV1_PPC_2_04 0x08 /* set if we support PowerPC 2.04 */
  94. #define OV1_PPC_2_05 0x04 /* set if we support PowerPC 2.05 */
  95. #define OV1_PPC_2_06 0x02 /* set if we support PowerPC 2.06 */
  96. #define OV1_PPC_2_07 0x01 /* set if we support PowerPC 2.07 */
  97. #define OV1_PPC_3_00 0x80 /* set if we support PowerPC 3.00 */
  98. #define OV1_PPC_3_1 0x40 /* set if we support PowerPC 3.1 */
  99. /* Option vector 2: Open Firmware options supported */
  100. #define OV2_REAL_MODE 0x20 /* set if we want OF in real mode */
  101. /* Option vector 3: processor options supported */
  102. #define OV3_FP 0x80 /* floating point */
  103. #define OV3_VMX 0x40 /* VMX/Altivec */
  104. #define OV3_DFP 0x20 /* decimal FP */
  105. /* Option vector 4: IBM PAPR implementation */
  106. #define OV4_MIN_ENT_CAP 0x01 /* minimum VP entitled capacity */
  107. /* Option vector 5: PAPR/OF options supported
  108. * These bits are also used in firmware_has_feature() to validate
  109. * the capabilities reported for vector 5 in the device tree so we
  110. * encode the vector index in the define and use the OV5_FEAT()
  111. * and OV5_INDX() macros to extract the desired information.
  112. */
  113. #define OV5_FEAT(x) ((x) & 0xff)
  114. #define OV5_INDX(x) ((x) >> 8)
  115. #define OV5_LPAR 0x0280 /* logical partitioning supported */
  116. #define OV5_SPLPAR 0x0240 /* shared-processor LPAR supported */
  117. /* ibm,dynamic-reconfiguration-memory property supported */
  118. #define OV5_DRCONF_MEMORY 0x0220
  119. #define OV5_LARGE_PAGES 0x0210 /* large pages supported */
  120. #define OV5_DONATE_DEDICATE_CPU 0x0202 /* donate dedicated CPU support */
  121. #define OV5_MSI 0x0201 /* PCIe/MSI support */
  122. #define OV5_CMO 0x0480 /* Cooperative Memory Overcommitment */
  123. #define OV5_XCMO 0x0440 /* Page Coalescing */
  124. #define OV5_FORM1_AFFINITY 0x0580 /* FORM1 NUMA affinity */
  125. #define OV5_PRRN 0x0540 /* Platform Resource Reassignment */
  126. #define OV5_FORM2_AFFINITY 0x0520 /* Form2 NUMA affinity */
  127. #define OV5_HP_EVT 0x0604 /* Hot Plug Event support */
  128. #define OV5_RESIZE_HPT 0x0601 /* Hash Page Table resizing */
  129. #define OV5_PFO_HW_RNG 0x1180 /* PFO Random Number Generator */
  130. #define OV5_PFO_HW_842 0x1140 /* PFO Compression Accelerator */
  131. #define OV5_PFO_HW_ENCR 0x1120 /* PFO Encryption Accelerator */
  132. #define OV5_SUB_PROCESSORS 0x1501 /* 1,2,or 4 Sub-Processors supported */
  133. #define OV5_DRMEM_V2 0x1680 /* ibm,dynamic-reconfiguration-v2 */
  134. #define OV5_XIVE_SUPPORT 0x17C0 /* XIVE Exploitation Support Mask */
  135. #define OV5_XIVE_LEGACY 0x1700 /* XIVE legacy mode Only */
  136. #define OV5_XIVE_EXPLOIT 0x1740 /* XIVE exploitation mode Only */
  137. #define OV5_XIVE_EITHER 0x1780 /* XIVE legacy or exploitation mode */
  138. /* MMU Base Architecture */
  139. #define OV5_MMU_SUPPORT 0x18C0 /* MMU Mode Support Mask */
  140. #define OV5_MMU_HASH 0x1800 /* Hash MMU Only */
  141. #define OV5_MMU_RADIX 0x1840 /* Radix MMU Only */
  142. #define OV5_MMU_EITHER 0x1880 /* Hash or Radix Supported */
  143. #define OV5_MMU_DYNAMIC 0x18C0 /* Hash or Radix Can Switch Later */
  144. #define OV5_NMMU 0x1820 /* Nest MMU Available */
  145. /* Hash Table Extensions */
  146. #define OV5_HASH_SEG_TBL 0x1980 /* In Memory Segment Tables Available */
  147. #define OV5_HASH_GTSE 0x1940 /* Guest Translation Shoot Down Avail */
  148. /* Radix Table Extensions */
  149. #define OV5_RADIX_GTSE 0x1A40 /* Guest Translation Shoot Down Avail */
  150. #define OV5_DRC_INFO 0x1640 /* Redef Prop Structures: drc-info */
  151. /* Option Vector 6: IBM PAPR hints */
  152. #define OV6_LINUX 0x02 /* Linux is our OS */
  153. #endif /* __KERNEL__ */
  154. #endif /* _POWERPC_PROM_H */