0002-nb-intel-haswell-Introduce-option-to-not-use-MRC.bin.patch 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. From c07391821c32cafea950574b85468f5b3284b6df Mon Sep 17 00:00:00 2001
  2. From: Angel Pons <th3fanbus@gmail.com>
  3. Date: Fri, 6 May 2022 21:12:14 +0200
  4. Subject: [PATCH 02/26] nb/intel/haswell: Introduce option to not use MRC.bin
  5. Introduce the `USE_NATIVE_RAMINIT` Kconfig option, which should allow
  6. booting coreboot on Haswell mainboards without the need of the closed
  7. source MRC.bin. For now, this option does not work at all; the needed
  8. magic will be implemented in subsequent commits. Add a config file to
  9. make sure the newly-introduced option gets build-tested.
  10. Change-Id: I46c77586f9b5771624082e07c60c205e578edd8e
  11. Signed-off-by: Angel Pons <th3fanbus@gmail.com>
  12. ---
  13. configs/config.asrock_b85m_pro4.native_raminit | 5 +++++
  14. src/northbridge/intel/haswell/Kconfig | 13 +++++++++++++
  15. src/northbridge/intel/haswell/Makefile.inc | 7 ++++++-
  16. .../intel/haswell/native_raminit/Makefile.inc | 3 +++
  17. .../intel/haswell/native_raminit/raminit_native.c | 15 +++++++++++++++
  18. 5 files changed, 42 insertions(+), 1 deletion(-)
  19. create mode 100644 configs/config.asrock_b85m_pro4.native_raminit
  20. create mode 100644 src/northbridge/intel/haswell/native_raminit/Makefile.inc
  21. create mode 100644 src/northbridge/intel/haswell/native_raminit/raminit_native.c
  22. diff --git a/configs/config.asrock_b85m_pro4.native_raminit b/configs/config.asrock_b85m_pro4.native_raminit
  23. new file mode 100644
  24. index 0000000000..2de538926f
  25. --- /dev/null
  26. +++ b/configs/config.asrock_b85m_pro4.native_raminit
  27. @@ -0,0 +1,5 @@
  28. +# Configuration used to build-test native raminit
  29. +CONFIG_VENDOR_ASROCK=y
  30. +CONFIG_BOARD_ASROCK_B85M_PRO4=y
  31. +CONFIG_USE_NATIVE_RAMINIT=y
  32. +CONFIG_DEBUG_RAM_SETUP=y
  33. diff --git a/src/northbridge/intel/haswell/Kconfig b/src/northbridge/intel/haswell/Kconfig
  34. index 50acb09a91..b659bf6d98 100644
  35. --- a/src/northbridge/intel/haswell/Kconfig
  36. +++ b/src/northbridge/intel/haswell/Kconfig
  37. @@ -9,6 +9,14 @@ config NORTHBRIDGE_INTEL_HASWELL
  38. if NORTHBRIDGE_INTEL_HASWELL
  39. +config USE_NATIVE_RAMINIT
  40. + bool "[NOT WORKING] Use native raminit"
  41. + default n
  42. + select HAVE_DEBUG_RAM_SETUP
  43. + help
  44. + Select if you want to use coreboot implementation of raminit rather than
  45. + MRC.bin. Currently incomplete and does not boot.
  46. +
  47. config HASWELL_VBOOT_IN_BOOTBLOCK
  48. depends on VBOOT
  49. bool "Start verstage in bootblock"
  50. @@ -45,6 +53,7 @@ config DCACHE_RAM_BASE
  51. config DCACHE_RAM_SIZE
  52. hex
  53. + default 0x40000 if USE_NATIVE_RAMINIT
  54. default 0x10000
  55. help
  56. The size of the cache-as-ram region required during bootblock
  57. @@ -53,12 +62,14 @@ config DCACHE_RAM_SIZE
  58. config DCACHE_RAM_MRC_VAR_SIZE
  59. hex
  60. + default 0x0 if USE_NATIVE_RAMINIT
  61. default 0x30000
  62. help
  63. The amount of cache-as-ram region required by the reference code.
  64. config DCACHE_BSP_STACK_SIZE
  65. hex
  66. + default 0x20000 if USE_NATIVE_RAMINIT
  67. default 0x2000
  68. help
  69. The amount of anticipated stack usage in CAR by bootblock and
  70. @@ -66,6 +77,7 @@ config DCACHE_BSP_STACK_SIZE
  71. config HAVE_MRC
  72. bool "Add a System Agent binary"
  73. + depends on !USE_NATIVE_RAMINIT
  74. help
  75. Select this option to add a System Agent binary to
  76. the resulting coreboot image.
  77. @@ -82,6 +94,7 @@ config MRC_FILE
  78. config HASWELL_HIDE_PEG_FROM_MRC
  79. bool "Hide PEG devices from MRC to work around hardcoded MRC behavior"
  80. + depends on !USE_NATIVE_RAMINIT
  81. default y
  82. help
  83. If set, hides all PEG devices from MRC. This allows the iGPU
  84. diff --git a/src/northbridge/intel/haswell/Makefile.inc b/src/northbridge/intel/haswell/Makefile.inc
  85. index 2d1532be05..329f1f7ffe 100644
  86. --- a/src/northbridge/intel/haswell/Makefile.inc
  87. +++ b/src/northbridge/intel/haswell/Makefile.inc
  88. @@ -19,6 +19,11 @@ romstage-y += report_platform.c
  89. postcar-y += memmap.c
  90. -subdirs-y += haswell_mrc
  91. +ifeq ($(CONFIG_USE_NATIVE_RAMINIT),y)
  92. +subdirs-y += native_raminit
  93. +
  94. +else
  95. +subdirs-y += haswell_mrc
  96. +endif
  97. endif
  98. diff --git a/src/northbridge/intel/haswell/native_raminit/Makefile.inc b/src/northbridge/intel/haswell/native_raminit/Makefile.inc
  99. new file mode 100644
  100. index 0000000000..8cfb4fb33e
  101. --- /dev/null
  102. +++ b/src/northbridge/intel/haswell/native_raminit/Makefile.inc
  103. @@ -0,0 +1,3 @@
  104. +## SPDX-License-Identifier: GPL-2.0-or-later
  105. +
  106. +romstage-y += raminit_native.c
  107. diff --git a/src/northbridge/intel/haswell/native_raminit/raminit_native.c b/src/northbridge/intel/haswell/native_raminit/raminit_native.c
  108. new file mode 100644
  109. index 0000000000..1aafdf8659
  110. --- /dev/null
  111. +++ b/src/northbridge/intel/haswell/native_raminit/raminit_native.c
  112. @@ -0,0 +1,15 @@
  113. +/* SPDX-License-Identifier: GPL-2.0-or-later */
  114. +
  115. +#include <console/console.h>
  116. +#include <northbridge/intel/haswell/raminit.h>
  117. +
  118. +void perform_raminit(const int s3resume)
  119. +{
  120. + /*
  121. + * See, this function's name is a lie. There are more things to
  122. + * do that memory initialisation, but they are relatively easy.
  123. + */
  124. +
  125. + /** TODO: Implement the required magic **/
  126. + die("NATIVE RAMINIT: More Magic (tm) required.\n");
  127. +}
  128. --
  129. 2.39.2