All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH aspeed-5.2] aspeed: g220a-bmc: Add an FRU
@ 2020-12-10 10:36 John Wang
  2020-12-10 10:50 ` Cédric Le Goater
  0 siblings, 1 reply; 2+ messages in thread
From: John Wang @ 2020-12-10 10:36 UTC (permalink / raw)
  To: xuxiaohan, yulei.sh
  Cc: Peter Maydell, Andrew Jeffery, open list:All patches CC here,
	open list:ASPEED BMCs, Cédric Le Goater, Joel Stanley

Add an eeprom device and fill it with fru
information

$ ipmitool fru print 0
Product Manufacturer  : Bytedance
Product Name          : G220A

Signed-off-by: John Wang <wangzhiqiang.bj@bytedance.com>
---
 hw/arm/aspeed.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 04c8ad2bcd..fc80d45513 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -595,6 +595,18 @@ static void g220a_bmc_i2c_init(AspeedMachineState *bmc)
     object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abort);
     object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abort);
     object_property_set_int(OBJECT(dev), "temperature2", 20000, &error_abort);
+
+    static uint8_t eeprom_buf[2 * 1024] = {
+            0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xfe,
+            0x01, 0x06, 0x00, 0xc9, 0x42, 0x79, 0x74, 0x65,
+            0x64, 0x61, 0x6e, 0x63, 0x65, 0xc5, 0x47, 0x32,
+            0x32, 0x30, 0x41, 0xc4, 0x41, 0x41, 0x42, 0x42,
+            0xc4, 0x43, 0x43, 0x44, 0x44, 0xc4, 0x45, 0x45,
+            0x46, 0x46, 0xc4, 0x48, 0x48, 0x47, 0x47, 0xc1,
+            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7,
+    };
+    smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 4), 0x57,
+                          eeprom_buf);
 }
 
 static bool aspeed_get_mmio_exec(Object *obj, Error **errp)
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH aspeed-5.2] aspeed: g220a-bmc: Add an FRU
  2020-12-10 10:36 [PATCH aspeed-5.2] aspeed: g220a-bmc: Add an FRU John Wang
@ 2020-12-10 10:50 ` Cédric Le Goater
  0 siblings, 0 replies; 2+ messages in thread
From: Cédric Le Goater @ 2020-12-10 10:50 UTC (permalink / raw)
  To: John Wang, xuxiaohan, yulei.sh
  Cc: Andrew Jeffery, Peter Maydell, open list:ASPEED BMCs,
	Joel Stanley, open list:All patches CC here

On 12/10/20 11:36 AM, John Wang wrote:
> Add an eeprom device and fill it with fru
> information
> 
> $ ipmitool fru print 0
> Product Manufacturer  : Bytedance
> Product Name          : G220A
> 
> Signed-off-by: John Wang <wangzhiqiang.bj@bytedance.com>


Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C. 

> ---
>  hw/arm/aspeed.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
> index 04c8ad2bcd..fc80d45513 100644
> --- a/hw/arm/aspeed.c
> +++ b/hw/arm/aspeed.c
> @@ -595,6 +595,18 @@ static void g220a_bmc_i2c_init(AspeedMachineState *bmc)
>      object_property_set_int(OBJECT(dev), "temperature0", 31000, &error_abort);
>      object_property_set_int(OBJECT(dev), "temperature1", 28000, &error_abort);
>      object_property_set_int(OBJECT(dev), "temperature2", 20000, &error_abort);
> +
> +    static uint8_t eeprom_buf[2 * 1024] = {
> +            0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xfe,
> +            0x01, 0x06, 0x00, 0xc9, 0x42, 0x79, 0x74, 0x65,
> +            0x64, 0x61, 0x6e, 0x63, 0x65, 0xc5, 0x47, 0x32,
> +            0x32, 0x30, 0x41, 0xc4, 0x41, 0x41, 0x42, 0x42,
> +            0xc4, 0x43, 0x43, 0x44, 0x44, 0xc4, 0x45, 0x45,
> +            0x46, 0x46, 0xc4, 0x48, 0x48, 0x47, 0x47, 0xc1,
> +            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7,
> +    };
> +    smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 4), 0x57,
> +                          eeprom_buf);
>  }
>  
>  static bool aspeed_get_mmio_exec(Object *obj, Error **errp)
> 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-10 10:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10 10:36 [PATCH aspeed-5.2] aspeed: g220a-bmc: Add an FRU John Wang
2020-12-10 10:50 ` Cédric Le Goater

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.