1
The following changes since commit a2b5f8b8ab7b2c947823088103a40f0ff11fe06b:
1
The following changes since commit 527dede083d3e3e5a13ee996776926e0a0c4e258:
2
2
3
Merge tag 'pull-tcg-20230301' of https://gitlab.com/rth7680/qemu into staging (2023-03-01 19:19:20 +0000)
3
Merge tag 'pull-request-2025-03-19' of https://gitlab.com/thuth/qemu into staging (2025-03-20 08:41:25 -0400)
4
4
5
are available in the Git repository at:
5
are available in the Git repository at:
6
6
7
https://github.com/legoater/qemu/ tags/pull-aspeed-20230302
7
https://github.com/legoater/qemu/ tags/pull-aspeed-20250323
8
8
9
for you to fetch changes up to b22a2d409b1acfdf0d63d1bb3595194ceb3d94da:
9
for you to fetch changes up to 78877b2e06464f49f777e086845e094ea7bc82ef:
10
10
11
aspeed/smc: Replace SysBus IRQs with GPIO lines (2023-03-02 13:57:50 +0100)
11
hw/misc/aspeed_hace: Fix buffer overflow in has_padding function (2025-03-23 18:42:16 +0100)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
aspeed queue:
14
aspeed queue:
15
15
16
* fix for the Aspeed I2C slave mode
16
* Fix AST2700 SoC model
17
* a new I2C echo device from Klaus and its associated test in avocado.
18
* initial SoC cleanups to allow the use of block devices instead of
19
drives on the command line.
20
* new facebook machines and eeprom fixes for the Fuji
21
* readline fix
22
17
23
----------------------------------------------------------------
18
----------------------------------------------------------------
24
Cédric Le Goater (4):
19
Jamin Lin (1):
25
tests/avocado/machine_aspeed.py: Add an I2C slave test
20
hw/misc/aspeed_hace: Fix buffer overflow in has_padding function
26
aspeed: Introduce a spi_boot region under the SoC
27
aspeed: Add a boot_rom overlap region in the SoC spi_boot container
28
aspeed/smc: Replace SysBus IRQs with GPIO lines
29
21
30
Dongli Zhang (1):
22
Steven Lee (1):
31
readline: fix hmp completion issue
23
hw/intc/aspeed: Fix IRQ handler mask check
32
24
33
Karthikeyan Pasupathi (2):
25
Troy Lee (1):
34
hw/arm/aspeed: Adding new machine Yosemitev2 in QEMU
26
aspeed: Fix maximum number of spi controller
35
hw/arm/aspeed: Adding new machine Tiogapass in QEMU
36
27
37
Klaus Jensen (2):
28
include/hw/arm/aspeed_soc.h | 2 +-
38
hw/i2c: only schedule pending master when bus is idle
29
hw/intc/aspeed_intc.c | 2 +-
39
hw/misc: add a toy i2c echo device
30
hw/misc/aspeed_hace.c | 5 +++++
40
31
3 files changed, 7 insertions(+), 2 deletions(-)
41
Sittisak Sinprem (2):
42
hw/at24c : modify at24c to support 1 byte address mode
43
aspeed/fuji : correct the eeprom size
44
45
docs/system/arm/aspeed.rst | 2 +
46
hw/arm/aspeed_eeprom.h | 6 ++
47
include/hw/arm/aspeed_soc.h | 5 ++
48
include/hw/i2c/i2c.h | 2 +
49
hw/arm/aspeed.c | 159 ++++++++++++++++++++++++++++------------
50
hw/arm/aspeed_ast2600.c | 13 ++++
51
hw/arm/aspeed_eeprom.c | 45 ++++++++++++
52
hw/arm/aspeed_soc.c | 14 ++++
53
hw/arm/fby35.c | 8 +-
54
hw/i2c/aspeed_i2c.c | 2 +
55
hw/i2c/core.c | 37 ++++++----
56
hw/misc/i2c-echo.c | 156 +++++++++++++++++++++++++++++++++++++++
57
hw/nvram/eeprom_at24c.c | 30 +++++++-
58
hw/ssi/aspeed_smc.c | 5 +-
59
monitor/hmp.c | 8 +-
60
hw/misc/meson.build | 2 +
61
tests/avocado/machine_aspeed.py | 10 +++
62
17 files changed, 421 insertions(+), 83 deletions(-)
63
create mode 100644 hw/misc/i2c-echo.c
64
diff view generated by jsdifflib
Deleted patch
1
From: Dongli Zhang <dongli.zhang@oracle.com>
2
1
3
The auto completion does not work in some cases.
4
5
Case 1.
6
7
1. (qemu) info reg
8
2. Press 'Tab'.
9
3. It does not auto complete.
10
11
Case 2.
12
13
1. (qemu) block_resize flo
14
2. Press 'Tab'.
15
3. It does not auto complete 'floppy0'.
16
17
Since the readline_add_completion_of() may add any completion when
18
strlen(pfx) is zero, we remove the check with (name[0] == '\0') because
19
strlen() always returns zero in that case.
20
21
Fixes: 52f50b1e9f8f ("readline: Extract readline_add_completion_of() from monitor")
22
Cc: Joe Jin <joe.jin@oracle.com>
23
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
24
Tested-by: Thomas Huth <thuth@redhat.com>
25
Reviewed-by: Markus Armbruster <armbru@redhat.com>
26
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
27
Signed-off-by: Cédric Le Goater <clg@kaod.org>
28
---
29
monitor/hmp.c | 8 ++------
30
1 file changed, 2 insertions(+), 6 deletions(-)
31
32
diff --git a/monitor/hmp.c b/monitor/hmp.c
33
index XXXXXXX..XXXXXXX 100644
34
--- a/monitor/hmp.c
35
+++ b/monitor/hmp.c
36
@@ -XXX,XX +XXX,XX @@ static void cmd_completion(MonitorHMP *mon, const char *name, const char *list)
37
}
38
memcpy(cmd, pstart, len);
39
cmd[len] = '\0';
40
- if (name[0] == '\0') {
41
- readline_add_completion_of(mon->rs, name, cmd);
42
- }
43
+ readline_add_completion_of(mon->rs, name, cmd);
44
if (*p == '\0') {
45
break;
46
}
47
@@ -XXX,XX +XXX,XX @@ static void monitor_find_completion_by_table(MonitorHMP *mon,
48
/* block device name completion */
49
readline_set_completion_index(mon->rs, strlen(str));
50
while ((blk = blk_next(blk)) != NULL) {
51
- if (str[0] == '\0') {
52
- readline_add_completion_of(mon->rs, str, blk_name(blk));
53
- }
54
+ readline_add_completion_of(mon->rs, str, blk_name(blk));
55
}
56
break;
57
case 's':
58
--
59
2.39.2
60
61
diff view generated by jsdifflib
Deleted patch
1
From: Klaus Jensen <k.jensen@samsung.com>
2
1
3
It is not given that the current master will release the bus after a
4
transfer ends. Only schedule a pending master if the bus is idle.
5
6
Fixes: 37fa5ca42623 ("hw/i2c: support multiple masters")
7
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
8
Acked-by: Corey Minyard <cminyard@mvista.com>
9
Message-Id: <20221116084312.35808-2-its@irrelevant.dk>
10
Signed-off-by: Cédric Le Goater <clg@kaod.org>
11
---
12
include/hw/i2c/i2c.h | 2 ++
13
hw/i2c/aspeed_i2c.c | 2 ++
14
hw/i2c/core.c | 37 ++++++++++++++++++++++---------------
15
3 files changed, 26 insertions(+), 15 deletions(-)
16
17
diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/i2c/i2c.h
20
+++ b/include/hw/i2c/i2c.h
21
@@ -XXX,XX +XXX,XX @@ int i2c_start_send(I2CBus *bus, uint8_t address);
22
*/
23
int i2c_start_send_async(I2CBus *bus, uint8_t address);
24
25
+void i2c_schedule_pending_master(I2CBus *bus);
26
+
27
void i2c_end_transfer(I2CBus *bus);
28
void i2c_nack(I2CBus *bus);
29
void i2c_ack(I2CBus *bus);
30
diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c
31
index XXXXXXX..XXXXXXX 100644
32
--- a/hw/i2c/aspeed_i2c.c
33
+++ b/hw/i2c/aspeed_i2c.c
34
@@ -XXX,XX +XXX,XX @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
35
}
36
SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_STOP_CMD, 0);
37
aspeed_i2c_set_state(bus, I2CD_IDLE);
38
+
39
+ i2c_schedule_pending_master(bus->bus);
40
}
41
42
if (aspeed_i2c_bus_pkt_mode_en(bus)) {
43
diff --git a/hw/i2c/core.c b/hw/i2c/core.c
44
index XXXXXXX..XXXXXXX 100644
45
--- a/hw/i2c/core.c
46
+++ b/hw/i2c/core.c
47
@@ -XXX,XX +XXX,XX @@ int i2c_start_transfer(I2CBus *bus, uint8_t address, bool is_recv)
48
49
void i2c_bus_master(I2CBus *bus, QEMUBH *bh)
50
{
51
- if (i2c_bus_busy(bus)) {
52
- I2CPendingMaster *node = g_new(struct I2CPendingMaster, 1);
53
- node->bh = bh;
54
+ I2CPendingMaster *node = g_new(struct I2CPendingMaster, 1);
55
+ node->bh = bh;
56
+
57
+ QSIMPLEQ_INSERT_TAIL(&bus->pending_masters, node, entry);
58
+}
59
+
60
+void i2c_schedule_pending_master(I2CBus *bus)
61
+{
62
+ I2CPendingMaster *node;
63
64
- QSIMPLEQ_INSERT_TAIL(&bus->pending_masters, node, entry);
65
+ if (i2c_bus_busy(bus)) {
66
+ /* someone is already controlling the bus; wait for it to release it */
67
+ return;
68
+ }
69
70
+ if (QSIMPLEQ_EMPTY(&bus->pending_masters)) {
71
return;
72
}
73
74
- bus->bh = bh;
75
+ node = QSIMPLEQ_FIRST(&bus->pending_masters);
76
+ bus->bh = node->bh;
77
+
78
+ QSIMPLEQ_REMOVE_HEAD(&bus->pending_masters, entry);
79
+ g_free(node);
80
+
81
qemu_bh_schedule(bus->bh);
82
}
83
84
void i2c_bus_release(I2CBus *bus)
85
{
86
bus->bh = NULL;
87
+
88
+ i2c_schedule_pending_master(bus);
89
}
90
91
int i2c_start_recv(I2CBus *bus, uint8_t address)
92
@@ -XXX,XX +XXX,XX @@ void i2c_end_transfer(I2CBus *bus)
93
g_free(node);
94
}
95
bus->broadcast = false;
96
-
97
- if (!QSIMPLEQ_EMPTY(&bus->pending_masters)) {
98
- I2CPendingMaster *node = QSIMPLEQ_FIRST(&bus->pending_masters);
99
- bus->bh = node->bh;
100
-
101
- QSIMPLEQ_REMOVE_HEAD(&bus->pending_masters, entry);
102
- g_free(node);
103
-
104
- qemu_bh_schedule(bus->bh);
105
- }
106
}
107
108
int i2c_send(I2CBus *bus, uint8_t data)
109
--
110
2.39.2
111
112
diff view generated by jsdifflib
1
The default boot address of the Aspeed SoCs is 0x0. For this reason,
1
From: Troy Lee <troy_lee@aspeedtech.com>
2
the FMC flash device contents are remapped by HW on the first 256MB of
3
the address space. In QEMU, this is currently done in the machine init
4
with the setup of a region alias.
5
2
6
Move this code to the SoC and introduce an extra container to prepare
3
Commit 6de4aa8dc544 ("hw/arm/aspeed_ast27x0: Add SoC Support for AST2700
7
ground for the boot ROM region which will overlap the FMC flash
4
A1") extends ast2700a1 spis_num to 3, but ASPEED_SPIS_NUM defines the
8
remapping.
5
maximum number of spi controller to 2, result in ehci[0] is being
6
overwritten in runtime.
9
7
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Signed-off-by: Troy Lee <troy_lee@aspeedtech.com>
11
Signed-off-by: Cédric Le Goater <clg@kaod.org>
9
Fixes: 6de4aa8dc544 ("hw/arm/aspeed_ast27x0: Add SoC Support for AST2700 A1")
10
Reviewed-by: Cédric Le Goater <clg@redhat.com>
11
Link: https://lore.kernel.org/qemu-devel/20250317065938.1902272-1-troy_lee@aspeedtech.com
12
Signed-off-by: Cédric Le Goater <clg@redhat.com>
12
---
13
---
13
include/hw/arm/aspeed_soc.h | 5 +++++
14
include/hw/arm/aspeed_soc.h | 2 +-
14
hw/arm/aspeed.c | 13 +------------
15
1 file changed, 1 insertion(+), 1 deletion(-)
15
hw/arm/aspeed_ast2600.c | 13 +++++++++++++
16
hw/arm/aspeed_soc.c | 14 ++++++++++++++
17
hw/arm/fby35.c | 8 +-------
18
5 files changed, 34 insertions(+), 19 deletions(-)
19
16
20
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
17
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
21
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
22
--- a/include/hw/arm/aspeed_soc.h
19
--- a/include/hw/arm/aspeed_soc.h
23
+++ b/include/hw/arm/aspeed_soc.h
20
+++ b/include/hw/arm/aspeed_soc.h
24
@@ -XXX,XX +XXX,XX @@ struct AspeedSoCState {
25
MemoryRegion *dram_mr;
26
MemoryRegion dram_container;
27
MemoryRegion sram;
28
+ MemoryRegion spi_boot_container;
29
+ MemoryRegion spi_boot;
30
AspeedVICState vic;
31
AspeedRtcState rtc;
32
AspeedTimerCtrlState timerctrl;
33
@@ -XXX,XX +XXX,XX @@ struct AspeedSoCClass {
34
35
36
enum {
37
+ ASPEED_DEV_SPI_BOOT,
38
ASPEED_DEV_IOMEM,
39
ASPEED_DEV_UART1,
40
ASPEED_DEV_UART2,
41
@@ -XXX,XX +XXX,XX @@ enum {
42
ASPEED_DEV_JTAG1,
43
};
44
45
+#define ASPEED_SOC_SPI_BOOT_ADDR 0x0
46
+
47
qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev);
48
bool aspeed_soc_uart_realize(AspeedSoCState *s, Error **errp);
49
void aspeed_soc_uart_set_chr(AspeedSoCState *s, int dev, Chardev *chr);
50
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
51
index XXXXXXX..XXXXXXX 100644
52
--- a/hw/arm/aspeed.c
53
+++ b/hw/arm/aspeed.c
54
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_init(MachineState *machine)
55
MemoryRegion *boot_rom = g_new(MemoryRegion, 1);
56
uint64_t size = memory_region_size(&fl->mmio);
57
58
- /*
59
- * create a ROM region using the default mapping window size of
60
- * the flash module. The window size is 64MB for the AST2400
61
- * SoC and 128MB for the AST2500 SoC, which is twice as big as
62
- * needed by the flash modules of the Aspeed machines.
63
- */
64
- if (ASPEED_MACHINE(machine)->mmio_exec) {
65
- memory_region_init_alias(boot_rom, NULL, "aspeed.boot_rom",
66
- &fl->mmio, 0, size);
67
- memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR,
68
- boot_rom);
69
- } else {
70
+ if (!ASPEED_MACHINE(machine)->mmio_exec) {
71
memory_region_init_rom(boot_rom, NULL, "aspeed.boot_rom",
72
size, &error_abort);
73
memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR,
74
diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
75
index XXXXXXX..XXXXXXX 100644
76
--- a/hw/arm/aspeed_ast2600.c
77
+++ b/hw/arm/aspeed_ast2600.c
78
@@ -XXX,XX +XXX,XX @@
21
@@ -XXX,XX +XXX,XX @@
79
#define ASPEED_SOC_DPMCU_SIZE 0x00040000
22
#include "hw/char/serial-mm.h"
80
23
#include "hw/intc/arm_gicv3.h"
81
static const hwaddr aspeed_soc_ast2600_memmap[] = {
24
82
+ [ASPEED_DEV_SPI_BOOT] = ASPEED_SOC_SPI_BOOT_ADDR,
25
-#define ASPEED_SPIS_NUM 2
83
[ASPEED_DEV_SRAM] = 0x10000000,
26
+#define ASPEED_SPIS_NUM 3
84
[ASPEED_DEV_DPMCU] = 0x18000000,
27
#define ASPEED_EHCIS_NUM 2
85
/* 0x16000000 0x17FFFFFF : AHB BUS do LPC Bus bridge */
28
#define ASPEED_WDTS_NUM 8
86
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
29
#define ASPEED_CPUS_NUM 4
87
qemu_irq irq;
88
g_autofree char *sram_name = NULL;
89
90
+ /* Default boot region (SPI memory or ROMs) */
91
+ memory_region_init(&s->spi_boot_container, OBJECT(s),
92
+ "aspeed.spi_boot_container", 0x10000000);
93
+ memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_SPI_BOOT],
94
+ &s->spi_boot_container);
95
+
96
/* IO space */
97
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem), "aspeed.io",
98
sc->memmap[ASPEED_DEV_IOMEM],
99
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
100
sysbus_connect_irq(SYS_BUS_DEVICE(&s->fmc), 0,
101
aspeed_soc_get_irq(s, ASPEED_DEV_FMC));
102
103
+ /* Set up an alias on the FMC CE0 region (boot default) */
104
+ MemoryRegion *fmc0_mmio = &s->fmc.flashes[0].mmio;
105
+ memory_region_init_alias(&s->spi_boot, OBJECT(s), "aspeed.spi_boot",
106
+ fmc0_mmio, 0, memory_region_size(fmc0_mmio));
107
+ memory_region_add_subregion(&s->spi_boot_container, 0x0, &s->spi_boot);
108
+
109
/* SPI */
110
for (i = 0; i < sc->spis_num; i++) {
111
object_property_set_link(OBJECT(&s->spi[i]), "dram",
112
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
113
index XXXXXXX..XXXXXXX 100644
114
--- a/hw/arm/aspeed_soc.c
115
+++ b/hw/arm/aspeed_soc.c
116
@@ -XXX,XX +XXX,XX @@
117
#define ASPEED_SOC_IOMEM_SIZE 0x00200000
118
119
static const hwaddr aspeed_soc_ast2400_memmap[] = {
120
+ [ASPEED_DEV_SPI_BOOT] = ASPEED_SOC_SPI_BOOT_ADDR,
121
[ASPEED_DEV_IOMEM] = 0x1E600000,
122
[ASPEED_DEV_FMC] = 0x1E620000,
123
[ASPEED_DEV_SPI1] = 0x1E630000,
124
@@ -XXX,XX +XXX,XX @@ static const hwaddr aspeed_soc_ast2400_memmap[] = {
125
};
126
127
static const hwaddr aspeed_soc_ast2500_memmap[] = {
128
+ [ASPEED_DEV_SPI_BOOT] = ASPEED_SOC_SPI_BOOT_ADDR,
129
[ASPEED_DEV_IOMEM] = 0x1E600000,
130
[ASPEED_DEV_FMC] = 0x1E620000,
131
[ASPEED_DEV_SPI1] = 0x1E630000,
132
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
133
Error *err = NULL;
134
g_autofree char *sram_name = NULL;
135
136
+ /* Default boot region (SPI memory or ROMs) */
137
+ memory_region_init(&s->spi_boot_container, OBJECT(s),
138
+ "aspeed.spi_boot_container", 0x10000000);
139
+ memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_SPI_BOOT],
140
+ &s->spi_boot_container);
141
+
142
/* IO space */
143
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem), "aspeed.io",
144
sc->memmap[ASPEED_DEV_IOMEM],
145
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
146
sysbus_connect_irq(SYS_BUS_DEVICE(&s->fmc), 0,
147
aspeed_soc_get_irq(s, ASPEED_DEV_FMC));
148
149
+ /* Set up an alias on the FMC CE0 region (boot default) */
150
+ MemoryRegion *fmc0_mmio = &s->fmc.flashes[0].mmio;
151
+ memory_region_init_alias(&s->spi_boot, OBJECT(s), "aspeed.spi_boot",
152
+ fmc0_mmio, 0, memory_region_size(fmc0_mmio));
153
+ memory_region_add_subregion(&s->spi_boot_container, 0x0, &s->spi_boot);
154
+
155
/* SPI */
156
for (i = 0; i < sc->spis_num; i++) {
157
if (!sysbus_realize(SYS_BUS_DEVICE(&s->spi[i]), errp)) {
158
diff --git a/hw/arm/fby35.c b/hw/arm/fby35.c
159
index XXXXXXX..XXXXXXX 100644
160
--- a/hw/arm/fby35.c
161
+++ b/hw/arm/fby35.c
162
@@ -XXX,XX +XXX,XX @@ static void fby35_bmc_init(Fby35State *s)
163
MemoryRegion *boot_rom = g_new(MemoryRegion, 1);
164
uint64_t size = memory_region_size(&fl->mmio);
165
166
- if (s->mmio_exec) {
167
- memory_region_init_alias(boot_rom, NULL, "aspeed.boot_rom",
168
- &fl->mmio, 0, size);
169
- memory_region_add_subregion(&s->bmc_memory, FBY35_BMC_FIRMWARE_ADDR,
170
- boot_rom);
171
- } else {
172
-
173
+ if (!s->mmio_exec) {
174
memory_region_init_rom(boot_rom, NULL, "aspeed.boot_rom",
175
size, &error_abort);
176
memory_region_add_subregion(&s->bmc_memory, FBY35_BMC_FIRMWARE_ADDR,
177
--
30
--
178
2.39.2
31
2.49.0
179
32
180
33
diff view generated by jsdifflib
1
It's cleaner and removes the curious '+ 1' required to skip the DMA
1
From: Steven Lee <steven_lee@aspeedtech.com>
2
IRQ line of the controller.
3
2
4
Signed-off-by: Cédric Le Goater <clg@kaod.org>
3
Updated the IRQ handler mask check to AND with select variable.
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
This ensures that the interrupt service routine is correctly triggered
6
Signed-off-by: Cédric Le Goater <clg@kaod.org>
5
for the interrupts within the same irq group.
6
7
For example, both `eth0` and the debug UART are handled in `GICINT132`.
8
Without this fix, the debug console may hang if the `eth0` ISR is not
9
handled.
10
11
Signed-off-by: Steven Lee <steven_lee@aspeedtech.com>
12
Change-Id: Ic3609eb72218dfd68be6057d78b8953b18828709
13
Reviewed-by: Cédric Le Goater <clg@redhat.com>
14
Fixes: d831c5fd8682 ("aspeed/intc: Add AST2700 support")
15
Link: https://lore.kernel.org/qemu-devel/20250320092543.4040672-2-steven_lee@aspeedtech.com
16
Signed-off-by: Cédric Le Goater <clg@redhat.com>
7
---
17
---
8
hw/arm/aspeed.c | 2 +-
18
hw/intc/aspeed_intc.c | 2 +-
9
hw/ssi/aspeed_smc.c | 5 +----
19
1 file changed, 1 insertion(+), 1 deletion(-)
10
2 files changed, 2 insertions(+), 5 deletions(-)
11
20
12
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
21
diff --git a/hw/intc/aspeed_intc.c b/hw/intc/aspeed_intc.c
13
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
14
--- a/hw/arm/aspeed.c
23
--- a/hw/intc/aspeed_intc.c
15
+++ b/hw/arm/aspeed.c
24
+++ b/hw/intc/aspeed_intc.c
16
@@ -XXX,XX +XXX,XX @@ void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
25
@@ -XXX,XX +XXX,XX @@ static void aspeed_intc_set_irq_handler(AspeedINTCState *s,
17
qdev_realize_and_unref(dev, BUS(s->spi), &error_fatal);
26
outpin_idx = intc_irq->outpin_idx;
18
27
inpin_idx = intc_irq->inpin_idx;
19
cs_line = qdev_get_gpio_in_named(dev, SSI_GPIO_CS, 0);
28
20
- sysbus_connect_irq(SYS_BUS_DEVICE(s), i + 1, cs_line);
29
- if (s->mask[inpin_idx] || s->regs[status_reg]) {
21
+ qdev_connect_gpio_out_named(DEVICE(s), "cs", i, cs_line);
30
+ if ((s->mask[inpin_idx] & select) || (s->regs[status_reg] & select)) {
22
}
31
/*
23
}
32
* a. mask is not 0 means in ISR mode
24
33
* sources interrupt routine are executing.
25
diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
26
index XXXXXXX..XXXXXXX 100644
27
--- a/hw/ssi/aspeed_smc.c
28
+++ b/hw/ssi/aspeed_smc.c
29
@@ -XXX,XX +XXX,XX @@ static void aspeed_smc_realize(DeviceState *dev, Error **errp)
30
31
/* Setup cs_lines for peripherals */
32
s->cs_lines = g_new0(qemu_irq, asc->cs_num_max);
33
-
34
- for (i = 0; i < asc->cs_num_max; ++i) {
35
- sysbus_init_irq(sbd, &s->cs_lines[i]);
36
- }
37
+ qdev_init_gpio_out_named(DEVICE(s), s->cs_lines, "cs", asc->cs_num_max);
38
39
/* The memory region for the controller registers */
40
memory_region_init_io(&s->mmio, OBJECT(s), &aspeed_smc_ops, s,
41
--
34
--
42
2.39.2
35
2.49.0
43
36
44
37
diff view generated by jsdifflib
1
From: Klaus Jensen <k.jensen@samsung.com>
1
From: Jamin Lin <jamin_lin@aspeedtech.com>
2
2
3
Add an example I2C device to demonstrate how a slave may master the bus
3
The maximum padding size is either 64 or 128 bytes and should always be smaller
4
and send data asynchronously to another slave.
4
than "req_len". If "padding_size" exceeds "req_len", then
5
"req_len - padding_size" underflows due to "uint32_t" data type, leading to a
6
large incorrect value (e.g., `0xFFXXXXXX`). This causes an out-of-bounds memory
7
access, potentially leading to a buffer overflow.
5
8
6
The device will echo whatever it is sent to the device identified by the
9
Added a check to ensure "padding_size" does not exceed "req_len" before
7
first byte received.
10
computing "pad_offset". This prevents "req_len - padding_size" from underflowing
11
and avoids accessing invalid memory.
8
12
9
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
13
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
10
[ clg: integrated fixes :
14
Reviewed-by: Cédric Le Goater <clg@redhat.com>
11
https://lore.kernel.org/qemu-devel/Y3yMKAhOkYGtnkOp@cormorant.local/ ]
15
Fixes: 5cd7d8564a8b563da724b9e6264c967f0a091afa ("aspeed/hace: Support AST2600 HACE ")
12
Message-Id: <20220601210831.67259-7-its@irrelevant.dk>
16
Link: https://lore.kernel.org/qemu-devel/20250321092623.2097234-3-jamin_lin@aspeedtech.com
13
Signed-off-by: Cédric Le Goater <clg@kaod.org>
17
Signed-off-by: Cédric Le Goater <clg@redhat.com>
14
---
18
---
15
hw/misc/i2c-echo.c | 156 ++++++++++++++++++++++++++++++++++++++++++++
19
hw/misc/aspeed_hace.c | 5 +++++
16
hw/misc/meson.build | 2 +
20
1 file changed, 5 insertions(+)
17
2 files changed, 158 insertions(+)
18
create mode 100644 hw/misc/i2c-echo.c
19
21
20
diff --git a/hw/misc/i2c-echo.c b/hw/misc/i2c-echo.c
22
diff --git a/hw/misc/aspeed_hace.c b/hw/misc/aspeed_hace.c
21
new file mode 100644
23
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX
24
--- a/hw/misc/aspeed_hace.c
23
--- /dev/null
25
+++ b/hw/misc/aspeed_hace.c
24
+++ b/hw/misc/i2c-echo.c
26
@@ -XXX,XX +XXX,XX @@ static bool has_padding(AspeedHACEState *s, struct iovec *iov,
25
@@ -XXX,XX +XXX,XX @@
27
if (*total_msg_len <= s->total_req_len) {
26
+#include "qemu/osdep.h"
28
uint32_t padding_size = s->total_req_len - *total_msg_len;
27
+#include "qemu/timer.h"
29
uint8_t *padding = iov->iov_base;
28
+#include "qemu/main-loop.h"
29
+#include "block/aio.h"
30
+#include "hw/i2c/i2c.h"
31
+
30
+
32
+#define TYPE_I2C_ECHO "i2c-echo"
31
+ if (padding_size > req_len) {
33
+OBJECT_DECLARE_SIMPLE_TYPE(I2CEchoState, I2C_ECHO)
32
+ return false;
34
+
35
+enum i2c_echo_state {
36
+ I2C_ECHO_STATE_IDLE,
37
+ I2C_ECHO_STATE_START_SEND,
38
+ I2C_ECHO_STATE_ACK,
39
+};
40
+
41
+typedef struct I2CEchoState {
42
+ I2CSlave parent_obj;
43
+
44
+ I2CBus *bus;
45
+
46
+ enum i2c_echo_state state;
47
+ QEMUBH *bh;
48
+
49
+ unsigned int pos;
50
+ uint8_t data[3];
51
+} I2CEchoState;
52
+
53
+static void i2c_echo_bh(void *opaque)
54
+{
55
+ I2CEchoState *state = opaque;
56
+
57
+ switch (state->state) {
58
+ case I2C_ECHO_STATE_IDLE:
59
+ return;
60
+
61
+ case I2C_ECHO_STATE_START_SEND:
62
+ if (i2c_start_send_async(state->bus, state->data[0])) {
63
+ goto release_bus;
64
+ }
33
+ }
65
+
34
+
66
+ state->pos++;
35
*pad_offset = req_len - padding_size;
67
+ state->state = I2C_ECHO_STATE_ACK;
36
if (padding[*pad_offset] == 0x80) {
68
+ return;
37
return true;
69
+
70
+ case I2C_ECHO_STATE_ACK:
71
+ if (state->pos > 2) {
72
+ break;
73
+ }
74
+
75
+ if (i2c_send_async(state->bus, state->data[state->pos++])) {
76
+ break;
77
+ }
78
+
79
+ return;
80
+ }
81
+
82
+
83
+ i2c_end_transfer(state->bus);
84
+release_bus:
85
+ i2c_bus_release(state->bus);
86
+
87
+ state->state = I2C_ECHO_STATE_IDLE;
88
+}
89
+
90
+static int i2c_echo_event(I2CSlave *s, enum i2c_event event)
91
+{
92
+ I2CEchoState *state = I2C_ECHO(s);
93
+
94
+ switch (event) {
95
+ case I2C_START_RECV:
96
+ state->pos = 0;
97
+
98
+ break;
99
+
100
+ case I2C_START_SEND:
101
+ state->pos = 0;
102
+
103
+ break;
104
+
105
+ case I2C_FINISH:
106
+ state->pos = 0;
107
+ state->state = I2C_ECHO_STATE_START_SEND;
108
+ i2c_bus_master(state->bus, state->bh);
109
+
110
+ break;
111
+
112
+ case I2C_NACK:
113
+ break;
114
+
115
+ default:
116
+ return -1;
117
+ }
118
+
119
+ return 0;
120
+}
121
+
122
+static uint8_t i2c_echo_recv(I2CSlave *s)
123
+{
124
+ I2CEchoState *state = I2C_ECHO(s);
125
+
126
+ if (state->pos > 2) {
127
+ return 0xff;
128
+ }
129
+
130
+ return state->data[state->pos++];
131
+}
132
+
133
+static int i2c_echo_send(I2CSlave *s, uint8_t data)
134
+{
135
+ I2CEchoState *state = I2C_ECHO(s);
136
+
137
+ if (state->pos > 2) {
138
+ return -1;
139
+ }
140
+
141
+ state->data[state->pos++] = data;
142
+
143
+ return 0;
144
+}
145
+
146
+static void i2c_echo_realize(DeviceState *dev, Error **errp)
147
+{
148
+ I2CEchoState *state = I2C_ECHO(dev);
149
+ BusState *bus = qdev_get_parent_bus(dev);
150
+
151
+ state->bus = I2C_BUS(bus);
152
+ state->bh = qemu_bh_new(i2c_echo_bh, state);
153
+
154
+ return;
155
+}
156
+
157
+static void i2c_echo_class_init(ObjectClass *oc, void *data)
158
+{
159
+ I2CSlaveClass *sc = I2C_SLAVE_CLASS(oc);
160
+ DeviceClass *dc = DEVICE_CLASS(oc);
161
+
162
+ dc->realize = i2c_echo_realize;
163
+
164
+ sc->event = i2c_echo_event;
165
+ sc->recv = i2c_echo_recv;
166
+ sc->send = i2c_echo_send;
167
+}
168
+
169
+static const TypeInfo i2c_echo = {
170
+ .name = TYPE_I2C_ECHO,
171
+ .parent = TYPE_I2C_SLAVE,
172
+ .instance_size = sizeof(I2CEchoState),
173
+ .class_init = i2c_echo_class_init,
174
+};
175
+
176
+static void register_types(void)
177
+{
178
+ type_register_static(&i2c_echo);
179
+}
180
+
181
+type_init(register_types);
182
diff --git a/hw/misc/meson.build b/hw/misc/meson.build
183
index XXXXXXX..XXXXXXX 100644
184
--- a/hw/misc/meson.build
185
+++ b/hw/misc/meson.build
186
@@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_rng.c'))
187
188
softmmu_ss.add(when: 'CONFIG_GRLIB', if_true: files('grlib_ahb_apb_pnp.c'))
189
190
+softmmu_ss.add(when: 'CONFIG_I2C', if_true: files('i2c-echo.c'))
191
+
192
specific_ss.add(when: 'CONFIG_AVR_POWER', if_true: files('avr_power.c'))
193
194
specific_ss.add(when: 'CONFIG_MAC_VIA', if_true: files('mac_via.c'))
195
--
38
--
196
2.39.2
39
2.49.0
197
40
198
41
diff view generated by jsdifflib
Deleted patch
1
The Aspeed 2600 I2C controller supports a slave mode which can be
2
tested with the I2C echo device. Test extracted from :
3
1
4
https://lists.nongnu.org/archive/html/qemu-devel/2022-06/msg00183.html
5
6
Suggested-by: Klaus Jensen <k.jensen@samsung.com>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Signed-off-by: Cédric Le Goater <clg@kaod.org>
9
---
10
tests/avocado/machine_aspeed.py | 10 ++++++++++
11
1 file changed, 10 insertions(+)
12
13
diff --git a/tests/avocado/machine_aspeed.py b/tests/avocado/machine_aspeed.py
14
index XXXXXXX..XXXXXXX 100644
15
--- a/tests/avocado/machine_aspeed.py
16
+++ b/tests/avocado/machine_aspeed.py
17
@@ -XXX,XX +XXX,XX @@ def test_arm_ast2600_evb_buildroot(self):
18
'tmp105,bus=aspeed.i2c.bus.3,address=0x4d,id=tmp-test');
19
self.vm.add_args('-device',
20
'ds1338,bus=aspeed.i2c.bus.3,address=0x32');
21
+ self.vm.add_args('-device',
22
+ 'i2c-echo,bus=aspeed.i2c.bus.3,address=0x42');
23
self.do_test_arm_aspeed_buildroot_start(image_path, '0xf00')
24
25
exec_command_and_wait_for_pattern(self,
26
@@ -XXX,XX +XXX,XX @@ def test_arm_ast2600_evb_buildroot(self):
27
year = time.strftime("%Y")
28
exec_command_and_wait_for_pattern(self, 'hwclock -f /dev/rtc1', year);
29
30
+ exec_command_and_wait_for_pattern(self,
31
+ 'echo slave-24c02 0x1064 > /sys/bus/i2c/devices/i2c-3/new_device',
32
+ 'i2c i2c-3: new_device: Instantiated device slave-24c02 at 0x64');
33
+ exec_command(self, 'i2cset -y 3 0x42 0x64 0x00 0xaa i');
34
+ time.sleep(0.1)
35
+ exec_command_and_wait_for_pattern(self,
36
+ 'hexdump /sys/bus/i2c/devices/3-1064/slave-eeprom',
37
+ '0000000 ffaa ffff ffff ffff ffff ffff ffff ffff');
38
self.do_test_arm_aspeed_buildroot_poweroff()
39
40
41
--
42
2.39.2
43
44
diff view generated by jsdifflib
Deleted patch
1
From: Karthikeyan Pasupathi <pkarthikeyan1509@gmail.com>
2
1
3
This patch support Yosemitev2 in QEMU environment.
4
and introduced EEPROM BMC FRU data support "add fbyv2_bmc_fruid data"
5
along with the machine support.
6
7
Signed-off-by: Karthikeyan Pasupathi <pkarthikeyan1509@gmail.com>
8
Reviewed-by: Cédric Le Goater <clg@kaod.org>
9
[ clg: - commit log topic update
10
- Documentation update ]
11
Message-Id: <20230216133326.216017-1-pkarthikeyan1509@gmail.com>
12
Signed-off-by: Cédric Le Goater <clg@kaod.org>
13
---
14
docs/system/arm/aspeed.rst | 1 +
15
hw/arm/aspeed_eeprom.h | 3 +++
16
hw/arm/aspeed.c | 31 +++++++++++++++++++++++++++++++
17
hw/arm/aspeed_eeprom.c | 23 +++++++++++++++++++++++
18
4 files changed, 58 insertions(+)
19
20
diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst
21
index XXXXXXX..XXXXXXX 100644
22
--- a/docs/system/arm/aspeed.rst
23
+++ b/docs/system/arm/aspeed.rst
24
@@ -XXX,XX +XXX,XX @@ AST2500 SoC based machines :
25
- ``sonorapass-bmc`` OCP SonoraPass BMC
26
- ``fp5280g2-bmc`` Inspur FP5280G2 BMC
27
- ``g220a-bmc`` Bytedance G220A BMC
28
+- ``yosemitev2-bmc`` Facebook YosemiteV2 BMC
29
30
AST2600 SoC based machines :
31
32
diff --git a/hw/arm/aspeed_eeprom.h b/hw/arm/aspeed_eeprom.h
33
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/arm/aspeed_eeprom.h
35
+++ b/hw/arm/aspeed_eeprom.h
36
@@ -XXX,XX +XXX,XX @@ extern const size_t fby35_nic_fruid_len;
37
extern const size_t fby35_bb_fruid_len;
38
extern const size_t fby35_bmc_fruid_len;
39
40
+extern const uint8_t yosemitev2_bmc_fruid[];
41
+extern const size_t yosemitev2_bmc_fruid_len;
42
+
43
#endif
44
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
45
index XXXXXXX..XXXXXXX 100644
46
--- a/hw/arm/aspeed.c
47
+++ b/hw/arm/aspeed.c
48
@@ -XXX,XX +XXX,XX @@ static void ast2600_evb_i2c_init(AspeedMachineState *bmc)
49
TYPE_TMP105, 0x4d);
50
}
51
52
+static void yosemitev2_bmc_i2c_init(AspeedMachineState *bmc)
53
+{
54
+ AspeedSoCState *soc = &bmc->soc;
55
+
56
+ at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 4), 0x51, 128 * KiB);
57
+ at24c_eeprom_init_rom(aspeed_i2c_get_bus(&soc->i2c, 8), 0x51, 128 * KiB,
58
+ yosemitev2_bmc_fruid, yosemitev2_bmc_fruid_len);
59
+}
60
+
61
static void romulus_bmc_i2c_init(AspeedMachineState *bmc)
62
{
63
AspeedSoCState *soc = &bmc->soc;
64
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc, void *data)
65
aspeed_soc_num_cpus(amc->soc_name);
66
};
67
68
+static void aspeed_machine_yosemitev2_class_init(ObjectClass *oc, void *data)
69
+{
70
+ MachineClass *mc = MACHINE_CLASS(oc);
71
+ AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
72
+
73
+ mc->desc = "Facebook YosemiteV2 BMC (ARM1176)";
74
+ amc->soc_name = "ast2500-a1";
75
+ amc->hw_strap1 = AST2500_EVB_HW_STRAP1;
76
+ amc->hw_strap2 = 0;
77
+ amc->fmc_model = "n25q256a";
78
+ amc->spi_model = "mx25l25635e";
79
+ amc->num_cs = 2;
80
+ amc->i2c_init = yosemitev2_bmc_i2c_init;
81
+ mc->default_ram_size = 512 * MiB;
82
+ mc->default_cpus = mc->min_cpus = mc->max_cpus =
83
+ aspeed_soc_num_cpus(amc->soc_name);
84
+};
85
+
86
static void aspeed_machine_romulus_class_init(ObjectClass *oc, void *data)
87
{
88
MachineClass *mc = MACHINE_CLASS(oc);
89
@@ -XXX,XX +XXX,XX @@ static const TypeInfo aspeed_machine_types[] = {
90
.name = MACHINE_TYPE_NAME("ast2600-evb"),
91
.parent = TYPE_ASPEED_MACHINE,
92
.class_init = aspeed_machine_ast2600_evb_class_init,
93
+ }, {
94
+ .name = MACHINE_TYPE_NAME("yosemitev2-bmc"),
95
+ .parent = TYPE_ASPEED_MACHINE,
96
+ .class_init = aspeed_machine_yosemitev2_class_init,
97
}, {
98
.name = MACHINE_TYPE_NAME("tacoma-bmc"),
99
.parent = TYPE_ASPEED_MACHINE,
100
diff --git a/hw/arm/aspeed_eeprom.c b/hw/arm/aspeed_eeprom.c
101
index XXXXXXX..XXXXXXX 100644
102
--- a/hw/arm/aspeed_eeprom.c
103
+++ b/hw/arm/aspeed_eeprom.c
104
@@ -XXX,XX +XXX,XX @@ const uint8_t fby35_bmc_fruid[] = {
105
0x6e, 0x66, 0x69, 0x67, 0x20, 0x41, 0xc1, 0x45,
106
};
107
108
+/* Yosemite V2 BMC FRU */
109
+const uint8_t yosemitev2_bmc_fruid[] = {
110
+ 0x01, 0x00, 0x00, 0x01, 0x0d, 0x00, 0x00, 0xf1, 0x01, 0x0c, 0x00, 0x36,
111
+ 0xe6, 0xd0, 0xc6, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x42, 0x4d,
112
+ 0x43, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, 0x4d, 0x6f,
113
+ 0x64, 0x75, 0x6c, 0x65, 0xcd, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
114
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58,
115
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e,
116
+ 0x30, 0xc9, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2,
117
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
118
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc1, 0x39, 0x01, 0x0c, 0x00, 0xc6,
119
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x59, 0x6f, 0x73, 0x65, 0x6d,
120
+ 0x69, 0x74, 0x65, 0x20, 0x56, 0x32, 0x2e, 0x30, 0x20, 0x45, 0x56, 0x54,
121
+ 0x32, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
122
+ 0x58, 0x58, 0x58, 0x58, 0xc4, 0x45, 0x56, 0x54, 0x32, 0xcd, 0x58, 0x58,
123
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc7,
124
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e, 0x30, 0xc9,
125
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc8, 0x43, 0x6f,
126
+ 0x6e, 0x66, 0x69, 0x67, 0x20, 0x41, 0xc1, 0x45,
127
+};
128
+
129
const size_t fby35_nic_fruid_len = sizeof(fby35_nic_fruid);
130
const size_t fby35_bb_fruid_len = sizeof(fby35_bb_fruid);
131
const size_t fby35_bmc_fruid_len = sizeof(fby35_bmc_fruid);
132
+
133
+const size_t yosemitev2_bmc_fruid_len = sizeof(yosemitev2_bmc_fruid);
134
--
135
2.39.2
136
137
diff view generated by jsdifflib
Deleted patch
1
From: Karthikeyan Pasupathi <pkarthikeyan1509@gmail.com>
2
1
3
This patch support Tiogapass in QEMU environment.
4
and introduced EEPROM BMC FRU data support "add tiogapass_bmc_fruid data"
5
along with the machine support.
6
7
Signed-off-by: Karthikeyan Pasupathi <pkarthikeyan1509@gmail.com>
8
Reviewed-by: Cédric Le Goater <clg@kaod.org>
9
[ clg: - commit log topic update
10
- checkpatch issues
11
- Documentation update ]
12
Message-Id: <20230216184342.253868-1-pkarthikeyan1509@gmail.com>
13
Signed-off-by: Cédric Le Goater <clg@kaod.org>
14
---
15
docs/system/arm/aspeed.rst | 1 +
16
hw/arm/aspeed_eeprom.h | 3 +++
17
hw/arm/aspeed.c | 32 ++++++++++++++++++++++++++++++++
18
hw/arm/aspeed_eeprom.c | 22 ++++++++++++++++++++++
19
4 files changed, 58 insertions(+)
20
21
diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst
22
index XXXXXXX..XXXXXXX 100644
23
--- a/docs/system/arm/aspeed.rst
24
+++ b/docs/system/arm/aspeed.rst
25
@@ -XXX,XX +XXX,XX @@ AST2500 SoC based machines :
26
- ``fp5280g2-bmc`` Inspur FP5280G2 BMC
27
- ``g220a-bmc`` Bytedance G220A BMC
28
- ``yosemitev2-bmc`` Facebook YosemiteV2 BMC
29
+- ``tiogapass-bmc`` Facebook Tiogapass BMC
30
31
AST2600 SoC based machines :
32
33
diff --git a/hw/arm/aspeed_eeprom.h b/hw/arm/aspeed_eeprom.h
34
index XXXXXXX..XXXXXXX 100644
35
--- a/hw/arm/aspeed_eeprom.h
36
+++ b/hw/arm/aspeed_eeprom.h
37
@@ -XXX,XX +XXX,XX @@
38
39
#include "qemu/osdep.h"
40
41
+extern const uint8_t tiogapass_bmc_fruid[];
42
+extern const size_t tiogapass_bmc_fruid_len;
43
+
44
extern const uint8_t fby35_nic_fruid[];
45
extern const uint8_t fby35_bb_fruid[];
46
extern const uint8_t fby35_bmc_fruid[];
47
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
48
index XXXXXXX..XXXXXXX 100644
49
--- a/hw/arm/aspeed.c
50
+++ b/hw/arm/aspeed.c
51
@@ -XXX,XX +XXX,XX @@ static void romulus_bmc_i2c_init(AspeedMachineState *bmc)
52
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), "ds1338", 0x32);
53
}
54
55
+static void tiogapass_bmc_i2c_init(AspeedMachineState *bmc)
56
+{
57
+ AspeedSoCState *soc = &bmc->soc;
58
+
59
+ at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 4), 0x54, 128 * KiB);
60
+ at24c_eeprom_init_rom(aspeed_i2c_get_bus(&soc->i2c, 6), 0x54, 128 * KiB,
61
+ tiogapass_bmc_fruid, tiogapass_bmc_fruid_len);
62
+}
63
+
64
static void create_pca9552(AspeedSoCState *soc, int bus_id, int addr)
65
{
66
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, bus_id),
67
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_romulus_class_init(ObjectClass *oc, void *data)
68
aspeed_soc_num_cpus(amc->soc_name);
69
};
70
71
+static void aspeed_machine_tiogapass_class_init(ObjectClass *oc, void *data)
72
+{
73
+ MachineClass *mc = MACHINE_CLASS(oc);
74
+ AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
75
+
76
+ mc->desc = "Facebook Tiogapass BMC (ARM1176)";
77
+ amc->soc_name = "ast2500-a1";
78
+ amc->hw_strap1 = AST2500_EVB_HW_STRAP1;
79
+ amc->hw_strap2 = 0;
80
+ amc->fmc_model = "n25q256a";
81
+ amc->spi_model = "mx25l25635e";
82
+ amc->num_cs = 2;
83
+ amc->i2c_init = tiogapass_bmc_i2c_init;
84
+ mc->default_ram_size = 1 * GiB;
85
+ mc->default_cpus = mc->min_cpus = mc->max_cpus =
86
+ aspeed_soc_num_cpus(amc->soc_name);
87
+ aspeed_soc_num_cpus(amc->soc_name);
88
+};
89
+
90
static void aspeed_machine_sonorapass_class_init(ObjectClass *oc, void *data)
91
{
92
MachineClass *mc = MACHINE_CLASS(oc);
93
@@ -XXX,XX +XXX,XX @@ static const TypeInfo aspeed_machine_types[] = {
94
.name = MACHINE_TYPE_NAME("tacoma-bmc"),
95
.parent = TYPE_ASPEED_MACHINE,
96
.class_init = aspeed_machine_tacoma_class_init,
97
+ }, {
98
+ .name = MACHINE_TYPE_NAME("tiogapass-bmc"),
99
+ .parent = TYPE_ASPEED_MACHINE,
100
+ .class_init = aspeed_machine_tiogapass_class_init,
101
}, {
102
.name = MACHINE_TYPE_NAME("g220a-bmc"),
103
.parent = TYPE_ASPEED_MACHINE,
104
diff --git a/hw/arm/aspeed_eeprom.c b/hw/arm/aspeed_eeprom.c
105
index XXXXXXX..XXXXXXX 100644
106
--- a/hw/arm/aspeed_eeprom.c
107
+++ b/hw/arm/aspeed_eeprom.c
108
@@ -XXX,XX +XXX,XX @@
109
110
#include "aspeed_eeprom.h"
111
112
+/* Tiogapass BMC FRU */
113
+const uint8_t tiogapass_bmc_fruid[] = {
114
+ 0x01, 0x00, 0x00, 0x01, 0x0d, 0x00, 0x00, 0xf1, 0x01, 0x0c, 0x00, 0x36,
115
+ 0xe6, 0xd0, 0xc6, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x42, 0x4d,
116
+ 0x43, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, 0x4d, 0x6f,
117
+ 0x64, 0x75, 0x6c, 0x65, 0xcd, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
118
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58,
119
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e,
120
+ 0x30, 0xc9, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2,
121
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
122
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc1, 0x39, 0x01, 0x0c, 0x00, 0xc6,
123
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x54, 0x69, 0x6f, 0x67, 0x61,
124
+ 0x20, 0x50, 0x61, 0x73, 0x73, 0x20, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65,
125
+ 0x32, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
126
+ 0x58, 0x58, 0x58, 0x58, 0xc4, 0x58, 0x58, 0x58, 0x32, 0xcd, 0x58, 0x58,
127
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc7,
128
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e, 0x30, 0xc9,
129
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc8, 0x43, 0x6f,
130
+ 0x6e, 0x66, 0x69, 0x67, 0x20, 0x41, 0xc1, 0x45,
131
+};
132
+
133
const uint8_t fby35_nic_fruid[] = {
134
0x01, 0x00, 0x00, 0x01, 0x0f, 0x20, 0x00, 0xcf, 0x01, 0x0e, 0x19, 0xd7,
135
0x5e, 0xcf, 0xc8, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xdd,
136
@@ -XXX,XX +XXX,XX @@ const uint8_t yosemitev2_bmc_fruid[] = {
137
0x6e, 0x66, 0x69, 0x67, 0x20, 0x41, 0xc1, 0x45,
138
};
139
140
+const size_t tiogapass_bmc_fruid_len = sizeof(tiogapass_bmc_fruid);
141
const size_t fby35_nic_fruid_len = sizeof(fby35_nic_fruid);
142
const size_t fby35_bb_fruid_len = sizeof(fby35_bb_fruid);
143
const size_t fby35_bmc_fruid_len = sizeof(fby35_bmc_fruid);
144
--
145
2.39.2
146
147
diff view generated by jsdifflib
Deleted patch
1
From: Sittisak Sinprem <ssinprem@celestica.com>
2
1
3
Signed-off-by: Sittisak Sinprem <ssinprem@celestica.com>
4
Reviewed-by: Peter Delevoryas <peter@pjd.dev>
5
[ clg: checkpatch issues ]
6
Message-Id: <167660539263.10409.9736070122710923479-1@git.sr.ht>
7
Signed-off-by: Cédric Le Goater <clg@kaod.org>
8
---
9
hw/nvram/eeprom_at24c.c | 30 +++++++++++++++++++++++++++---
10
1 file changed, 27 insertions(+), 3 deletions(-)
11
12
diff --git a/hw/nvram/eeprom_at24c.c b/hw/nvram/eeprom_at24c.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/hw/nvram/eeprom_at24c.c
15
+++ b/hw/nvram/eeprom_at24c.c
16
@@ -XXX,XX +XXX,XX @@ struct EEPROMState {
17
uint16_t cur;
18
/* total size in bytes */
19
uint32_t rsize;
20
+ /*
21
+ * address byte number
22
+ * for 24c01, 24c02 size <= 256 byte, use only 1 byte
23
+ * otherwise size > 256, use 2 byte
24
+ */
25
+ uint8_t asize;
26
+
27
bool writable;
28
/* cells changed since last START? */
29
bool changed;
30
@@ -XXX,XX +XXX,XX @@ uint8_t at24c_eeprom_recv(I2CSlave *s)
31
EEPROMState *ee = AT24C_EE(s);
32
uint8_t ret;
33
34
- if (ee->haveaddr == 1) {
35
+ /*
36
+ * If got the byte address but not completely with address size
37
+ * will return the invalid value
38
+ */
39
+ if (ee->haveaddr > 0 && ee->haveaddr < ee->asize) {
40
return 0xff;
41
}
42
43
@@ -XXX,XX +XXX,XX @@ int at24c_eeprom_send(I2CSlave *s, uint8_t data)
44
{
45
EEPROMState *ee = AT24C_EE(s);
46
47
- if (ee->haveaddr < 2) {
48
+ if (ee->haveaddr < ee->asize) {
49
ee->cur <<= 8;
50
ee->cur |= data;
51
ee->haveaddr++;
52
- if (ee->haveaddr == 2) {
53
+ if (ee->haveaddr == ee->asize) {
54
ee->cur %= ee->rsize;
55
DPRINTK("Set pointer %04x\n", ee->cur);
56
}
57
@@ -XXX,XX +XXX,XX @@ static void at24c_eeprom_realize(DeviceState *dev, Error **errp)
58
}
59
DPRINTK("Reset read backing file\n");
60
}
61
+
62
+ /*
63
+ * If address size didn't define with property set
64
+ * value is 0 as default, setting it by Rom size detecting.
65
+ */
66
+ if (ee->asize == 0) {
67
+ if (ee->rsize <= 256) {
68
+ ee->asize = 1;
69
+ } else {
70
+ ee->asize = 2;
71
+ }
72
+ }
73
}
74
75
static
76
@@ -XXX,XX +XXX,XX @@ void at24c_eeprom_reset(DeviceState *state)
77
78
static Property at24c_eeprom_props[] = {
79
DEFINE_PROP_UINT32("rom-size", EEPROMState, rsize, 0),
80
+ DEFINE_PROP_UINT8("address-size", EEPROMState, asize, 0),
81
DEFINE_PROP_BOOL("writable", EEPROMState, writable, true),
82
DEFINE_PROP_DRIVE("drive", EEPROMState, blk),
83
DEFINE_PROP_END_OF_LIST()
84
--
85
2.39.2
86
87
diff view generated by jsdifflib
Deleted patch
1
From: Sittisak Sinprem <ssinprem@celestica.com>
2
1
3
Device 24C64 the size is 64 kilobits = 8kilobyte
4
Device 24C02 the size is 2 kilobits = 256byte
5
6
Signed-off-by: Sittisak Sinprem <ssinprem@celestica.com>
7
Reviewed-by: Peter Delevoryas <peter@pjd.dev>
8
[ clg: checkpatch issues ]
9
Message-Id: <167660539263.10409.9736070122710923479-2@git.sr.ht>
10
Signed-off-by: Cédric Le Goater <clg@kaod.org>
11
---
12
hw/arm/aspeed.c | 36 ++++++++++++++++++++----------------
13
1 file changed, 20 insertions(+), 16 deletions(-)
14
15
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/aspeed.c
18
+++ b/hw/arm/aspeed.c
19
@@ -XXX,XX +XXX,XX @@ static void fuji_bmc_i2c_init(AspeedMachineState *bmc)
20
i2c_slave_create_simple(i2c[17], TYPE_LM75, 0x4c);
21
i2c_slave_create_simple(i2c[17], TYPE_LM75, 0x4d);
22
23
- at24c_eeprom_init(i2c[19], 0x52, 64 * KiB);
24
- at24c_eeprom_init(i2c[20], 0x50, 2 * KiB);
25
- at24c_eeprom_init(i2c[22], 0x52, 2 * KiB);
26
+ /*
27
+ * EEPROM 24c64 size is 64Kbits or 8 Kbytes
28
+ * 24c02 size is 2Kbits or 256 bytes
29
+ */
30
+ at24c_eeprom_init(i2c[19], 0x52, 8 * KiB);
31
+ at24c_eeprom_init(i2c[20], 0x50, 256);
32
+ at24c_eeprom_init(i2c[22], 0x52, 256);
33
34
i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x48);
35
i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x49);
36
i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x4a);
37
i2c_slave_create_simple(i2c[3], TYPE_TMP422, 0x4c);
38
39
- at24c_eeprom_init(i2c[8], 0x51, 64 * KiB);
40
+ at24c_eeprom_init(i2c[8], 0x51, 8 * KiB);
41
i2c_slave_create_simple(i2c[8], TYPE_LM75, 0x4a);
42
43
i2c_slave_create_simple(i2c[50], TYPE_LM75, 0x4c);
44
- at24c_eeprom_init(i2c[50], 0x52, 64 * KiB);
45
+ at24c_eeprom_init(i2c[50], 0x52, 8 * KiB);
46
i2c_slave_create_simple(i2c[51], TYPE_TMP75, 0x48);
47
i2c_slave_create_simple(i2c[52], TYPE_TMP75, 0x49);
48
49
i2c_slave_create_simple(i2c[59], TYPE_TMP75, 0x48);
50
i2c_slave_create_simple(i2c[60], TYPE_TMP75, 0x49);
51
52
- at24c_eeprom_init(i2c[65], 0x53, 64 * KiB);
53
+ at24c_eeprom_init(i2c[65], 0x53, 8 * KiB);
54
i2c_slave_create_simple(i2c[66], TYPE_TMP75, 0x49);
55
i2c_slave_create_simple(i2c[66], TYPE_TMP75, 0x48);
56
- at24c_eeprom_init(i2c[68], 0x52, 64 * KiB);
57
- at24c_eeprom_init(i2c[69], 0x52, 64 * KiB);
58
- at24c_eeprom_init(i2c[70], 0x52, 64 * KiB);
59
- at24c_eeprom_init(i2c[71], 0x52, 64 * KiB);
60
+ at24c_eeprom_init(i2c[68], 0x52, 8 * KiB);
61
+ at24c_eeprom_init(i2c[69], 0x52, 8 * KiB);
62
+ at24c_eeprom_init(i2c[70], 0x52, 8 * KiB);
63
+ at24c_eeprom_init(i2c[71], 0x52, 8 * KiB);
64
65
- at24c_eeprom_init(i2c[73], 0x53, 64 * KiB);
66
+ at24c_eeprom_init(i2c[73], 0x53, 8 * KiB);
67
i2c_slave_create_simple(i2c[74], TYPE_TMP75, 0x49);
68
i2c_slave_create_simple(i2c[74], TYPE_TMP75, 0x48);
69
- at24c_eeprom_init(i2c[76], 0x52, 64 * KiB);
70
- at24c_eeprom_init(i2c[77], 0x52, 64 * KiB);
71
- at24c_eeprom_init(i2c[78], 0x52, 64 * KiB);
72
- at24c_eeprom_init(i2c[79], 0x52, 64 * KiB);
73
- at24c_eeprom_init(i2c[28], 0x50, 2 * KiB);
74
+ at24c_eeprom_init(i2c[76], 0x52, 8 * KiB);
75
+ at24c_eeprom_init(i2c[77], 0x52, 8 * KiB);
76
+ at24c_eeprom_init(i2c[78], 0x52, 8 * KiB);
77
+ at24c_eeprom_init(i2c[79], 0x52, 8 * KiB);
78
+ at24c_eeprom_init(i2c[28], 0x50, 256);
79
80
for (int i = 0; i < 8; i++) {
81
at24c_eeprom_init(i2c[81 + i * 8], 0x56, 64 * KiB);
82
--
83
2.39.2
84
85
diff view generated by jsdifflib
Deleted patch
1
To avoid the SPI transactions fetching instructions from the FMC CE0
2
flash device and speed up boot, a ROM can be created if a drive is
3
available.
4
1
5
Reverse the logic to allow a machine to boot without a drive, using a
6
block device instead :
7
8
-blockdev node-name=fmc0,driver=file,filename=/path/to/flash.img \
9
-device mx66u51235f,bus=ssi.0,drive=fmc0
10
11
Signed-off-by: Cédric Le Goater <clg@kaod.org>
12
---
13
hw/arm/aspeed.c | 47 +++++++++++++++++++++++++++--------------------
14
1 file changed, 27 insertions(+), 20 deletions(-)
15
16
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/arm/aspeed.c
19
+++ b/hw/arm/aspeed.c
20
@@ -XXX,XX +XXX,XX @@ static void aspeed_reset_secondary(ARMCPU *cpu,
21
cpu_set_pc(cs, info->smp_loader_start);
22
}
23
24
-#define FIRMWARE_ADDR 0x0
25
-
26
-static void write_boot_rom(DriveInfo *dinfo, hwaddr addr, size_t rom_size,
27
+static void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
28
Error **errp)
29
{
30
- BlockBackend *blk = blk_by_legacy_dinfo(dinfo);
31
g_autofree void *storage = NULL;
32
int64_t size;
33
34
@@ -XXX,XX +XXX,XX @@ static void write_boot_rom(DriveInfo *dinfo, hwaddr addr, size_t rom_size,
35
rom_add_blob_fixed("aspeed.boot_rom", storage, rom_size, addr);
36
}
37
38
+/*
39
+ * Create a ROM and copy the flash contents at the expected address
40
+ * (0x0). Boots faster than execute-in-place.
41
+ */
42
+static void aspeed_install_boot_rom(AspeedSoCState *soc, BlockBackend *blk,
43
+ uint64_t rom_size)
44
+{
45
+ MemoryRegion *boot_rom = g_new(MemoryRegion, 1);
46
+
47
+ memory_region_init_rom(boot_rom, NULL, "aspeed.boot_rom", rom_size,
48
+ &error_abort);
49
+ memory_region_add_subregion_overlap(&soc->spi_boot_container, 0,
50
+ boot_rom, 1);
51
+ write_boot_rom(blk, ASPEED_SOC_SPI_BOOT_ADDR, rom_size, &error_abort);
52
+}
53
+
54
void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
55
unsigned int count, int unit0)
56
{
57
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_init(MachineState *machine)
58
AspeedMachineState *bmc = ASPEED_MACHINE(machine);
59
AspeedMachineClass *amc = ASPEED_MACHINE_GET_CLASS(machine);
60
AspeedSoCClass *sc;
61
- DriveInfo *drive0 = drive_get(IF_MTD, 0, 0);
62
int i;
63
NICInfo *nd = &nd_table[0];
64
65
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_init(MachineState *machine)
66
bmc->spi_model ? bmc->spi_model : amc->spi_model,
67
1, amc->num_cs);
68
69
- /* Install first FMC flash content as a boot rom. */
70
- if (drive0) {
71
- AspeedSMCFlash *fl = &bmc->soc.fmc.flashes[0];
72
- MemoryRegion *boot_rom = g_new(MemoryRegion, 1);
73
- uint64_t size = memory_region_size(&fl->mmio);
74
-
75
- if (!ASPEED_MACHINE(machine)->mmio_exec) {
76
- memory_region_init_rom(boot_rom, NULL, "aspeed.boot_rom",
77
- size, &error_abort);
78
- memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR,
79
- boot_rom);
80
- write_boot_rom(drive0, FIRMWARE_ADDR, size, &error_abort);
81
- }
82
- }
83
-
84
if (machine->kernel_filename && sc->num_cpus > 1) {
85
/* With no u-boot we must set up a boot stub for the secondary CPU */
86
MemoryRegion *smpboot = g_new(MemoryRegion, 1);
87
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_init(MachineState *machine)
88
drive_get(IF_SD, 0, bmc->soc.sdhci.num_slots));
89
}
90
91
+ if (!bmc->mmio_exec) {
92
+ DriveInfo *mtd0 = drive_get(IF_MTD, 0, 0);
93
+
94
+ if (mtd0) {
95
+ uint64_t rom_size = memory_region_size(&bmc->soc.spi_boot);
96
+ aspeed_install_boot_rom(&bmc->soc, blk_by_legacy_dinfo(mtd0),
97
+ rom_size);
98
+ }
99
+ }
100
+
101
arm_load_kernel(ARM_CPU(first_cpu), machine, &aspeed_board_binfo);
102
}
103
104
--
105
2.39.2
106
107
diff view generated by jsdifflib