hw/nvram/eeprom_at24c: Add init_rom field and at24c_eeprom_init_rom helper
commit9f782e9e827b35166d50476ab26c1b5d568e9509
authorPeter Delevoryas <peter@pjd.dev>
Tue, 7 Feb 2023 08:02:04 +0000 (7 09:02 +0100)
committerCédric Le Goater <clg@kaod.org>
Tue, 7 Feb 2023 08:02:04 +0000 (7 09:02 +0100)
tree3ee91c343c3b758233cd2f5c5735dcdd4f4744ca
parent9077e09a13755b4774a4e640ed3ac1a92db11839
hw/nvram/eeprom_at24c: Add init_rom field and at24c_eeprom_init_rom helper

Allows users to specify binary data to initialize an EEPROM, allowing users to
emulate data programmed at manufacturing time.

- Added init_rom and init_rom_size attributes to TYPE_AT24C_EE
- Added at24c_eeprom_init_rom helper function to initialize attributes
- If -drive property is provided, it overrides init_rom data

Signed-off-by: Peter Delevoryas <peter@pjd.dev>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Corey Minyard <cminyard@mvista.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Ninad Palsule <ninadpalsule@us.ibm.com>
Link: https://lore.kernel.org/r/20230128060543.95582-4-peter@pjd.dev
Signed-off-by: Cédric Le Goater <clg@kaod.org>
hw/nvram/eeprom_at24c.c
include/hw/nvram/eeprom_at24c.h