Additional NPCM7xx devices and IPMI BMC emulation support
cover Additional NPCM7xx devices and IPMI BMC emulation support
This patch series include a few more NPCM7XX devices including
- Analog Digital Converter (ADC)
- Pulse Width Modulation (PWM)
- Keyboard Style Controller (KSC)
To utilize these modules we also add two extra functionalities:
1. We modified the CLK module to generate clock values using qdev_clock. These clocks are used to determine various clocks in NPCM7XX devices.
2. We added support for emulating IPMI responder devices in BMC machines, similar to the existing IPMI device support for CPU emulation. This allows a qemu instance running BMC firmware to serve as an external BMC for a qemu instance running server software. It utilizes the KCS module we implemented.
Hao Wu (7):
hw/misc: Add clock converter in NPCM7XX CLK module hw/timer: Refactor NPCM7XX Timer to use CLK clock hw/adc: Add an ADC module for NPCM7XX hw/misc: Add a PWM module for NPCM7XX hw/ipmi: Add an IPMI host interface hw/ipmi: Add a KCS Module for NPCM7XX hw/ipmi: Add an IPMI external host device
default-configs/devices/arm-softmmu.mak | 2 + docs/system/arm/nuvoton.rst | 6 +- hw/adc/meson.build | 1 + hw/adc/npcm7xx_adc.c | 318 ++++++++++ hw/arm/npcm7xx.c | 65 +- hw/ipmi/Kconfig | 5 + hw/ipmi/ipmi_host.c | 40 ++ hw/ipmi/ipmi_host_extern.c | 435 +++++++++++++ hw/ipmi/meson.build | 3 + hw/ipmi/npcm7xx_kcs.c | 570 +++++++++++++++++ hw/misc/meson.build | 1 + hw/misc/npcm7xx_clk.c | 795 +++++++++++++++++++++++- hw/misc/npcm7xx_pwm.c | 535 ++++++++++++++++ hw/timer/npcm7xx_timer.c | 25 +- include/hw/adc/npcm7xx_adc.h | 72 +++ include/hw/arm/npcm7xx.h | 6 + include/hw/ipmi/ipmi_host.h | 56 ++ include/hw/ipmi/ipmi_responder.h | 66 ++ include/hw/ipmi/npcm7xx_kcs.h | 105 ++++ include/hw/misc/npcm7xx_clk.h | 146 ++++- include/hw/misc/npcm7xx_pwm.h | 106 ++++ include/hw/timer/npcm7xx_timer.h | 1 + tests/qtest/meson.build | 4 +- tests/qtest/npcm7xx_adc-test.c | 400 ++++++++++++ tests/qtest/npcm7xx_pwm-test.c | 490 +++++++++++++++ 25 files changed, 4221 insertions(+), 32 deletions(-) create mode 100644 hw/adc/npcm7xx_adc.c create mode 100644 hw/ipmi/ipmi_host.c create mode 100644 hw/ipmi/ipmi_host_extern.c create mode 100644 hw/ipmi/npcm7xx_kcs.c create mode 100644 hw/misc/npcm7xx_pwm.c create mode 100644 include/hw/adc/npcm7xx_adc.h create mode 100644 include/hw/ipmi/ipmi_host.h create mode 100644 include/hw/ipmi/ipmi_responder.h create mode 100644 include/hw/ipmi/npcm7xx_kcs.h create mode 100644 include/hw/misc/npcm7xx_pwm.h create mode 100644 tests/qtest/npcm7xx_adc-test.c create mode 100644 tests/qtest/npcm7xx_pwm-test.c
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 1/7 hw/misc: Add clock converter in NPCM7XX CLK module
This patch allows NPCM7XX CLK module to compute clocks that are used by other NPCM7XX modules.
Add a new struct NPCM7xxClockConverterState which represents a single converter. Each clock converter in CLK module represents one converter in NPCM7XX CLK Module(PLL, SEL or Divider). Each converter takes one or more input clocks and converts them into one output clock. They form a clock hierarchy in the CLK module and are responsible for outputing clocks for various other modules in an NPCM7XX SoC.
Each converter has a function pointer called "convert" which represents the unique logic for that converter.
The clock contains two initialization information: ConverterInitInfo and ConverterConnectionInfo. They represent the vertices and edges in the clock diagram respectively.
--- hw/misc/npcm7xx_clk.c | 795 +++++++++++++++++++++++++++++++++- include/hw/misc/npcm7xx_clk.h | 140 +++++- 2 files changed, 927 insertions(+), 8 deletions(-)
hw/misc/npcm7xx_clk.c +789 -6
@@ -18,6 +18,7 @@#include "hw/misc/npcm7xx_clk.h" #include "hw/timer/npcm7xx_timer.h" +#include "hw/qdev-clock.h" #include "migration/vmstate.h" #include "qemu/error-report.h" #include "qemu/log.h"
@@ -27,9 +28,22 @@#include "trace.h" #include "sysemu/watchdog.h" +/* +* The reference clock hz, and the SECCNT and CNTR25M registers in this module, +* is always 25 MHz. +*/ +#define NPCM7XX_CLOCK_REF_HZ (25000000) + +/* Register Field Definitions */ +#define NPCM7XX_CLK_WDRCR_CA9C BIT(0)/* Cortex A9 Cores */ +#define PLLCON_LOKI BIT(31)#define PLLCON_LOKS BIT(30)#define PLLCON_PWDEN BIT(12) +#define PLLCON_FBDV (con) extract32((con), 16, 12) +#define PLLCON_OTDV2 (con) extract32((con), 13, 3) +#define PLLCON_OTDV1 (con) extract32((con), 8, 3) +#define PLLCON_INDV (con) extract32((con), 0, 6)enum NPCM7xxCLKRegisters {NPCM7XX_CLK_CLKEN1 ,
@@ -89,12 +103,609 @@ static const uint32_t cold_reset_values[NPCM7XX_CLK_NR_REGS] = { [NPCM7XX_CLK_AHBCKFI] = 0x000000c8, }; -/* Register Field Definitions */ -#define NPCM7XX_CLK_WDRCR_CA9C BIT(0)/* Cortex A9 Cores */ -/* The number of watchdogs that can trigger a reset. */ #define NPCM7XX_NR_WATCHDOGS (3) +/* Clock converter functions */ + +#define TYPE_NPCM7XX_CLOCK_PLL "npcm7xx-clock-pll" +#define NPCM7XX_CLOCK_PLL (obj) OBJECT_CHECK(NPCM7xxClockPLLState, \ + (obj), TYPE_NPCM7XX_CLOCK_PLL) +#define TYPE_NPCM7XX_CLOCK_SEL "npcm7xx-clock-sel" +#define NPCM7XX_CLOCK_SEL (obj) OBJECT_CHECK(NPCM7xxClockSELState, \ + (obj), TYPE_NPCM7XX_CLOCK_SEL) +#define TYPE_NPCM7XX_CLOCK_DIVIDER "npcm7xx-clock-divider" +#define NPCM7XX_CLOCK_DIVIDER (obj) OBJECT_CHECK(NPCM7xxClockDividerState, \ + (obj), TYPE_NPCM7XX_CLOCK_DIVIDER) + +static void npcm7xx_clk_update_pll (void *opaque) +{ +NPCM7xxClockPLLState *s = opaque; +uint32_t con = s->clk->regs[s->reg]; +uint64_t freq; + +/* The PLL is grounded if it is not locked yet. */ +if (con &PLLCON_LOKI ) { + freq =clock_get_hz (s->clock_in); + freq *=PLLCON_FBDV (con); + freq /=PLLCON_INDV (con) *PLLCON_OTDV1 (con) *PLLCON_OTDV2 (con); + }else { + freq =0 ; + } + +clock_update_hz (s->clock_out, freq); +} + +static void npcm7xx_clk_update_sel (void *opaque) +{ +NPCM7xxClockSELState *s = opaque; +uint32_t index =extract32 (s->clk->regs[NPCM7XX_CLK_CLKSEL ], s->offset, + s->len); + +if (index >= s->input_size) { +qemu_log_mask (LOG_GUEST_ERROR , +"%s: SEL index: %u out of range\n" , + __func__, index); + index =0 ; + } +clock_update_hz (s->clock_out,clock_get_hz (s->clock_in[index])); +} + +static void npcm7xx_clk_update_divider (void *opaque) +{ +NPCM7xxClockDividerState *s = opaque; +uint32_t freq; + + freq = s->divide (s); +clock_update_hz (s->clock_out, freq); +} + +static uint32_t divide_by_constant (NPCM7xxClockDividerState *s) +{ +return clock_get_hz (s->clock_in) / s->divisor; +} + +static uint32_t divide_by_reg_divisor (NPCM7xxClockDividerState *s) +{ +return clock_get_hz (s->clock_in) / + (extract32 (s->clk->regs[s->reg], s->offset, s->len) +1 ); +} + +static uint32_t divide_by_reg_divisor_times_2 (NPCM7xxClockDividerState *s) +{ +return divide_by_reg_divisor (s) /2 ; +} + +static uint32_t shift_by_reg_divisor (NPCM7xxClockDividerState *s) +{ +return clock_get_hz (s->clock_in) >> +extract32 (s->clk->regs[s->reg], s->offset, s->len); +} + +static NPCM7xxClockPLL find_pll_by_reg (enum NPCM7xxCLKRegisters reg) +{ +switch (reg) { +case NPCM7XX_CLK_PLLCON0 : +return NPCM7XX_CLOCK_PLL0 ; +case NPCM7XX_CLK_PLLCON1 : +return NPCM7XX_CLOCK_PLL1 ; +case NPCM7XX_CLK_PLLCON2 : +return NPCM7XX_CLOCK_PLL2 ; +case NPCM7XX_CLK_PLLCONG : +return NPCM7XX_CLOCK_PLLG ; +default : +g_assert_not_reached (); + } +} + +static void npcm7xx_clk_update_all_plls (NPCM7xxCLKState *clk) +{ +int i; + +for (i =0 ; i <NPCM7XX_CLOCK_NR_PLLS ; ++i) { +npcm7xx_clk_update_pll (&clk->plls[i]); + } +} + +static void npcm7xx_clk_update_all_sels (NPCM7xxCLKState *clk) +{ +int i; + +for (i =0 ; i <NPCM7XX_CLOCK_NR_SELS ; ++i) { +npcm7xx_clk_update_sel (&clk->sels[i]); + } +} + +static void npcm7xx_clk_update_all_dividers (NPCM7xxCLKState *clk) +{ +int i; + +for (i =0 ; i <NPCM7XX_CLOCK_NR_DIVIDERS ; ++i) { +npcm7xx_clk_update_divider (&clk->dividers[i]); + } +} + +static void npcm7xx_clk_update_all_clocks (NPCM7xxCLKState *clk) +{ +clock_update_hz (clk->clkref,NPCM7XX_CLOCK_REF_HZ ); +npcm7xx_clk_update_all_plls (clk); +npcm7xx_clk_update_all_sels (clk); +npcm7xx_clk_update_all_dividers (clk); +} + +/* Types of clock sources. */ +typedef enum ClockSrcType { +CLKSRC_REF , +CLKSRC_PLL , +CLKSRC_SEL , +CLKSRC_DIV , +}ClockSrcType ; + +typedef struct PLLInitInfo { +const char *name; +ClockSrcType src_type; +int src_index; +int reg; +const char *public_name; +}PLLInitInfo ; + +typedef struct SELInitInfo { +const char *name; +uint8_t input_size; +ClockSrcType src_type[NPCM7XX_CLK_SEL_MAX_INPUT ]; +int src_index[NPCM7XX_CLK_SEL_MAX_INPUT ]; +int offset; +int len; +const char *public_name; +}SELInitInfo ; + +typedef struct DividerInitInfo { +const char *name; +ClockSrcType src_type; +int src_index; +uint32_t (*divide)(NPCM7xxClockDividerState *s); +int reg;/* not used when type == CONSTANT */ +int offset;/* not used when type == CONSTANT */ +int len;/* not used when type == CONSTANT */ +int divisor;/* used only when type == CONSTANT */ +const char *public_name; +}DividerInitInfo ; + +static const PLLInitInfo pll_init_info_list[] = { + [NPCM7XX_CLOCK_PLL0 ] = { + .name ="pll0" , + .src_type =CLKSRC_REF , + .reg =NPCM7XX_CLK_PLLCON0 , + }, + [NPCM7XX_CLOCK_PLL1 ] = { + .name ="pll1" , + .src_type =CLKSRC_REF , + .reg =NPCM7XX_CLK_PLLCON1 , + }, + [NPCM7XX_CLOCK_PLL2 ] = { + .name ="pll2" , + .src_type =CLKSRC_REF , + .reg =NPCM7XX_CLK_PLLCON2 , + }, + [NPCM7XX_CLOCK_PLLG ] = { + .name ="pllg" , + .src_type =CLKSRC_REF , + .reg =NPCM7XX_CLK_PLLCONG , + }, +}; + +static const SELInitInfo sel_init_info_list[] = { + [NPCM7XX_CLOCK_PIXCKSEL ] = { + .name ="pixcksel" , + .input_size =2 , + .src_type = {CLKSRC_PLL ,CLKSRC_REF }, + .src_index = {NPCM7XX_CLOCK_PLLG ,0 }, + .offset =5 , + .len =1 , + .public_name ="pixel-clock" , + }, + [NPCM7XX_CLOCK_MCCKSEL ] = { + .name ="mccksel" , + .input_size =4 , + .src_type = {CLKSRC_DIV ,CLKSRC_REF ,CLKSRC_REF , +/*MCBPCK, shouldn't be used in normal operation*/ +CLKSRC_REF }, + .src_index = {NPCM7XX_CLOCK_PLL1D2 ,0 ,0 ,0 }, + .offset =12 , + .len =2 , + .public_name ="mc-phy-clock" , + }, + [NPCM7XX_CLOCK_CPUCKSEL ] = { + .name ="cpucksel" , + .input_size =4 , + .src_type = {CLKSRC_PLL ,CLKSRC_DIV ,CLKSRC_REF , +/*SYSBPCK, shouldn't be used in normal operation*/ +CLKSRC_REF }, + .src_index = {NPCM7XX_CLOCK_PLL0 ,NPCM7XX_CLOCK_PLL1D2 ,0 ,0 }, + .offset =0 , + .len =2 , + .public_name ="system-clock" , + }, + [NPCM7XX_CLOCK_CLKOUTSEL ] = { + .name ="clkoutsel" , + .input_size =5 , + .src_type = {CLKSRC_PLL ,CLKSRC_DIV ,CLKSRC_REF , +CLKSRC_PLL ,CLKSRC_DIV }, + .src_index = {NPCM7XX_CLOCK_PLL0 ,NPCM7XX_CLOCK_PLL1D2 ,0 , +NPCM7XX_CLOCK_PLLG ,NPCM7XX_CLOCK_PLL2D2 }, + .offset =18 , + .len =3 , + .public_name ="tock" , + }, + [NPCM7XX_CLOCK_UARTCKSEL ] = { + .name ="uartcksel" , + .input_size =4 , + .src_type = {CLKSRC_PLL ,CLKSRC_DIV ,CLKSRC_REF ,CLKSRC_DIV }, + .src_index = {NPCM7XX_CLOCK_PLL0 ,NPCM7XX_CLOCK_PLL1D2 ,0 , +NPCM7XX_CLOCK_PLL2D2 }, + .offset =8 , + .len =2 , + }, + [NPCM7XX_CLOCK_TIMCKSEL ] = { + .name ="timcksel" , + .input_size =4 , + .src_type = {CLKSRC_PLL ,CLKSRC_DIV ,CLKSRC_REF ,CLKSRC_DIV }, + .src_index = {NPCM7XX_CLOCK_PLL0 ,NPCM7XX_CLOCK_PLL1D2 ,0 , +NPCM7XX_CLOCK_PLL2D2 }, + .offset =14 , + .len =2 , + }, + [NPCM7XX_CLOCK_SDCKSEL ] = { + .name ="sdcksel" , + .input_size =4 , + .src_type = {CLKSRC_PLL ,CLKSRC_DIV ,CLKSRC_REF ,CLKSRC_DIV }, + .src_index = {NPCM7XX_CLOCK_PLL0 ,NPCM7XX_CLOCK_PLL1D2 ,0 , +NPCM7XX_CLOCK_PLL2D2 }, + .offset =6 , + .len =2 , + }, + [NPCM7XX_CLOCK_GFXMSEL ] = { + .name ="gfxmksel" , + .input_size =2 , + .src_type = {CLKSRC_REF ,CLKSRC_PLL }, + .src_index = {0 ,NPCM7XX_CLOCK_PLL2 }, + .offset =21 , + .len =1 , + }, + [NPCM7XX_CLOCK_SUCKSEL ] = { + .name ="sucksel" , + .input_size =4 , + .src_type = {CLKSRC_PLL ,CLKSRC_DIV ,CLKSRC_REF ,CLKSRC_DIV }, + .src_index = {NPCM7XX_CLOCK_PLL0 ,NPCM7XX_CLOCK_PLL1D2 ,0 , +NPCM7XX_CLOCK_PLL2D2 }, + .offset =10 , + .len =2 , + }, +}; + +static const DividerInitInfo divider_init_info_list[] = { + [NPCM7XX_CLOCK_PLL1D2 ] = { + .name ="pll1d2" , + .src_type =CLKSRC_PLL , + .src_index =NPCM7XX_CLOCK_PLL1 , + .divide = divide_by_constant, + .divisor =2 , + }, + [NPCM7XX_CLOCK_PLL2D2 ] = { + .name ="pll2d2" , + .src_type =CLKSRC_PLL , + .src_index =NPCM7XX_CLOCK_PLL2 , + .divide = divide_by_constant, + .divisor =2 , + }, + [NPCM7XX_CLOCK_MC_DIVIDER ] = { + .name ="mc-divider" , + .src_type =CLKSRC_SEL , + .src_index =NPCM7XX_CLOCK_MCCKSEL , + .divide = divide_by_constant, + .divisor =2 , + .public_name ="mc-clock" + }, + [NPCM7XX_CLOCK_AXI_DIVIDER ] = { + .name ="axi-divider" , + .src_type =CLKSRC_SEL , + .src_index =NPCM7XX_CLOCK_CPUCKSEL , + .divide = shift_by_reg_divisor, + .reg =NPCM7XX_CLK_CLKDIV1 , + .offset =0 , + .len =1 , + .public_name ="clk2" + }, + [NPCM7XX_CLOCK_AHB_DIVIDER ] = { + .name ="ahb-divider" , + .src_type =CLKSRC_DIV , + .src_index =NPCM7XX_CLOCK_AXI_DIVIDER , + .divide = divide_by_reg_divisor, + .reg =NPCM7XX_CLK_CLKDIV1 , + .offset =26 , + .len =2 , + .public_name ="clk4" + }, + [NPCM7XX_CLOCK_AHB3_DIVIDER ] = { + .name ="ahb3-divider" , + .src_type =CLKSRC_DIV , + .src_index =NPCM7XX_CLOCK_AHB_DIVIDER , + .divide = divide_by_reg_divisor, + .reg =NPCM7XX_CLK_CLKDIV1 , + .offset =6 , + .len =5 , + .public_name ="ahb3-spi3-clock" + }, + [NPCM7XX_CLOCK_SPI0_DIVIDER ] = { + .name ="spi0-divider" , + .src_type =CLKSRC_DIV , + .src_index =NPCM7XX_CLOCK_AHB_DIVIDER , + .divide = divide_by_reg_divisor, + .reg =NPCM7XX_CLK_CLKDIV3 , + .offset =6 , + .len =5 , + .public_name ="spi0-clock" , + }, + [NPCM7XX_CLOCK_SPIX_DIVIDER ] = { + .name ="spix-divider" , + .src_type =CLKSRC_DIV , + .src_index =NPCM7XX_CLOCK_AHB_DIVIDER , + .divide = divide_by_reg_divisor, + .reg =NPCM7XX_CLK_CLKDIV3 , + .offset =1 , + .len =5 , + .public_name ="spix-clock" , + }, + [NPCM7XX_CLOCK_APB1_DIVIDER ] = { + .name ="apb1-divider" , + .src_type =CLKSRC_DIV , + .src_index =NPCM7XX_CLOCK_AHB_DIVIDER , + .divide = shift_by_reg_divisor, + .reg =NPCM7XX_CLK_CLKDIV2 , + .offset =24 , + .len =2 , + .public_name ="apb1-clock" , + }, + [NPCM7XX_CLOCK_APB2_DIVIDER ] = { + .name ="apb2-divider" , + .src_type =CLKSRC_DIV , + .src_index =NPCM7XX_CLOCK_AHB_DIVIDER , + .divide = shift_by_reg_divisor, + .reg =NPCM7XX_CLK_CLKDIV2 , + .offset =26 , + .len =2 , + .public_name ="apb2-clock" , + }, + [NPCM7XX_CLOCK_APB3_DIVIDER ] = { + .name ="apb3-divider" , + .src_type =CLKSRC_DIV , + .src_index =NPCM7XX_CLOCK_AHB_DIVIDER , + .divide = shift_by_reg_divisor, + .reg =NPCM7XX_CLK_CLKDIV2 , + .offset =28 , + .len =2 , + .public_name ="apb3-clock" , + }, + [NPCM7XX_CLOCK_APB4_DIVIDER ] = { + .name ="apb4-divider" , + .src_type =CLKSRC_DIV , + .src_index =NPCM7XX_CLOCK_AHB_DIVIDER , + .divide = shift_by_reg_divisor, + .reg =NPCM7XX_CLK_CLKDIV2 , + .offset =30 , + .len =2 , + .public_name ="apb4-clock" , + }, + [NPCM7XX_CLOCK_APB5_DIVIDER ] = { + .name ="apb5-divider" , + .src_type =CLKSRC_DIV , + .src_index =NPCM7XX_CLOCK_AHB_DIVIDER , + .divide = shift_by_reg_divisor, + .reg =NPCM7XX_CLK_CLKDIV2 , + .offset =22 , + .len =2 , + .public_name ="apb5-clock" , + }, + [NPCM7XX_CLOCK_CLKOUT_DIVIDER ] = { + .name ="clkout-divider" , + .src_type =CLKSRC_SEL , + .src_index =NPCM7XX_CLOCK_CLKOUTSEL , + .divide = divide_by_reg_divisor, + .reg =NPCM7XX_CLK_CLKDIV2 , + .offset =16 , + .len =5 , + .public_name ="clkout" , + }, + [NPCM7XX_CLOCK_UART_DIVIDER ] = { + .name ="uart-divider" , + .src_type =CLKSRC_SEL , + .src_index =NPCM7XX_CLOCK_UARTCKSEL , + .divide = divide_by_reg_divisor, + .reg =NPCM7XX_CLK_CLKDIV1 , + .offset =16 , + .len =5 , + .public_name ="uart-clock" , + }, + [NPCM7XX_CLOCK_TIMER_DIVIDER ] = { + .name ="timer-divider" , + .src_type =CLKSRC_SEL , + .src_index =NPCM7XX_CLOCK_TIMCKSEL , + .divide = divide_by_reg_divisor, + .reg =NPCM7XX_CLK_CLKDIV1 , + .offset =21 , + .len =5 , + .public_name ="timer-clock" , + }, + [NPCM7XX_CLOCK_ADC_DIVIDER ] = { + .name ="adc-divider" , + .src_type =CLKSRC_DIV , + .src_index =NPCM7XX_CLOCK_TIMER_DIVIDER , + .divide = shift_by_reg_divisor, + .reg =NPCM7XX_CLK_CLKDIV1 , + .offset =28 , + .len =3 , + .public_name ="adc-clock" , + }, + [NPCM7XX_CLOCK_MMC_DIVIDER ] = { + .name ="mmc-divider" , + .src_type =CLKSRC_SEL , + .src_index =NPCM7XX_CLOCK_SDCKSEL , + .divide = divide_by_reg_divisor, + .reg =NPCM7XX_CLK_CLKDIV1 , + .offset =11 , + .len =5 , + .public_name ="mmc-clock" , + }, + [NPCM7XX_CLOCK_SDHC_DIVIDER ] = { + .name ="sdhc-divider" , + .src_type =CLKSRC_SEL , + .src_index =NPCM7XX_CLOCK_SDCKSEL , + .divide = divide_by_reg_divisor_times_2, + .reg =NPCM7XX_CLK_CLKDIV2 , + .offset =0 , + .len =4 , + .public_name ="sdhc-clock" , + }, + [NPCM7XX_CLOCK_GFXM_DIVIDER ] = { + .name ="gfxm-divider" , + .src_type =CLKSRC_SEL , + .src_index =NPCM7XX_CLOCK_GFXMSEL , + .divide = divide_by_constant, + .divisor =3 , + .public_name ="gfxm-clock" , + }, + [NPCM7XX_CLOCK_UTMI_DIVIDER ] = { + .name ="utmi-divider" , + .src_type =CLKSRC_SEL , + .src_index =NPCM7XX_CLOCK_SUCKSEL , + .divide = divide_by_reg_divisor, + .reg =NPCM7XX_CLK_CLKDIV2 , + .offset =8 , + .len =5 , + .public_name ="utmi-clock" , + }, +}; + +static void npcm7xx_clk_pll_init (Object *obj) +{ +NPCM7xxClockPLLState *pll =NPCM7XX_CLOCK_PLL (obj); + + pll->clock_in =qdev_init_clock_in (DEVICE (pll),"clock-in" , + npcm7xx_clk_update_pll, pll); + pll->clock_out =qdev_init_clock_out (DEVICE (pll),"clock-out" ); +} + +static void npcm7xx_clk_sel_init (Object *obj) +{ +int i; +NPCM7xxClockSELState *sel =NPCM7XX_CLOCK_SEL (obj); + +for (i =0 ; i <NPCM7XX_CLK_SEL_MAX_INPUT ; ++i) { + sel->clock_in[i] =qdev_init_clock_in (DEVICE (sel), +g_strdup_printf ("clock-in[%d]" , i), + npcm7xx_clk_update_sel, sel); + } + sel->clock_out =qdev_init_clock_out (DEVICE (sel),"clock-out" ); +} +static void npcm7xx_clk_divider_init (Object *obj) +{ +NPCM7xxClockDividerState *div =NPCM7XX_CLOCK_DIVIDER (obj); + + div->clock_in =qdev_init_clock_in (DEVICE (div),"clock-in" , + npcm7xx_clk_update_divider, div); + div->clock_out =qdev_init_clock_out (DEVICE (div),"clock-out" ); +} + +static void npcm7xx_init_clock_pll (NPCM7xxClockPLLState *pll, +NPCM7xxCLKState *clk,const PLLInitInfo *init_info) +{ + pll->name = init_info->name; + pll->clk = clk; + pll->reg = init_info->reg; +if (init_info->public_name !=NULL ) { +qdev_alias_clock (DEVICE (pll),"clock-out" ,DEVICE (clk), + init_info->public_name); + } +} + +static void npcm7xx_init_clock_sel (NPCM7xxClockSELState *sel, +NPCM7xxCLKState *clk,const SELInitInfo *init_info) +{ +int input_size = init_info->input_size; + + sel->name = init_info->name; + sel->clk = clk; + sel->input_size = init_info->input_size; +g_assert (input_size <=NPCM7XX_CLK_SEL_MAX_INPUT ); + sel->offset = init_info->offset; + sel->len = init_info->len; +if (init_info->public_name !=NULL ) { +qdev_alias_clock (DEVICE (sel),"clock-out" ,DEVICE (clk), + init_info->public_name); + } +} + +static void npcm7xx_init_clock_divider (NPCM7xxClockDividerState *div, +NPCM7xxCLKState *clk,const DividerInitInfo *init_info) +{ + div->name = init_info->name; + div->clk = clk; + + div->divide = init_info->divide; +if (div->divide == divide_by_constant) { + div->divisor = init_info->divisor; + }else { + div->reg = init_info->reg; + div->offset = init_info->offset; + div->len = init_info->len; + } +if (init_info->public_name !=NULL ) { +qdev_alias_clock (DEVICE (div),"clock-out" ,DEVICE (clk), + init_info->public_name); + } +} + +static Clock *npcm7xx_get_clock (NPCM7xxCLKState *clk,ClockSrcType type, +int index) +{ +switch (type) { +case CLKSRC_REF : +return clk->clkref; +case CLKSRC_PLL : +return clk->plls[index].clock_out; +case CLKSRC_SEL : +return clk->sels[index].clock_out; +case CLKSRC_DIV : +return clk->dividers[index].clock_out; +default : +g_assert_not_reached (); + } +} + +static void npcm7xx_connect_clocks (NPCM7xxCLKState *clk) +{ +int i, j; +Clock *src; + +for (i =0 ; i <NPCM7XX_CLOCK_NR_PLLS ; ++i) { + src =npcm7xx_get_clock (clk, pll_init_info_list[i].src_type, + pll_init_info_list[i].src_index); +clock_set_source (clk->plls[i].clock_in, src); + } +for (i =0 ; i <NPCM7XX_CLOCK_NR_SELS ; ++i) { +for (j =0 ; j < sel_init_info_list[i].input_size; ++j) { + src =npcm7xx_get_clock (clk, sel_init_info_list[i].src_type[j], + sel_init_info_list[i].src_index[j]); +clock_set_source (clk->sels[i].clock_in[j], src); + } + } +for (i =0 ; i <NPCM7XX_CLOCK_NR_DIVIDERS ; ++i) { + src =npcm7xx_get_clock (clk, divider_init_info_list[i].src_type, + divider_init_info_list[i].src_index); +clock_set_source (clk->dividers[i].clock_in, src); + } +} +static uint64_t npcm7xx_clk_read (void *opaque,hwaddr offset,unsigned size) {uint32_t reg = offset /sizeof (uint32_t );
@@ -129,7 +740,7 @@ static uint64_t npcm7xx_clk_read(void *opaque, hwaddr offset, unsigned size)* * The 4 LSBs are always zero: (1e9 / 640) << 4 = 25000000. */ - value = (((now_ns - s->ref_ns) /640 ) <<4 ) %NPCM7XX_TIMER_REF_HZ ; + value = (((now_ns - s->ref_ns) /640 ) <<4 ) %NPCM7XX_CLOCK_REF_HZ ;break ;default :
@@ -183,6 +794,20 @@ static void npcm7xx_clk_write(void *opaque, hwaddr offset, value |= (value &PLLCON_LOKS ); } } +/* Only update PLL when it is locked. */ +if (value &PLLCON_LOKI ) { +npcm7xx_clk_update_pll (&s->plls[find_pll_by_reg (reg)]); + } +break ; + +case NPCM7XX_CLK_CLKSEL : +npcm7xx_clk_update_all_sels (s); +break ; + +case NPCM7XX_CLK_CLKDIV1 : +case NPCM7XX_CLK_CLKDIV2 : +case NPCM7XX_CLK_CLKDIV3 : +npcm7xx_clk_update_all_dividers (s);break ;case NPCM7XX_CLK_CNTR25M :
@@ -234,6 +859,7 @@ static void npcm7xx_clk_enter_reset(Object *obj, ResetType type)case RESET_TYPE_COLD :memcpy (s->regs, cold_reset_values,sizeof (cold_reset_values)); s->ref_ns =qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ); +npcm7xx_clk_update_all_clocks (s);return ; }
@@ -245,6 +871,42 @@ static void npcm7xx_clk_enter_reset(Object *obj, ResetType type) __func__, type); } +static void npcm7xx_clk_init_clock_hierarchy (NPCM7xxCLKState *s) +{ +int i; + + s->clkref =qdev_init_clock_in (DEVICE (s),"clkref" ,NULL ,NULL ); + +/* First pass: init all converter modules */ +QEMU_BUILD_BUG_ON (ARRAY_SIZE (pll_init_info_list) !=NPCM7XX_CLOCK_NR_PLLS ); +QEMU_BUILD_BUG_ON (ARRAY_SIZE (sel_init_info_list) !=NPCM7XX_CLOCK_NR_SELS ); +QEMU_BUILD_BUG_ON (ARRAY_SIZE (divider_init_info_list) + !=NPCM7XX_CLOCK_NR_DIVIDERS ); +for (i =0 ; i <NPCM7XX_CLOCK_NR_PLLS ; ++i) { +object_initialize_child (OBJECT (s), pll_init_info_list[i].name, + &s->plls[i],TYPE_NPCM7XX_CLOCK_PLL ); +npcm7xx_init_clock_pll (&s->plls[i], s, + &pll_init_info_list[i]); + } +for (i =0 ; i <NPCM7XX_CLOCK_NR_SELS ; ++i) { +object_initialize_child (OBJECT (s), sel_init_info_list[i].name, + &s->sels[i],TYPE_NPCM7XX_CLOCK_SEL ); +npcm7xx_init_clock_sel (&s->sels[i], s, + &sel_init_info_list[i]); + } +for (i =0 ; i <NPCM7XX_CLOCK_NR_DIVIDERS ; ++i) { +object_initialize_child (OBJECT (s), divider_init_info_list[i].name, + &s->dividers[i],TYPE_NPCM7XX_CLOCK_DIVIDER ); +npcm7xx_init_clock_divider (&s->dividers[i], s, + ÷r_init_info_list[i]); + } + +/* Second pass: connect converter modules */ +npcm7xx_connect_clocks (s); + +clock_update_hz (s->clkref,NPCM7XX_CLOCK_REF_HZ ); +} +static void npcm7xx_clk_init (Object *obj) {NPCM7xxCLKState *s =NPCM7XX_CLK (obj);
@@ -252,21 +914,114 @@ static void npcm7xx_clk_init(Object *obj)memory_region_init_io (&s->iomem, obj, &npcm7xx_clk_ops, s,TYPE_NPCM7XX_CLK ,4 * KiB);sysbus_init_mmio (&s->parent, &s->iomem); +} + +static int npcm7xx_clk_post_load (void *opaque,int version_id) +{ +if (version_id >=1 ) { +NPCM7xxCLKState *clk = opaque; + +npcm7xx_clk_update_all_clocks (clk); + } + +return 0 ; +} + +static void npcm7xx_clk_realize (DeviceState *dev,Error **errp) +{ +int i; +NPCM7xxCLKState *s =NPCM7XX_CLK (dev); +qdev_init_gpio_in_named (DEVICE (s), npcm7xx_clk_perform_watchdog_reset,NPCM7XX_WATCHDOG_RESET_GPIO_IN ,NPCM7XX_NR_WATCHDOGS ); +npcm7xx_clk_init_clock_hierarchy (s); + +/* Realize child devices */ +for (i =0 ; i <NPCM7XX_CLOCK_NR_PLLS ; ++i) { +if (!qdev_realize (DEVICE (&s->plls[i]),NULL , errp)) { +return ; + } + } +for (i =0 ; i <NPCM7XX_CLOCK_NR_SELS ; ++i) { +if (!qdev_realize (DEVICE (&s->sels[i]),NULL , errp)) { +return ; + } + } +for (i =0 ; i <NPCM7XX_CLOCK_NR_DIVIDERS ; ++i) { +if (!qdev_realize (DEVICE (&s->dividers[i]),NULL , errp)) { +return ; + } + } } -static const VMStateDescription vmstate_npcm7xx_clk = { - .name ="npcm7xx-clk" , +static const VMStateDescription vmstate_npcm7xx_clk_pll = { + .name ="npcm7xx-clock-pll" , + .version_id =0 , + .minimum_version_id =0 , + .fields = (VMStateField []) { +VMSTATE_CLOCK (clock_in, NPCM7xxClockPLLState), +VMSTATE_END_OF_LIST (), + }, +}; + +static const VMStateDescription vmstate_npcm7xx_clk_sel = { + .name ="npcm7xx-clock-sel" , + .version_id =0 , + .minimum_version_id =0 , + .fields = (VMStateField []) { +VMSTATE_ARRAY_OF_POINTER_TO_STRUCT (clock_in, NPCM7xxClockSELState, +NPCM7XX_CLK_SEL_MAX_INPUT ,0 , vmstate_clock, Clock), +VMSTATE_END_OF_LIST (), + }, +}; + +static const VMStateDescription vmstate_npcm7xx_clk_divider = { + .name ="npcm7xx-clock-divider" , .version_id =0 , .minimum_version_id =0 , + .fields = (VMStateField []) { +VMSTATE_CLOCK (clock_in, NPCM7xxClockDividerState), +VMSTATE_END_OF_LIST (), + }, +}; + +static const VMStateDescription vmstate_npcm7xx_clk = { + .name ="npcm7xx-clk" , + .version_id =1 , + .minimum_version_id =1 , + .post_load = npcm7xx_clk_post_load, .fields = (VMStateField []) {VMSTATE_UINT32_ARRAY (regs, NPCM7xxCLKState,NPCM7XX_CLK_NR_REGS ),VMSTATE_INT64 (ref_ns, NPCM7xxCLKState), +VMSTATE_CLOCK (clkref, NPCM7xxCLKState),VMSTATE_END_OF_LIST (), }, }; +static void npcm7xx_clk_pll_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); + + dc->desc ="NPCM7xx Clock PLL Module" ; + dc->vmsd = &vmstate_npcm7xx_clk_pll; +} + +static void npcm7xx_clk_sel_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); + + dc->desc ="NPCM7xx Clock SEL Module" ; + dc->vmsd = &vmstate_npcm7xx_clk_sel; +} + +static void npcm7xx_clk_divider_class_init (ObjectClass *klass,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); + + dc->desc ="NPCM7xx Clock Divider Module" ; + dc->vmsd = &vmstate_npcm7xx_clk_divider; +} +static void npcm7xx_clk_class_init (ObjectClass *klass,void *data) {ResettableClass *rc =RESETTABLE_CLASS (klass);
@@ -276,9 +1031,34 @@ static void npcm7xx_clk_class_init(ObjectClass *klass, void *data) dc->desc ="NPCM7xx Clock Control Registers" ; dc->vmsd = &vmstate_npcm7xx_clk; + dc->realize = npcm7xx_clk_realize; rc->phases.enter = npcm7xx_clk_enter_reset; } +static const TypeInfo npcm7xx_clk_pll_info = { + .name =TYPE_NPCM7XX_CLOCK_PLL , + .parent =TYPE_DEVICE , + .instance_size =sizeof (NPCM7xxClockPLLState), + .instance_init = npcm7xx_clk_pll_init, + .class_init = npcm7xx_clk_pll_class_init, +}; + +static const TypeInfo npcm7xx_clk_sel_info = { + .name =TYPE_NPCM7XX_CLOCK_SEL , + .parent =TYPE_DEVICE , + .instance_size =sizeof (NPCM7xxClockSELState), + .instance_init = npcm7xx_clk_sel_init, + .class_init = npcm7xx_clk_sel_class_init, +}; + +static const TypeInfo npcm7xx_clk_divider_info = { + .name =TYPE_NPCM7XX_CLOCK_DIVIDER , + .parent =TYPE_DEVICE , + .instance_size =sizeof (NPCM7xxClockDividerState), + .instance_init = npcm7xx_clk_divider_init, + .class_init = npcm7xx_clk_divider_class_init, +}; +static const TypeInfo npcm7xx_clk_info = { .name =TYPE_NPCM7XX_CLK , .parent =TYPE_SYS_BUS_DEVICE ,
@@ -289,6 +1069,9 @@ static const TypeInfo npcm7xx_clk_info = {static void npcm7xx_clk_register_type (void ) { +type_register_static (&npcm7xx_clk_pll_info); +type_register_static (&npcm7xx_clk_sel_info); +type_register_static (&npcm7xx_clk_divider_info);type_register_static (&npcm7xx_clk_info); }type_init (npcm7xx_clk_register_type);
include/hw/misc/npcm7xx_clk.h +138 -2
160 lines not on this page · raw message
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 2/7 hw/timer: Refactor NPCM7XX Timer to use CLK clock
In reply to Hao Wu viaThis patch makes NPCM7XX Timer to use a the timer clock generated by the CLK module instead of the magic nubmer TIMER_REF_HZ.
--- hw/arm/npcm7xx.c | 5 +++++ hw/timer/npcm7xx_timer.c | 25 +++++++++++++++---------- include/hw/misc/npcm7xx_clk.h | 6 ------ include/hw/timer/npcm7xx_timer.h | 1 + 4 files changed, 21 insertions(+), 16 deletions(-)
hw/arm/npcm7xx.c +5 -0
@@ -22,6 +22,7 @@#include "hw/char/serial.h" #include "hw/loader.h" #include "hw/misc/unimp.h" +#include "hw/qdev-clock.h" #include "hw/qdev-properties.h" #include "qapi/error.h" #include "qemu/units.h"
@@ -420,6 +421,10 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)int first_irq;int j; +/* Connect the timer clock. */ +qdev_connect_clock_in (DEVICE (&s->tim[i]),"clock" ,qdev_get_clock_out ( +DEVICE (&s->clk),"timer-clock" )); +sysbus_realize (sbd, &error_abort);sysbus_mmio_map (sbd,0 , npcm7xx_tim_addr[i]);
hw/timer/npcm7xx_timer.c +15 -10
@@ -17,8 +17,8 @@#include "qemu/osdep.h" #include "hw/irq.h" +#include "hw/qdev-clock.h" #include "hw/qdev-properties.h" -#include "hw/misc/npcm7xx_clk.h" #include "hw/timer/npcm7xx_timer.h" #include "migration/vmstate.h" #include "qemu/bitops.h"
@@ -130,7 +130,7 @@ static int64_t npcm7xx_timer_count_to_ns(NPCM7xxTimer *t, uint32_t count) {int64_t ns = count; - ns *=NANOSECONDS_PER_SECOND /NPCM7XX_TIMER_REF_HZ ; + ns *=NANOSECONDS_PER_SECOND /clock_get_hz (t->ctrl->clock); ns *=npcm7xx_tcsr_prescaler (t->tcsr);return ns;
@@ -141,7 +141,7 @@ static uint32_t npcm7xx_timer_ns_to_count(NPCM7xxTimer *t, int64_t ns) {int64_t count; - count = ns / (NANOSECONDS_PER_SECOND /NPCM7XX_TIMER_REF_HZ ); + count = ns / (NANOSECONDS_PER_SECOND /clock_get_hz (t->ctrl->clock)); count /=npcm7xx_tcsr_prescaler (t->tcsr);return count;
@@ -166,8 +166,10 @@ static uint32_t npcm7xx_watchdog_timer_prescaler(const NPCM7xxWatchdogTimer *t)static void npcm7xx_watchdog_timer_reset_cycles (NPCM7xxWatchdogTimer *t,int64_t cycles) { +g_assert (clock_get_hz (t->ctrl->clock) ==25000000 );uint32_t prescaler =npcm7xx_watchdog_timer_prescaler (t); -int64_t ns = (NANOSECONDS_PER_SECOND /NPCM7XX_TIMER_REF_HZ ) * cycles; +int64_t ns = (NANOSECONDS_PER_SECOND /clock_get_hz (t->ctrl->clock)) + * cycles;/* * The reset function always clears the current timer. The caller of the
@@ -606,10 +608,11 @@ static void npcm7xx_timer_hold_reset(Object *obj)qemu_irq_lower (s->watchdog_timer.irq); } -static void npcm7xx_timer_realize (DeviceState *dev,Error **errp) +static void npcm7xx_timer_init (Object *obj) { -NPCM7xxTimerCtrlState *s =NPCM7XX_TIMER (dev); +NPCM7xxTimerCtrlState *s =NPCM7XX_TIMER (obj);SysBusDevice *sbd = &s->parent; +DeviceState *dev =DEVICE (obj);int i;NPCM7xxWatchdogTimer *w;
@@ -627,11 +630,12 @@ static void npcm7xx_timer_realize(DeviceState *dev, Error **errp) npcm7xx_watchdog_timer_expired, w);sysbus_init_irq (sbd, &w->irq); -memory_region_init_io (&s->iomem,OBJECT (s), &npcm7xx_timer_ops, s, +memory_region_init_io (&s->iomem, obj, &npcm7xx_timer_ops, s,TYPE_NPCM7XX_TIMER ,4 * KiB);sysbus_init_mmio (sbd, &s->iomem);qdev_init_gpio_out_named (dev, &w->reset_signal,NPCM7XX_WATCHDOG_RESET_GPIO_OUT ,1 ); + s->clock =qdev_init_clock_in (dev,"clock" ,NULL ,NULL ); }static const VMStateDescription vmstate_npcm7xx_base_timer = {
@@ -675,10 +679,11 @@ static const VMStateDescription vmstate_npcm7xx_watchdog_timer = {static const VMStateDescription vmstate_npcm7xx_timer_ctrl = { .name ="npcm7xx-timer-ctrl" , - .version_id =1 , - .minimum_version_id =1 , + .version_id =2 , + .minimum_version_id =2 , .fields = (VMStateField []) {VMSTATE_UINT32 (tisr, NPCM7xxTimerCtrlState), +VMSTATE_CLOCK (clock, NPCM7xxTimerCtrlState),VMSTATE_STRUCT_ARRAY (timer, NPCM7xxTimerCtrlState,NPCM7XX_TIMERS_PER_CTRL ,0 , vmstate_npcm7xx_timer, NPCM7xxTimer),
@@ -697,7 +702,6 @@ static void npcm7xx_timer_class_init(ObjectClass *klass, void *data)QEMU_BUILD_BUG_ON (NPCM7XX_TIMER_REGS_END >NPCM7XX_TIMER_NR_REGS ); dc->desc ="NPCM7xx Timer Controller" ; - dc->realize = npcm7xx_timer_realize; dc->vmsd = &vmstate_npcm7xx_timer_ctrl; rc->phases.enter = npcm7xx_timer_enter_reset; rc->phases.hold = npcm7xx_timer_hold_reset;
@@ -708,6 +712,7 @@ static const TypeInfo npcm7xx_timer_info = { .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(NPCM7xxTimerCtrlState), .class_init = npcm7xx_timer_class_init, + .instance_init = npcm7xx_timer_init, };static void npcm7xx_timer_register_type (void )
include/hw/misc/npcm7xx_clk.h +0 -6
@@ -20,12 +20,6 @@#include "hw/clock.h" #include "hw/sysbus.h" -/* -* The reference clock frequency for the timer modules, and the SECCNT and -* CNTR25M registers in this module, is always 25 MHz. -*/ -#define NPCM7XX_TIMER_REF_HZ (25000000) -/* * Number of registers in our device state structure. Don't change this without * incrementing the version_id in the vmstate.
include/hw/timer/npcm7xx_timer.h +1 -0
@@ -101,6 +101,7 @@ struct NPCM7xxTimerCtrlState {uint32_t tisr; +Clock *clock;NPCM7xxTimer timer[NPCM7XX_TIMERS_PER_CTRL ];NPCM7xxWatchdogTimer watchdog_timer; };
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 3/7 hw/adc: Add an ADC module for NPCM7XX
In reply to Hao Wu viaThe ADC is part of NPCM7XX Module. Its behavior is controled by the ADC_CON register. It converts one of the eight analog inputs into a digital input and stores it in the ADC_DATA register when enabled.
--- docs/system/arm/nuvoton.rst | 2 +- hw/adc/meson.build | 1 + hw/adc/npcm7xx_adc.c | 318 ++++++++++++++++++++++++++ hw/arm/npcm7xx.c | 24 +- include/hw/adc/npcm7xx_adc.h | 72 ++++++ include/hw/arm/npcm7xx.h | 2 + tests/qtest/meson.build | 3 +- tests/qtest/npcm7xx_adc-test.c | 400 +++++++++++++++++++++++++++++++++ 8 files changed, 819 insertions(+), 3 deletions(-) create mode 100644 hw/adc/npcm7xx_adc.c create mode 100644 include/hw/adc/npcm7xx_adc.h create mode 100644 tests/qtest/npcm7xx_adc-test.c
docs/system/arm/nuvoton.rst +1 -1
@@ -41,6 +41,7 @@ Supported devices * Random Number Generator (RNG) * USB host (USBH) * GPIO controller + * Analog to Digital Converter (ADC) Missing devices ---------------
@@ -58,7 +59,6 @@ Missing devices * USB device (USBD) * SMBus controller (SMBF) * Peripheral SPI controller (PSPI) - * Analog to Digital Converter (ADC) * SD/MMC host * PECI interface * Pulse Width Modulation (PWM)
hw/adc/meson.build +1 -0
@@ -1 +1,2 @@ softmmu_ss.add(when: 'CONFIG_STM32F2XX_ADC', if_true: files('stm32f2xx_adc.c')) +softmmu_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_adc.c'))
hw/adc/npcm7xx_adc.c new file +318 -0
318 lines not on this page · raw message
hw/arm/npcm7xx.c +23 -1
@@ -51,6 +51,9 @@#define NPCM7XX_EHCI_BA (0xf0806000)#define NPCM7XX_OHCI_BA (0xf0807000) +/* ADC Module */ +#define NPCM7XX_ADC_BA (0xf000c000) +/* Internal AHB SRAM */ #define NPCM7XX_RAM3_BA (0xc0008000)#define NPCM7XX_RAM3_SZ (4 * KiB)
@@ -61,6 +64,7 @@#define NPCM7XX_ROM_BA (0xffff0000)#define NPCM7XX_ROM_SZ (64 * KiB) +/* Clock configuration values to be fixed up when bypassing bootloader */ /* Run PLL1 at 1600 MHz */
@@ -73,6 +77,7 @@* interrupts. */ enum NPCM7xxInterrupt { +NPCM7XX_ADC_IRQ =0 ,NPCM7XX_UART0_IRQ =2 ,NPCM7XX_UART1_IRQ ,NPCM7XX_UART2_IRQ ,
@@ -296,6 +301,14 @@ static void npcm7xx_init_fuses(NPCM7xxState *s) sizeof(value)); } +static void npcm7xx_write_adc_calibration (NPCM7xxState *s) +{ +/* Both ADC and the fuse array must have realized. */ +QEMU_BUILD_BUG_ON (sizeof (s->adc.calibration_r_values) !=4 ); +npcm7xx_otp_array_write (&s->fuse_array, s->adc.calibration_r_values, +NPCM7XX_FUSE_ADC_CALIB ,sizeof (s->adc.calibration_r_values)); +} +static qemu_irq npcm7xx_irq (NPCM7xxState *s,int n) {return qdev_get_gpio_in (DEVICE (&s->a9mpcore), n);
@@ -322,6 +335,7 @@ static void npcm7xx_init(Object *obj) TYPE_NPCM7XX_FUSE_ARRAY);object_initialize_child (obj,"mc" , &s->mc,TYPE_NPCM7XX_MC );object_initialize_child (obj,"rng" , &s->rng,TYPE_NPCM7XX_RNG ); +object_initialize_child (obj,"adc" , &s->adc,TYPE_NPCM7XX_ADC );for (i =0 ; i <ARRAY_SIZE (s->tim); i++) {object_initialize_child (obj,"tim[*]" , &s->tim[i],TYPE_NPCM7XX_TIMER );
@@ -414,6 +428,15 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)sysbus_realize (SYS_BUS_DEVICE (&s->mc), &error_abort);sysbus_mmio_map (SYS_BUS_DEVICE (&s->mc),0 ,NPCM7XX_MC_BA ); +/* ADC Modules. Cannot fail. */ +qdev_connect_clock_in (DEVICE (&s->adc),"clock" ,qdev_get_clock_out ( +DEVICE (&s->clk),"adc-clock" )); +sysbus_realize (SYS_BUS_DEVICE (&s->adc), &error_abort); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->adc),0 ,NPCM7XX_ADC_BA ); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->adc),0 , +npcm7xx_irq (s,NPCM7XX_ADC_IRQ )); +npcm7xx_write_adc_calibration (s); +/* Timer Modules (TIM). Cannot fail. */ QEMU_BUILD_BUG_ON (ARRAY_SIZE (npcm7xx_tim_addr) !=ARRAY_SIZE (s->tim));for (i =0 ; i <ARRAY_SIZE (s->tim); i++) {
@@ -528,7 +551,6 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)create_unimplemented_device ("npcm7xx.vdmx" ,0xe0800000 ,4 * KiB);create_unimplemented_device ("npcm7xx.pcierc" ,0xe1000000 ,64 * KiB);create_unimplemented_device ("npcm7xx.kcs" ,0xf0007000 ,4 * KiB); -create_unimplemented_device ("npcm7xx.adc" ,0xf000c000 ,4 * KiB);create_unimplemented_device ("npcm7xx.gfxi" ,0xf000e000 ,4 * KiB);create_unimplemented_device ("npcm7xx.gpio[0]" ,0xf0010000 ,4 * KiB);create_unimplemented_device ("npcm7xx.gpio[1]" ,0xf0011000 ,4 * KiB);
include/hw/adc/npcm7xx_adc.h new file +72 -0
72 lines not on this page · raw message
include/hw/arm/npcm7xx.h +2 -0
@@ -17,6 +17,7 @@#define NPCM7XX_H #include "hw/boards.h" +#include "hw/adc/npcm7xx_adc.h" #include "hw/cpu/a9mpcore.h" #include "hw/gpio/npcm7xx_gpio.h" #include "hw/mem/npcm7xx_mc.h"
@@ -76,6 +77,7 @@ typedef struct NPCM7xxState {NPCM7xxGCRState gcr;NPCM7xxCLKState clk;NPCM7xxTimerCtrlState tim[3 ]; +NPCM7xxADCState adc;NPCM7xxOTPState key_storage;NPCM7xxOTPState fuse_array;NPCM7xxMCState mc;
tests/qtest/meson.build +2 -1
@@ -134,7 +134,8 @@ qtests_sparc64 = \ ['prom-env-test', 'boot-serial-test'] qtests_npcm7xx = \ - ['npcm7xx_gpio-test', + ['npcm7xx_adc-test', + 'npcm7xx_gpio-test', 'npcm7xx_rng-test', 'npcm7xx_timer-test', 'npcm7xx_watchdog_timer-test']
tests/qtest/npcm7xx_adc-test.c new file +400 -0
400 lines not on this page · raw message
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 4/7 hw/misc: Add a PWM module for NPCM7XX
In reply to Hao Wu viaThe PWM module is part of NPCM7XX module. Each NPCM7XX module has two identical PWM modules. Each module contains 4 PWM entries. Each PWM has two outputs: frequency and duty_cycle. Both are computed using inputs from software side.
This module does not model detail pulse signals since it is expensive. It also does not model interrupts and watchdogs that are dependant on the detail models. The interfaces for these are left in the module so that anyone in need for these functionalities can implement on their own.
--- docs/system/arm/nuvoton.rst | 2 +- hw/arm/npcm7xx.c | 26 +- hw/misc/meson.build | 1 + hw/misc/npcm7xx_pwm.c | 535 +++++++++++++++++++++++++++++++++ include/hw/arm/npcm7xx.h | 2 + include/hw/misc/npcm7xx_pwm.h | 106 +++++++ tests/qtest/meson.build | 1 + tests/qtest/npcm7xx_pwm-test.c | 490 ++++++++++++++++++++++++++++++ 8 files changed, 1160 insertions(+), 3 deletions(-) create mode 100644 hw/misc/npcm7xx_pwm.c create mode 100644 include/hw/misc/npcm7xx_pwm.h create mode 100644 tests/qtest/npcm7xx_pwm-test.c
docs/system/arm/nuvoton.rst +1 -1
@@ -42,6 +42,7 @@ Supported devices * USB host (USBH) * GPIO controller * Analog to Digital Converter (ADC) + * Pulse Width Modulation (PWM) Missing devices ---------------
@@ -61,7 +62,6 @@ Missing devices * Peripheral SPI controller (PSPI) * SD/MMC host * PECI interface - * Pulse Width Modulation (PWM) * Tachometer * PCI and PCIe root complex and bridges * VDM and MCTP support
hw/arm/npcm7xx.c +24 -2
@@ -102,6 +102,8 @@ enum NPCM7xxInterrupt {NPCM7XX_WDG2_IRQ ,/* Timer Module 2 Watchdog */ NPCM7XX_EHCI_IRQ =61 ,NPCM7XX_OHCI_IRQ =62 , +NPCM7XX_PWM0_IRQ =93 ,/* PWM module 0 */ +NPCM7XX_PWM1_IRQ ,/* PWM module 1 */ NPCM7XX_GPIO0_IRQ =116 ,NPCM7XX_GPIO1_IRQ , NPCM7XX_GPIO2_IRQ,
@@ -144,6 +146,12 @@ static const hwaddr npcm7xx_fiu3_flash_addr[] = { 0xb8000000, /* CS3 */ }; +/* Register base address for each PWM Module */ +static const hwaddr npcm7xx_pwm_addr[] = { +0xf0103000 , +0xf0104000 , +}; + static const struct { hwaddr regs_addr; uint32_t unconnected_pins;
@@ -353,6 +361,10 @@ static void npcm7xx_init(Object *obj)object_initialize_child (obj, npcm7xx_fiu[i].name, &s->fiu[i],TYPE_NPCM7XX_FIU ); } + +for (i =0 ; i <ARRAY_SIZE (s->pwm); i++) { +object_initialize_child (obj,"pwm[*]" , &s->pwm[i],TYPE_NPCM7XX_PWM ); + } }static void npcm7xx_realize (DeviceState *dev,Error **errp)
@@ -513,6 +525,18 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)sysbus_connect_irq (SYS_BUS_DEVICE (&s->ohci),0 ,npcm7xx_irq (s,NPCM7XX_OHCI_IRQ )); +/* PWM Modules. Cannot fail. */ +QEMU_BUILD_BUG_ON (ARRAY_SIZE (npcm7xx_pwm_addr) !=ARRAY_SIZE (s->pwm)); +for (i =0 ; i <ARRAY_SIZE (s->pwm); i++) { +SysBusDevice *sbd =SYS_BUS_DEVICE (&s->pwm[i]); + +qdev_connect_clock_in (DEVICE (&s->pwm[i]),"clock" ,qdev_get_clock_out ( +DEVICE (&s->clk),"apb3-clock" )); +sysbus_realize (sbd, &error_abort); +sysbus_mmio_map (sbd,0 , npcm7xx_pwm_addr[i]); +sysbus_connect_irq (sbd, i,npcm7xx_irq (s,NPCM7XX_PWM0_IRQ + i)); + } +/* * Flash Interface Unit (FIU). Can fail if incorrect number of chip selects * specified, but this is a programming error.
@@ -580,8 +604,6 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)create_unimplemented_device ("npcm7xx.peci" ,0xf0100000 ,4 * KiB);create_unimplemented_device ("npcm7xx.siox[1]" ,0xf0101000 ,4 * KiB);create_unimplemented_device ("npcm7xx.siox[2]" ,0xf0102000 ,4 * KiB); -create_unimplemented_device ("npcm7xx.pwm[0]" ,0xf0103000 ,4 * KiB); -create_unimplemented_device ("npcm7xx.pwm[1]" ,0xf0104000 ,4 * KiB);create_unimplemented_device ("npcm7xx.mft[0]" ,0xf0180000 ,4 * KiB);create_unimplemented_device ("npcm7xx.mft[1]" ,0xf0181000 ,4 * KiB);create_unimplemented_device ("npcm7xx.mft[2]" ,0xf0182000 ,4 * KiB);
hw/misc/meson.build +1 -0
@@ -64,6 +64,7 @@ softmmu_ss.add(when: 'CONFIG_MAINSTONE', if_true: files('mst_fpga.c')) softmmu_ss.add(when: 'CONFIG_NPCM7XX', if_true: files( 'npcm7xx_clk.c', 'npcm7xx_gcr.c', + 'npcm7xx_pwm.c', 'npcm7xx_rng.c', )) softmmu_ss.add(when: 'CONFIG_OMAP', if_true: files(
hw/misc/npcm7xx_pwm.c new file +535 -0
535 lines not on this page · raw message
include/hw/arm/npcm7xx.h +2 -0
@@ -23,6 +23,7 @@#include "hw/mem/npcm7xx_mc.h" #include "hw/misc/npcm7xx_clk.h" #include "hw/misc/npcm7xx_gcr.h" +#include "hw/misc/npcm7xx_pwm.h" #include "hw/misc/npcm7xx_rng.h" #include "hw/nvram/npcm7xx_otp.h" #include "hw/timer/npcm7xx_timer.h"
@@ -78,6 +79,7 @@ typedef struct NPCM7xxState {NPCM7xxCLKState clk;NPCM7xxTimerCtrlState tim[3 ];NPCM7xxADCState adc; +NPCM7xxPWMState pwm[2 ];NPCM7xxOTPState key_storage;NPCM7xxOTPState fuse_array;NPCM7xxMCState mc;
include/hw/misc/npcm7xx_pwm.h new file +106 -0
106 lines not on this page · raw message
tests/qtest/meson.build +1 -0
@@ -136,6 +136,7 @@ qtests_sparc64 = \ qtests_npcm7xx = \ ['npcm7xx_adc-test', 'npcm7xx_gpio-test', + 'npcm7xx_pwm-test', 'npcm7xx_rng-test', 'npcm7xx_timer-test', 'npcm7xx_watchdog_timer-test']
tests/qtest/npcm7xx_pwm-test.c new file +490 -0
490 lines not on this page · raw message
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 5/7 hw/ipmi: Add an IPMI host interface
In reply to Hao Wu viaThe IPMI host interface is used to emulate IPMI related devices on a System-on-Chip (SoC) used for Baseband Management Controller (BMC). This interface consists of two components: IPMI host and IPMI responder. An IPMI responder is a device to intercept reads and writes to the system interface registers in the host. An IPMI host emulates the host behavior on a BMC emulation.
For more information see docs/spec/ipmi.rst.
--- default-configs/devices/arm-softmmu.mak | 2 + hw/ipmi/Kconfig | 5 ++ hw/ipmi/ipmi_host.c | 40 +++++++++++++++ hw/ipmi/meson.build | 1 + include/hw/ipmi/ipmi_host.h | 56 +++++++++++++++++++++ include/hw/ipmi/ipmi_responder.h | 66 +++++++++++++++++++++++++ 6 files changed, 170 insertions(+) create mode 100644 hw/ipmi/ipmi_host.c create mode 100644 include/hw/ipmi/ipmi_host.h create mode 100644 include/hw/ipmi/ipmi_responder.h
default-configs/devices/arm-softmmu.mak +2 -0
@@ -27,6 +27,8 @@ CONFIG_GUMSTIX=y CONFIG_SPITZ=y CONFIG_TOSA=y CONFIG_Z2=y +CONFIG_IPMI=y +CONFIG_IPMI_HOST=y CONFIG_NPCM7XX=y CONFIG_COLLIE=y CONFIG_ASPEED_SOC=y
hw/ipmi/Kconfig +5 -0
@@ -6,6 +6,11 @@ config IPMI_LOCAL default y depends on IPMI +config IPMI_HOST + bool + default y + depends on IPMI + config IPMI_EXTERN bool default y
hw/ipmi/ipmi_host.c new file +40 -0
@@ -0,0 +1,40 @@ +/* +* IPMI Host emulation +* +* Copyright 2020 Google LLC +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* for more details. +*/ + +#include "hw/ipmi/ipmi_host.h" +#include "hw/ipmi/ipmi_responder.h" + +static TypeInfo ipmi_responder_type_info = { + .name =TYPE_IPMI_RESPONDER , + .parent =TYPE_INTERFACE , + .class_size =sizeof (IPMIResponderClass), +}; + +static TypeInfo ipmi_host_type_info = { + .name =TYPE_IPMI_HOST , + .parent =TYPE_DEVICE , + .instance_size =sizeof (IPMIHost), + .abstract = true, + .class_size =sizeof (IPMIHostClass), +}; + +static void ipmi_register_types (void ) +{ +type_register_static (&ipmi_responder_type_info); +type_register_static (&ipmi_host_type_info); +} + +type_init (ipmi_register_types)
hw/ipmi/meson.build +1 -0
@@ -7,5 +7,6 @@ ipmi_ss.add(when: 'CONFIG_PCI_IPMI_KCS', if_true: files('pci_ipmi_kcs.c')) ipmi_ss.add(when: 'CONFIG_ISA_IPMI_BT', if_true: files('isa_ipmi_bt.c')) ipmi_ss.add(when: 'CONFIG_PCI_IPMI_BT', if_true: files('pci_ipmi_bt.c')) ipmi_ss.add(when: 'CONFIG_IPMI_SSIF', if_true: files('smbus_ipmi.c')) +ipmi_ss.add(when: 'CONFIG_IPMI_HOST', if_true: files('ipmi_host.c')) softmmu_ss.add_all(when: 'CONFIG_IPMI', if_true: ipmi_ss)
include/hw/ipmi/ipmi_host.h new file +56 -0
56 lines not on this page · raw message
include/hw/ipmi/ipmi_responder.h new file +66 -0
66 lines not on this page · raw message
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 6/7 hw/ipmi: Add a KCS Module for NPCM7XX
In reply to Hao Wu viaAdd a KCS module for NPCM7xx SoC. This module implements the IPMI responder interface and is responsible to communicate with an external host via the KCS channels in an NPCM7xx SoC.
--- docs/system/arm/nuvoton.rst | 2 +- hw/arm/npcm7xx.c | 10 +- hw/ipmi/meson.build | 1 + hw/ipmi/npcm7xx_kcs.c | 570 ++++++++++++++++++++++++++++++++++ include/hw/arm/npcm7xx.h | 2 + include/hw/ipmi/npcm7xx_kcs.h | 105 +++++++ 6 files changed, 688 insertions(+), 2 deletions(-) create mode 100644 hw/ipmi/npcm7xx_kcs.c create mode 100644 include/hw/ipmi/npcm7xx_kcs.h
docs/system/arm/nuvoton.rst +1 -1
@@ -43,6 +43,7 @@ Supported devices * GPIO controller * Analog to Digital Converter (ADC) * Pulse Width Modulation (PWM) + * Keyboard Controller Style (KCS) channels Missing devices ---------------
@@ -50,7 +51,6 @@ Missing devices * LPC/eSPI host-to-BMC interface, including * Keyboard and mouse controller interface (KBCI) - * Keyboard Controller Style (KCS) channels * BIOS POST code FIFO * System Wake-up Control (SWC) * Shared memory (SHM)
hw/arm/npcm7xx.c +9 -1
@@ -46,6 +46,7 @@#define NPCM7XX_CLK_BA (0xf0801000)#define NPCM7XX_MC_BA (0xf0824000)#define NPCM7XX_RNG_BA (0xf000b000) +#define NPCM7XX_KCS_BA (0xf0007000)/* USB Host modules */ #define NPCM7XX_EHCI_BA (0xf0806000)
@@ -82,6 +83,7 @@ enum NPCM7xxInterrupt {NPCM7XX_UART1_IRQ ,NPCM7XX_UART2_IRQ ,NPCM7XX_UART3_IRQ , +NPCM7XX_KCS_HIB_IRQ =9 ,NPCM7XX_TIMER0_IRQ =32 ,/* Timer Module 0 */ NPCM7XX_TIMER1_IRQ , NPCM7XX_TIMER2_IRQ,
@@ -353,6 +355,7 @@ static void npcm7xx_init(Object *obj)object_initialize_child (obj,"gpio[*]" , &s->gpio[i],TYPE_NPCM7XX_GPIO ); } +object_initialize_child (obj,"kcs" , &s->kcs,TYPE_NPCM7XX_KCS );object_initialize_child (obj,"ehci" , &s->ehci,TYPE_NPCM7XX_EHCI );object_initialize_child (obj,"ohci" , &s->ohci,TYPE_SYSBUS_OHCI );
@@ -509,6 +512,12 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp) npcm7xx_irq(s, NPCM7XX_GPIO0_IRQ + i)); } +/* KCS modules. Cannot fail. */ +sysbus_realize (SYS_BUS_DEVICE (&s->kcs), &error_abort); +sysbus_mmio_map (SYS_BUS_DEVICE (&s->kcs),0 ,NPCM7XX_KCS_BA ); +sysbus_connect_irq (SYS_BUS_DEVICE (&s->kcs),0 , +npcm7xx_irq (s,NPCM7XX_KCS_HIB_IRQ )); +/* USB Host */ object_property_set_bool (OBJECT (&s->ehci),"companion-enable" , true, &error_abort);
@@ -574,7 +583,6 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)create_unimplemented_device ("npcm7xx.shm" ,0xc0001000 ,4 * KiB);create_unimplemented_device ("npcm7xx.vdmx" ,0xe0800000 ,4 * KiB);create_unimplemented_device ("npcm7xx.pcierc" ,0xe1000000 ,64 * KiB); -create_unimplemented_device ("npcm7xx.kcs" ,0xf0007000 ,4 * KiB);create_unimplemented_device ("npcm7xx.gfxi" ,0xf000e000 ,4 * KiB);create_unimplemented_device ("npcm7xx.gpio[0]" ,0xf0010000 ,4 * KiB);create_unimplemented_device ("npcm7xx.gpio[1]" ,0xf0011000 ,4 * KiB);
hw/ipmi/meson.build +1 -0
@@ -8,5 +8,6 @@ ipmi_ss.add(when: 'CONFIG_ISA_IPMI_BT', if_true: files('isa_ipmi_bt.c')) ipmi_ss.add(when: 'CONFIG_PCI_IPMI_BT', if_true: files('pci_ipmi_bt.c')) ipmi_ss.add(when: 'CONFIG_IPMI_SSIF', if_true: files('smbus_ipmi.c')) ipmi_ss.add(when: 'CONFIG_IPMI_HOST', if_true: files('ipmi_host.c')) +ipmi_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_kcs.c')) softmmu_ss.add_all(when: 'CONFIG_IPMI', if_true: ipmi_ss)
hw/ipmi/npcm7xx_kcs.c new file +570 -0
570 lines not on this page · raw message
include/hw/arm/npcm7xx.h +2 -0
@@ -20,6 +20,7 @@#include "hw/adc/npcm7xx_adc.h" #include "hw/cpu/a9mpcore.h" #include "hw/gpio/npcm7xx_gpio.h" +#include "hw/ipmi/npcm7xx_kcs.h" #include "hw/mem/npcm7xx_mc.h" #include "hw/misc/npcm7xx_clk.h" #include "hw/misc/npcm7xx_gcr.h"
@@ -85,6 +86,7 @@ typedef struct NPCM7xxState {NPCM7xxMCState mc;NPCM7xxRNGState rng;NPCM7xxGPIOState gpio[8 ]; +NPCM7xxKCSState kcs;EHCISysBusState ehci;OHCISysBusState ohci;NPCM7xxFIUState fiu[2 ];
include/hw/ipmi/npcm7xx_kcs.h new file +105 -0
105 lines not on this page · raw message
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
PATCH 7/7 hw/ipmi: Add an IPMI external host device
In reply to Hao Wu viaThe IPMI external host device works for Baseband Management Controller (BMC) emulations. It works as a representation of a host class that connects to a given BMC. It can connect to a real host hardware or a emulated or simulated host device. In particular it can connect to a host QEMU instance with device ipmi-bmc-extern.
For more details of IPMI host device in BMC emulation, see docs/specs/ipmi.rst.
--- hw/ipmi/ipmi_host_extern.c | 435 +++++++++++++++++++++++++++++++++++++ hw/ipmi/meson.build | 1 + 2 files changed, 436 insertions(+) create mode 100644 hw/ipmi/ipmi_host_extern.c
hw/ipmi/ipmi_host_extern.c new file +435 -0
@@ -0,0 +1,435 @@ +/* +* IPMI Host external connection +* +* Copyright 2020 Google LLC +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* for more details. +*/ + +/* +* This is designed to connect to a host QEMU VM that runs ipmi_bmc_extern. +*/ + +#include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "qemu/module.h" +#include "qapi/error.h" +#include "qemu/timer.h" +#include "chardev/char-fe.h" +#include "hw/ipmi/ipmi.h" +#include "hw/ipmi/ipmi_host.h" +#include "hw/ipmi/ipmi_responder.h" +#include "hw/qdev-properties.h" +#include "migration/vmstate.h" + +#define VM_MSG_CHAR 0xA0/* Marks end of message */ +#define VM_CMD_CHAR 0xA1/* Marks end of a command */ +#define VM_ESCAPE_CHAR 0xAA/* Set bit 4 from the next byte to 0 */ + +#define VM_PROTOCOL_VERSION 1 +#define VM_CMD_VERSION 0xff/* A version number byte follows */ +#define VM_CMD_RESET 0x04 +#define VM_CMD_CAPABILITIES 0x08 + +#define TYPE_IPMI_HOST_EXTERN "ipmi-host-extern" +#define IPMI_HOST_EXTERN (obj) OBJECT_CHECK(IPMIHostExtern, (obj), \ + TYPE_IPMI_HOST_EXTERN) + +typedef struct IPMIHostExtern { +IPMIHost parent; +CharBackend chr; +struct QEMUTimer *extern_timer; + +bool connected; +uint8_t capability; + +unsigned char inbuf[MAX_IPMI_MSG_SIZE +2 ]; +unsigned int inpos; +bool in_escape; +bool in_too_many; +bool sending_cmd; + +unsigned char outbuf[(MAX_IPMI_MSG_SIZE +2 ) *2 +1 ]; +unsigned int outpos; +unsigned int outlen; +}IPMIHostExtern ; + +static unsigned char +ipmb_checksum (const unsigned char *data,int size,unsigned char start) +{ +unsigned char csum = start; + +for (; size >0 ; size--, data++) { + csum += *data; + } +return csum; +} + +static void continue_send (IPMIHostExtern *ihe) +{ +int ret; + +if (ihe->outlen ==0 ) { +return ; + } + ret =qemu_chr_fe_write (&ihe->chr, ihe->outbuf + ihe->outpos, + ihe->outlen - ihe->outpos); +if (ret >0 ) { + ihe->outpos += ret; + } +if (ihe->outpos < ihe->outlen) { +/* Not fully transmitted, try again in a 10ms */ +timer_mod_ns (ihe->extern_timer, +qemu_clock_get_ns (QEMU_CLOCK_VIRTUAL ) +10000000 ); + }else { +/* Sent */ + ihe->outlen =0 ; + ihe->outpos =0 ; + } +} + +static void extern_timeout (void *opaque) +{ +IPMIHostExtern *ihe = opaque; + +if (ihe->connected) { +continue_send (ihe); + } +} + +static void addchar (IPMIHostExtern *ihe,unsigned char ch) +{ +switch (ch) { +case VM_MSG_CHAR : +case VM_CMD_CHAR : +case VM_ESCAPE_CHAR : +/* Escape the special characters. */ + ihe->outbuf[ihe->outlen++] =VM_ESCAPE_CHAR ; + ch |=0x10 ; +/* fall through */ +default : + ihe->outbuf[ihe->outlen++] = ch; + } +} + +static void send_version (IPMIHostExtern *ihe) +{ +addchar (ihe,VM_CMD_VERSION ); +addchar (ihe,VM_PROTOCOL_VERSION ); + ihe->outbuf[ihe->outlen++] =VM_CMD_CHAR ; +continue_send (ihe); +} + +/* +* Handle a command (typically IPMI response) from IPMI responder +* and send it out to the external host. +*/ +static void ipmi_host_extern_handle_command (IPMIHost *h,uint8_t *cmd, +unsigned cmd_len,unsigned max_cmd_len,uint8_t msg_id) +{ +IPMIHostExtern *ihe =IPMI_HOST_EXTERN (h); +uint8_t err =0 , csum; +int i; + +if (!ihe->connected) { +/* We are not connected to external host. Just do nothing. */ +return ; + } +addchar (ihe, msg_id); +/* If it's too short or it was truncated, return an error. */ +if (cmd_len <2 ) { + err =IPMI_CC_REQUEST_DATA_LENGTH_INVALID ; + }else if ((cmd_len > max_cmd_len) || (cmd_len >MAX_IPMI_MSG_SIZE )) { + err =IPMI_CC_REQUEST_DATA_TRUNCATED ; + } +if (err) { +/* Send out the error message */ +unsigned char rsp[3 ]; + + rsp[0 ] = cmd[0 ] |0x04 ; + rsp[1 ] = cmd[1 ]; + rsp[2 ] = err; +for (i =0 ; i <3 ; ++i) { +addchar (ihe, rsp[i]); + } + csum =ipmb_checksum (&msg_id,1 ,0 ); +addchar (ihe, -ipmb_checksum (rsp,3 , csum)); + }else { +for (i =0 ; i < cmd_len; i++) { +addchar (ihe, cmd[i]); + } + csum =ipmb_checksum (&msg_id,1 ,0 ); +addchar (ihe, -ipmb_checksum (cmd, cmd_len, csum)); + } + + ihe->outbuf[ihe->outlen++] =VM_MSG_CHAR ; + +/* Start the transmit */ +continue_send (ihe); +} + +/* +* This function handles an IPMI message received from an external host by +* sending it to the IPMI responder class. +*/ +static void handle_msg (IPMIHostExtern *ihe) +{ +IPMIResponderClass *k =IPMI_RESPONDER_GET_CLASS (ihe->parent.responder); +if (unlikely (ihe->in_escape)) { +ipmi_debug ("msg escape not ended\n" ); +return ; + } +if (unlikely (ihe->inpos <4 )) { +ipmi_debug ("msg too short\n" ); +return ; + } +if (unlikely (ihe->in_too_many)) { + ihe->inbuf[3 ] =IPMI_CC_REQUEST_DATA_TRUNCATED ; + ihe->inpos =4 ; + }else if (unlikely (ipmb_checksum (ihe->inbuf, ihe->inpos,0 ) !=0 )) { +ipmi_debug ("msg checksum failure\n" ); +return ; + }else { + ihe->inpos--;/* Remove checkum */ + } + + k->handle_req (ihe->parent.responder, ihe->inbuf[0 ], ihe->inbuf +1 , + ihe->inpos -1 ); +} + +/* This function handles a control command from the host. */ +static void handle_command (IPMIHostExtern *ihe) +{ +uint8_t cmd; + +if (unlikely (ihe->in_too_many)) { +ipmi_debug ("cmd in too many\n" ); +return ; + } + +if (unlikely (ihe->in_escape)) { +ipmi_debug ("cmd ends with escape character\n" ); +return ; + } + +if (unlikely (ihe->inpos <1 )) { +ipmi_debug ("empty command.\n" ); +return ; + } + + cmd = ihe->inbuf[0 ]; +switch (cmd) { +case VM_CMD_VERSION : +/* The host informs us the protocol version. */ +if (unlikely (ihe->inpos <2 )) { +ipmi_debug ("Host cmd version truncated.\n" ); +break ; + } +if (unlikely (ihe->inbuf[1 ] !=VM_PROTOCOL_VERSION )) { +ipmi_debug ("Host protocol version %u is different from our version" +" %u\n" , ihe->inbuf[1 ],VM_PROTOCOL_VERSION ); + } +break ; +case VM_CMD_RESET : +/* The host tells us a reset has happened. */ +break ; +case VM_CMD_CAPABILITIES : +/* The host tells us its capability. */ +if (unlikely (ihe->inpos <2 )) { +ipmi_debug ("Host cmd capability truncated.\n" ); +break ; + } + ihe->capability = ihe->inbuf[1 ]; +break ; +default : +/* The host shouldn't send us this command. Just ignore if they do. */ +ipmi_debug ("Host cmd type %02x is invalid.\n" , cmd); + } +} + +/* Clear the state of ipmi-host-extern. Happens at the end of a message. */ +static void clear_state (IPMIHostExtern *ihe) +{ + ihe->in_escape = false; + ihe->in_too_many = false; + ihe->inpos =0 ; +} + +/* We always welcome an incoming request. */ +static int can_receive (void *opaque) +{ +return 1 ; +} + +/* +* This function mirrors ipmi-bmc-extern. It handles an incoming character +* sequence and translates it into IPMI message. +*/ +static void receive (void *opaque,const uint8_t *buf,int size) +{ +IPMIHostExtern *ihe = opaque; +int i; + +for (i =0 ; i < size; ++i) { +uint8_t ch = buf[i]; + +switch (ch) { +case VM_MSG_CHAR : +/* The preceding characters are an IPMI message. */ +handle_msg (ihe); +clear_state (ihe); +break ; + +case VM_CMD_CHAR : +/* The preceding characters are a control command. */ +handle_command (ihe); +clear_state (ihe); +break ; + +case VM_ESCAPE_CHAR : + ihe->in_escape = true; +break ; + +default : +if (ihe->in_escape) { + ch &= ~0x10 ; + ihe->in_escape = false; + } +if (ihe->in_too_many) { +break ; + } +if (ihe->inpos >=ARRAY_SIZE (ihe->inbuf)) { + ihe->in_too_many = true; +break ; + } + ihe->inbuf[ihe->inpos++] = ch; +break ; + } + } +return ; +} + +static void chr_event (void *opaque,QEMUChrEvent event) +{ +IPMIHostExtern *ihe = opaque; + +switch (event) { +case CHR_EVENT_OPENED : + ihe->connected = true; +clear_state (ihe); +send_version (ihe); +break ; + +case CHR_EVENT_CLOSED : + ihe->connected = false; +break ; + +case CHR_EVENT_BREAK : +case CHR_EVENT_MUX_IN : +case CHR_EVENT_MUX_OUT : +/* Ignore */ +break ; + +default : +g_assert_not_reached (); + } +} + +static void ipmi_host_extern_responder_check (const Object *obj, +const char *name,Object *val,Error **errp) +{ +IPMIHostExtern *ihe =IPMI_HOST_EXTERN (obj); + +if (ihe->parent.responder) { +error_setg (errp,"IPMI host already has a responder" ); + } +} + +static void ipmi_host_extern_realize (DeviceState *dev,Error **errp) +{ +IPMIHostExtern *ihe =IPMI_HOST_EXTERN (dev); +IPMIResponderClass *rk; + +if (!qemu_chr_fe_backend_connected (&ihe->chr)) { +error_setg (errp,"IPMI external host requires chardev attribute" ); +return ; + } + +qemu_chr_fe_set_handlers (&ihe->chr, can_receive, receive, + chr_event,NULL , ihe,NULL , true); + +if (ihe->parent.responder ==NULL ) { +error_setg (errp,"IPMI host requires responder attribute" ); +return ; + } + rk =IPMI_RESPONDER_GET_CLASS (ihe->parent.responder); + rk->set_host (ihe->parent.responder, &ihe->parent); +} + +static const VMStateDescription vmstate_ipmi_host_extern = { + .name =TYPE_IPMI_HOST_EXTERN , + .version_id =0 , + .minimum_version_id =0 , + .fields = (VMStateField []) { +VMSTATE_END_OF_LIST () + } +}; + +static void ipmi_host_extern_init (Object *obj) +{ +IPMIHostExtern *ihe =IPMI_HOST_EXTERN (obj); + +object_property_add_link (OBJECT (ihe),"responder" ,TYPE_IPMI_RESPONDER , + (Object **)(&ihe->parent.responder), + ipmi_host_extern_responder_check,OBJ_PROP_LINK_STRONG ); + ihe->extern_timer =timer_new_ns (QEMU_CLOCK_VIRTUAL , extern_timeout, ihe); +vmstate_register (NULL ,0 , &vmstate_ipmi_host_extern, ihe); +} + +static void ipmi_host_extern_finalize (Object *obj) +{ +IPMIHostExtern *ihe =IPMI_HOST_EXTERN (obj); + +timer_del (ihe->extern_timer); +timer_free (ihe->extern_timer); +} + +static Property ipmi_host_extern_properties[] = { +DEFINE_PROP_CHR ("chardev" , IPMIHostExtern, chr), +DEFINE_PROP_END_OF_LIST (), +}; + +static void ipmi_host_extern_class_init (ObjectClass *oc,void *data) +{ +DeviceClass *dc =DEVICE_CLASS (oc); +IPMIHostClass *bk =IPMI_HOST_CLASS (oc); + + bk->handle_command = ipmi_host_extern_handle_command; + dc->hotpluggable = false; + dc->realize = ipmi_host_extern_realize; +device_class_set_props (dc, ipmi_host_extern_properties); +} + +static const TypeInfo ipmi_host_extern_type = { + .name =TYPE_IPMI_HOST_EXTERN , + .parent =TYPE_IPMI_HOST , + .instance_size =sizeof (IPMIHostExtern), + .instance_init = ipmi_host_extern_init, + .instance_finalize = ipmi_host_extern_finalize, + .class_init = ipmi_host_extern_class_init, + }; + +static void ipmi_host_extern_register_types (void ) +{ +type_register_static (&ipmi_host_extern_type); +} + +type_init (ipmi_host_extern_register_types)
hw/ipmi/meson.build +1 -0
@@ -8,6 +8,7 @@ ipmi_ss.add(when: 'CONFIG_ISA_IPMI_BT', if_true: files('isa_ipmi_bt.c')) ipmi_ss.add(when: 'CONFIG_PCI_IPMI_BT', if_true: files('pci_ipmi_bt.c')) ipmi_ss.add(when: 'CONFIG_IPMI_SSIF', if_true: files('smbus_ipmi.c')) ipmi_ss.add(when: 'CONFIG_IPMI_HOST', if_true: files('ipmi_host.c')) +ipmi_ss.add(when: 'CONFIG_IPMI_HOST', if_true: files('ipmi_host_extern.c')) ipmi_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_kcs.c')) softmmu_ss.add_all(when: 'CONFIG_IPMI', if_true: ipmi_ss)
Signature · 1 line
2.29.2.684.gfbc64c5ab5-goog
Quoted 6 lines · Hao Wu
This patch series include a few more NPCM7XX devices including
- Analog Digital Converter (ADC)
- Pulse Width Modulation (PWM)
- Keyboard Style Controller (KSC)
Quoted 8 lines
To utilize these modules we also add two extra functionalities:
1. We modified the CLK module to generate clock values using
qdev_clock. These clocks are used to determine various clocks in NPCM7XX devices.
2. We added support for emulating IPMI responder devices in BMC machines, similar to the existing IPMI device support for CPU emulation. This allows a qemu instance running BMC firmware to serve as an external BMC for a qemu instance running server software. It utilizes the KCS module we implemented.
Looking at the IPMI changes, why didn't you just re-use the existing IPMI infrastructure? ipmi_host.[ch] is basically a subset of ipmi.[ch], and the ipmi_host_extern looks like a copy of of ipmi_bmc_extern with some names changed. That kind of code duplication is not acceptable. Plus you copied my code and removed my copyrights, which is really not acceptable and illegal.
I'm not exactly sure why you needed you own KCS interface, either. It looks like the interface is somewhat different in some ways, but integrating it into the current KCS code is probably a better choice if that can be done.
-corey
Quoted 52 lines
Hao Wu (7):
hw/misc: Add clock converter in NPCM7XX CLK module hw/timer: Refactor NPCM7XX Timer to use CLK clock hw/adc: Add an ADC module for NPCM7XX hw/misc: Add a PWM module for NPCM7XX hw/ipmi: Add an IPMI host interface hw/ipmi: Add a KCS Module for NPCM7XX hw/ipmi: Add an IPMI external host devicedefault-configs/devices/arm-softmmu.mak | 2 + docs/system/arm/nuvoton.rst | 6 +- hw/adc/meson.build | 1 + hw/adc/npcm7xx_adc.c | 318 ++++++++++ hw/arm/npcm7xx.c | 65 +- hw/ipmi/Kconfig | 5 + hw/ipmi/ipmi_host.c | 40 ++ hw/ipmi/ipmi_host_extern.c | 435 +++++++++++++ hw/ipmi/meson.build | 3 + hw/ipmi/npcm7xx_kcs.c | 570 +++++++++++++++++ hw/misc/meson.build | 1 + hw/misc/npcm7xx_clk.c | 795 +++++++++++++++++++++++- hw/misc/npcm7xx_pwm.c | 535 ++++++++++++++++ hw/timer/npcm7xx_timer.c | 25 +- include/hw/adc/npcm7xx_adc.h | 72 +++ include/hw/arm/npcm7xx.h | 6 + include/hw/ipmi/ipmi_host.h | 56 ++ include/hw/ipmi/ipmi_responder.h | 66 ++ include/hw/ipmi/npcm7xx_kcs.h | 105 ++++ include/hw/misc/npcm7xx_clk.h | 146 ++++- include/hw/misc/npcm7xx_pwm.h | 106 ++++ include/hw/timer/npcm7xx_timer.h | 1 + tests/qtest/meson.build | 4 +- tests/qtest/npcm7xx_adc-test.c | 400 ++++++++++++ tests/qtest/npcm7xx_pwm-test.c | 490 +++++++++++++++ 25 files changed, 4221 insertions(+), 32 deletions(-) create mode 100644 hw/adc/npcm7xx_adc.c create mode 100644 hw/ipmi/ipmi_host.c create mode 100644 hw/ipmi/ipmi_host_extern.c create mode 100644 hw/ipmi/npcm7xx_kcs.c create mode 100644 hw/misc/npcm7xx_pwm.c create mode 100644 include/hw/adc/npcm7xx_adc.h create mode 100644 include/hw/ipmi/ipmi_host.h create mode 100644 include/hw/ipmi/ipmi_responder.h create mode 100644 include/hw/ipmi/npcm7xx_kcs.h create mode 100644 include/hw/misc/npcm7xx_pwm.h create mode 100644 tests/qtest/npcm7xx_adc-test.c create mode 100644 tests/qtest/npcm7xx_pwm-test.cSignature · 1 line
2.29.2.684.gfbc64c5ab5-goog
Tl,dr: We'll remove the IPMI changes from the current patch set and refactor
them in a separate patch set.
Thank you for your review! On high level, we are trying to emulate the BMC side of the IPMI protocol. So we cannot directly use the existing IPMI code. However, they do have a lot in duplication as you pointed out. So we'll refactor
the existing IPMI code and update in a way that we only add the required functionality.
As for the KCS module, the BMC side of the protocol is the opposite direction
of the existing ipmi_kcs.c code which is on the host/CPU side. For example, in READ_STATE the CPU would read data while the BMC would write data. So we can't directly use the same implementation. (They're different files in
Linux either.) However, we can refactor it to re-use some of the common definitions.
We would like to remove the IPMI and KCS stuff from the current patch set. We'll send the refactored code in a separate patch set after addressing your concerns.
Thanks again for the review!
Quoted 86 lines · Corey Minyard
Quoted 6 lines · Hao Wu
This patch series include a few more NPCM7XX devices including
- Analog Digital Converter (ADC)
- Pulse Width Modulation (PWM)
- Keyboard Style Controller (KSC)Quoted 6 lines
To utilize these modules we also add two extra functionalities:
1. We modified the CLK module to generate clock values using
qdev_clock. These clocks are used to determine various clocks in NPCM7XX devices.
2. We added support for emulating IPMI responder devices in BMC machines, similar to the existing IPMI device support for CPU emulation. Thisallows
Quoted 1 line
a qemu instance running BMC firmware to serve as an external BMC for
a qemu
Quoted 1 line
instance running server software. It utilizes the KCS module we
implemented.
Looking at the IPMI changes, why didn't you just re-use the existing IPMI infrastructure? ipmi_host.[ch] is basically a subset of ipmi.[ch], and the
ipmi_host_externlooks like a copy of ofipmi_bmc_externwith some names changed. That kind of code duplication is not acceptable. Plus you copied my code and removed my copyrights, which is really not acceptable and illegal.I'm not exactly sure why you needed you own KCS interface, either. It looks like the interface is somewhat different in some ways, but integrating it into the current KCS code is probably a better choice if that can be done.
-corey
Quoted 52 lines
Hao Wu (7):
hw/misc: Add clock converter in NPCM7XX CLK module hw/timer: Refactor NPCM7XX Timer to use CLK clock hw/adc: Add an ADC module for NPCM7XX hw/misc: Add a PWM module for NPCM7XX hw/ipmi: Add an IPMI host interface hw/ipmi: Add a KCS Module for NPCM7XX hw/ipmi: Add an IPMI external host devicedefault-configs/devices/arm-softmmu.mak | 2 + docs/system/arm/nuvoton.rst | 6 +- hw/adc/meson.build | 1 + hw/adc/npcm7xx_adc.c | 318 ++++++++++ hw/arm/npcm7xx.c | 65 +- hw/ipmi/Kconfig | 5 + hw/ipmi/ipmi_host.c | 40 ++ hw/ipmi/ipmi_host_extern.c | 435 +++++++++++++ hw/ipmi/meson.build | 3 + hw/ipmi/npcm7xx_kcs.c | 570 +++++++++++++++++ hw/misc/meson.build | 1 + hw/misc/npcm7xx_clk.c | 795 +++++++++++++++++++++++- hw/misc/npcm7xx_pwm.c | 535 ++++++++++++++++ hw/timer/npcm7xx_timer.c | 25 +- include/hw/adc/npcm7xx_adc.h | 72 +++ include/hw/arm/npcm7xx.h | 6 + include/hw/ipmi/ipmi_host.h | 56 ++ include/hw/ipmi/ipmi_responder.h | 66 ++ include/hw/ipmi/npcm7xx_kcs.h | 105 ++++ include/hw/misc/npcm7xx_clk.h | 146 ++++- include/hw/misc/npcm7xx_pwm.h | 106 ++++ include/hw/timer/npcm7xx_timer.h | 1 + tests/qtest/meson.build | 4 +- tests/qtest/npcm7xx_adc-test.c | 400 ++++++++++++ tests/qtest/npcm7xx_pwm-test.c | 490 +++++++++++++++ 25 files changed, 4221 insertions(+), 32 deletions(-) create mode 100644 hw/adc/npcm7xx_adc.c create mode 100644 hw/ipmi/ipmi_host.c create mode 100644 hw/ipmi/ipmi_host_extern.c create mode 100644 hw/ipmi/npcm7xx_kcs.c create mode 100644 hw/misc/npcm7xx_pwm.c create mode 100644 include/hw/adc/npcm7xx_adc.h create mode 100644 include/hw/ipmi/ipmi_host.h create mode 100644 include/hw/ipmi/ipmi_responder.h create mode 100644 include/hw/ipmi/npcm7xx_kcs.h create mode 100644 include/hw/misc/npcm7xx_pwm.h create mode 100644 tests/qtest/npcm7xx_adc-test.c create mode 100644 tests/qtest/npcm7xx_pwm-test.c--
2.29.2.684.gfbc64c5ab5-goog
Quoted 10 lines · Hao Wu
Tl,dr: We'll remove the IPMI changes from the current patch set and refactor
them in a separate patch set.Thank you for your review! On high level, we are trying to emulate the BMC side of the IPMI protocol. So we cannot directly use the existing IPMI code. However, they do have a lot in duplication as you pointed out. So we'll refactor
the existing IPMI code and update in a way that we only add the required functionality.
Ah, I didn't figure that out from what you posted. So the idea is you can create the BMC side of the system in one qemu session with your changes and then you connect it to a host system running qemu with the host side of the interface.
The wire protocol is basically symmetric, but the command handling will need to be separate. So you probably want to split out the base protocol from ipmi_bmc_extern into its own file and use that from your own file, to avoid the duplication.
You need to do proper ATTN handling on the BMC side. And you will also need ties into GPIOs and whatnot for doing the reset, NMI, etc.
"ipmi_host" is probably not the best name. At least to me that implied the host side of the interface. I'm not coming up with something I really like, though. Maybe "bmc_host"? That's more descriptive, though I'm sure a better name exists. Then you could have "bmc_host_extern" for the protocol. If you come up with a better naming scheme, the existing files can be renamed, too.
Thanks,
-corey
Quoted 104 lines
As for the KCS module, the BMC side of the protocol is the opposite direction
of the existingipmi_kcs.ccode which is on the host/CPU side. For example, inREAD_STATEthe CPU would read data while the BMC would write data. So we can't directly use the same implementation. (They're different files in
Linux either.) However, we can refactor it to re-use some of the common definitions.We would like to remove the IPMI and KCS stuff from the current patch set. We'll send the refactored code in a separate patch set after addressing your concerns.
Thanks again for the review!
Quoted 86 lines · Corey Minyard
Quoted 6 lines · Hao Wu
This patch series include a few more NPCM7XX devices including
- Analog Digital Converter (ADC)
- Pulse Width Modulation (PWM)
- Keyboard Style Controller (KSC)Quoted 6 lines
To utilize these modules we also add two extra functionalities:
1. We modified the CLK module to generate clock values using
qdev_clock. These clocks are used to determine various clocks in NPCM7XX devices.
2. We added support for emulating IPMI responder devices in BMC machines, similar to the existing IPMI device support for CPU emulation. Thisallows
Quoted 1 line
a qemu instance running BMC firmware to serve as an external BMC for
a qemu
Quoted 1 line
instance running server software. It utilizes the KCS module we
implemented.
Looking at the IPMI changes, why didn't you just re-use the existing IPMI infrastructure? ipmi_host.[ch] is basically a subset of ipmi.[ch], and the
ipmi_host_externlooks like a copy of ofipmi_bmc_externwith some names changed. That kind of code duplication is not acceptable. Plus you copied my code and removed my copyrights, which is really not acceptable and illegal.I'm not exactly sure why you needed you own KCS interface, either. It looks like the interface is somewhat different in some ways, but integrating it into the current KCS code is probably a better choice if that can be done.
-corey
Quoted 52 lines
Hao Wu (7):
hw/misc: Add clock converter in NPCM7XX CLK module hw/timer: Refactor NPCM7XX Timer to use CLK clock hw/adc: Add an ADC module for NPCM7XX hw/misc: Add a PWM module for NPCM7XX hw/ipmi: Add an IPMI host interface hw/ipmi: Add a KCS Module for NPCM7XX hw/ipmi: Add an IPMI external host devicedefault-configs/devices/arm-softmmu.mak | 2 + docs/system/arm/nuvoton.rst | 6 +- hw/adc/meson.build | 1 + hw/adc/npcm7xx_adc.c | 318 ++++++++++ hw/arm/npcm7xx.c | 65 +- hw/ipmi/Kconfig | 5 + hw/ipmi/ipmi_host.c | 40 ++ hw/ipmi/ipmi_host_extern.c | 435 +++++++++++++ hw/ipmi/meson.build | 3 + hw/ipmi/npcm7xx_kcs.c | 570 +++++++++++++++++ hw/misc/meson.build | 1 + hw/misc/npcm7xx_clk.c | 795 +++++++++++++++++++++++- hw/misc/npcm7xx_pwm.c | 535 ++++++++++++++++ hw/timer/npcm7xx_timer.c | 25 +- include/hw/adc/npcm7xx_adc.h | 72 +++ include/hw/arm/npcm7xx.h | 6 + include/hw/ipmi/ipmi_host.h | 56 ++ include/hw/ipmi/ipmi_responder.h | 66 ++ include/hw/ipmi/npcm7xx_kcs.h | 105 ++++ include/hw/misc/npcm7xx_clk.h | 146 ++++- include/hw/misc/npcm7xx_pwm.h | 106 ++++ include/hw/timer/npcm7xx_timer.h | 1 + tests/qtest/meson.build | 4 +- tests/qtest/npcm7xx_adc-test.c | 400 ++++++++++++ tests/qtest/npcm7xx_pwm-test.c | 490 +++++++++++++++ 25 files changed, 4221 insertions(+), 32 deletions(-) create mode 100644 hw/adc/npcm7xx_adc.c create mode 100644 hw/ipmi/ipmi_host.c create mode 100644 hw/ipmi/ipmi_host_extern.c create mode 100644 hw/ipmi/npcm7xx_kcs.c create mode 100644 hw/misc/npcm7xx_pwm.c create mode 100644 include/hw/adc/npcm7xx_adc.h create mode 100644 include/hw/ipmi/ipmi_host.h create mode 100644 include/hw/ipmi/ipmi_responder.h create mode 100644 include/hw/ipmi/npcm7xx_kcs.h create mode 100644 include/hw/misc/npcm7xx_pwm.h create mode 100644 tests/qtest/npcm7xx_adc-test.c create mode 100644 tests/qtest/npcm7xx_pwm-test.c--
2.29.2.684.gfbc64c5ab5-goog
Quoted 27 lines · Corey Minyard
Quoted 5 lines · Hao Wu
Tl,dr: We'll remove the IPMI changes from the current patch set and refactor
them in a separate patch set.Thank you for your review! On high level, we are trying to emulate the
BMC
Quoted 1 line
side of the IPMI protocol. So we cannot directly use the existing IPMI
code.
Quoted 4 lines
However, they do have a lot in duplication as you pointed out. So we'll refactor
the existing IPMI code and update in a way that we only add the required functionality.Ah, I didn't figure that out from what you posted. So the idea is you can create the BMC side of the system in one qemu session with your changes and then you connect it to a host system running qemu with the host side of the interface.
The wire protocol is basically symmetric, but the command handling will need to be separate. So you probably want to split out the base protocol from
ipmi_bmc_externinto its own file and use that from your own file, to avoid the duplication.You need to do proper ATTN handling on the BMC side. And you will also need ties into GPIOs and whatnot for doing the reset, NMI, etc.
Quoted 7 lines
"
ipmi_host" is probably not the best name. At least to me that implied the host side of the interface. I'm not coming up with something I really like, though. Maybe "bmc_host"? That's more descriptive, though I'm sure a better name exists. Then you could have "bmc_host_extern" for the protocol. If you come up with a better naming scheme, the existing files can be renamed, too.
The naming is my fault.
My thinking was that ipmi-host-extern is to the BMC what ipmi-bmc-extern is to the host. That is, the former represents the host as seen by the BMC, and the latter represents the BMC as seen by the host.
I sent some docs to the list earlier this year, but sadly, I never got around to follow up. You can see the generated docs here:
https://hskinnemoen.github.io/qemu/specs/ipmi.html
Hao, perhaps you should include my documentation patches in your next IPMI series? If we come up with a better naming scheme for both sides, I can update the docs accordingly.
Havard
Quoted 119 lines
Thanks,
-corey
Quoted 4 lines
As for the KCS module, the BMC side of the protocol is the opposite direction
of the existingipmi_kcs.ccode which is on the host/CPU side. Forexample,
Quoted 2 lines
in
READ_STATEthe CPU would read data while the BMC would write data. So we can't directly use the same implementation. (They're differentfiles
Quoted 5 lines
in
Linux either.) However, we can refactor it to re-use some of the common definitions.We would like to remove the IPMI and KCS stuff from the current patch
set.
Quoted 17 lines
We'll send the refactored code in a separate patch set after addressing your concerns.
Thanks again for the review!
Quoted 10 lines · Corey Minyard
Quoted 9 lines · Hao Wu
This patch series include a few more NPCM7XX devices including
- Analog Digital Converter (ADC)
- Pulse Width Modulation (PWM)
- Keyboard Style Controller (KSC)To utilize these modules we also add two extra functionalities:
1. We modified the CLK module to generate clock values using
qdev_clock.Quoted 1 line
Quoted 1 line
Quoted 1 line
These clocks are used to determine various clocks in NPCM7XX
devices.
Quoted 1 line
Quoted 1 line
Quoted 1 line
2. We added support for emulating IPMI responder devices in BMC
machines,
Quoted 1 line
Quoted 1 line
Quoted 1 line
similar to the existing IPMI device support for CPU emulation.
This
Quoted 2 lines
Quoted 2 lines
allows
Quoted 1 line
a qemu instance running BMC firmware to serve as an external BMC
for
Quoted 6 lines
Quoted 6 lines
a qemu
Quoted 1 line
instance running server software. It utilizes the KCS module we
implemented.
Looking at the IPMI changes, why didn't you just re-use the existing IPMI infrastructure? ipmi_host.[ch] is basically a subset of
ipmi.[ch],
Quoted 22 lines
Quoted 22 lines
and the
ipmi_host_externlooks like a copy of ofipmi_bmc_externwith some names changed. That kind of code duplication is not acceptable. Plus you copied my code and removed my copyrights, which is really not acceptable and illegal.I'm not exactly sure why you needed you own KCS interface, either. It looks like the interface is somewhat different in some ways, but integrating it into the current KCS code is probably a better choice if that can be done.
-corey
Quoted 10 lines
Hao Wu (7):
hw/misc: Add clock converter in NPCM7XX CLK module hw/timer: Refactor NPCM7XX Timer to use CLK clock hw/adc: Add an ADC module for NPCM7XX hw/misc: Add a PWM module for NPCM7XX hw/ipmi: Add an IPMI host interface hw/ipmi: Add a KCS Module for NPCM7XX hw/ipmi: Add an IPMI external host deviceQuoted 12 lines
Quoted 4 lines
Quoted 4 lines
default-configs/devices/arm-softmmu.mak | 2 + docs/system/arm/nuvoton.rst | 6 +- hw/adc/meson.build | 1 + hw/adc/npcm7xx_adc.c | 318 ++++++++++Quoted 8 lines
Quoted 8 lines
hw/arm/npcm7xx.c | 65 +- hw/ipmi/Kconfig | 5 + hw/ipmi/ipmi_host.c | 40 ++ hw/ipmi/ipmi_host_extern.c | 435 +++++++++++++ hw/ipmi/meson.build | 3 + hw/ipmi/npcm7xx_kcs.c | 570 +++++++++++++++++ hw/misc/meson.build | 1 + hw/misc/npcm7xx_clk.c | 795+++++++++++++++++++++++-
Quoted 31 lines
Quoted 31 lines
Quoted 30 lines
hw/misc/npcm7xx_pwm.c | 535 ++++++++++++++++ hw/timer/npcm7xx_timer.c | 25 +- include/hw/adc/npcm7xx_adc.h | 72 +++ include/hw/arm/npcm7xx.h | 6 + include/hw/ipmi/ipmi_host.h | 56 ++ include/hw/ipmi/ipmi_responder.h | 66 ++ include/hw/ipmi/npcm7xx_kcs.h | 105 ++++ include/hw/misc/npcm7xx_clk.h | 146 ++++- include/hw/misc/npcm7xx_pwm.h | 106 ++++ include/hw/timer/npcm7xx_timer.h | 1 + tests/qtest/meson.build | 4 +- tests/qtest/npcm7xx_adc-test.c | 400 ++++++++++++ tests/qtest/npcm7xx_pwm-test.c | 490 +++++++++++++++ 25 files changed, 4221 insertions(+), 32 deletions(-) create mode 100644 hw/adc/npcm7xx_adc.c create mode 100644 hw/ipmi/ipmi_host.c create mode 100644 hw/ipmi/ipmi_host_extern.c create mode 100644 hw/ipmi/npcm7xx_kcs.c create mode 100644 hw/misc/npcm7xx_pwm.c create mode 100644 include/hw/adc/npcm7xx_adc.h create mode 100644 include/hw/ipmi/ipmi_host.h create mode 100644 include/hw/ipmi/ipmi_responder.h create mode 100644 include/hw/ipmi/npcm7xx_kcs.h create mode 100644 include/hw/misc/npcm7xx_pwm.h create mode 100644 tests/qtest/npcm7xx_adc-test.c create mode 100644 tests/qtest/npcm7xx_pwm-test.c--
2.29.2.684.gfbc64c5ab5-goog
Thanks for the comments!
I've removed IPMI part from the patch sets. I'll send a separate patch sets once the refactor is done. I'll also include Havard's documentation in it.
I haven't thought of a better name. We can update the name accordingly.
Quoted 176 lines · Havard Skinnemoen
Quoted 27 lines · Corey Minyard
Quoted 5 lines · Hao Wu
Tl,dr: We'll remove the IPMI changes from the current patch set and refactor
them in a separate patch set.Thank you for your review! On high level, we are trying to emulate the
BMC
Quoted 1 line
side of the IPMI protocol. So we cannot directly use the existing IPMI
code.
Quoted 4 lines
However, they do have a lot in duplication as you pointed out. So we'll refactor
the existing IPMI code and update in a way that we only add the required functionality.Ah, I didn't figure that out from what you posted. So the idea is you can create the BMC side of the system in one qemu session with your changes and then you connect it to a host system running qemu with the host side of the interface.
The wire protocol is basically symmetric, but the command handling will need to be separate. So you probably want to split out the base protocol from
ipmi_bmc_externinto its own file and use that from your own file, to avoid the duplication.You need to do proper ATTN handling on the BMC side. And you will also need ties into GPIOs and whatnot for doing the reset, NMI, etc.
Quoted 7 lines
"
ipmi_host" is probably not the best name. At least to me that implied the host side of the interface. I'm not coming up with something I really like, though. Maybe "bmc_host"? That's more descriptive, though I'm sure a better name exists. Then you could have "bmc_host_extern" for the protocol. If you come up with a better naming scheme, the existing files can be renamed, too.The naming is my fault.
My thinking was that ipmi-host-extern is to the BMC what ipmi-bmc-extern is to the host. That is, the former represents the host as seen by the BMC, and the latter represents the BMC as seen by the host.
I sent some docs to the list earlier this year, but sadly, I never got around to follow up. You can see the generated docs here:
https://hskinnemoen.github.io/qemu/specs/ipmi.html
Hao, perhaps you should include my documentation patches in your next IPMI series? If we come up with a better naming scheme for both sides, I can update the docs accordingly.
Havard
Quoted 120 lines
Thanks,
-corey
Quoted 4 lines
As for the KCS module, the BMC side of the protocol is the opposite direction
of the existingipmi_kcs.ccode which is on the host/CPU side. Forexample,
Quoted 2 lines
in
READ_STATEthe CPU would read data while the BMC would write data. So we can't directly use the same implementation. (They're differentfiles
Quoted 5 lines
in
Linux either.) However, we can refactor it to re-use some of the common definitions.We would like to remove the IPMI and KCS stuff from the current patch
set.
Quoted 17 lines
We'll send the refactored code in a separate patch set after addressing your concerns.
Thanks again for the review!
Quoted 10 lines · Corey Minyard
Quoted 9 lines · Hao Wu
This patch series include a few more NPCM7XX devices including
- Analog Digital Converter (ADC)
- Pulse Width Modulation (PWM)
- Keyboard Style Controller (KSC)To utilize these modules we also add two extra functionalities:
1. We modified the CLK module to generate clock values using
qdev_clock.Quoted 1 line
Quoted 1 line
Quoted 1 line
These clocks are used to determine various clocks in NPCM7XX
devices.
Quoted 1 line
Quoted 1 line
Quoted 1 line
2. We added support for emulating IPMI responder devices in BMC
machines,
Quoted 1 line
Quoted 1 line
Quoted 1 line
similar to the existing IPMI device support for CPU emulation.
This
Quoted 2 lines
Quoted 2 lines
allows
Quoted 1 line
a qemu instance running BMC firmware to serve as an external BMC
for
Quoted 6 lines
Quoted 6 lines
a qemu
Quoted 1 line
instance running server software. It utilizes the KCS module we
implemented.
Looking at the IPMI changes, why didn't you just re-use the existing IPMI infrastructure? ipmi_host.[ch] is basically a subset of
ipmi.[ch],
Quoted 8 lines
Quoted 8 lines
and the
ipmi_host_externlooks like a copy of ofipmi_bmc_externwith some names changed. That kind of code duplication is not acceptable. Plus you copied my code and removed my copyrights, which is really not acceptable and illegal.I'm not exactly sure why you needed you own KCS interface, either. It looks like the interface is somewhat different in some ways, but integrating it into the current KCS code is probably a better choice
if
Quoted 14 lines
Quoted 14 lines
that can be done.
-corey
Quoted 10 lines
Hao Wu (7):
hw/misc: Add clock converter in NPCM7XX CLK module hw/timer: Refactor NPCM7XX Timer to use CLK clock hw/adc: Add an ADC module for NPCM7XX hw/misc: Add a PWM module for NPCM7XX hw/ipmi: Add an IPMI host interface hw/ipmi: Add a KCS Module for NPCM7XX hw/ipmi: Add an IPMI external host deviceQuoted 12 lines
Quoted 4 lines
Quoted 4 lines
default-configs/devices/arm-softmmu.mak | 2 + docs/system/arm/nuvoton.rst | 6 +- hw/adc/meson.build | 1 + hw/adc/npcm7xx_adc.c | 318 ++++++++++Quoted 8 lines
Quoted 8 lines
hw/arm/npcm7xx.c | 65 +- hw/ipmi/Kconfig | 5 + hw/ipmi/ipmi_host.c | 40 ++ hw/ipmi/ipmi_host_extern.c | 435 +++++++++++++ hw/ipmi/meson.build | 3 + hw/ipmi/npcm7xx_kcs.c | 570 +++++++++++++++++ hw/misc/meson.build | 1 + hw/misc/npcm7xx_clk.c | 795+++++++++++++++++++++++-
Quoted 31 lines
Quoted 31 lines
Quoted 30 lines
hw/misc/npcm7xx_pwm.c | 535 ++++++++++++++++ hw/timer/npcm7xx_timer.c | 25 +- include/hw/adc/npcm7xx_adc.h | 72 +++ include/hw/arm/npcm7xx.h | 6 + include/hw/ipmi/ipmi_host.h | 56 ++ include/hw/ipmi/ipmi_responder.h | 66 ++ include/hw/ipmi/npcm7xx_kcs.h | 105 ++++ include/hw/misc/npcm7xx_clk.h | 146 ++++- include/hw/misc/npcm7xx_pwm.h | 106 ++++ include/hw/timer/npcm7xx_timer.h | 1 + tests/qtest/meson.build | 4 +- tests/qtest/npcm7xx_adc-test.c | 400 ++++++++++++ tests/qtest/npcm7xx_pwm-test.c | 490 +++++++++++++++ 25 files changed, 4221 insertions(+), 32 deletions(-) create mode 100644 hw/adc/npcm7xx_adc.c create mode 100644 hw/ipmi/ipmi_host.c create mode 100644 hw/ipmi/ipmi_host_extern.c create mode 100644 hw/ipmi/npcm7xx_kcs.c create mode 100644 hw/misc/npcm7xx_pwm.c create mode 100644 include/hw/adc/npcm7xx_adc.h create mode 100644 include/hw/ipmi/ipmi_host.h create mode 100644 include/hw/ipmi/ipmi_responder.h create mode 100644 include/hw/ipmi/npcm7xx_kcs.h create mode 100644 include/hw/misc/npcm7xx_pwm.h create mode 100644 tests/qtest/npcm7xx_adc-test.c create mode 100644 tests/qtest/npcm7xx_pwm-test.c--
2.29.2.684.gfbc64c5ab5-goog
Quoted 37 lines · Havard Skinnemoen
Quoted 27 lines · Corey Minyard
Quoted 5 lines · Hao Wu
Tl,dr: We'll remove the IPMI changes from the current patch set and refactor
them in a separate patch set.Thank you for your review! On high level, we are trying to emulate the
BMC
Quoted 1 line
side of the IPMI protocol. So we cannot directly use the existing IPMI
code.
Quoted 4 lines
However, they do have a lot in duplication as you pointed out. So we'll refactor
the existing IPMI code and update in a way that we only add the required functionality.Ah, I didn't figure that out from what you posted. So the idea is you can create the BMC side of the system in one qemu session with your changes and then you connect it to a host system running qemu with the host side of the interface.
The wire protocol is basically symmetric, but the command handling will need to be separate. So you probably want to split out the base protocol from
ipmi_bmc_externinto its own file and use that from your own file, to avoid the duplication.You need to do proper ATTN handling on the BMC side. And you will also need ties into GPIOs and whatnot for doing the reset, NMI, etc.
Quoted 7 lines
"
ipmi_host" is probably not the best name. At least to me that implied the host side of the interface. I'm not coming up with something I really like, though. Maybe "bmc_host"? That's more descriptive, though I'm sure a better name exists. Then you could have "bmc_host_extern" for the protocol. If you come up with a better naming scheme, the existing files can be renamed, too.
Quoted 5 lines
The naming is my fault.
My thinking was that ipmi-host-extern is to the BMC what ipmi-bmc-extern is to the host. That is, the former represents the host as seen by the BMC, and the latter represents the BMC as seen by the host.
Yeah, I kind of figured that, which is why I suggested that the existing files can be renamed. I really like it when I can look at a directory and tell what everything does. Unfortunately, that's generally harder to achieve than it sounds.
We could also create a separate bmc directory under hw. Then the names you have make more sense. It would also make things a bit cleaner, since I wouldn't really be maintaining the BMC side of things. I'm already dealing with that on the Linux side.
Quoted 9 lines
I sent some docs to the list earlier this year, but sadly, I never got around to follow up. You can see the generated docs here:
https://hskinnemoen.github.io/qemu/specs/ipmi.html
Hao, perhaps you should include my documentation patches in your next IPMI series? If we come up with a better naming scheme for both sides, I can update the docs accordingly.
I remember that now. Yes, documentation would be good.
Thanks,
-corey
Quoted 123 lines
Havard
Quoted 119 lines
Thanks,
-corey
Quoted 4 lines
As for the KCS module, the BMC side of the protocol is the opposite direction
of the existingipmi_kcs.ccode which is on the host/CPU side. Forexample,
Quoted 2 lines
in
READ_STATEthe CPU would read data while the BMC would write data. So we can't directly use the same implementation. (They're differentfiles
Quoted 5 lines
in
Linux either.) However, we can refactor it to re-use some of the common definitions.We would like to remove the IPMI and KCS stuff from the current patch
set.
Quoted 17 lines
We'll send the refactored code in a separate patch set after addressing your concerns.
Thanks again for the review!
Quoted 10 lines · Corey Minyard
Quoted 9 lines · Hao Wu
This patch series include a few more NPCM7XX devices including
- Analog Digital Converter (ADC)
- Pulse Width Modulation (PWM)
- Keyboard Style Controller (KSC)To utilize these modules we also add two extra functionalities:
1. We modified the CLK module to generate clock values using
qdev_clock.Quoted 1 line
Quoted 1 line
Quoted 1 line
These clocks are used to determine various clocks in NPCM7XX
devices.
Quoted 1 line
Quoted 1 line
Quoted 1 line
2. We added support for emulating IPMI responder devices in BMC
machines,
Quoted 1 line
Quoted 1 line
Quoted 1 line
similar to the existing IPMI device support for CPU emulation.
This
Quoted 2 lines
Quoted 2 lines
allows
Quoted 1 line
a qemu instance running BMC firmware to serve as an external BMC
for
Quoted 6 lines
Quoted 6 lines
a qemu
Quoted 1 line
instance running server software. It utilizes the KCS module we
implemented.
Looking at the IPMI changes, why didn't you just re-use the existing IPMI infrastructure? ipmi_host.[ch] is basically a subset of
ipmi.[ch],
Quoted 22 lines
Quoted 22 lines
and the
ipmi_host_externlooks like a copy of ofipmi_bmc_externwith some names changed. That kind of code duplication is not acceptable. Plus you copied my code and removed my copyrights, which is really not acceptable and illegal.I'm not exactly sure why you needed you own KCS interface, either. It looks like the interface is somewhat different in some ways, but integrating it into the current KCS code is probably a better choice if that can be done.
-corey
Quoted 10 lines
Hao Wu (7):
hw/misc: Add clock converter in NPCM7XX CLK module hw/timer: Refactor NPCM7XX Timer to use CLK clock hw/adc: Add an ADC module for NPCM7XX hw/misc: Add a PWM module for NPCM7XX hw/ipmi: Add an IPMI host interface hw/ipmi: Add a KCS Module for NPCM7XX hw/ipmi: Add an IPMI external host deviceQuoted 12 lines
Quoted 4 lines
Quoted 4 lines
default-configs/devices/arm-softmmu.mak | 2 + docs/system/arm/nuvoton.rst | 6 +- hw/adc/meson.build | 1 + hw/adc/npcm7xx_adc.c | 318 ++++++++++Quoted 8 lines
Quoted 8 lines
hw/arm/npcm7xx.c | 65 +- hw/ipmi/Kconfig | 5 + hw/ipmi/ipmi_host.c | 40 ++ hw/ipmi/ipmi_host_extern.c | 435 +++++++++++++ hw/ipmi/meson.build | 3 + hw/ipmi/npcm7xx_kcs.c | 570 +++++++++++++++++ hw/misc/meson.build | 1 + hw/misc/npcm7xx_clk.c | 795+++++++++++++++++++++++-
Quoted 31 lines
Quoted 31 lines
Quoted 30 lines
hw/misc/npcm7xx_pwm.c | 535 ++++++++++++++++ hw/timer/npcm7xx_timer.c | 25 +- include/hw/adc/npcm7xx_adc.h | 72 +++ include/hw/arm/npcm7xx.h | 6 + include/hw/ipmi/ipmi_host.h | 56 ++ include/hw/ipmi/ipmi_responder.h | 66 ++ include/hw/ipmi/npcm7xx_kcs.h | 105 ++++ include/hw/misc/npcm7xx_clk.h | 146 ++++- include/hw/misc/npcm7xx_pwm.h | 106 ++++ include/hw/timer/npcm7xx_timer.h | 1 + tests/qtest/meson.build | 4 +- tests/qtest/npcm7xx_adc-test.c | 400 ++++++++++++ tests/qtest/npcm7xx_pwm-test.c | 490 +++++++++++++++ 25 files changed, 4221 insertions(+), 32 deletions(-) create mode 100644 hw/adc/npcm7xx_adc.c create mode 100644 hw/ipmi/ipmi_host.c create mode 100644 hw/ipmi/ipmi_host_extern.c create mode 100644 hw/ipmi/npcm7xx_kcs.c create mode 100644 hw/misc/npcm7xx_pwm.c create mode 100644 include/hw/adc/npcm7xx_adc.h create mode 100644 include/hw/ipmi/ipmi_host.h create mode 100644 include/hw/ipmi/ipmi_responder.h create mode 100644 include/hw/ipmi/npcm7xx_kcs.h create mode 100644 include/hw/misc/npcm7xx_pwm.h create mode 100644 tests/qtest/npcm7xx_adc-test.c create mode 100644 tests/qtest/npcm7xx_pwm-test.c--
2.29.2.684.gfbc64c5ab5-goog