[Skiboot] [PATCH v6 09/29] naca: move naca definition from asm to C
Vasant Hegde
hegdevasant at linux.vnet.ibm.com
Fri Nov 8 21:02:04 AEDT 2019
On 11/6/19 5:40 PM, Nicholas Piggin wrote:
> This results in the same layout and location of the naca and hv data
> structures.
>
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> ---
> asm/asm-offsets.c | 2 --
> asm/head.S | 50 ------------------------------------------
> hdata/Makefile.inc | 2 +-
> hdata/hdata.h | 2 ++
> hdata/naca.c | 26 ++++++++++++++++++++++
> hdata/naca.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++
> hdata/spira.c | 11 ++++------
> hdata/spira.h | 2 ++
> include/mem-map.h | 2 ++
> skiboot.lds.S | 5 +++++
> 10 files changed, 96 insertions(+), 60 deletions(-)
> create mode 100644 hdata/naca.c
> create mode 100644 hdata/naca.h
.../...
> +++ 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
> @@ -1706,15 +1707,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 = SPIRAH_OFF;
> - *spira_offset = 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 eb5d1ea1b..14fbc5f59 100644
> --- a/hdata/spira.h
> +++ b/hdata/spira.h
> @@ -80,6 +80,8 @@ struct spira {
> u8 reserved[0x60];
> } __packed __align(0x100);
>
> +#define SPIRA_ACTUAL_SIZE (sizeof(struct spira) - 0x60)
Better to define macro for 0x60? Otherwise we may forget this is size of
reserved bytes in spira structure and miss to update whenever we make changes to
spira structure.
-Vasant
More information about the Skiboot
mailing list