diff options
-rw-r--r-- | hw/arm/aspeed.c | 13 | ||||
-rw-r--r-- | hw/arm/aspeed_ast2600.c | 3 | ||||
-rw-r--r-- | hw/arm/aspeed_soc.c | 3 | ||||
-rw-r--r-- | include/hw/arm/aspeed.h | 6 |
4 files changed, 21 insertions, 4 deletions
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 2e7917da74..ad9f772e06 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -258,6 +258,7 @@ static void aspeed_machine_init(MachineState *machine) DriveInfo *drive0 = drive_get(IF_MTD, 0, 0); ram_addr_t max_ram_size; int i; + NICInfo *nd = &nd_table[0]; bmc = g_new0(AspeedBoardState, 1); @@ -277,6 +278,14 @@ static void aspeed_machine_init(MachineState *machine) object_property_set_uint(OBJECT(&bmc->soc), ram_size, "ram-size", &error_fatal); + for (i = 0; i < sc->macs_num; i++) { + if ((amc->macs_mask & (1 << i)) && nd->used) { + qemu_check_nic_model(nd, TYPE_FTGMAC100); + qdev_set_nic_properties(DEVICE(&bmc->soc.ftgmac100[i]), nd); + nd++; + } + } + object_property_set_int(OBJECT(&bmc->soc), amc->hw_strap1, "hw-strap1", &error_abort); object_property_set_int(OBJECT(&bmc->soc), amc->hw_strap2, "hw-strap2", @@ -556,12 +565,14 @@ static int aspeed_soc_num_cpus(const char *soc_name) static void aspeed_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); + AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc); mc->init = aspeed_machine_init; mc->no_floppy = 1; mc->no_cdrom = 1; mc->no_parallel = 1; mc->default_ram_id = "ram"; + amc->macs_mask = ASPEED_MAC0_ON; aspeed_machine_class_props_init(oc); } @@ -680,6 +691,7 @@ static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc, void *data) amc->fmc_model = "w25q512jv"; amc->spi_model = "mx66u51235f"; amc->num_cs = 1; + amc->macs_mask = ASPEED_MAC1_ON | ASPEED_MAC2_ON | ASPEED_MAC3_ON; amc->i2c_init = ast2600_evb_i2c_init; mc->default_ram_size = 1 * GiB; mc->default_cpus = mc->min_cpus = mc->max_cpus = @@ -698,6 +710,7 @@ static void aspeed_machine_tacoma_class_init(ObjectClass *oc, void *data) amc->fmc_model = "mx66l1g45g"; amc->spi_model = "mx66l1g45g"; amc->num_cs = 2; + amc->macs_mask = ASPEED_MAC2_ON; amc->i2c_init = witherspoon_bmc_i2c_init; /* Same board layout */ mc->default_ram_size = 1 * GiB; mc->default_cpus = mc->min_cpus = mc->max_cpus = diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c index c6821b3322..b912d19f80 100644 --- a/hw/arm/aspeed_ast2600.c +++ b/hw/arm/aspeed_ast2600.c @@ -461,8 +461,7 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) } /* Net */ - for (i = 0; i < nb_nics && i < sc->macs_num; i++) { - qdev_set_nic_properties(DEVICE(&s->ftgmac100[i]), &nd_table[i]); + for (i = 0; i < sc->macs_num; i++) { object_property_set_bool(OBJECT(&s->ftgmac100[i]), true, "aspeed", &err); object_property_set_bool(OBJECT(&s->ftgmac100[i]), true, "realized", diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c index e6f4b59134..3ec1257c14 100644 --- a/hw/arm/aspeed_soc.c +++ b/hw/arm/aspeed_soc.c @@ -404,8 +404,7 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) } /* Net */ - for (i = 0; i < nb_nics && i < sc->macs_num; i++) { - qdev_set_nic_properties(DEVICE(&s->ftgmac100[i]), &nd_table[i]); + for (i = 0; i < sc->macs_num; i++) { object_property_set_bool(OBJECT(&s->ftgmac100[i]), true, "aspeed", &err); object_property_set_bool(OBJECT(&s->ftgmac100[i]), true, "realized", diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h index 18521484b9..95b4daece8 100644 --- a/include/hw/arm/aspeed.h +++ b/include/hw/arm/aspeed.h @@ -23,6 +23,11 @@ typedef struct AspeedMachine { bool mmio_exec; } AspeedMachine; +#define ASPEED_MAC0_ON (1 << 0) +#define ASPEED_MAC1_ON (1 << 1) +#define ASPEED_MAC2_ON (1 << 2) +#define ASPEED_MAC3_ON (1 << 3) + #define ASPEED_MACHINE_CLASS(klass) \ OBJECT_CLASS_CHECK(AspeedMachineClass, (klass), TYPE_ASPEED_MACHINE) #define ASPEED_MACHINE_GET_CLASS(obj) \ @@ -39,6 +44,7 @@ typedef struct AspeedMachineClass { const char *fmc_model; const char *spi_model; uint32_t num_cs; + uint32_t macs_mask; void (*i2c_init)(AspeedBoardState *bmc); } AspeedMachineClass; |