At present this is just an ordinary variable. We may consider making it a
fixed register in the future.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
*/
#include <common.h>
+#include <debug_uart.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Global declaration of gd */
+struct global_data *global_data_ptr;
+
+void arch_setup_gd(gd_t *new_gd)
+{
+ global_data_ptr = new_gd;
+
+ /*
+ * TODO(sjg@chromium.org): For some reason U-Boot does not boot
+ * without this line. It fails to start up U-Boot proper and instead
+ * restarts SPL. Need to figure out why:
+ *
+ * U-Boot SPL 2017.01
+ *
+ * U-Boot SPL 2017.01
+ * CPU: Intel(R) Core(TM) i5-3427U CPU @ 1.80GHz
+ * Trying to boot from SPIJumping to 64-bit U-Boot: Note many
+ * features are missing
+ *
+ * U-Boot SPL 2017.01
+ */
+ printch(' ');
+}
int cpu_has_64bit(void)
{
#include <asm-generic/global_data.h>
#ifndef __ASSEMBLY__
-# ifdef CONFIG_EFI_APP
+# if defined(CONFIG_EFI_APP) || CONFIG_IS_ENABLED(X86_64)
+/* TODO(sjg@chromium.org): Consider using a fixed register for gd on x86_64 */
#define gd global_data_ptr
#define DECLARE_GLOBAL_DATA_PTR extern struct global_data *global_data_ptr
{
gd_t *gd_ptr;
+#if CONFIG_IS_ENABLED(X86_64)
+ asm volatile("fs mov 0, %0\n" : "=r" (gd_ptr));
+#else
asm volatile("fs movl 0, %0\n" : "=r" (gd_ptr));
+#endif
return gd_ptr;
}