hw/misc: Add nr_regs and cold_reset_values to NPCM GCR

These 2 values are different between NPCM7XX and NPCM8XX
GCRs. So we add them to the class and assign different values
to them.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Hao Wu <wuhaotsh@google.com>
Message-id: 20250219184609.1839281-7-wuhaotsh@google.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Hao Wu 2025-02-19 10:45:57 -08:00 committed by Peter Maydell
parent c99064e637
commit 8ca2021b9d
2 changed files with 27 additions and 13 deletions

View file

@ -18,6 +18,7 @@
#include "exec/memory.h"
#include "hw/sysbus.h"
#include "qom/object.h"
/*
* NPCM7XX PWRON STRAP bit fields
@ -53,6 +54,7 @@
* Number of registers in our device state structure. Don't change this without
* incrementing the version_id in the vmstate.
*/
#define NPCM_GCR_MAX_NR_REGS NPCM7XX_GCR_NR_REGS
#define NPCM7XX_GCR_NR_REGS (0x148 / sizeof(uint32_t))
typedef struct NPCMGCRState {
@ -60,15 +62,22 @@ typedef struct NPCMGCRState {
MemoryRegion iomem;
uint32_t regs[NPCM7XX_GCR_NR_REGS];
uint32_t regs[NPCM_GCR_MAX_NR_REGS];
uint32_t reset_pwron;
uint32_t reset_mdlr;
uint32_t reset_intcr3;
} NPCMGCRState;
typedef struct NPCMGCRClass {
SysBusDeviceClass parent;
size_t nr_regs;
const uint32_t *cold_reset_values;
} NPCMGCRClass;
#define TYPE_NPCM_GCR "npcm-gcr"
#define TYPE_NPCM7XX_GCR "npcm7xx-gcr"
OBJECT_DECLARE_SIMPLE_TYPE(NPCMGCRState, NPCM_GCR)
OBJECT_DECLARE_TYPE(NPCMGCRState, NPCMGCRClass, NPCM_GCR)
#endif /* NPCM_GCR_H */