aboutsummaryrefslogtreecommitdiff
path: root/hdata
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2019-12-08 22:22:50 +1000
committerOliver O'Halloran <oohall@gmail.com>2019-12-16 14:50:56 +1100
commit0d12f0c88b04547349424903548aa649d2a00780 (patch)
treef9655af8110411d5f7b7600bac4e53b6ba95bacb /hdata
parent8d49ff5356f0aadf84e54d3ced04632f0d748436 (diff)
downloadskiboot-0d12f0c88b04547349424903548aa649d2a00780.zip
skiboot-0d12f0c88b04547349424903548aa649d2a00780.tar.gz
skiboot-0d12f0c88b04547349424903548aa649d2a00780.tar.bz2
naca: move naca definition from asm to C
This results in the same layout and location of the naca and hv data structures. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Diffstat (limited to 'hdata')
-rw-r--r--hdata/Makefile.inc2
-rw-r--r--hdata/hdata.h2
-rw-r--r--hdata/naca.c26
-rw-r--r--hdata/naca.h54
-rw-r--r--hdata/spira.c11
-rw-r--r--hdata/spira.h6
6 files changed, 92 insertions, 9 deletions
diff --git a/hdata/Makefile.inc b/hdata/Makefile.inc
index 2d52f76..49690f3 100644
--- a/hdata/Makefile.inc
+++ b/hdata/Makefile.inc
@@ -1,7 +1,7 @@
# -*-Makefile-*-
SUBDIRS += hdata
-HDATA_OBJS = spira.o pcia.o hdif.o memory.o fsp.o iohub.o vpd.o slca.o
+HDATA_OBJS = naca.o spira.o pcia.o hdif.o memory.o fsp.o iohub.o vpd.o slca.o
HDATA_OBJS += cpu-common.o vpd-common.o hostservices.o i2c.o tpmrel.o
DEVSRC_OBJ = hdata/built-in.a
diff --git a/hdata/hdata.h b/hdata/hdata.h
index 7504b1e..580e5c7 100644
--- a/hdata/hdata.h
+++ b/hdata/hdata.h
@@ -5,6 +5,8 @@
#define __HDATA_H
#include <processor.h>
+#include "hdif.h"
+#include "spira.h"
struct dt_node;
diff --git a/hdata/naca.c b/hdata/naca.c
new file mode 100644
index 0000000..b215c39
--- /dev/null
+++ b/hdata/naca.c
@@ -0,0 +1,26 @@
+#include <compiler.h>
+#include <mem-map.h>
+#include <types.h>
+
+#include "naca.h"
+#include "spira.h"
+
+__section(".naca.data") struct naca naca = {
+ .spirah_addr = CPU_TO_BE64(SPIRAH_OFF),
+ .hv_release_data_addr = CPU_TO_BE64(NACA_OFF + offsetof(struct naca, hv_release_data)),
+ .spira_addr = CPU_TO_BE64(SPIRA_OFF),
+ .lid_table_addr = CPU_TO_BE64(NACA_OFF + offsetof(struct naca, hv_lid_load_table)),
+ .spira_size = CPU_TO_BE32(SPIRA_ACTUAL_SIZE),
+ .hv_load_map_addr = 0,
+ .attn_enabled = 0,
+ .pcia_supported = 1,
+ .__primary_thread_entry = CPU_TO_BE64(0x180),
+ .__secondary_thread_entry = CPU_TO_BE64(0x180),
+ .hv_release_data = {
+ .vrm = CPU_TO_BE64(0x666), /* ? */
+ },
+ .hv_lid_load_table = {
+ .w0 = CPU_TO_BE32(0x10),
+ .w1 = CPU_TO_BE32(0x10),
+ },
+};
diff --git a/hdata/naca.h b/hdata/naca.h
new file mode 100644
index 0000000..1271b59
--- /dev/null
+++ b/hdata/naca.h
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: Apache-2.0
+/* Copyright 2019 IBM Corp. */
+
+#ifndef __NACA_H
+#define __NACA_H
+
+#include <compiler.h>
+#include <inttypes.h>
+#include <types.h>
+
+struct hv_release_data {
+ uint8_t reserved_0x0[58];
+ __be64 vrm;
+} __packed __attribute__((aligned(0x10)));
+
+struct hv_lid_load_table {
+ __be32 w0;
+ __be32 w1;
+ __be32 w2;
+ __be32 w3;
+} __packed __attribute__((aligned(0x10)));
+
+/*
+ * NACA structure, accessed by the FSP to find the SPIRA
+ */
+struct naca {
+ __be64 spirah_addr; /* 0x0000 */
+ uint8_t reserved_0x8[0x10];
+ __be64 hv_release_data_addr; /* 0x0018 */
+ uint8_t reserved_0x20[0x10];
+ __be64 spira_addr; /* 0x0030 */
+ __be64 lid_table_addr; /* 0x0038 */
+ uint8_t reserved_0x40[0x60];
+ __be32 spira_size; /* 0x00a0 */
+ uint8_t reserved_0xa4[0x1c];
+ __be64 hv_load_map_addr; /* 0x00c0 */
+ uint8_t reserved_0xc8[0xe4];
+ uint8_t flags[4]; /* 0x01ac */
+ uint8_t reserved_0x1b0[0x5];
+ uint8_t attn_enabled; /* 0x01b5 */
+ uint8_t reserved_0x1b6[0x1];
+ uint8_t pcia_supported; /* 0x01b7 */
+ __be64 __primary_thread_entry; /* 0x01b8 */
+ __be64 __secondary_thread_entry; /* 0x01c0 */
+ uint8_t reserved_0x1d0[0xe38];
+
+ /* Not part of the naca but it's convenient to put them here */
+ struct hv_release_data hv_release_data;
+ struct hv_lid_load_table hv_lid_load_table;
+} __packed __attribute((aligned(0x10)));
+
+extern struct naca naca;
+
+#endif
diff --git a/hdata/spira.c b/hdata/spira.c
index f621707..7e19d3d 100644
--- a/hdata/spira.c
+++ b/hdata/spira.c
@@ -3,7 +3,6 @@
#include <inttypes.h>
#include <device.h>
-#include "spira.h"
#include <cpu.h>
#include <vpd.h>
#include <interrupts.h>
@@ -15,6 +14,8 @@
#include "hdata.h"
#include "hostservices.h"
+#include "naca.h"
+#include "spira.h"
/* Processor Initialization structure, contains
* the initial NIA and MSR values for the entry
@@ -1703,15 +1704,11 @@ static void fixup_spira(void)
static void update_spirah_addr(void)
{
#if !defined(TEST)
- extern uint32_t naca;
- uint64_t *spirah_offset = (uint64_t *)&naca;
- uint64_t *spira_offset = (uint64_t *)((u64)(&naca) + 0x30);
-
if (proc_gen < proc_gen_p9)
return;
- *spirah_offset = CPU_TO_BE64(SPIRAH_OFF);
- *spira_offset = CPU_TO_BE64(SPIRA_OFF);
+ naca.spirah_addr = CPU_TO_BE64(SPIRAH_OFF);
+ naca.spira_addr = CPU_TO_BE64(SPIRA_OFF);
spirah.ntuples.hs_data_area.addr = CPU_TO_BE64(SPIRA_HEAP_BASE - SKIBOOT_BASE);
spirah.ntuples.mdump_res.addr = CPU_TO_BE64(MDRT_TABLE_BASE - SKIBOOT_BASE);
#endif
diff --git a/hdata/spira.h b/hdata/spira.h
index 2c944be..2c28722 100644
--- a/hdata/spira.h
+++ b/hdata/spira.h
@@ -66,6 +66,8 @@ struct spira_ntuples {
struct spira_ntuple proc_dump_area; /* 0x400 */
};
+#define SPIRA_RESERVED_BYTES 0x60
+
struct spira {
struct HDIF_common_hdr hdr;
struct HDIF_idata_ptr ntuples_ptr;
@@ -77,9 +79,11 @@ struct spira {
*
* According to FSP engineers, this is an okay thing to do.
*/
- u8 reserved[0x60];
+ u8 reserved[SPIRA_RESERVED_BYTES];
} __packed __align(0x100);
+#define SPIRA_ACTUAL_SIZE (sizeof(struct spira) - SPIRA_RESERVED_BYTES)
+
extern struct spira spira;
/* SPIRA-H signature */