This commit moves the Facebook fby35 BMC machine implementation out of aspeed.c into a new standalone file aspeed_ast2600_fby35.c. This refactor continues the modularization effort for Aspeed platform support, placing each board’s logic in its own dedicated source file. It improves maintainability, readability, and simplifies future development for new platforms without cluttering aspeed.c. Key updates include: - Moved fby35_i2c_init() and fby35_reset() to the new file. - Moved aspeed_machine_fby35_class_init() and machine registration to the new file. - Removed fby35 FRU data (fby35_nic_fruid, fby35_bb_fruid, fby35_bmc_fruid) and their size definitions from aspeed_eeprom.[ch]. - Added aspeed_ast2600_fby35.c to the build system (meson.build). - Cleaned up all fby35-specific code and declarations from aspeed.c and aspeed_eeprom.*. - Introduced FBY35_BMC_RAM_SIZE macro based on FUJI_BMC_RAM_SIZE to remove inter-file dependency. No functional changes. Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Link: https://lore.kernel.org/qemu-devel/20251104031325.146374-20-jamin_lin@aspeedtech.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
178 lines
8.5 KiB
C
178 lines
8.5 KiB
C
/*
|
|
* Facebook fby35
|
|
*
|
|
* Copyright 2016 IBM Corp.
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#include "qemu/osdep.h"
|
|
#include "qapi/error.h"
|
|
#include "hw/arm/machines-qom.h"
|
|
#include "hw/arm/aspeed.h"
|
|
#include "hw/arm/aspeed_soc.h"
|
|
#include "hw/nvram/eeprom_at24c.h"
|
|
#include "hw/sensor/tmp105.h"
|
|
#include "system/reset.h"
|
|
|
|
#define TYPE_LM75 TYPE_TMP105
|
|
#define TYPE_TMP421 "tmp421"
|
|
#define FBY35_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB)
|
|
|
|
static const uint8_t fby35_nic_fruid[] = {
|
|
0x01, 0x00, 0x00, 0x01, 0x0f, 0x20, 0x00, 0xcf, 0x01, 0x0e, 0x19, 0xd7,
|
|
0x5e, 0xcf, 0xc8, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xdd,
|
|
0x4d, 0x65, 0x6c, 0x6c, 0x61, 0x6e, 0x6f, 0x78, 0x20, 0x43, 0x6f, 0x6e,
|
|
0x6e, 0x65, 0x63, 0x74, 0x58, 0x2d, 0x36, 0x20, 0x44, 0x58, 0x20, 0x4f,
|
|
0x43, 0x50, 0x33, 0x2e, 0x30, 0xd8, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd5, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0x58, 0x58, 0x58, 0xcc, 0x46, 0x52, 0x55, 0x20, 0x56, 0x65, 0x72,
|
|
0x20, 0x30, 0x2e, 0x30, 0x32, 0xc0, 0xc0, 0xc0, 0xc1, 0x00, 0x00, 0x2f,
|
|
0x01, 0x11, 0x19, 0xc8, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0xdd, 0x4d, 0x65, 0x6c, 0x6c, 0x61, 0x6e, 0x6f, 0x78, 0x20, 0x43, 0x6f,
|
|
0x6e, 0x6e, 0x65, 0x63, 0x74, 0x58, 0x2d, 0x36, 0x20, 0x44, 0x58, 0x20,
|
|
0x4f, 0x43, 0x50, 0x33, 0x2e, 0x30, 0xd5, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0x58, 0x58, 0x58, 0xd3, 0x41, 0x39, 0x20, 0x20, 0x20, 0x20, 0x20,
|
|
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
|
0xd8, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0xc0, 0xc0, 0xc0, 0xc0, 0xcd, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
|
|
0x74, 0x58, 0x2d, 0x36, 0x20, 0x44, 0x58, 0xc1, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0xdb, 0xc0, 0x82, 0x30, 0x15, 0x79, 0x7f, 0xa6, 0x00,
|
|
0x01, 0x18, 0x0b, 0xff, 0x08, 0x00, 0xff, 0xff, 0x64, 0x00, 0x00, 0x00,
|
|
0x00, 0x03, 0x20, 0x01, 0xff, 0xff, 0x04, 0x46, 0x00, 0xff, 0xff, 0xff,
|
|
0xff, 0xff, 0xff, 0xff, 0x01, 0x81, 0x09, 0x15, 0xb3, 0x10, 0x1d, 0x00,
|
|
0x24, 0x15, 0xb3, 0x00, 0x02, 0xeb, 0x8a, 0x95, 0x5c,
|
|
};
|
|
static const size_t fby35_nic_fruid_len = sizeof(fby35_nic_fruid);
|
|
|
|
static const uint8_t fby35_bb_fruid[] = {
|
|
0x01, 0x00, 0x01, 0x03, 0x10, 0x00, 0x00, 0xeb, 0x01, 0x02, 0x17, 0xc3,
|
|
0x4e, 0x2f, 0x41, 0xc3, 0x4e, 0x2f, 0x41, 0xc1, 0x00, 0x00, 0x00, 0x23,
|
|
0x01, 0x0d, 0x00, 0xb6, 0xd2, 0xd0, 0xc6, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0xd5, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74,
|
|
0x20, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x20, 0x77, 0x42, 0x4d, 0x43, 0xcd,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e, 0x30, 0xc9, 0x58, 0x58, 0x58,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x01, 0x0c, 0x00, 0xc6,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x59, 0x6f, 0x73, 0x65, 0x6d,
|
|
0x69, 0x74, 0x65, 0x20, 0x56, 0x33, 0x2e, 0x35, 0x20, 0x45, 0x56, 0x54,
|
|
0x32, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0x58, 0x58, 0x58, 0xc4, 0x45, 0x56, 0x54, 0x32, 0xcd, 0x58, 0x58,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc7,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e, 0x30, 0xc9,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x4e, 0x2f,
|
|
0x41, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43,
|
|
};
|
|
static const size_t fby35_bb_fruid_len = sizeof(fby35_bb_fruid);
|
|
|
|
static const uint8_t fby35_bmc_fruid[] = {
|
|
0x01, 0x00, 0x00, 0x01, 0x0d, 0x00, 0x00, 0xf1, 0x01, 0x0c, 0x00, 0x36,
|
|
0xe6, 0xd0, 0xc6, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x42, 0x4d,
|
|
0x43, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, 0x4d, 0x6f,
|
|
0x64, 0x75, 0x6c, 0x65, 0xcd, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e,
|
|
0x30, 0xc9, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc1, 0x39, 0x01, 0x0c, 0x00, 0xc6,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x59, 0x6f, 0x73, 0x65, 0x6d,
|
|
0x69, 0x74, 0x65, 0x20, 0x56, 0x33, 0x2e, 0x35, 0x20, 0x45, 0x56, 0x54,
|
|
0x32, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
|
|
0x58, 0x58, 0x58, 0x58, 0xc4, 0x45, 0x56, 0x54, 0x32, 0xcd, 0x58, 0x58,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc7,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e, 0x30, 0xc9,
|
|
0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc8, 0x43, 0x6f,
|
|
0x6e, 0x66, 0x69, 0x67, 0x20, 0x41, 0xc1, 0x45,
|
|
};
|
|
static const size_t fby35_bmc_fruid_len = sizeof(fby35_bmc_fruid);
|
|
|
|
static void fby35_i2c_init(AspeedMachineState *bmc)
|
|
{
|
|
AspeedSoCState *soc = bmc->soc;
|
|
I2CBus *i2c[16];
|
|
|
|
for (int i = 0; i < 16; i++) {
|
|
i2c[i] = aspeed_i2c_get_bus(&soc->i2c, i);
|
|
}
|
|
|
|
i2c_slave_create_simple(i2c[2], TYPE_LM75, 0x4f);
|
|
i2c_slave_create_simple(i2c[8], TYPE_TMP421, 0x1f);
|
|
/* Hotswap controller is actually supposed to be mp5920 or ltc4282. */
|
|
i2c_slave_create_simple(i2c[11], "adm1272", 0x44);
|
|
i2c_slave_create_simple(i2c[12], TYPE_LM75, 0x4e);
|
|
i2c_slave_create_simple(i2c[12], TYPE_LM75, 0x4f);
|
|
|
|
at24c_eeprom_init(i2c[4], 0x51, 128 * KiB);
|
|
at24c_eeprom_init(i2c[6], 0x51, 128 * KiB);
|
|
at24c_eeprom_init_rom(i2c[8], 0x50, 32 * KiB, fby35_nic_fruid,
|
|
fby35_nic_fruid_len);
|
|
at24c_eeprom_init_rom(i2c[11], 0x51, 128 * KiB, fby35_bb_fruid,
|
|
fby35_bb_fruid_len);
|
|
at24c_eeprom_init_rom(i2c[11], 0x54, 128 * KiB, fby35_bmc_fruid,
|
|
fby35_bmc_fruid_len);
|
|
|
|
/*
|
|
* TODO: There is a multi-master i2c connection to an AST1030 MiniBMC on
|
|
* buses 0, 1, 2, 3, and 9. Source address 0x10, target address 0x20 on
|
|
* each.
|
|
*/
|
|
}
|
|
|
|
static void fby35_reset(MachineState *state, ResetType type)
|
|
{
|
|
AspeedMachineState *bmc = ASPEED_MACHINE(state);
|
|
AspeedGPIOState *gpio = &bmc->soc->gpio;
|
|
|
|
qemu_devices_reset(type);
|
|
|
|
/* Board ID: 7 (Class-1, 4 slots) */
|
|
object_property_set_bool(OBJECT(gpio), "gpioV4", true, &error_fatal);
|
|
object_property_set_bool(OBJECT(gpio), "gpioV5", true, &error_fatal);
|
|
object_property_set_bool(OBJECT(gpio), "gpioV6", true, &error_fatal);
|
|
object_property_set_bool(OBJECT(gpio), "gpioV7", false, &error_fatal);
|
|
|
|
/* Slot presence pins, inverse polarity. (False means present) */
|
|
object_property_set_bool(OBJECT(gpio), "gpioH4", false, &error_fatal);
|
|
object_property_set_bool(OBJECT(gpio), "gpioH5", true, &error_fatal);
|
|
object_property_set_bool(OBJECT(gpio), "gpioH6", true, &error_fatal);
|
|
object_property_set_bool(OBJECT(gpio), "gpioH7", true, &error_fatal);
|
|
|
|
/* Slot 12v power pins, normal polarity. (True means powered-on) */
|
|
object_property_set_bool(OBJECT(gpio), "gpioB2", true, &error_fatal);
|
|
object_property_set_bool(OBJECT(gpio), "gpioB3", false, &error_fatal);
|
|
object_property_set_bool(OBJECT(gpio), "gpioB4", false, &error_fatal);
|
|
object_property_set_bool(OBJECT(gpio), "gpioB5", false, &error_fatal);
|
|
}
|
|
|
|
static void aspeed_machine_fby35_class_init(ObjectClass *oc, const void *data)
|
|
{
|
|
MachineClass *mc = MACHINE_CLASS(oc);
|
|
AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
|
|
|
|
mc->desc = "Facebook fby35 BMC (Cortex-A7)";
|
|
mc->reset = fby35_reset;
|
|
amc->fmc_model = "mx66l1g45g";
|
|
amc->num_cs = 2;
|
|
amc->macs_mask = ASPEED_MAC3_ON;
|
|
amc->i2c_init = fby35_i2c_init;
|
|
mc->default_ram_size = FBY35_BMC_RAM_SIZE;
|
|
aspeed_machine_class_init_cpus_defaults(mc);
|
|
}
|
|
|
|
static const TypeInfo aspeed_ast2600_fby35_types[] = {
|
|
{
|
|
.name = MACHINE_TYPE_NAME("fby35-bmc"),
|
|
.parent = MACHINE_TYPE_NAME("ast2600-evb"),
|
|
.class_init = aspeed_machine_fby35_class_init,
|
|
.interfaces = arm_machine_interfaces,
|
|
}
|
|
};
|
|
|
|
DEFINE_TYPES(aspeed_ast2600_fby35_types)
|