prom.h 6.3 KB

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