1
The following changes since commit a95260486aa7e78d7c7194eba65cf03311ad94ad:
1
Hello,
2
2
3
Merge tag 'pull-tcg-20231023' of https://gitlab.com/rth7680/qemu into staging (2023-10-23 14:45:46 -0700)
3
Here is the aspeed series I plan to send as a PR this week.
4
4
5
are available in the Git repository at:
5
- fix for the Aspeed I2C slave mode, an I2C echo device from Klaus
6
and its associated test in avocado.
7
- initial cleanups to allow the use of block devices instead of
8
drives on the command line.
9
- new facebook machines and eeprom fixes for the Fuji
10
- readline fix !
6
11
7
https://github.com/legoater/qemu/ tags/pull-aspeed-20231025
12
Thanks,
8
13
9
for you to fetch changes up to dd41ce7a6f13ad4f45ebaf52b9fa91fe5fc961df:
14
C.
10
15
11
hw/arm/aspeed: Move AspeedSoCState::cpu/vic to Aspeed2400SoCState (2023-10-25 09:52:44 +0200)
16
Cédric Le Goater (4):
17
tests/avocado/machine_aspeed.py: Add an I2C slave test
18
aspeed: Introduce a spi_boot region under the SoC
19
aspeed: Add a boot_rom overlap region in the SoC spi_boot container
20
aspeed/smc: Replace SysBus IRQs with GPIO lines
12
21
13
----------------------------------------------------------------
22
Dongli Zhang (1):
14
aspeed queue:
23
readline: fix hmp completion issue
15
24
16
* Update of Andrew's email
25
Karthikeyan Pasupathi (2):
17
* Split of AspeedSoCState per 2400/2600/10x0
26
hw/arm/aspeed: Adding new machine Yosemitev2 in QEMU
27
hw/arm/aspeed: Adding new machine Tiogapass in QEMU
18
28
19
----------------------------------------------------------------
29
Klaus Jensen (2):
20
Andrew Jeffery (1):
30
hw/i2c: only schedule pending master when bus is idle
21
MAINTAINERS: aspeed: Update Andrew's email address
31
hw/misc: add a toy i2c echo device
22
32
23
Philippe Mathieu-Daudé (11):
33
Sittisak Sinprem (2):
24
hw/arm/aspeed: Extract code common to all boards to a common file
34
hw/at24c : modify at24c to support 1 byte address mode
25
hw/arm/aspeed: Rename aspeed_soc_init() as AST2400/2500 specific
35
aspeed/fuji : correct the eeprom size
26
hw/arm/aspeed: Rename aspeed_soc_realize() as AST2400/2500 specific
27
hw/arm/aspeed: Dynamically allocate AspeedMachineState::soc field
28
hw/arm/aspeed: Introduce TYPE_ASPEED10X0_SOC
29
hw/arm/aspeed: Introduce TYPE_ASPEED2600_SOC
30
hw/arm/aspeed: Introduce TYPE_ASPEED2400_SOC
31
hw/arm/aspeed: Check 'memory' link is set in common aspeed_soc_realize
32
hw/arm/aspeed: Move AspeedSoCState::armv7m to Aspeed10x0SoCState
33
hw/arm/aspeed: Move AspeedSoCState::a7mpcore to Aspeed2600SoCState
34
hw/arm/aspeed: Move AspeedSoCState::cpu/vic to Aspeed2400SoCState
35
36
36
MAINTAINERS | 2 +-
37
docs/system/arm/aspeed.rst | 2 +
37
include/hw/arm/aspeed_soc.h | 35 +++++-
38
hw/arm/aspeed_eeprom.h | 6 ++
38
hw/arm/aspeed.c | 101 +++++++--------
39
include/hw/arm/aspeed_soc.h | 5 +
39
hw/arm/aspeed_ast10x0.c | 53 ++++----
40
include/hw/i2c/i2c.h | 2 +
40
hw/arm/{aspeed_soc.c => aspeed_ast2400.c} | 197 +++++++-----------------------
41
hw/arm/aspeed.c | 159 ++++++++++++++++++++++----------
41
hw/arm/aspeed_ast2600.c | 75 ++++++------
42
hw/arm/aspeed_ast2600.c | 13 +++
42
hw/arm/aspeed_soc_common.c | 154 +++++++++++++++++++++++
43
hw/arm/aspeed_eeprom.c | 45 +++++++++
43
hw/arm/fby35.c | 27 ++--
44
hw/arm/aspeed_soc.c | 14 +++
44
hw/arm/meson.build | 3 +-
45
hw/arm/fby35.c | 8 +-
45
9 files changed, 363 insertions(+), 284 deletions(-)
46
hw/i2c/aspeed_i2c.c | 2 +
46
rename hw/arm/{aspeed_soc.c => aspeed_ast2400.c} (76%)
47
hw/i2c/core.c | 37 +++++---
47
create mode 100644 hw/arm/aspeed_soc_common.c
48
hw/misc/i2c-echo.c | 156 +++++++++++++++++++++++++++++++
49
hw/nvram/eeprom_at24c.c | 30 +++++-
50
hw/ssi/aspeed_smc.c | 5 +-
51
monitor/hmp.c | 8 +-
52
hw/misc/meson.build | 2 +
53
tests/avocado/machine_aspeed.py | 10 ++
54
17 files changed, 421 insertions(+), 83 deletions(-)
55
create mode 100644 hw/misc/i2c-echo.c
48
56
57
--
58
2.39.2
59
60
diff view generated by jsdifflib
Deleted patch
1
From: Andrew Jeffery <andrew@codeconstruct.com.au>
2
1
3
I've changed employers, have company email that deals with patch-based
4
workflows without too much of a headache, and am trying to steer some
5
content out of my personal mail.
6
7
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
8
Signed-off-by: Cédric Le Goater <clg@kaod.org>
9
---
10
MAINTAINERS | 2 +-
11
1 file changed, 1 insertion(+), 1 deletion(-)
12
13
diff --git a/MAINTAINERS b/MAINTAINERS
14
index XXXXXXX..XXXXXXX 100644
15
--- a/MAINTAINERS
16
+++ b/MAINTAINERS
17
@@ -XXX,XX +XXX,XX @@ F: docs/system/arm/emcraft-sf2.rst
18
ASPEED BMCs
19
M: Cédric Le Goater <clg@kaod.org>
20
M: Peter Maydell <peter.maydell@linaro.org>
21
-R: Andrew Jeffery <andrew@aj.id.au>
22
+R: Andrew Jeffery <andrew@codeconstruct.com.au>
23
R: Joel Stanley <joel@jms.id.au>
24
L: qemu-arm@nongnu.org
25
S: Maintained
26
--
27
2.41.0
28
29
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Dongli Zhang <dongli.zhang@oracle.com>
2
2
3
The ARM array and VIC peripheral are only used by the
3
The auto completion does not work in some cases.
4
2400 series, remove them from the common AspeedSoCState.
5
4
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Case 1.
7
Reviewed-by: Cédric Le Goater <clg@kaod.org>
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>
8
Signed-off-by: Cédric Le Goater <clg@kaod.org>
27
Signed-off-by: Cédric Le Goater <clg@kaod.org>
9
---
28
---
10
include/hw/arm/aspeed_soc.h | 5 +++--
29
monitor/hmp.c | 8 ++------
11
hw/arm/{aspeed_soc.c => aspeed_ast2400.c} | 27 +++++++++++++----------
30
1 file changed, 2 insertions(+), 6 deletions(-)
12
hw/arm/meson.build | 2 +-
13
3 files changed, 19 insertions(+), 15 deletions(-)
14
rename hw/arm/{aspeed_soc.c => aspeed_ast2400.c} (95%)
15
31
16
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
32
diff --git a/monitor/hmp.c b/monitor/hmp.c
17
index XXXXXXX..XXXXXXX 100644
33
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/arm/aspeed_soc.h
34
--- a/monitor/hmp.c
19
+++ b/include/hw/arm/aspeed_soc.h
35
+++ b/monitor/hmp.c
20
@@ -XXX,XX +XXX,XX @@
36
@@ -XXX,XX +XXX,XX @@ static void cmd_completion(MonitorHMP *mon, const char *name, const char *list)
21
struct AspeedSoCState {
22
DeviceState parent;
23
24
- ARMCPU cpu[ASPEED_CPUS_NUM];
25
MemoryRegion *memory;
26
MemoryRegion *dram_mr;
27
MemoryRegion dram_container;
28
MemoryRegion sram;
29
MemoryRegion spi_boot_container;
30
MemoryRegion spi_boot;
31
- AspeedVICState vic;
32
AspeedRtcState rtc;
33
AspeedTimerCtrlState timerctrl;
34
AspeedI2CState i2c;
35
@@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_TYPE(AspeedSoCState, AspeedSoCClass, ASPEED_SOC)
36
37
struct Aspeed2400SoCState {
38
AspeedSoCState parent;
39
+
40
+ ARMCPU cpu[ASPEED_CPUS_NUM];
41
+ AspeedVICState vic;
42
};
43
44
#define TYPE_ASPEED2400_SOC "aspeed2400-soc"
45
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_ast2400.c
46
similarity index 95%
47
rename from hw/arm/aspeed_soc.c
48
rename to hw/arm/aspeed_ast2400.c
49
index XXXXXXX..XXXXXXX 100644
50
--- a/hw/arm/aspeed_soc.c
51
+++ b/hw/arm/aspeed_ast2400.c
52
@@ -XXX,XX +XXX,XX @@ static const int aspeed_soc_ast2400_irqmap[] = {
53
54
static qemu_irq aspeed_soc_ast2400_get_irq(AspeedSoCState *s, int dev)
55
{
56
+ Aspeed2400SoCState *a = ASPEED2400_SOC(s);
57
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
58
59
- return qdev_get_gpio_in(DEVICE(&s->vic), sc->irqmap[dev]);
60
+ return qdev_get_gpio_in(DEVICE(&a->vic), sc->irqmap[dev]);
61
}
62
63
static void aspeed_ast2400_soc_init(Object *obj)
64
{
65
+ Aspeed2400SoCState *a = ASPEED2400_SOC(obj);
66
AspeedSoCState *s = ASPEED_SOC(obj);
67
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
68
int i;
69
@@ -XXX,XX +XXX,XX @@ static void aspeed_ast2400_soc_init(Object *obj)
70
}
71
72
for (i = 0; i < sc->num_cpus; i++) {
73
- object_initialize_child(obj, "cpu[*]", &s->cpu[i], sc->cpu_type);
74
+ object_initialize_child(obj, "cpu[*]", &a->cpu[i], sc->cpu_type);
75
}
76
77
snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname);
78
@@ -XXX,XX +XXX,XX @@ static void aspeed_ast2400_soc_init(Object *obj)
79
object_property_add_alias(obj, "hw-prot-key", OBJECT(&s->scu),
80
"hw-prot-key");
81
82
- object_initialize_child(obj, "vic", &s->vic, TYPE_ASPEED_VIC);
83
+ object_initialize_child(obj, "vic", &a->vic, TYPE_ASPEED_VIC);
84
85
object_initialize_child(obj, "rtc", &s->rtc, TYPE_ASPEED_RTC);
86
87
@@ -XXX,XX +XXX,XX @@ static void aspeed_ast2400_soc_init(Object *obj)
88
static void aspeed_ast2400_soc_realize(DeviceState *dev, Error **errp)
89
{
90
int i;
91
+ Aspeed2400SoCState *a = ASPEED2400_SOC(dev);
92
AspeedSoCState *s = ASPEED_SOC(dev);
93
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
94
Error *err = NULL;
95
@@ -XXX,XX +XXX,XX @@ static void aspeed_ast2400_soc_realize(DeviceState *dev, Error **errp)
96
97
/* CPU */
98
for (i = 0; i < sc->num_cpus; i++) {
99
- object_property_set_link(OBJECT(&s->cpu[i]), "memory",
100
+ object_property_set_link(OBJECT(&a->cpu[i]), "memory",
101
OBJECT(s->memory), &error_abort);
102
- if (!qdev_realize(DEVICE(&s->cpu[i]), NULL, errp)) {
103
+ if (!qdev_realize(DEVICE(&a->cpu[i]), NULL, errp)) {
104
return;
105
}
37
}
106
}
38
memcpy(cmd, pstart, len);
107
39
cmd[len] = '\0';
108
/* SRAM */
40
- if (name[0] == '\0') {
109
- sram_name = g_strdup_printf("aspeed.sram.%d", CPU(&s->cpu[0])->cpu_index);
41
- readline_add_completion_of(mon->rs, name, cmd);
110
+ sram_name = g_strdup_printf("aspeed.sram.%d", CPU(&a->cpu[0])->cpu_index);
42
- }
111
memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_size, &err);
43
+ readline_add_completion_of(mon->rs, name, cmd);
112
if (err) {
44
if (*p == '\0') {
113
error_propagate(errp, err);
45
break;
114
@@ -XXX,XX +XXX,XX @@ static void aspeed_ast2400_soc_realize(DeviceState *dev, Error **errp)
46
}
115
aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->scu), 0, sc->memmap[ASPEED_DEV_SCU]);
47
@@ -XXX,XX +XXX,XX @@ static void monitor_find_completion_by_table(MonitorHMP *mon,
116
48
/* block device name completion */
117
/* VIC */
49
readline_set_completion_index(mon->rs, strlen(str));
118
- if (!sysbus_realize(SYS_BUS_DEVICE(&s->vic), errp)) {
50
while ((blk = blk_next(blk)) != NULL) {
119
+ if (!sysbus_realize(SYS_BUS_DEVICE(&a->vic), errp)) {
51
- if (str[0] == '\0') {
120
return;
52
- readline_add_completion_of(mon->rs, str, blk_name(blk));
121
}
53
- }
122
- aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->vic), 0, sc->memmap[ASPEED_DEV_VIC]);
54
+ readline_add_completion_of(mon->rs, str, blk_name(blk));
123
- sysbus_connect_irq(SYS_BUS_DEVICE(&s->vic), 0,
55
}
124
- qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_IRQ));
56
break;
125
- sysbus_connect_irq(SYS_BUS_DEVICE(&s->vic), 1,
57
case 's':
126
- qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_FIQ));
127
+ aspeed_mmio_map(s, SYS_BUS_DEVICE(&a->vic), 0, sc->memmap[ASPEED_DEV_VIC]);
128
+ sysbus_connect_irq(SYS_BUS_DEVICE(&a->vic), 0,
129
+ qdev_get_gpio_in(DEVICE(&a->cpu), ARM_CPU_IRQ));
130
+ sysbus_connect_irq(SYS_BUS_DEVICE(&a->vic), 1,
131
+ qdev_get_gpio_in(DEVICE(&a->cpu), ARM_CPU_FIQ));
132
133
/* RTC */
134
if (!sysbus_realize(SYS_BUS_DEVICE(&s->rtc), errp)) {
135
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
136
index XXXXXXX..XXXXXXX 100644
137
--- a/hw/arm/meson.build
138
+++ b/hw/arm/meson.build
139
@@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'CONFIG_FSL_IMX25', if_true: files('fsl-imx25.c', 'imx25_pdk.c'
140
arm_ss.add(when: 'CONFIG_FSL_IMX31', if_true: files('fsl-imx31.c', 'kzm.c'))
141
arm_ss.add(when: 'CONFIG_FSL_IMX6', if_true: files('fsl-imx6.c'))
142
arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
143
- 'aspeed_soc.c',
144
'aspeed.c',
145
'aspeed_soc_common.c',
146
+ 'aspeed_ast2400.c',
147
'aspeed_ast2600.c',
148
'aspeed_ast10x0.c',
149
'aspeed_eeprom.c',
150
--
58
--
151
2.41.0
59
2.39.2
152
60
153
61
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Klaus Jensen <k.jensen@samsung.com>
2
2
3
The v7-M core is specific to the Aspeed 10x0 series,
3
It is not given that the current master will release the bus after a
4
remove it from the common AspeedSoCState.
4
transfer ends. Only schedule a pending master if the bus is idle.
5
5
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Fixes: 37fa5ca42623 ("hw/i2c: support multiple masters")
7
Reviewed-by: Cédric Le Goater <clg@kaod.org>
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>
8
Signed-off-by: Cédric Le Goater <clg@kaod.org>
10
Signed-off-by: Cédric Le Goater <clg@kaod.org>
9
---
11
---
10
include/hw/arm/aspeed_soc.h | 5 ++---
12
include/hw/i2c/i2c.h | 2 ++
11
hw/arm/aspeed_ast10x0.c | 27 +++++++++++++++------------
13
hw/i2c/aspeed_i2c.c | 2 ++
12
hw/arm/fby35.c | 13 ++++++++-----
14
hw/i2c/core.c | 37 ++++++++++++++++++++++---------------
13
3 files changed, 25 insertions(+), 20 deletions(-)
15
3 files changed, 26 insertions(+), 15 deletions(-)
14
16
15
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
17
diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h
16
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
17
--- a/include/hw/arm/aspeed_soc.h
19
--- a/include/hw/i2c/i2c.h
18
+++ b/include/hw/arm/aspeed_soc.h
20
+++ b/include/hw/i2c/i2c.h
19
@@ -XXX,XX +XXX,XX @@
21
@@ -XXX,XX +XXX,XX @@ int i2c_start_send(I2CBus *bus, uint8_t address);
20
#define ASPEED_JTAG_NUM 2
22
*/
21
23
int i2c_start_send_async(I2CBus *bus, uint8_t address);
22
struct AspeedSoCState {
24
23
- /*< private >*/
25
+void i2c_schedule_pending_master(I2CBus *bus);
24
DeviceState parent;
25
26
- /*< public >*/
27
ARMCPU cpu[ASPEED_CPUS_NUM];
28
A15MPPrivState a7mpcore;
29
- ARMv7MState armv7m;
30
MemoryRegion *memory;
31
MemoryRegion *dram_mr;
32
MemoryRegion dram_container;
33
@@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2600SoCState, ASPEED2600_SOC)
34
35
struct Aspeed10x0SoCState {
36
AspeedSoCState parent;
37
+
26
+
38
+ ARMv7MState armv7m;
27
void i2c_end_transfer(I2CBus *bus);
39
};
28
void i2c_nack(I2CBus *bus);
40
29
void i2c_ack(I2CBus *bus);
41
#define TYPE_ASPEED10X0_SOC "aspeed10x0-soc"
30
diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c
42
diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c
43
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
44
--- a/hw/arm/aspeed_ast10x0.c
32
--- a/hw/i2c/aspeed_i2c.c
45
+++ b/hw/arm/aspeed_ast10x0.c
33
+++ b/hw/i2c/aspeed_i2c.c
46
@@ -XXX,XX +XXX,XX @@ static const int aspeed_soc_ast1030_irqmap[] = {
34
@@ -XXX,XX +XXX,XX @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
47
35
}
48
static qemu_irq aspeed_soc_ast1030_get_irq(AspeedSoCState *s, int dev)
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)
49
{
50
{
50
+ Aspeed10x0SoCState *a = ASPEED10X0_SOC(s);
51
- if (i2c_bus_busy(bus)) {
51
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
52
- I2CPendingMaster *node = g_new(struct I2CPendingMaster, 1);
52
53
- node->bh = bh;
53
- return qdev_get_gpio_in(DEVICE(&s->armv7m), sc->irqmap[dev]);
54
+ I2CPendingMaster *node = g_new(struct I2CPendingMaster, 1);
54
+ return qdev_get_gpio_in(DEVICE(&a->armv7m), sc->irqmap[dev]);
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);
55
}
82
}
56
83
57
static void aspeed_soc_ast1030_init(Object *obj)
84
void i2c_bus_release(I2CBus *bus)
58
{
85
{
59
+ Aspeed10x0SoCState *a = ASPEED10X0_SOC(obj);
86
bus->bh = NULL;
60
AspeedSoCState *s = ASPEED_SOC(obj);
87
+
61
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
88
+ i2c_schedule_pending_master(bus);
62
char socname[8];
89
}
63
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_init(Object *obj)
90
64
g_assert_not_reached();
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);
65
}
94
}
66
95
bus->broadcast = false;
67
- object_initialize_child(obj, "armv7m", &s->armv7m, TYPE_ARMV7M);
96
-
68
+ object_initialize_child(obj, "armv7m", &a->armv7m, TYPE_ARMV7M);
97
- if (!QSIMPLEQ_EMPTY(&bus->pending_masters)) {
69
98
- I2CPendingMaster *node = QSIMPLEQ_FIRST(&bus->pending_masters);
70
s->sysclk = qdev_init_clock_in(DEVICE(s), "sysclk", NULL, NULL, 0);
99
- bus->bh = node->bh;
71
100
-
72
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_init(Object *obj)
101
- QSIMPLEQ_REMOVE_HEAD(&bus->pending_masters, entry);
73
102
- g_free(node);
74
static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
103
-
75
{
104
- qemu_bh_schedule(bus->bh);
76
+ Aspeed10x0SoCState *a = ASPEED10X0_SOC(dev_soc);
105
- }
77
AspeedSoCState *s = ASPEED_SOC(dev_soc);
78
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
79
DeviceState *armv7m;
80
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
81
0x40000);
82
83
/* AST1030 CPU Core */
84
- armv7m = DEVICE(&s->armv7m);
85
+ armv7m = DEVICE(&a->armv7m);
86
qdev_prop_set_uint32(armv7m, "num-irq", 256);
87
qdev_prop_set_string(armv7m, "cpu-type", sc->cpu_type);
88
qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk);
89
- object_property_set_link(OBJECT(&s->armv7m), "memory",
90
+ object_property_set_link(OBJECT(&a->armv7m), "memory",
91
OBJECT(s->memory), &error_abort);
92
- sysbus_realize(SYS_BUS_DEVICE(&s->armv7m), &error_abort);
93
+ sysbus_realize(SYS_BUS_DEVICE(&a->armv7m), &error_abort);
94
95
/* Internal SRAM */
96
sram_name = g_strdup_printf("aspeed.sram.%d",
97
- CPU(s->armv7m.cpu)->cpu_index);
98
+ CPU(a->armv7m.cpu)->cpu_index);
99
memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_size, &err);
100
if (err != NULL) {
101
error_propagate(errp, err);
102
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
103
}
104
aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->i2c), 0, sc->memmap[ASPEED_DEV_I2C]);
105
for (i = 0; i < ASPEED_I2C_GET_CLASS(&s->i2c)->num_busses; i++) {
106
- qemu_irq irq = qdev_get_gpio_in(DEVICE(&s->armv7m),
107
+ qemu_irq irq = qdev_get_gpio_in(DEVICE(&a->armv7m),
108
sc->irqmap[ASPEED_DEV_I2C] + i);
109
/* The AST1030 I2C controller has one IRQ per bus. */
110
sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c.busses[i]), 0, irq);
111
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
112
}
113
aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->i3c), 0, sc->memmap[ASPEED_DEV_I3C]);
114
for (i = 0; i < ASPEED_I3C_NR_DEVICES; i++) {
115
- qemu_irq irq = qdev_get_gpio_in(DEVICE(&s->armv7m),
116
+ qemu_irq irq = qdev_get_gpio_in(DEVICE(&a->armv7m),
117
sc->irqmap[ASPEED_DEV_I3C] + i);
118
/* The AST1030 I3C controller has one IRQ per bus. */
119
sysbus_connect_irq(SYS_BUS_DEVICE(&s->i3c.devices[i]), 0, irq);
120
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
121
* On the AST1030 LPC subdevice IRQs are connected straight to the GIC.
122
*/
123
sysbus_connect_irq(SYS_BUS_DEVICE(&s->lpc), 1 + aspeed_lpc_kcs_1,
124
- qdev_get_gpio_in(DEVICE(&s->armv7m),
125
+ qdev_get_gpio_in(DEVICE(&a->armv7m),
126
sc->irqmap[ASPEED_DEV_KCS] + aspeed_lpc_kcs_1));
127
128
sysbus_connect_irq(SYS_BUS_DEVICE(&s->lpc), 1 + aspeed_lpc_kcs_2,
129
- qdev_get_gpio_in(DEVICE(&s->armv7m),
130
+ qdev_get_gpio_in(DEVICE(&a->armv7m),
131
sc->irqmap[ASPEED_DEV_KCS] + aspeed_lpc_kcs_2));
132
133
sysbus_connect_irq(SYS_BUS_DEVICE(&s->lpc), 1 + aspeed_lpc_kcs_3,
134
- qdev_get_gpio_in(DEVICE(&s->armv7m),
135
+ qdev_get_gpio_in(DEVICE(&a->armv7m),
136
sc->irqmap[ASPEED_DEV_KCS] + aspeed_lpc_kcs_3));
137
138
sysbus_connect_irq(SYS_BUS_DEVICE(&s->lpc), 1 + aspeed_lpc_kcs_4,
139
- qdev_get_gpio_in(DEVICE(&s->armv7m),
140
+ qdev_get_gpio_in(DEVICE(&a->armv7m),
141
sc->irqmap[ASPEED_DEV_KCS] + aspeed_lpc_kcs_4));
142
143
/* UART */
144
diff --git a/hw/arm/fby35.c b/hw/arm/fby35.c
145
index XXXXXXX..XXXXXXX 100644
146
--- a/hw/arm/fby35.c
147
+++ b/hw/arm/fby35.c
148
@@ -XXX,XX +XXX,XX @@ struct Fby35State {
149
Clock *bic_sysclk;
150
151
AspeedSoCState bmc;
152
- AspeedSoCState bic;
153
+ Aspeed10x0SoCState bic;
154
155
bool mmio_exec;
156
};
157
@@ -XXX,XX +XXX,XX @@ static void fby35_bmc_init(Fby35State *s)
158
159
static void fby35_bic_init(Fby35State *s)
160
{
161
+ AspeedSoCState *soc;
162
+
163
s->bic_sysclk = clock_new(OBJECT(s), "SYSCLK");
164
clock_set_hz(s->bic_sysclk, 200000000ULL);
165
166
object_initialize_child(OBJECT(s), "bic", &s->bic, "ast1030-a1");
167
+ soc = ASPEED_SOC(&s->bic);
168
169
memory_region_init(&s->bic_memory, OBJECT(&s->bic), "bic-memory",
170
UINT64_MAX);
171
@@ -XXX,XX +XXX,XX @@ static void fby35_bic_init(Fby35State *s)
172
qdev_connect_clock_in(DEVICE(&s->bic), "sysclk", s->bic_sysclk);
173
object_property_set_link(OBJECT(&s->bic), "memory", OBJECT(&s->bic_memory),
174
&error_abort);
175
- aspeed_soc_uart_set_chr(&s->bic, ASPEED_DEV_UART5, serial_hd(1));
176
+ aspeed_soc_uart_set_chr(soc, ASPEED_DEV_UART5, serial_hd(1));
177
qdev_realize(DEVICE(&s->bic), NULL, &error_abort);
178
179
- aspeed_board_init_flashes(&s->bic.fmc, "sst25vf032b", 2, 2);
180
- aspeed_board_init_flashes(&s->bic.spi[0], "sst25vf032b", 2, 4);
181
- aspeed_board_init_flashes(&s->bic.spi[1], "sst25vf032b", 2, 6);
182
+ aspeed_board_init_flashes(&soc->fmc, "sst25vf032b", 2, 2);
183
+ aspeed_board_init_flashes(&soc->spi[0], "sst25vf032b", 2, 4);
184
+ aspeed_board_init_flashes(&soc->spi[1], "sst25vf032b", 2, 6);
185
}
106
}
186
107
187
static void fby35_init(MachineState *machine)
108
int i2c_send(I2CBus *bus, uint8_t data)
188
--
109
--
189
2.41.0
110
2.39.2
190
111
191
112
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Klaus Jensen <k.jensen@samsung.com>
2
2
3
aspeed_soc.c contains definitions specific to the AST2400
3
Add an example I2C device to demonstrate how a slave may master the bus
4
and AST2500 SoCs, but also some definitions for other AST
4
and send data asynchronously to another slave.
5
SoCs: move them to a common file.
6
5
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
The device will echo whatever it is sent to the device identified by the
8
Reviewed-by: Cédric Le Goater <clg@kaod.org>
7
first byte received.
8
9
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
10
[ clg: integrated fixes :
11
https://lore.kernel.org/qemu-devel/Y3yMKAhOkYGtnkOp@cormorant.local/ ]
12
Message-Id: <20220601210831.67259-7-its@irrelevant.dk>
9
Signed-off-by: Cédric Le Goater <clg@kaod.org>
13
Signed-off-by: Cédric Le Goater <clg@kaod.org>
10
---
14
---
11
hw/arm/aspeed_soc.c | 96 -------------------------------
15
hw/misc/i2c-echo.c | 156 ++++++++++++++++++++++++++++++++++++++++++++
12
hw/arm/aspeed_soc_common.c | 114 +++++++++++++++++++++++++++++++++++++
16
hw/misc/meson.build | 2 +
13
hw/arm/meson.build | 1 +
17
2 files changed, 158 insertions(+)
14
3 files changed, 115 insertions(+), 96 deletions(-)
18
create mode 100644 hw/misc/i2c-echo.c
15
create mode 100644 hw/arm/aspeed_soc_common.c
16
19
17
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
20
diff --git a/hw/misc/i2c-echo.c b/hw/misc/i2c-echo.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/aspeed_soc.c
20
+++ b/hw/arm/aspeed_soc.c
21
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_register_types(void)
22
};
23
24
type_init(aspeed_soc_register_types);
25
-
26
-qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev)
27
-{
28
- return ASPEED_SOC_GET_CLASS(s)->get_irq(s, dev);
29
-}
30
-
31
-bool aspeed_soc_uart_realize(AspeedSoCState *s, Error **errp)
32
-{
33
- AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
34
- SerialMM *smm;
35
-
36
- for (int i = 0, uart = ASPEED_DEV_UART1; i < sc->uarts_num; i++, uart++) {
37
- smm = &s->uart[i];
38
-
39
- /* Chardev property is set by the machine. */
40
- qdev_prop_set_uint8(DEVICE(smm), "regshift", 2);
41
- qdev_prop_set_uint32(DEVICE(smm), "baudbase", 38400);
42
- qdev_set_legacy_instance_id(DEVICE(smm), sc->memmap[uart], 2);
43
- qdev_prop_set_uint8(DEVICE(smm), "endianness", DEVICE_LITTLE_ENDIAN);
44
- if (!sysbus_realize(SYS_BUS_DEVICE(smm), errp)) {
45
- return false;
46
- }
47
-
48
- sysbus_connect_irq(SYS_BUS_DEVICE(smm), 0, aspeed_soc_get_irq(s, uart));
49
- aspeed_mmio_map(s, SYS_BUS_DEVICE(smm), 0, sc->memmap[uart]);
50
- }
51
-
52
- return true;
53
-}
54
-
55
-void aspeed_soc_uart_set_chr(AspeedSoCState *s, int dev, Chardev *chr)
56
-{
57
- AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
58
- int i = dev - ASPEED_DEV_UART1;
59
-
60
- g_assert(0 <= i && i < ARRAY_SIZE(s->uart) && i < sc->uarts_num);
61
- qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", chr);
62
-}
63
-
64
-/*
65
- * SDMC should be realized first to get correct RAM size and max size
66
- * values
67
- */
68
-bool aspeed_soc_dram_init(AspeedSoCState *s, Error **errp)
69
-{
70
- AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
71
- ram_addr_t ram_size, max_ram_size;
72
-
73
- ram_size = object_property_get_uint(OBJECT(&s->sdmc), "ram-size",
74
- &error_abort);
75
- max_ram_size = object_property_get_uint(OBJECT(&s->sdmc), "max-ram-size",
76
- &error_abort);
77
-
78
- memory_region_init(&s->dram_container, OBJECT(s), "ram-container",
79
- max_ram_size);
80
- memory_region_add_subregion(&s->dram_container, 0, s->dram_mr);
81
-
82
- /*
83
- * Add a memory region beyond the RAM region to let firmwares scan
84
- * the address space with load/store and guess how much RAM the
85
- * SoC has.
86
- */
87
- if (ram_size < max_ram_size) {
88
- DeviceState *dev = qdev_new(TYPE_UNIMPLEMENTED_DEVICE);
89
-
90
- qdev_prop_set_string(dev, "name", "ram-empty");
91
- qdev_prop_set_uint64(dev, "size", max_ram_size - ram_size);
92
- if (!sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), errp)) {
93
- return false;
94
- }
95
-
96
- memory_region_add_subregion_overlap(&s->dram_container, ram_size,
97
- sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0), -1000);
98
- }
99
-
100
- memory_region_add_subregion(s->memory,
101
- sc->memmap[ASPEED_DEV_SDRAM], &s->dram_container);
102
- return true;
103
-}
104
-
105
-void aspeed_mmio_map(AspeedSoCState *s, SysBusDevice *dev, int n, hwaddr addr)
106
-{
107
- memory_region_add_subregion(s->memory, addr,
108
- sysbus_mmio_get_region(dev, n));
109
-}
110
-
111
-void aspeed_mmio_map_unimplemented(AspeedSoCState *s, SysBusDevice *dev,
112
- const char *name, hwaddr addr, uint64_t size)
113
-{
114
- qdev_prop_set_string(DEVICE(dev), "name", name);
115
- qdev_prop_set_uint64(DEVICE(dev), "size", size);
116
- sysbus_realize(dev, &error_abort);
117
-
118
- memory_region_add_subregion_overlap(s->memory, addr,
119
- sysbus_mmio_get_region(dev, 0), -1000);
120
-}
121
diff --git a/hw/arm/aspeed_soc_common.c b/hw/arm/aspeed_soc_common.c
122
new file mode 100644
21
new file mode 100644
123
index XXXXXXX..XXXXXXX
22
index XXXXXXX..XXXXXXX
124
--- /dev/null
23
--- /dev/null
125
+++ b/hw/arm/aspeed_soc_common.c
24
+++ b/hw/misc/i2c-echo.c
126
@@ -XXX,XX +XXX,XX @@
25
@@ -XXX,XX +XXX,XX @@
127
+/*
26
+#include "qemu/osdep.h"
128
+ * ASPEED SoC family
27
+#include "qemu/timer.h"
129
+ *
28
+#include "qemu/main-loop.h"
130
+ * Andrew Jeffery <andrew@aj.id.au>
29
+#include "block/aio.h"
131
+ * Jeremy Kerr <jk@ozlabs.org>
30
+#include "hw/i2c/i2c.h"
132
+ *
133
+ * Copyright 2016 IBM Corp.
134
+ *
135
+ * This code is licensed under the GPL version 2 or later. See
136
+ * the COPYING file in the top-level directory.
137
+ */
138
+
31
+
139
+#include "qemu/osdep.h"
32
+#define TYPE_I2C_ECHO "i2c-echo"
140
+#include "qapi/error.h"
33
+OBJECT_DECLARE_SIMPLE_TYPE(I2CEchoState, I2C_ECHO)
141
+#include "hw/misc/unimp.h"
34
+
142
+#include "hw/arm/aspeed_soc.h"
35
+enum i2c_echo_state {
143
+#include "hw/char/serial.h"
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
+ }
65
+
66
+ state->pos++;
67
+ state->state = I2C_ECHO_STATE_ACK;
68
+ return;
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
+ }
144
+
81
+
145
+
82
+
146
+qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev)
83
+ i2c_end_transfer(state->bus);
147
+{
84
+release_bus:
148
+ return ASPEED_SOC_GET_CLASS(s)->get_irq(s, dev);
85
+ i2c_bus_release(state->bus);
86
+
87
+ state->state = I2C_ECHO_STATE_IDLE;
149
+}
88
+}
150
+
89
+
151
+bool aspeed_soc_uart_realize(AspeedSoCState *s, Error **errp)
90
+static int i2c_echo_event(I2CSlave *s, enum i2c_event event)
152
+{
91
+{
153
+ AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
92
+ I2CEchoState *state = I2C_ECHO(s);
154
+ SerialMM *smm;
155
+
93
+
156
+ for (int i = 0, uart = ASPEED_DEV_UART1; i < sc->uarts_num; i++, uart++) {
94
+ switch (event) {
157
+ smm = &s->uart[i];
95
+ case I2C_START_RECV:
96
+ state->pos = 0;
158
+
97
+
159
+ /* Chardev property is set by the machine. */
98
+ break;
160
+ qdev_prop_set_uint8(DEVICE(smm), "regshift", 2);
161
+ qdev_prop_set_uint32(DEVICE(smm), "baudbase", 38400);
162
+ qdev_set_legacy_instance_id(DEVICE(smm), sc->memmap[uart], 2);
163
+ qdev_prop_set_uint8(DEVICE(smm), "endianness", DEVICE_LITTLE_ENDIAN);
164
+ if (!sysbus_realize(SYS_BUS_DEVICE(smm), errp)) {
165
+ return false;
166
+ }
167
+
99
+
168
+ sysbus_connect_irq(SYS_BUS_DEVICE(smm), 0, aspeed_soc_get_irq(s, uart));
100
+ case I2C_START_SEND:
169
+ aspeed_mmio_map(s, SYS_BUS_DEVICE(smm), 0, sc->memmap[uart]);
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;
170
+ }
117
+ }
171
+
118
+
172
+ return true;
119
+ return 0;
173
+}
120
+}
174
+
121
+
175
+void aspeed_soc_uart_set_chr(AspeedSoCState *s, int dev, Chardev *chr)
122
+static uint8_t i2c_echo_recv(I2CSlave *s)
176
+{
123
+{
177
+ AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
124
+ I2CEchoState *state = I2C_ECHO(s);
178
+ int i = dev - ASPEED_DEV_UART1;
179
+
125
+
180
+ g_assert(0 <= i && i < ARRAY_SIZE(s->uart) && i < sc->uarts_num);
126
+ if (state->pos > 2) {
181
+ qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", chr);
127
+ return 0xff;
128
+ }
129
+
130
+ return state->data[state->pos++];
182
+}
131
+}
183
+
132
+
184
+/*
133
+static int i2c_echo_send(I2CSlave *s, uint8_t data)
185
+ * SDMC should be realized first to get correct RAM size and max size
186
+ * values
187
+ */
188
+bool aspeed_soc_dram_init(AspeedSoCState *s, Error **errp)
189
+{
134
+{
190
+ AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
135
+ I2CEchoState *state = I2C_ECHO(s);
191
+ ram_addr_t ram_size, max_ram_size;
192
+
136
+
193
+ ram_size = object_property_get_uint(OBJECT(&s->sdmc), "ram-size",
137
+ if (state->pos > 2) {
194
+ &error_abort);
138
+ return -1;
195
+ max_ram_size = object_property_get_uint(OBJECT(&s->sdmc), "max-ram-size",
196
+ &error_abort);
197
+
198
+ memory_region_init(&s->dram_container, OBJECT(s), "ram-container",
199
+ max_ram_size);
200
+ memory_region_add_subregion(&s->dram_container, 0, s->dram_mr);
201
+
202
+ /*
203
+ * Add a memory region beyond the RAM region to let firmwares scan
204
+ * the address space with load/store and guess how much RAM the
205
+ * SoC has.
206
+ */
207
+ if (ram_size < max_ram_size) {
208
+ DeviceState *dev = qdev_new(TYPE_UNIMPLEMENTED_DEVICE);
209
+
210
+ qdev_prop_set_string(dev, "name", "ram-empty");
211
+ qdev_prop_set_uint64(dev, "size", max_ram_size - ram_size);
212
+ if (!sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), errp)) {
213
+ return false;
214
+ }
215
+
216
+ memory_region_add_subregion_overlap(&s->dram_container, ram_size,
217
+ sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0), -1000);
218
+ }
139
+ }
219
+
140
+
220
+ memory_region_add_subregion(s->memory,
141
+ state->data[state->pos++] = data;
221
+ sc->memmap[ASPEED_DEV_SDRAM], &s->dram_container);
142
+
222
+ return true;
143
+ return 0;
223
+}
144
+}
224
+
145
+
225
+void aspeed_mmio_map(AspeedSoCState *s, SysBusDevice *dev, int n, hwaddr addr)
146
+static void i2c_echo_realize(DeviceState *dev, Error **errp)
226
+{
147
+{
227
+ memory_region_add_subregion(s->memory, addr,
148
+ I2CEchoState *state = I2C_ECHO(dev);
228
+ sysbus_mmio_get_region(dev, n));
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;
229
+}
155
+}
230
+
156
+
231
+void aspeed_mmio_map_unimplemented(AspeedSoCState *s, SysBusDevice *dev,
157
+static void i2c_echo_class_init(ObjectClass *oc, void *data)
232
+ const char *name, hwaddr addr, uint64_t size)
233
+{
158
+{
234
+ qdev_prop_set_string(DEVICE(dev), "name", name);
159
+ I2CSlaveClass *sc = I2C_SLAVE_CLASS(oc);
235
+ qdev_prop_set_uint64(DEVICE(dev), "size", size);
160
+ DeviceClass *dc = DEVICE_CLASS(oc);
236
+ sysbus_realize(dev, &error_abort);
237
+
161
+
238
+ memory_region_add_subregion_overlap(s->memory, addr,
162
+ dc->realize = i2c_echo_realize;
239
+ sysbus_mmio_get_region(dev, 0), -1000);
163
+
164
+ sc->event = i2c_echo_event;
165
+ sc->recv = i2c_echo_recv;
166
+ sc->send = i2c_echo_send;
240
+}
167
+}
241
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
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
242
index XXXXXXX..XXXXXXX 100644
183
index XXXXXXX..XXXXXXX 100644
243
--- a/hw/arm/meson.build
184
--- a/hw/misc/meson.build
244
+++ b/hw/arm/meson.build
185
+++ b/hw/misc/meson.build
245
@@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'CONFIG_FSL_IMX6', if_true: files('fsl-imx6.c'))
186
@@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_rng.c'))
246
arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
187
247
'aspeed_soc.c',
188
softmmu_ss.add(when: 'CONFIG_GRLIB', if_true: files('grlib_ahb_apb_pnp.c'))
248
'aspeed.c',
189
249
+ 'aspeed_soc_common.c',
190
+softmmu_ss.add(when: 'CONFIG_I2C', if_true: files('i2c-echo.c'))
250
'aspeed_ast2600.c',
191
+
251
'aspeed_ast10x0.c',
192
specific_ss.add(when: 'CONFIG_AVR_POWER', if_true: files('avr_power.c'))
252
'aspeed_eeprom.c',
193
194
specific_ss.add(when: 'CONFIG_MAC_VIA', if_true: files('mac_via.c'))
253
--
195
--
254
2.41.0
196
2.39.2
255
197
256
198
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
The Aspeed 2600 I2C controller supports a slave mode which can be
2
tested with the I2C echo device. Test extracted from :
2
3
3
TYPE_ASPEED2600_SOC inherits from TYPE_ASPEED_SOC.
4
https://lists.nongnu.org/archive/html/qemu-devel/2022-06/msg00183.html
4
In few commits we'll add more fields, but to keep
5
review process simple, don't add any yet.
6
5
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Suggested-by: Klaus Jensen <k.jensen@samsung.com>
8
Reviewed-by: Cédric Le Goater <clg@kaod.org>
9
Signed-off-by: Cédric Le Goater <clg@kaod.org>
7
Signed-off-by: Cédric Le Goater <clg@kaod.org>
10
---
8
---
11
include/hw/arm/aspeed_soc.h | 7 +++++++
9
tests/avocado/machine_aspeed.py | 10 ++++++++++
12
hw/arm/aspeed_ast2600.c | 26 +++++++++++++-------------
10
1 file changed, 10 insertions(+)
13
2 files changed, 20 insertions(+), 13 deletions(-)
14
11
15
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
12
diff --git a/tests/avocado/machine_aspeed.py b/tests/avocado/machine_aspeed.py
16
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
17
--- a/include/hw/arm/aspeed_soc.h
14
--- a/tests/avocado/machine_aspeed.py
18
+++ b/include/hw/arm/aspeed_soc.h
15
+++ b/tests/avocado/machine_aspeed.py
19
@@ -XXX,XX +XXX,XX @@ struct AspeedSoCState {
16
@@ -XXX,XX +XXX,XX @@ def test_arm_ast2600_evb_buildroot(self):
20
#define TYPE_ASPEED_SOC "aspeed-soc"
17
'tmp105,bus=aspeed.i2c.bus.3,address=0x4d,id=tmp-test');
21
OBJECT_DECLARE_TYPE(AspeedSoCState, AspeedSoCClass, ASPEED_SOC)
18
self.vm.add_args('-device',
22
19
'ds1338,bus=aspeed.i2c.bus.3,address=0x32');
23
+struct Aspeed2600SoCState {
20
+ self.vm.add_args('-device',
24
+ AspeedSoCState parent;
21
+ 'i2c-echo,bus=aspeed.i2c.bus.3,address=0x42');
25
+};
22
self.do_test_arm_aspeed_buildroot_start(image_path, '0xf00')
26
+
23
27
+#define TYPE_ASPEED2600_SOC "aspeed2600-soc"
24
exec_command_and_wait_for_pattern(self,
28
+OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2600SoCState, ASPEED2600_SOC)
25
@@ -XXX,XX +XXX,XX @@ def test_arm_ast2600_evb_buildroot(self):
29
+
26
year = time.strftime("%Y")
30
struct Aspeed10x0SoCState {
27
exec_command_and_wait_for_pattern(self, 'hwclock -f /dev/rtc1', year);
31
AspeedSoCState parent;
28
32
};
29
+ exec_command_and_wait_for_pattern(self,
33
diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
30
+ 'echo slave-24c02 0x1064 > /sys/bus/i2c/devices/i2c-3/new_device',
34
index XXXXXXX..XXXXXXX 100644
31
+ 'i2c i2c-3: new_device: Instantiated device slave-24c02 at 0x64');
35
--- a/hw/arm/aspeed_ast2600.c
32
+ exec_command(self, 'i2cset -y 3 0x42 0x64 0x00 0xaa i');
36
+++ b/hw/arm/aspeed_ast2600.c
33
+ time.sleep(0.1)
37
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_class_init(ObjectClass *oc, void *data)
34
+ exec_command_and_wait_for_pattern(self,
38
sc->get_irq = aspeed_soc_ast2600_get_irq;
35
+ 'hexdump /sys/bus/i2c/devices/3-1064/slave-eeprom',
39
}
36
+ '0000000 ffaa ffff ffff ffff ffff ffff ffff ffff');
40
37
self.do_test_arm_aspeed_buildroot_poweroff()
41
-static const TypeInfo aspeed_soc_ast2600_type_info = {
38
42
- .name = "ast2600-a3",
39
43
- .parent = TYPE_ASPEED_SOC,
44
- .instance_size = sizeof(AspeedSoCState),
45
- .instance_init = aspeed_soc_ast2600_init,
46
- .class_init = aspeed_soc_ast2600_class_init,
47
- .class_size = sizeof(AspeedSoCClass),
48
+static const TypeInfo aspeed_soc_ast2600_types[] = {
49
+ {
50
+ .name = TYPE_ASPEED2600_SOC,
51
+ .parent = TYPE_ASPEED_SOC,
52
+ .instance_size = sizeof(Aspeed2600SoCState),
53
+ .abstract = true,
54
+ }, {
55
+ .name = "ast2600-a3",
56
+ .parent = TYPE_ASPEED2600_SOC,
57
+ .instance_init = aspeed_soc_ast2600_init,
58
+ .class_init = aspeed_soc_ast2600_class_init,
59
+ },
60
};
61
62
-static void aspeed_soc_register_types(void)
63
-{
64
- type_register_static(&aspeed_soc_ast2600_type_info);
65
-};
66
-
67
-type_init(aspeed_soc_register_types)
68
+DEFINE_TYPES(aspeed_soc_ast2600_types)
69
--
40
--
70
2.41.0
41
2.39.2
71
42
72
43
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Karthikeyan Pasupathi <pkarthikeyan1509@gmail.com>
2
2
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
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>
4
Reviewed-by: Cédric Le Goater <clg@kaod.org>
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>
5
Signed-off-by: Cédric Le Goater <clg@kaod.org>
12
Signed-off-by: Cédric Le Goater <clg@kaod.org>
6
---
13
---
7
hw/arm/aspeed_soc_common.c | 11 +++++++++++
14
docs/system/arm/aspeed.rst | 1 +
8
1 file changed, 11 insertions(+)
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(+)
9
19
10
diff --git a/hw/arm/aspeed_soc_common.c b/hw/arm/aspeed_soc_common.c
20
diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst
11
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
12
--- a/hw/arm/aspeed_soc_common.c
22
--- a/docs/system/arm/aspeed.rst
13
+++ b/hw/arm/aspeed_soc_common.c
23
+++ b/docs/system/arm/aspeed.rst
14
@@ -XXX,XX +XXX,XX @@ void aspeed_mmio_map_unimplemented(AspeedSoCState *s, SysBusDevice *dev,
24
@@ -XXX,XX +XXX,XX @@ AST2500 SoC based machines :
15
sysbus_mmio_get_region(dev, 0), -1000);
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);
16
}
50
}
17
51
18
+static void aspeed_soc_realize(DeviceState *dev, Error **errp)
52
+static void yosemitev2_bmc_i2c_init(AspeedMachineState *bmc)
19
+{
53
+{
20
+ AspeedSoCState *s = ASPEED_SOC(dev);
54
+ AspeedSoCState *soc = &bmc->soc;
21
+
55
+
22
+ if (!s->memory) {
56
+ at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 4), 0x51, 128 * KiB);
23
+ error_setg(errp, "'memory' link is not set");
57
+ at24c_eeprom_init_rom(aspeed_i2c_get_bus(&soc->i2c, 8), 0x51, 128 * KiB,
24
+ return;
58
+ yosemitev2_bmc_fruid, yosemitev2_bmc_fruid_len);
25
+ }
26
+}
59
+}
27
+
60
+
28
static Property aspeed_soc_properties[] = {
61
static void romulus_bmc_i2c_init(AspeedMachineState *bmc)
29
DEFINE_PROP_LINK("dram", AspeedSoCState, dram_mr, TYPE_MEMORY_REGION,
30
MemoryRegion *),
31
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_class_init(ObjectClass *oc, void *data)
32
{
62
{
33
DeviceClass *dc = DEVICE_CLASS(oc);
63
AspeedSoCState *soc = &bmc->soc;
34
64
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc, void *data)
35
+ dc->realize = aspeed_soc_realize;
65
aspeed_soc_num_cpus(amc->soc_name);
36
device_class_set_props(dc, aspeed_soc_properties);
66
};
37
}
67
38
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);
39
--
134
--
40
2.41.0
135
2.39.2
41
136
42
137
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Karthikeyan Pasupathi <pkarthikeyan1509@gmail.com>
2
2
3
TYPE_ASPEED2400_SOC inherits from TYPE_ASPEED_SOC.
3
This patch support Tiogapass in QEMU environment.
4
In few commits we'll add more fields, but to keep
4
and introduced EEPROM BMC FRU data support "add tiogapass_bmc_fruid data"
5
review process simple, don't add any yet.
5
along with the machine support.
6
6
7
TYPE_ASPEED_SOC is common to various Aspeed SoCs,
7
Signed-off-by: Karthikeyan Pasupathi <pkarthikeyan1509@gmail.com>
8
define it in aspeed_soc_common.c.
9
10
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Reviewed-by: Cédric Le Goater <clg@kaod.org>
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>
12
Signed-off-by: Cédric Le Goater <clg@kaod.org>
13
Signed-off-by: Cédric Le Goater <clg@kaod.org>
13
---
14
---
14
include/hw/arm/aspeed_soc.h | 7 +++++
15
docs/system/arm/aspeed.rst | 1 +
15
hw/arm/aspeed_soc.c | 61 +++++++++++--------------------------
16
hw/arm/aspeed_eeprom.h | 3 +++
16
hw/arm/aspeed_soc_common.c | 29 ++++++++++++++++++
17
hw/arm/aspeed.c | 32 ++++++++++++++++++++++++++++++++
17
3 files changed, 53 insertions(+), 44 deletions(-)
18
hw/arm/aspeed_eeprom.c | 22 ++++++++++++++++++++++
19
4 files changed, 58 insertions(+)
18
20
19
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
21
diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst
20
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
21
--- a/include/hw/arm/aspeed_soc.h
23
--- a/docs/system/arm/aspeed.rst
22
+++ b/include/hw/arm/aspeed_soc.h
24
+++ b/docs/system/arm/aspeed.rst
23
@@ -XXX,XX +XXX,XX @@ struct AspeedSoCState {
25
@@ -XXX,XX +XXX,XX @@ AST2500 SoC based machines :
24
#define TYPE_ASPEED_SOC "aspeed-soc"
26
- ``fp5280g2-bmc`` Inspur FP5280G2 BMC
25
OBJECT_DECLARE_TYPE(AspeedSoCState, AspeedSoCClass, ASPEED_SOC)
27
- ``g220a-bmc`` Bytedance G220A BMC
26
28
- ``yosemitev2-bmc`` Facebook YosemiteV2 BMC
27
+struct Aspeed2400SoCState {
29
+- ``tiogapass-bmc`` Facebook Tiogapass BMC
28
+ AspeedSoCState parent;
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);
29
+};
88
+};
30
+
89
+
31
+#define TYPE_ASPEED2400_SOC "aspeed2400-soc"
90
static void aspeed_machine_sonorapass_class_init(ObjectClass *oc, void *data)
32
+OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2400SoCState, ASPEED2400_SOC)
91
{
33
+
92
MachineClass *mc = MACHINE_CLASS(oc);
34
struct Aspeed2600SoCState {
93
@@ -XXX,XX +XXX,XX @@ static const TypeInfo aspeed_machine_types[] = {
35
AspeedSoCState parent;
94
.name = MACHINE_TYPE_NAME("tacoma-bmc"),
36
};
95
.parent = TYPE_ASPEED_MACHINE,
37
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
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
38
index XXXXXXX..XXXXXXX 100644
105
index XXXXXXX..XXXXXXX 100644
39
--- a/hw/arm/aspeed_soc.c
106
--- a/hw/arm/aspeed_eeprom.c
40
+++ b/hw/arm/aspeed_soc.c
107
+++ b/hw/arm/aspeed_eeprom.c
41
@@ -XXX,XX +XXX,XX @@ static void aspeed_ast2400_soc_realize(DeviceState *dev, Error **errp)
42
sysbus_connect_irq(SYS_BUS_DEVICE(&s->hace), 0,
43
aspeed_soc_get_irq(s, ASPEED_DEV_HACE));
44
}
45
-static Property aspeed_soc_properties[] = {
46
- DEFINE_PROP_LINK("memory", AspeedSoCState, memory, TYPE_MEMORY_REGION,
47
- MemoryRegion *),
48
- DEFINE_PROP_LINK("dram", AspeedSoCState, dram_mr, TYPE_MEMORY_REGION,
49
- MemoryRegion *),
50
- DEFINE_PROP_END_OF_LIST(),
51
-};
52
-
53
-static void aspeed_soc_class_init(ObjectClass *oc, void *data)
54
-{
55
- DeviceClass *dc = DEVICE_CLASS(oc);
56
-
57
- device_class_set_props(dc, aspeed_soc_properties);
58
-}
59
-
60
-static const TypeInfo aspeed_soc_type_info = {
61
- .name = TYPE_ASPEED_SOC,
62
- .parent = TYPE_DEVICE,
63
- .instance_size = sizeof(AspeedSoCState),
64
- .class_size = sizeof(AspeedSoCClass),
65
- .class_init = aspeed_soc_class_init,
66
- .abstract = true,
67
-};
68
69
static void aspeed_soc_ast2400_class_init(ObjectClass *oc, void *data)
70
{
71
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2400_class_init(ObjectClass *oc, void *data)
72
sc->get_irq = aspeed_soc_ast2400_get_irq;
73
}
74
75
-static const TypeInfo aspeed_soc_ast2400_type_info = {
76
- .name = "ast2400-a1",
77
- .parent = TYPE_ASPEED_SOC,
78
- .instance_init = aspeed_ast2400_soc_init,
79
- .instance_size = sizeof(AspeedSoCState),
80
- .class_init = aspeed_soc_ast2400_class_init,
81
-};
82
-
83
static void aspeed_soc_ast2500_class_init(ObjectClass *oc, void *data)
84
{
85
AspeedSoCClass *sc = ASPEED_SOC_CLASS(oc);
86
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2500_class_init(ObjectClass *oc, void *data)
87
sc->get_irq = aspeed_soc_ast2400_get_irq;
88
}
89
90
-static const TypeInfo aspeed_soc_ast2500_type_info = {
91
- .name = "ast2500-a1",
92
- .parent = TYPE_ASPEED_SOC,
93
- .instance_init = aspeed_ast2400_soc_init,
94
- .instance_size = sizeof(AspeedSoCState),
95
- .class_init = aspeed_soc_ast2500_class_init,
96
-};
97
-static void aspeed_soc_register_types(void)
98
-{
99
- type_register_static(&aspeed_soc_type_info);
100
- type_register_static(&aspeed_soc_ast2400_type_info);
101
- type_register_static(&aspeed_soc_ast2500_type_info);
102
+static const TypeInfo aspeed_soc_ast2400_types[] = {
103
+ {
104
+ .name = TYPE_ASPEED2400_SOC,
105
+ .parent = TYPE_ASPEED_SOC,
106
+ .instance_init = aspeed_ast2400_soc_init,
107
+ .instance_size = sizeof(Aspeed2400SoCState),
108
+ .abstract = true,
109
+ }, {
110
+ .name = "ast2400-a1",
111
+ .parent = TYPE_ASPEED2400_SOC,
112
+ .class_init = aspeed_soc_ast2400_class_init,
113
+ }, {
114
+ .name = "ast2500-a1",
115
+ .parent = TYPE_ASPEED2400_SOC,
116
+ .class_init = aspeed_soc_ast2500_class_init,
117
+ },
118
};
119
120
-type_init(aspeed_soc_register_types);
121
+DEFINE_TYPES(aspeed_soc_ast2400_types)
122
diff --git a/hw/arm/aspeed_soc_common.c b/hw/arm/aspeed_soc_common.c
123
index XXXXXXX..XXXXXXX 100644
124
--- a/hw/arm/aspeed_soc_common.c
125
+++ b/hw/arm/aspeed_soc_common.c
126
@@ -XXX,XX +XXX,XX @@
108
@@ -XXX,XX +XXX,XX @@
127
109
128
#include "qemu/osdep.h"
110
#include "aspeed_eeprom.h"
129
#include "qapi/error.h"
111
130
+#include "hw/qdev-properties.h"
112
+/* Tiogapass BMC FRU */
131
#include "hw/misc/unimp.h"
113
+const uint8_t tiogapass_bmc_fruid[] = {
132
#include "hw/arm/aspeed_soc.h"
114
+ 0x01, 0x00, 0x00, 0x01, 0x0d, 0x00, 0x00, 0xf1, 0x01, 0x0c, 0x00, 0x36,
133
#include "hw/char/serial.h"
115
+ 0xe6, 0xd0, 0xc6, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x42, 0x4d,
134
@@ -XXX,XX +XXX,XX @@ void aspeed_mmio_map_unimplemented(AspeedSoCState *s, SysBusDevice *dev,
116
+ 0x43, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, 0x4d, 0x6f,
135
memory_region_add_subregion_overlap(s->memory, addr,
117
+ 0x64, 0x75, 0x6c, 0x65, 0xcd, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
136
sysbus_mmio_get_region(dev, 0), -1000);
118
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58,
137
}
119
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e,
138
+
120
+ 0x30, 0xc9, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2,
139
+static Property aspeed_soc_properties[] = {
121
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
140
+ DEFINE_PROP_LINK("dram", AspeedSoCState, dram_mr, TYPE_MEMORY_REGION,
122
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc1, 0x39, 0x01, 0x0c, 0x00, 0xc6,
141
+ MemoryRegion *),
123
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x54, 0x69, 0x6f, 0x67, 0x61,
142
+ DEFINE_PROP_LINK("memory", AspeedSoCState, memory, TYPE_MEMORY_REGION,
124
+ 0x20, 0x50, 0x61, 0x73, 0x73, 0x20, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65,
143
+ MemoryRegion *),
125
+ 0x32, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
144
+ DEFINE_PROP_END_OF_LIST(),
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,
145
+};
131
+};
146
+
132
+
147
+static void aspeed_soc_class_init(ObjectClass *oc, void *data)
133
const uint8_t fby35_nic_fruid[] = {
148
+{
134
0x01, 0x00, 0x00, 0x01, 0x0f, 0x20, 0x00, 0xcf, 0x01, 0x0e, 0x19, 0xd7,
149
+ DeviceClass *dc = DEVICE_CLASS(oc);
135
0x5e, 0xcf, 0xc8, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xdd,
150
+
136
@@ -XXX,XX +XXX,XX @@ const uint8_t yosemitev2_bmc_fruid[] = {
151
+ device_class_set_props(dc, aspeed_soc_properties);
137
0x6e, 0x66, 0x69, 0x67, 0x20, 0x41, 0xc1, 0x45,
152
+}
138
};
153
+
139
154
+static const TypeInfo aspeed_soc_types[] = {
140
+const size_t tiogapass_bmc_fruid_len = sizeof(tiogapass_bmc_fruid);
155
+ {
141
const size_t fby35_nic_fruid_len = sizeof(fby35_nic_fruid);
156
+ .name = TYPE_ASPEED_SOC,
142
const size_t fby35_bb_fruid_len = sizeof(fby35_bb_fruid);
157
+ .parent = TYPE_DEVICE,
143
const size_t fby35_bmc_fruid_len = sizeof(fby35_bmc_fruid);
158
+ .instance_size = sizeof(AspeedSoCState),
159
+ .class_size = sizeof(AspeedSoCClass),
160
+ .class_init = aspeed_soc_class_init,
161
+ .abstract = true,
162
+ },
163
+};
164
+
165
+DEFINE_TYPES(aspeed_soc_types)
166
--
144
--
167
2.41.0
145
2.39.2
168
146
169
147
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Sittisak Sinprem <ssinprem@celestica.com>
2
2
3
TYPE_ASPEED10X0_SOC inherits from TYPE_ASPEED_SOC.
3
Signed-off-by: Sittisak Sinprem <ssinprem@celestica.com>
4
In few commits we'll add more fields, but to keep
4
Reviewed-by: Peter Delevoryas <peter@pjd.dev>
5
review process simple, don't add any yet.
5
[ clg: checkpatch issues ]
6
6
Message-Id: <167660539263.10409.9736070122710923479-1@git.sr.ht>
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Reviewed-by: Cédric Le Goater <clg@kaod.org>
9
Signed-off-by: Cédric Le Goater <clg@kaod.org>
7
Signed-off-by: Cédric Le Goater <clg@kaod.org>
10
---
8
---
11
include/hw/arm/aspeed_soc.h | 7 +++++++
9
hw/nvram/eeprom_at24c.c | 30 +++++++++++++++++++++++++++---
12
hw/arm/aspeed_ast10x0.c | 26 +++++++++++++-------------
10
1 file changed, 27 insertions(+), 3 deletions(-)
13
2 files changed, 20 insertions(+), 13 deletions(-)
14
11
15
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
12
diff --git a/hw/nvram/eeprom_at24c.c b/hw/nvram/eeprom_at24c.c
16
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
17
--- a/include/hw/arm/aspeed_soc.h
14
--- a/hw/nvram/eeprom_at24c.c
18
+++ b/include/hw/arm/aspeed_soc.h
15
+++ b/hw/nvram/eeprom_at24c.c
19
@@ -XXX,XX +XXX,XX @@ struct AspeedSoCState {
16
@@ -XXX,XX +XXX,XX @@ struct EEPROMState {
20
#define TYPE_ASPEED_SOC "aspeed-soc"
17
uint16_t cur;
21
OBJECT_DECLARE_TYPE(AspeedSoCState, AspeedSoCClass, ASPEED_SOC)
18
/* total size in bytes */
22
19
uint32_t rsize;
23
+struct Aspeed10x0SoCState {
20
+ /*
24
+ AspeedSoCState parent;
21
+ * address byte number
25
+};
22
+ * for 24c01, 24c02 size <= 256 byte, use only 1 byte
23
+ * otherwise size > 256, use 2 byte
24
+ */
25
+ uint8_t asize;
26
+
26
+
27
+#define TYPE_ASPEED10X0_SOC "aspeed10x0-soc"
27
bool writable;
28
+OBJECT_DECLARE_SIMPLE_TYPE(Aspeed10x0SoCState, ASPEED10X0_SOC)
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
}
29
+
61
+
30
struct AspeedSoCClass {
62
+ /*
31
DeviceClass parent_class;
63
+ * If address size didn't define with property set
32
64
+ * value is 0 as default, setting it by Rom size detecting.
33
diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c
65
+ */
34
index XXXXXXX..XXXXXXX 100644
66
+ if (ee->asize == 0) {
35
--- a/hw/arm/aspeed_ast10x0.c
67
+ if (ee->rsize <= 256) {
36
+++ b/hw/arm/aspeed_ast10x0.c
68
+ ee->asize = 1;
37
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_class_init(ObjectClass *klass, void *data)
69
+ } else {
38
sc->get_irq = aspeed_soc_ast1030_get_irq;
70
+ ee->asize = 2;
71
+ }
72
+ }
39
}
73
}
40
74
41
-static const TypeInfo aspeed_soc_ast1030_type_info = {
75
static
42
- .name = "ast1030-a1",
76
@@ -XXX,XX +XXX,XX @@ void at24c_eeprom_reset(DeviceState *state)
43
- .parent = TYPE_ASPEED_SOC,
77
44
- .instance_size = sizeof(AspeedSoCState),
78
static Property at24c_eeprom_props[] = {
45
- .instance_init = aspeed_soc_ast1030_init,
79
DEFINE_PROP_UINT32("rom-size", EEPROMState, rsize, 0),
46
- .class_init = aspeed_soc_ast1030_class_init,
80
+ DEFINE_PROP_UINT8("address-size", EEPROMState, asize, 0),
47
- .class_size = sizeof(AspeedSoCClass),
81
DEFINE_PROP_BOOL("writable", EEPROMState, writable, true),
48
+static const TypeInfo aspeed_soc_ast10x0_types[] = {
82
DEFINE_PROP_DRIVE("drive", EEPROMState, blk),
49
+ {
83
DEFINE_PROP_END_OF_LIST()
50
+ .name = TYPE_ASPEED10X0_SOC,
51
+ .parent = TYPE_ASPEED_SOC,
52
+ .instance_size = sizeof(Aspeed10x0SoCState),
53
+ .abstract = true,
54
+ }, {
55
+ .name = "ast1030-a1",
56
+ .parent = TYPE_ASPEED10X0_SOC,
57
+ .instance_init = aspeed_soc_ast1030_init,
58
+ .class_init = aspeed_soc_ast1030_class_init,
59
+ },
60
};
61
62
-static void aspeed_soc_register_types(void)
63
-{
64
- type_register_static(&aspeed_soc_ast1030_type_info);
65
-}
66
-
67
-type_init(aspeed_soc_register_types)
68
+DEFINE_TYPES(aspeed_soc_ast10x0_types)
69
--
84
--
70
2.41.0
85
2.39.2
71
86
72
87
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Sittisak Sinprem <ssinprem@celestica.com>
2
2
3
Keep aspeed_soc_class_init() generic, set the realize handler
3
Device 24C64 the size is 64 kilobits = 8kilobyte
4
to aspeed_ast2400_soc_realize() in each 2400/2500 class_init.
4
Device 24C02 the size is 2 kilobits = 256byte
5
5
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Signed-off-by: Sittisak Sinprem <ssinprem@celestica.com>
7
Reviewed-by: Cédric Le Goater <clg@kaod.org>
7
Reviewed-by: Peter Delevoryas <peter@pjd.dev>
8
[ clg: checkpatch issues ]
9
Message-Id: <167660539263.10409.9736070122710923479-2@git.sr.ht>
8
Signed-off-by: Cédric Le Goater <clg@kaod.org>
10
Signed-off-by: Cédric Le Goater <clg@kaod.org>
9
---
11
---
10
hw/arm/aspeed_soc.c | 15 +++++++++++----
12
hw/arm/aspeed.c | 36 ++++++++++++++++++++----------------
11
1 file changed, 11 insertions(+), 4 deletions(-)
13
1 file changed, 20 insertions(+), 16 deletions(-)
12
14
13
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
15
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
14
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/arm/aspeed_soc.c
17
--- a/hw/arm/aspeed.c
16
+++ b/hw/arm/aspeed_soc.c
18
+++ b/hw/arm/aspeed.c
17
@@ -XXX,XX +XXX,XX @@ static void aspeed_ast2400_soc_init(Object *obj)
19
@@ -XXX,XX +XXX,XX @@ static void fuji_bmc_i2c_init(AspeedMachineState *bmc)
18
object_initialize_child(obj, "video", &s->video, TYPE_UNIMPLEMENTED_DEVICE);
20
i2c_slave_create_simple(i2c[17], TYPE_LM75, 0x4c);
19
}
21
i2c_slave_create_simple(i2c[17], TYPE_LM75, 0x4d);
20
22
21
-static void aspeed_soc_realize(DeviceState *dev, Error **errp)
23
- at24c_eeprom_init(i2c[19], 0x52, 64 * KiB);
22
+static void aspeed_ast2400_soc_realize(DeviceState *dev, Error **errp)
24
- at24c_eeprom_init(i2c[20], 0x50, 2 * KiB);
23
{
25
- at24c_eeprom_init(i2c[22], 0x52, 2 * KiB);
24
int i;
26
+ /*
25
AspeedSoCState *s = ASPEED_SOC(dev);
27
+ * EEPROM 24c64 size is 64Kbits or 8 Kbytes
26
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_class_init(ObjectClass *oc, void *data)
28
+ * 24c02 size is 2Kbits or 256 bytes
27
{
29
+ */
28
DeviceClass *dc = DEVICE_CLASS(oc);
30
+ at24c_eeprom_init(i2c[19], 0x52, 8 * KiB);
29
31
+ at24c_eeprom_init(i2c[20], 0x50, 256);
30
- dc->realize = aspeed_soc_realize;
32
+ at24c_eeprom_init(i2c[22], 0x52, 256);
31
- /* Reason: Uses serial_hds and nd_table in realize() directly */
33
32
- dc->user_creatable = false;
34
i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x48);
33
device_class_set_props(dc, aspeed_soc_properties);
35
i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x49);
34
}
36
i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x4a);
35
37
i2c_slave_create_simple(i2c[3], TYPE_TMP422, 0x4c);
36
@@ -XXX,XX +XXX,XX @@ static const TypeInfo aspeed_soc_type_info = {
38
37
static void aspeed_soc_ast2400_class_init(ObjectClass *oc, void *data)
39
- at24c_eeprom_init(i2c[8], 0x51, 64 * KiB);
38
{
40
+ at24c_eeprom_init(i2c[8], 0x51, 8 * KiB);
39
AspeedSoCClass *sc = ASPEED_SOC_CLASS(oc);
41
i2c_slave_create_simple(i2c[8], TYPE_LM75, 0x4a);
40
+ DeviceClass *dc = DEVICE_CLASS(oc);
42
41
+
43
i2c_slave_create_simple(i2c[50], TYPE_LM75, 0x4c);
42
+ dc->realize = aspeed_ast2400_soc_realize;
44
- at24c_eeprom_init(i2c[50], 0x52, 64 * KiB);
43
+ /* Reason: Uses serial_hds and nd_table in realize() directly */
45
+ at24c_eeprom_init(i2c[50], 0x52, 8 * KiB);
44
+ dc->user_creatable = false;
46
i2c_slave_create_simple(i2c[51], TYPE_TMP75, 0x48);
45
47
i2c_slave_create_simple(i2c[52], TYPE_TMP75, 0x49);
46
sc->name = "ast2400-a1";
48
47
sc->cpu_type = ARM_CPU_TYPE_NAME("arm926");
49
i2c_slave_create_simple(i2c[59], TYPE_TMP75, 0x48);
48
@@ -XXX,XX +XXX,XX @@ static const TypeInfo aspeed_soc_ast2400_type_info = {
50
i2c_slave_create_simple(i2c[60], TYPE_TMP75, 0x49);
49
static void aspeed_soc_ast2500_class_init(ObjectClass *oc, void *data)
51
50
{
52
- at24c_eeprom_init(i2c[65], 0x53, 64 * KiB);
51
AspeedSoCClass *sc = ASPEED_SOC_CLASS(oc);
53
+ at24c_eeprom_init(i2c[65], 0x53, 8 * KiB);
52
+ DeviceClass *dc = DEVICE_CLASS(oc);
54
i2c_slave_create_simple(i2c[66], TYPE_TMP75, 0x49);
53
+
55
i2c_slave_create_simple(i2c[66], TYPE_TMP75, 0x48);
54
+ dc->realize = aspeed_ast2400_soc_realize;
56
- at24c_eeprom_init(i2c[68], 0x52, 64 * KiB);
55
+ /* Reason: Uses serial_hds and nd_table in realize() directly */
57
- at24c_eeprom_init(i2c[69], 0x52, 64 * KiB);
56
+ dc->user_creatable = false;
58
- at24c_eeprom_init(i2c[70], 0x52, 64 * KiB);
57
59
- at24c_eeprom_init(i2c[71], 0x52, 64 * KiB);
58
sc->name = "ast2500-a1";
60
+ at24c_eeprom_init(i2c[68], 0x52, 8 * KiB);
59
sc->cpu_type = ARM_CPU_TYPE_NAME("arm1176");
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);
60
--
82
--
61
2.41.0
83
2.39.2
62
84
63
85
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
The default boot address of the Aspeed SoCs is 0x0. For this reason,
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.
2
5
3
The v7-A cluster is specific to the Aspeed 2600 series,
6
Move this code to the SoC and introduce an extra container to prepare
4
remove it from the common AspeedSoCState.
7
ground for the boot ROM region which will overlap the FMC flash
8
remapping.
5
9
6
The ARM cores belong to the MP cluster, but the array
7
is currently used by TYPE_ASPEED2600_SOC. We'll clean
8
that soon, but for now keep it in Aspeed2600SoCState.
9
10
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Reviewed-by: Cédric Le Goater <clg@kaod.org>
12
Signed-off-by: Cédric Le Goater <clg@kaod.org>
10
Signed-off-by: Cédric Le Goater <clg@kaod.org>
13
---
11
---
14
include/hw/arm/aspeed_soc.h | 4 ++-
12
include/hw/arm/aspeed_soc.h | 5 +++++
15
hw/arm/aspeed_ast2600.c | 49 ++++++++++++++++++++-----------------
13
hw/arm/aspeed.c | 13 +------------
16
hw/arm/fby35.c | 14 ++++++-----
14
hw/arm/aspeed_ast2600.c | 13 +++++++++++++
17
3 files changed, 37 insertions(+), 30 deletions(-)
15
hw/arm/aspeed_soc.c | 14 ++++++++++++++
16
hw/arm/fby35.c | 8 +-------
17
5 files changed, 34 insertions(+), 19 deletions(-)
18
18
19
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
19
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
20
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
21
--- a/include/hw/arm/aspeed_soc.h
21
--- a/include/hw/arm/aspeed_soc.h
22
+++ b/include/hw/arm/aspeed_soc.h
22
+++ b/include/hw/arm/aspeed_soc.h
23
@@ -XXX,XX +XXX,XX @@ struct AspeedSoCState {
23
@@ -XXX,XX +XXX,XX @@ struct AspeedSoCState {
24
DeviceState parent;
25
26
ARMCPU cpu[ASPEED_CPUS_NUM];
27
- A15MPPrivState a7mpcore;
28
MemoryRegion *memory;
29
MemoryRegion *dram_mr;
24
MemoryRegion *dram_mr;
30
MemoryRegion dram_container;
25
MemoryRegion dram_container;
31
@@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2400SoCState, ASPEED2400_SOC)
26
MemoryRegion sram;
32
27
+ MemoryRegion spi_boot_container;
33
struct Aspeed2600SoCState {
28
+ MemoryRegion spi_boot;
34
AspeedSoCState parent;
29
AspeedVICState vic;
30
AspeedRtcState rtc;
31
AspeedTimerCtrlState timerctrl;
32
@@ -XXX,XX +XXX,XX @@ struct AspeedSoCClass {
33
34
35
enum {
36
+ ASPEED_DEV_SPI_BOOT,
37
ASPEED_DEV_IOMEM,
38
ASPEED_DEV_UART1,
39
ASPEED_DEV_UART2,
40
@@ -XXX,XX +XXX,XX @@ enum {
41
ASPEED_DEV_JTAG1,
42
};
43
44
+#define ASPEED_SOC_SPI_BOOT_ADDR 0x0
35
+
45
+
36
+ A15MPPrivState a7mpcore;
46
qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev);
37
+ ARMCPU cpu[ASPEED_CPUS_NUM]; /* XXX belong to a7mpcore */
47
bool aspeed_soc_uart_realize(AspeedSoCState *s, Error **errp);
38
};
48
void aspeed_soc_uart_set_chr(AspeedSoCState *s, int dev, Chardev *chr);
39
49
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
40
#define TYPE_ASPEED2600_SOC "aspeed2600-soc"
50
index XXXXXXX..XXXXXXX 100644
51
--- a/hw/arm/aspeed.c
52
+++ b/hw/arm/aspeed.c
53
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_init(MachineState *machine)
54
MemoryRegion *boot_rom = g_new(MemoryRegion, 1);
55
uint64_t size = memory_region_size(&fl->mmio);
56
57
- /*
58
- * create a ROM region using the default mapping window size of
59
- * the flash module. The window size is 64MB for the AST2400
60
- * SoC and 128MB for the AST2500 SoC, which is twice as big as
61
- * needed by the flash modules of the Aspeed machines.
62
- */
63
- if (ASPEED_MACHINE(machine)->mmio_exec) {
64
- memory_region_init_alias(boot_rom, NULL, "aspeed.boot_rom",
65
- &fl->mmio, 0, size);
66
- memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR,
67
- boot_rom);
68
- } else {
69
+ if (!ASPEED_MACHINE(machine)->mmio_exec) {
70
memory_region_init_rom(boot_rom, NULL, "aspeed.boot_rom",
71
size, &error_abort);
72
memory_region_add_subregion(get_system_memory(), FIRMWARE_ADDR,
41
diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
73
diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
42
index XXXXXXX..XXXXXXX 100644
74
index XXXXXXX..XXXXXXX 100644
43
--- a/hw/arm/aspeed_ast2600.c
75
--- a/hw/arm/aspeed_ast2600.c
44
+++ b/hw/arm/aspeed_ast2600.c
76
+++ b/hw/arm/aspeed_ast2600.c
45
@@ -XXX,XX +XXX,XX @@ static const int aspeed_soc_ast2600_irqmap[] = {
77
@@ -XXX,XX +XXX,XX @@
46
78
#define ASPEED_SOC_DPMCU_SIZE 0x00040000
47
static qemu_irq aspeed_soc_ast2600_get_irq(AspeedSoCState *s, int dev)
79
48
{
80
static const hwaddr aspeed_soc_ast2600_memmap[] = {
49
+ Aspeed2600SoCState *a = ASPEED2600_SOC(s);
81
+ [ASPEED_DEV_SPI_BOOT] = ASPEED_SOC_SPI_BOOT_ADDR,
50
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
82
[ASPEED_DEV_SRAM] = 0x10000000,
51
83
[ASPEED_DEV_DPMCU] = 0x18000000,
52
- return qdev_get_gpio_in(DEVICE(&s->a7mpcore), sc->irqmap[dev]);
84
/* 0x16000000 0x17FFFFFF : AHB BUS do LPC Bus bridge */
53
+ return qdev_get_gpio_in(DEVICE(&a->a7mpcore), sc->irqmap[dev]);
85
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
54
}
86
qemu_irq irq;
55
87
g_autofree char *sram_name = NULL;
56
static void aspeed_soc_ast2600_init(Object *obj)
88
57
{
89
+ /* Default boot region (SPI memory or ROMs) */
58
+ Aspeed2600SoCState *a = ASPEED2600_SOC(obj);
90
+ memory_region_init(&s->spi_boot_container, OBJECT(s),
59
AspeedSoCState *s = ASPEED_SOC(obj);
91
+ "aspeed.spi_boot_container", 0x10000000);
60
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
92
+ memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_SPI_BOOT],
61
int i;
93
+ &s->spi_boot_container);
62
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_init(Object *obj)
94
+
63
}
95
/* IO space */
64
96
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem), "aspeed.io",
65
for (i = 0; i < sc->num_cpus; i++) {
97
sc->memmap[ASPEED_DEV_IOMEM],
66
- object_initialize_child(obj, "cpu[*]", &s->cpu[i], sc->cpu_type);
98
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
67
+ object_initialize_child(obj, "cpu[*]", &a->cpu[i], sc->cpu_type);
99
sysbus_connect_irq(SYS_BUS_DEVICE(&s->fmc), 0,
68
}
100
aspeed_soc_get_irq(s, ASPEED_DEV_FMC));
69
101
70
snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname);
102
+ /* Set up an alias on the FMC CE0 region (boot default) */
71
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_init(Object *obj)
103
+ MemoryRegion *fmc0_mmio = &s->fmc.flashes[0].mmio;
72
object_property_add_alias(obj, "hw-prot-key", OBJECT(&s->scu),
104
+ memory_region_init_alias(&s->spi_boot, OBJECT(s), "aspeed.spi_boot",
73
"hw-prot-key");
105
+ fmc0_mmio, 0, memory_region_size(fmc0_mmio));
74
106
+ memory_region_add_subregion(&s->spi_boot_container, 0x0, &s->spi_boot);
75
- object_initialize_child(obj, "a7mpcore", &s->a7mpcore,
107
+
76
+ object_initialize_child(obj, "a7mpcore", &a->a7mpcore,
108
/* SPI */
77
TYPE_A15MPCORE_PRIV);
109
for (i = 0; i < sc->spis_num; i++) {
78
110
object_property_set_link(OBJECT(&s->spi[i]), "dram",
79
object_initialize_child(obj, "rtc", &s->rtc, TYPE_ASPEED_RTC);
111
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
80
@@ -XXX,XX +XXX,XX @@ static uint64_t aspeed_calc_affinity(int cpu)
112
index XXXXXXX..XXXXXXX 100644
81
static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
113
--- a/hw/arm/aspeed_soc.c
82
{
114
+++ b/hw/arm/aspeed_soc.c
83
int i;
115
@@ -XXX,XX +XXX,XX @@
84
+ Aspeed2600SoCState *a = ASPEED2600_SOC(dev);
116
#define ASPEED_SOC_IOMEM_SIZE 0x00200000
85
AspeedSoCState *s = ASPEED_SOC(dev);
117
86
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
118
static const hwaddr aspeed_soc_ast2400_memmap[] = {
119
+ [ASPEED_DEV_SPI_BOOT] = ASPEED_SOC_SPI_BOOT_ADDR,
120
[ASPEED_DEV_IOMEM] = 0x1E600000,
121
[ASPEED_DEV_FMC] = 0x1E620000,
122
[ASPEED_DEV_SPI1] = 0x1E630000,
123
@@ -XXX,XX +XXX,XX @@ static const hwaddr aspeed_soc_ast2400_memmap[] = {
124
};
125
126
static const hwaddr aspeed_soc_ast2500_memmap[] = {
127
+ [ASPEED_DEV_SPI_BOOT] = ASPEED_SOC_SPI_BOOT_ADDR,
128
[ASPEED_DEV_IOMEM] = 0x1E600000,
129
[ASPEED_DEV_FMC] = 0x1E620000,
130
[ASPEED_DEV_SPI1] = 0x1E630000,
131
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
87
Error *err = NULL;
132
Error *err = NULL;
88
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
133
g_autofree char *sram_name = NULL;
89
/* CPU */
134
90
for (i = 0; i < sc->num_cpus; i++) {
135
+ /* Default boot region (SPI memory or ROMs) */
91
if (sc->num_cpus > 1) {
136
+ memory_region_init(&s->spi_boot_container, OBJECT(s),
92
- object_property_set_int(OBJECT(&s->cpu[i]), "reset-cbar",
137
+ "aspeed.spi_boot_container", 0x10000000);
93
+ object_property_set_int(OBJECT(&a->cpu[i]), "reset-cbar",
138
+ memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_SPI_BOOT],
94
ASPEED_A7MPCORE_ADDR, &error_abort);
139
+ &s->spi_boot_container);
95
}
140
+
96
- object_property_set_int(OBJECT(&s->cpu[i]), "mp-affinity",
141
/* IO space */
97
+ object_property_set_int(OBJECT(&a->cpu[i]), "mp-affinity",
142
aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->iomem), "aspeed.io",
98
aspeed_calc_affinity(i), &error_abort);
143
sc->memmap[ASPEED_DEV_IOMEM],
99
144
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
100
- object_property_set_int(OBJECT(&s->cpu[i]), "cntfrq", 1125000000,
145
sysbus_connect_irq(SYS_BUS_DEVICE(&s->fmc), 0,
101
+ object_property_set_int(OBJECT(&a->cpu[i]), "cntfrq", 1125000000,
146
aspeed_soc_get_irq(s, ASPEED_DEV_FMC));
102
&error_abort);
147
103
- object_property_set_bool(OBJECT(&s->cpu[i]), "neon", false,
148
+ /* Set up an alias on the FMC CE0 region (boot default) */
104
+ object_property_set_bool(OBJECT(&a->cpu[i]), "neon", false,
149
+ MemoryRegion *fmc0_mmio = &s->fmc.flashes[0].mmio;
105
&error_abort);
150
+ memory_region_init_alias(&s->spi_boot, OBJECT(s), "aspeed.spi_boot",
106
- object_property_set_bool(OBJECT(&s->cpu[i]), "vfp-d32", false,
151
+ fmc0_mmio, 0, memory_region_size(fmc0_mmio));
107
+ object_property_set_bool(OBJECT(&a->cpu[i]), "vfp-d32", false,
152
+ memory_region_add_subregion(&s->spi_boot_container, 0x0, &s->spi_boot);
108
&error_abort);
153
+
109
- object_property_set_link(OBJECT(&s->cpu[i]), "memory",
154
/* SPI */
110
+ object_property_set_link(OBJECT(&a->cpu[i]), "memory",
155
for (i = 0; i < sc->spis_num; i++) {
111
OBJECT(s->memory), &error_abort);
156
if (!sysbus_realize(SYS_BUS_DEVICE(&s->spi[i]), errp)) {
112
113
- if (!qdev_realize(DEVICE(&s->cpu[i]), NULL, errp)) {
114
+ if (!qdev_realize(DEVICE(&a->cpu[i]), NULL, errp)) {
115
return;
116
}
117
}
118
119
/* A7MPCORE */
120
- object_property_set_int(OBJECT(&s->a7mpcore), "num-cpu", sc->num_cpus,
121
+ object_property_set_int(OBJECT(&a->a7mpcore), "num-cpu", sc->num_cpus,
122
&error_abort);
123
- object_property_set_int(OBJECT(&s->a7mpcore), "num-irq",
124
+ object_property_set_int(OBJECT(&a->a7mpcore), "num-irq",
125
ROUND_UP(AST2600_MAX_IRQ + GIC_INTERNAL, 32),
126
&error_abort);
127
128
- sysbus_realize(SYS_BUS_DEVICE(&s->a7mpcore), &error_abort);
129
- aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->a7mpcore), 0, ASPEED_A7MPCORE_ADDR);
130
+ sysbus_realize(SYS_BUS_DEVICE(&a->a7mpcore), &error_abort);
131
+ aspeed_mmio_map(s, SYS_BUS_DEVICE(&a->a7mpcore), 0, ASPEED_A7MPCORE_ADDR);
132
133
for (i = 0; i < sc->num_cpus; i++) {
134
- SysBusDevice *sbd = SYS_BUS_DEVICE(&s->a7mpcore);
135
- DeviceState *d = DEVICE(&s->cpu[i]);
136
+ SysBusDevice *sbd = SYS_BUS_DEVICE(&a->a7mpcore);
137
+ DeviceState *d = DEVICE(&a->cpu[i]);
138
139
irq = qdev_get_gpio_in(d, ARM_CPU_IRQ);
140
sysbus_connect_irq(sbd, i, irq);
141
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
142
}
143
144
/* SRAM */
145
- sram_name = g_strdup_printf("aspeed.sram.%d", CPU(&s->cpu[0])->cpu_index);
146
+ sram_name = g_strdup_printf("aspeed.sram.%d", CPU(&a->cpu[0])->cpu_index);
147
memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_size, &err);
148
if (err) {
149
error_propagate(errp, err);
150
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
151
}
152
aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->i2c), 0, sc->memmap[ASPEED_DEV_I2C]);
153
for (i = 0; i < ASPEED_I2C_GET_CLASS(&s->i2c)->num_busses; i++) {
154
- irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore),
155
+ irq = qdev_get_gpio_in(DEVICE(&a->a7mpcore),
156
sc->irqmap[ASPEED_DEV_I2C] + i);
157
/* The AST2600 I2C controller has one IRQ per bus. */
158
sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c.busses[i]), 0, irq);
159
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
160
* offset 0.
161
*/
162
sysbus_connect_irq(SYS_BUS_DEVICE(&s->lpc), 1 + aspeed_lpc_kcs_1,
163
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
164
+ qdev_get_gpio_in(DEVICE(&a->a7mpcore),
165
sc->irqmap[ASPEED_DEV_KCS] + aspeed_lpc_kcs_1));
166
167
sysbus_connect_irq(SYS_BUS_DEVICE(&s->lpc), 1 + aspeed_lpc_kcs_2,
168
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
169
+ qdev_get_gpio_in(DEVICE(&a->a7mpcore),
170
sc->irqmap[ASPEED_DEV_KCS] + aspeed_lpc_kcs_2));
171
172
sysbus_connect_irq(SYS_BUS_DEVICE(&s->lpc), 1 + aspeed_lpc_kcs_3,
173
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
174
+ qdev_get_gpio_in(DEVICE(&a->a7mpcore),
175
sc->irqmap[ASPEED_DEV_KCS] + aspeed_lpc_kcs_3));
176
177
sysbus_connect_irq(SYS_BUS_DEVICE(&s->lpc), 1 + aspeed_lpc_kcs_4,
178
- qdev_get_gpio_in(DEVICE(&s->a7mpcore),
179
+ qdev_get_gpio_in(DEVICE(&a->a7mpcore),
180
sc->irqmap[ASPEED_DEV_KCS] + aspeed_lpc_kcs_4));
181
182
/* HACE */
183
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
184
}
185
aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->i3c), 0, sc->memmap[ASPEED_DEV_I3C]);
186
for (i = 0; i < ASPEED_I3C_NR_DEVICES; i++) {
187
- irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore),
188
+ irq = qdev_get_gpio_in(DEVICE(&a->a7mpcore),
189
sc->irqmap[ASPEED_DEV_I3C] + i);
190
/* The AST2600 I3C controller has one IRQ per bus. */
191
sysbus_connect_irq(SYS_BUS_DEVICE(&s->i3c.devices[i]), 0, irq);
192
diff --git a/hw/arm/fby35.c b/hw/arm/fby35.c
157
diff --git a/hw/arm/fby35.c b/hw/arm/fby35.c
193
index XXXXXXX..XXXXXXX 100644
158
index XXXXXXX..XXXXXXX 100644
194
--- a/hw/arm/fby35.c
159
--- a/hw/arm/fby35.c
195
+++ b/hw/arm/fby35.c
160
+++ b/hw/arm/fby35.c
196
@@ -XXX,XX +XXX,XX @@ struct Fby35State {
197
MemoryRegion bic_memory;
198
Clock *bic_sysclk;
199
200
- AspeedSoCState bmc;
201
+ Aspeed2600SoCState bmc;
202
Aspeed10x0SoCState bic;
203
204
bool mmio_exec;
205
@@ -XXX,XX +XXX,XX @@ static void fby35_bmc_write_boot_rom(DriveInfo *dinfo, MemoryRegion *mr,
206
207
static void fby35_bmc_init(Fby35State *s)
208
{
209
+ AspeedSoCState *soc;
210
+
211
object_initialize_child(OBJECT(s), "bmc", &s->bmc, "ast2600-a3");
212
+ soc = ASPEED_SOC(&s->bmc);
213
214
memory_region_init(&s->bmc_memory, OBJECT(&s->bmc), "bmc-memory",
215
UINT64_MAX);
216
@@ -XXX,XX +XXX,XX @@ static void fby35_bmc_init(Fby35State *s)
161
@@ -XXX,XX +XXX,XX @@ static void fby35_bmc_init(Fby35State *s)
217
&error_abort);
162
MemoryRegion *boot_rom = g_new(MemoryRegion, 1);
218
object_property_set_int(OBJECT(&s->bmc), "hw-strap2", 0x00000003,
163
uint64_t size = memory_region_size(&fl->mmio);
219
&error_abort);
164
220
- aspeed_soc_uart_set_chr(&s->bmc, ASPEED_DEV_UART5, serial_hd(0));
165
- if (s->mmio_exec) {
221
+ aspeed_soc_uart_set_chr(soc, ASPEED_DEV_UART5, serial_hd(0));
166
- memory_region_init_alias(boot_rom, NULL, "aspeed.boot_rom",
222
qdev_realize(DEVICE(&s->bmc), NULL, &error_abort);
167
- &fl->mmio, 0, size);
223
168
- memory_region_add_subregion(&s->bmc_memory, FBY35_BMC_FIRMWARE_ADDR,
224
- aspeed_board_init_flashes(&s->bmc.fmc, "n25q00", 2, 0);
169
- boot_rom);
225
+ aspeed_board_init_flashes(&soc->fmc, "n25q00", 2, 0);
170
- } else {
226
171
-
227
/* Install first FMC flash content as a boot rom. */
172
+ if (!s->mmio_exec) {
228
if (!s->mmio_exec) {
173
memory_region_init_rom(boot_rom, NULL, "aspeed.boot_rom",
229
DriveInfo *mtd0 = drive_get(IF_MTD, 0, 0);
174
size, &error_abort);
230
175
memory_region_add_subregion(&s->bmc_memory, FBY35_BMC_FIRMWARE_ADDR,
231
if (mtd0) {
232
- AspeedSoCState *bmc = &s->bmc;
233
- uint64_t rom_size = memory_region_size(&bmc->spi_boot);
234
+ uint64_t rom_size = memory_region_size(&soc->spi_boot);
235
236
memory_region_init_rom(&s->bmc_boot_rom, NULL, "aspeed.boot_rom",
237
rom_size, &error_abort);
238
- memory_region_add_subregion_overlap(&bmc->spi_boot_container, 0,
239
+ memory_region_add_subregion_overlap(&soc->spi_boot_container, 0,
240
&s->bmc_boot_rom, 1);
241
242
fby35_bmc_write_boot_rom(mtd0, &s->bmc_boot_rom,
243
--
176
--
244
2.41.0
177
2.39.2
245
178
246
179
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
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.
2
4
3
We want to derivate the big AspeedSoCState object in some more
5
Reverse the logic to allow a machine to boot without a drive, using a
4
SoC-specific ones. Since the object size will vary, allocate it
6
block device instead :
5
dynamically.
6
7
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
-blockdev node-name=fmc0,driver=file,filename=/path/to/flash.img \
8
Reviewed-by: Cédric Le Goater <clg@kaod.org>
9
-device mx66u51235f,bus=ssi.0,drive=fmc0
10
9
Signed-off-by: Cédric Le Goater <clg@kaod.org>
11
Signed-off-by: Cédric Le Goater <clg@kaod.org>
10
---
12
---
11
hw/arm/aspeed.c | 101 +++++++++++++++++++++++++-----------------------
13
hw/arm/aspeed.c | 47 +++++++++++++++++++++++++++--------------------
12
1 file changed, 52 insertions(+), 49 deletions(-)
14
1 file changed, 27 insertions(+), 20 deletions(-)
13
15
14
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
16
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
15
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/arm/aspeed.c
18
--- a/hw/arm/aspeed.c
17
+++ b/hw/arm/aspeed.c
19
+++ b/hw/arm/aspeed.c
18
@@ -XXX,XX +XXX,XX @@ struct AspeedMachineState {
20
@@ -XXX,XX +XXX,XX @@ static void aspeed_reset_secondary(ARMCPU *cpu,
19
MachineState parent_obj;
21
cpu_set_pc(cs, info->smp_loader_start);
20
/* Public */
22
}
21
23
22
- AspeedSoCState soc;
24
-#define FIRMWARE_ADDR 0x0
23
+ AspeedSoCState *soc;
25
-
24
MemoryRegion boot_rom;
26
-static void write_boot_rom(DriveInfo *dinfo, hwaddr addr, size_t rom_size,
25
bool mmio_exec;
27
+static void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
26
uint32_t uart_chosen;
28
Error **errp)
27
@@ -XXX,XX +XXX,XX @@ static void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
28
static void aspeed_install_boot_rom(AspeedMachineState *bmc, BlockBackend *blk,
29
uint64_t rom_size)
30
{
29
{
31
- AspeedSoCState *soc = &bmc->soc;
30
- BlockBackend *blk = blk_by_legacy_dinfo(dinfo);
32
+ AspeedSoCState *soc = bmc->soc;
31
g_autofree void *storage = NULL;
33
32
int64_t size;
34
memory_region_init_rom(&bmc->boot_rom, NULL, "aspeed.boot_rom", rom_size,
33
35
&error_abort);
34
@@ -XXX,XX +XXX,XX @@ static void write_boot_rom(DriveInfo *dinfo, hwaddr addr, size_t rom_size,
36
@@ -XXX,XX +XXX,XX @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo)
35
rom_add_blob_fixed("aspeed.boot_rom", storage, rom_size, addr);
37
static void connect_serial_hds_to_uarts(AspeedMachineState *bmc)
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)
38
{
56
{
39
AspeedMachineClass *amc = ASPEED_MACHINE_GET_CLASS(bmc);
40
- AspeedSoCState *s = &bmc->soc;
41
+ AspeedSoCState *s = bmc->soc;
42
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
43
int uart_chosen = bmc->uart_chosen ? bmc->uart_chosen : amc->uart_default;
44
45
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_init(MachineState *machine)
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);
46
int i;
62
int i;
47
NICInfo *nd = &nd_table[0];
63
NICInfo *nd = &nd_table[0];
48
64
49
- object_initialize_child(OBJECT(machine), "soc", &bmc->soc, amc->soc_name);
50
-
51
- sc = ASPEED_SOC_GET_CLASS(&bmc->soc);
52
+ bmc->soc = ASPEED_SOC(object_new(amc->soc_name));
53
+ object_property_add_child(OBJECT(machine), "soc", OBJECT(bmc->soc));
54
+ object_unref(OBJECT(bmc->soc));
55
+ sc = ASPEED_SOC_GET_CLASS(bmc->soc);
56
57
/*
58
* This will error out if the RAM size is not supported by the
59
* memory controller of the SoC.
60
*/
61
- object_property_set_uint(OBJECT(&bmc->soc), "ram-size", machine->ram_size,
62
+ object_property_set_uint(OBJECT(bmc->soc), "ram-size", machine->ram_size,
63
&error_fatal);
64
65
for (i = 0; i < sc->macs_num; i++) {
66
if ((amc->macs_mask & (1 << i)) && nd->used) {
67
qemu_check_nic_model(nd, TYPE_FTGMAC100);
68
- qdev_set_nic_properties(DEVICE(&bmc->soc.ftgmac100[i]), nd);
69
+ qdev_set_nic_properties(DEVICE(&bmc->soc->ftgmac100[i]), nd);
70
nd++;
71
}
72
}
73
74
- object_property_set_int(OBJECT(&bmc->soc), "hw-strap1", amc->hw_strap1,
75
+ object_property_set_int(OBJECT(bmc->soc), "hw-strap1", amc->hw_strap1,
76
&error_abort);
77
- object_property_set_int(OBJECT(&bmc->soc), "hw-strap2", amc->hw_strap2,
78
+ object_property_set_int(OBJECT(bmc->soc), "hw-strap2", amc->hw_strap2,
79
&error_abort);
80
- object_property_set_link(OBJECT(&bmc->soc), "memory",
81
+ object_property_set_link(OBJECT(bmc->soc), "memory",
82
OBJECT(get_system_memory()), &error_abort);
83
- object_property_set_link(OBJECT(&bmc->soc), "dram",
84
+ object_property_set_link(OBJECT(bmc->soc), "dram",
85
OBJECT(machine->ram), &error_abort);
86
if (machine->kernel_filename) {
87
/*
88
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_init(MachineState *machine)
65
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_init(MachineState *machine)
89
* that runs to unlock the SCU. In this case set the default to
90
* be unlocked as the kernel expects
91
*/
92
- object_property_set_int(OBJECT(&bmc->soc), "hw-prot-key",
93
+ object_property_set_int(OBJECT(bmc->soc), "hw-prot-key",
94
ASPEED_SCU_PROT_KEY, &error_abort);
95
}
96
connect_serial_hds_to_uarts(bmc);
97
- qdev_realize(DEVICE(&bmc->soc), NULL, &error_abort);
98
+ qdev_realize(DEVICE(bmc->soc), NULL, &error_abort);
99
100
if (defaults_enabled()) {
101
- aspeed_board_init_flashes(&bmc->soc.fmc,
102
+ aspeed_board_init_flashes(&bmc->soc->fmc,
103
bmc->fmc_model ? bmc->fmc_model : amc->fmc_model,
104
amc->num_cs, 0);
105
- aspeed_board_init_flashes(&bmc->soc.spi[0],
106
+ aspeed_board_init_flashes(&bmc->soc->spi[0],
107
bmc->spi_model ? bmc->spi_model : amc->spi_model,
66
bmc->spi_model ? bmc->spi_model : amc->spi_model,
108
1, amc->num_cs);
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));
109
}
89
}
110
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_init(MachineState *machine)
90
111
amc->i2c_init(bmc);
91
+ if (!bmc->mmio_exec) {
112
}
92
+ DriveInfo *mtd0 = drive_get(IF_MTD, 0, 0);
113
93
+
114
- for (i = 0; i < bmc->soc.sdhci.num_slots; i++) {
94
+ if (mtd0) {
115
- sdhci_attach_drive(&bmc->soc.sdhci.slots[i],
95
+ uint64_t rom_size = memory_region_size(&bmc->soc.spi_boot);
116
+ for (i = 0; i < bmc->soc->sdhci.num_slots; i++) {
96
+ aspeed_install_boot_rom(&bmc->soc, blk_by_legacy_dinfo(mtd0),
117
+ sdhci_attach_drive(&bmc->soc->sdhci.slots[i],
97
+ rom_size);
118
drive_get(IF_SD, 0, i));
98
+ }
119
}
99
+ }
120
100
+
121
- if (bmc->soc.emmc.num_slots) {
101
arm_load_kernel(ARM_CPU(first_cpu), machine, &aspeed_board_binfo);
122
- sdhci_attach_drive(&bmc->soc.emmc.slots[0],
123
- drive_get(IF_SD, 0, bmc->soc.sdhci.num_slots));
124
+ if (bmc->soc->emmc.num_slots) {
125
+ sdhci_attach_drive(&bmc->soc->emmc.slots[0],
126
+ drive_get(IF_SD, 0, bmc->soc->sdhci.num_slots));
127
}
128
129
if (!bmc->mmio_exec) {
130
- DeviceState *dev = ssi_get_cs(bmc->soc.fmc.spi, 0);
131
+ DeviceState *dev = ssi_get_cs(bmc->soc->fmc.spi, 0);
132
BlockBackend *fmc0 = dev ? m25p80_get_blk(dev) : NULL;
133
134
if (fmc0) {
135
- uint64_t rom_size = memory_region_size(&bmc->soc.spi_boot);
136
+ uint64_t rom_size = memory_region_size(&bmc->soc->spi_boot);
137
aspeed_install_boot_rom(bmc, fmc0, rom_size);
138
}
139
}
140
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_init(MachineState *machine)
141
142
static void palmetto_bmc_i2c_init(AspeedMachineState *bmc)
143
{
144
- AspeedSoCState *soc = &bmc->soc;
145
+ AspeedSoCState *soc = bmc->soc;
146
DeviceState *dev;
147
uint8_t *eeprom_buf = g_malloc0(32 * 1024);
148
149
@@ -XXX,XX +XXX,XX @@ static void palmetto_bmc_i2c_init(AspeedMachineState *bmc)
150
151
static void quanta_q71l_bmc_i2c_init(AspeedMachineState *bmc)
152
{
153
- AspeedSoCState *soc = &bmc->soc;
154
+ AspeedSoCState *soc = bmc->soc;
155
156
/*
157
* The quanta-q71l platform expects tmp75s which are compatible with
158
@@ -XXX,XX +XXX,XX @@ static void quanta_q71l_bmc_i2c_init(AspeedMachineState *bmc)
159
160
static void ast2500_evb_i2c_init(AspeedMachineState *bmc)
161
{
162
- AspeedSoCState *soc = &bmc->soc;
163
+ AspeedSoCState *soc = bmc->soc;
164
uint8_t *eeprom_buf = g_malloc0(8 * 1024);
165
166
smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 3), 0x50,
167
@@ -XXX,XX +XXX,XX @@ static void ast2500_evb_i2c_init(AspeedMachineState *bmc)
168
169
static void ast2600_evb_i2c_init(AspeedMachineState *bmc)
170
{
171
- AspeedSoCState *soc = &bmc->soc;
172
+ AspeedSoCState *soc = bmc->soc;
173
uint8_t *eeprom_buf = g_malloc0(8 * 1024);
174
175
smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 7), 0x50,
176
@@ -XXX,XX +XXX,XX @@ static void ast2600_evb_i2c_init(AspeedMachineState *bmc)
177
178
static void yosemitev2_bmc_i2c_init(AspeedMachineState *bmc)
179
{
180
- AspeedSoCState *soc = &bmc->soc;
181
+ AspeedSoCState *soc = bmc->soc;
182
183
at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 4), 0x51, 128 * KiB);
184
at24c_eeprom_init_rom(aspeed_i2c_get_bus(&soc->i2c, 8), 0x51, 128 * KiB,
185
@@ -XXX,XX +XXX,XX @@ static void yosemitev2_bmc_i2c_init(AspeedMachineState *bmc)
186
187
static void romulus_bmc_i2c_init(AspeedMachineState *bmc)
188
{
189
- AspeedSoCState *soc = &bmc->soc;
190
+ AspeedSoCState *soc = bmc->soc;
191
192
/* The romulus board expects Epson RX8900 I2C RTC but a ds1338 is
193
* good enough */
194
@@ -XXX,XX +XXX,XX @@ static void romulus_bmc_i2c_init(AspeedMachineState *bmc)
195
196
static void tiogapass_bmc_i2c_init(AspeedMachineState *bmc)
197
{
198
- AspeedSoCState *soc = &bmc->soc;
199
+ AspeedSoCState *soc = bmc->soc;
200
201
at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 4), 0x54, 128 * KiB);
202
at24c_eeprom_init_rom(aspeed_i2c_get_bus(&soc->i2c, 6), 0x54, 128 * KiB,
203
@@ -XXX,XX +XXX,XX @@ static void create_pca9552(AspeedSoCState *soc, int bus_id, int addr)
204
205
static void sonorapass_bmc_i2c_init(AspeedMachineState *bmc)
206
{
207
- AspeedSoCState *soc = &bmc->soc;
208
+ AspeedSoCState *soc = bmc->soc;
209
210
/* bus 2 : */
211
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 2), "tmp105", 0x48);
212
@@ -XXX,XX +XXX,XX @@ static void witherspoon_bmc_i2c_init(AspeedMachineState *bmc)
213
{14, LED_COLOR_GREEN, "front-power-3", GPIO_POLARITY_ACTIVE_LOW},
214
{15, LED_COLOR_GREEN, "front-id-5", GPIO_POLARITY_ACTIVE_LOW},
215
};
216
- AspeedSoCState *soc = &bmc->soc;
217
+ AspeedSoCState *soc = bmc->soc;
218
uint8_t *eeprom_buf = g_malloc0(8 * 1024);
219
DeviceState *dev;
220
LEDState *led;
221
@@ -XXX,XX +XXX,XX @@ static void witherspoon_bmc_i2c_init(AspeedMachineState *bmc)
222
223
static void g220a_bmc_i2c_init(AspeedMachineState *bmc)
224
{
225
- AspeedSoCState *soc = &bmc->soc;
226
+ AspeedSoCState *soc = bmc->soc;
227
DeviceState *dev;
228
229
dev = DEVICE(i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 3),
230
@@ -XXX,XX +XXX,XX @@ static void g220a_bmc_i2c_init(AspeedMachineState *bmc)
231
232
static void fp5280g2_bmc_i2c_init(AspeedMachineState *bmc)
233
{
234
- AspeedSoCState *soc = &bmc->soc;
235
+ AspeedSoCState *soc = bmc->soc;
236
I2CSlave *i2c_mux;
237
238
/* The at24c256 */
239
@@ -XXX,XX +XXX,XX @@ static void fp5280g2_bmc_i2c_init(AspeedMachineState *bmc)
240
241
static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
242
{
243
- AspeedSoCState *soc = &bmc->soc;
244
+ AspeedSoCState *soc = bmc->soc;
245
I2CSlave *i2c_mux;
246
247
at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 0), 0x51, 32 * KiB);
248
@@ -XXX,XX +XXX,XX @@ static void get_pca9548_channels(I2CBus *bus, uint8_t mux_addr,
249
250
static void fuji_bmc_i2c_init(AspeedMachineState *bmc)
251
{
252
- AspeedSoCState *soc = &bmc->soc;
253
+ AspeedSoCState *soc = bmc->soc;
254
I2CBus *i2c[144] = {};
255
256
for (int i = 0; i < 16; i++) {
257
@@ -XXX,XX +XXX,XX @@ static void fuji_bmc_i2c_init(AspeedMachineState *bmc)
258
259
static void bletchley_bmc_i2c_init(AspeedMachineState *bmc)
260
{
261
- AspeedSoCState *soc = &bmc->soc;
262
+ AspeedSoCState *soc = bmc->soc;
263
I2CBus *i2c[13] = {};
264
for (int i = 0; i < 13; i++) {
265
if ((i == 8) || (i == 11)) {
266
@@ -XXX,XX +XXX,XX @@ static void bletchley_bmc_i2c_init(AspeedMachineState *bmc)
267
268
static void fby35_i2c_init(AspeedMachineState *bmc)
269
{
270
- AspeedSoCState *soc = &bmc->soc;
271
+ AspeedSoCState *soc = bmc->soc;
272
I2CBus *i2c[16];
273
274
for (int i = 0; i < 16; i++) {
275
@@ -XXX,XX +XXX,XX @@ static void fby35_i2c_init(AspeedMachineState *bmc)
276
277
static void qcom_dc_scm_bmc_i2c_init(AspeedMachineState *bmc)
278
{
279
- AspeedSoCState *soc = &bmc->soc;
280
+ AspeedSoCState *soc = bmc->soc;
281
282
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 15), "tmp105", 0x4d);
283
}
102
}
284
103
285
static void qcom_dc_scm_firework_i2c_init(AspeedMachineState *bmc)
286
{
287
- AspeedSoCState *soc = &bmc->soc;
288
+ AspeedSoCState *soc = bmc->soc;
289
I2CSlave *therm_mux, *cpuvr_mux;
290
291
/* Create the generic DC-SCM hardware */
292
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_bletchley_class_init(ObjectClass *oc, void *data)
293
static void fby35_reset(MachineState *state, ShutdownCause reason)
294
{
295
AspeedMachineState *bmc = ASPEED_MACHINE(state);
296
- AspeedGPIOState *gpio = &bmc->soc.gpio;
297
+ AspeedGPIOState *gpio = &bmc->soc->gpio;
298
299
qemu_devices_reset(reason);
300
301
@@ -XXX,XX +XXX,XX @@ static void aspeed_minibmc_machine_init(MachineState *machine)
302
sysclk = clock_new(OBJECT(machine), "SYSCLK");
303
clock_set_hz(sysclk, SYSCLK_FRQ);
304
305
- object_initialize_child(OBJECT(machine), "soc", &bmc->soc, amc->soc_name);
306
- qdev_connect_clock_in(DEVICE(&bmc->soc), "sysclk", sysclk);
307
+ bmc->soc = ASPEED_SOC(object_new(amc->soc_name));
308
+ object_property_add_child(OBJECT(machine), "soc", OBJECT(bmc->soc));
309
+ object_unref(OBJECT(bmc->soc));
310
+ qdev_connect_clock_in(DEVICE(bmc->soc), "sysclk", sysclk);
311
312
- object_property_set_link(OBJECT(&bmc->soc), "memory",
313
+ object_property_set_link(OBJECT(bmc->soc), "memory",
314
OBJECT(get_system_memory()), &error_abort);
315
connect_serial_hds_to_uarts(bmc);
316
- qdev_realize(DEVICE(&bmc->soc), NULL, &error_abort);
317
+ qdev_realize(DEVICE(bmc->soc), NULL, &error_abort);
318
319
- aspeed_board_init_flashes(&bmc->soc.fmc,
320
+ aspeed_board_init_flashes(&bmc->soc->fmc,
321
bmc->fmc_model ? bmc->fmc_model : amc->fmc_model,
322
amc->num_cs,
323
0);
324
325
- aspeed_board_init_flashes(&bmc->soc.spi[0],
326
+ aspeed_board_init_flashes(&bmc->soc->spi[0],
327
bmc->spi_model ? bmc->spi_model : amc->spi_model,
328
amc->num_cs, amc->num_cs);
329
330
- aspeed_board_init_flashes(&bmc->soc.spi[1],
331
+ aspeed_board_init_flashes(&bmc->soc->spi[1],
332
bmc->spi_model ? bmc->spi_model : amc->spi_model,
333
amc->num_cs, (amc->num_cs * 2));
334
335
@@ -XXX,XX +XXX,XX @@ static void aspeed_minibmc_machine_init(MachineState *machine)
336
337
static void ast1030_evb_i2c_init(AspeedMachineState *bmc)
338
{
339
- AspeedSoCState *soc = &bmc->soc;
340
+ AspeedSoCState *soc = bmc->soc;
341
342
/* U10 24C08 connects to SDA/SCL Group 1 by default */
343
uint8_t *eeprom_buf = g_malloc0(32 * 1024);
344
--
104
--
345
2.41.0
105
2.39.2
346
106
347
107
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
It's cleaner and removes the curious '+ 1' required to skip the DMA
2
IRQ line of the controller.
2
3
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
Signed-off-by: Cédric Le Goater <clg@kaod.org>
4
Reviewed-by: Cédric Le Goater <clg@kaod.org>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Signed-off-by: Cédric Le Goater <clg@kaod.org>
6
Signed-off-by: Cédric Le Goater <clg@kaod.org>
6
---
7
---
7
hw/arm/aspeed_soc.c | 6 +++---
8
hw/arm/aspeed.c | 2 +-
8
1 file changed, 3 insertions(+), 3 deletions(-)
9
hw/ssi/aspeed_smc.c | 5 +----
10
2 files changed, 2 insertions(+), 5 deletions(-)
9
11
10
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
12
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
11
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
12
--- a/hw/arm/aspeed_soc.c
14
--- a/hw/arm/aspeed.c
13
+++ b/hw/arm/aspeed_soc.c
15
+++ b/hw/arm/aspeed.c
14
@@ -XXX,XX +XXX,XX @@ static qemu_irq aspeed_soc_ast2400_get_irq(AspeedSoCState *s, int dev)
16
@@ -XXX,XX +XXX,XX @@ void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
15
return qdev_get_gpio_in(DEVICE(&s->vic), sc->irqmap[dev]);
17
qdev_realize_and_unref(dev, BUS(s->spi), &error_fatal);
18
19
cs_line = qdev_get_gpio_in_named(dev, SSI_GPIO_CS, 0);
20
- sysbus_connect_irq(SYS_BUS_DEVICE(s), i + 1, cs_line);
21
+ qdev_connect_gpio_out_named(DEVICE(s), "cs", i, cs_line);
22
}
16
}
23
}
17
24
18
-static void aspeed_soc_init(Object *obj)
25
diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
19
+static void aspeed_ast2400_soc_init(Object *obj)
26
index XXXXXXX..XXXXXXX 100644
20
{
27
--- a/hw/ssi/aspeed_smc.c
21
AspeedSoCState *s = ASPEED_SOC(obj);
28
+++ b/hw/ssi/aspeed_smc.c
22
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
29
@@ -XXX,XX +XXX,XX @@ static void aspeed_smc_realize(DeviceState *dev, Error **errp)
23
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2400_class_init(ObjectClass *oc, void *data)
30
24
static const TypeInfo aspeed_soc_ast2400_type_info = {
31
/* Setup cs_lines for peripherals */
25
.name = "ast2400-a1",
32
s->cs_lines = g_new0(qemu_irq, asc->cs_num_max);
26
.parent = TYPE_ASPEED_SOC,
33
-
27
- .instance_init = aspeed_soc_init,
34
- for (i = 0; i < asc->cs_num_max; ++i) {
28
+ .instance_init = aspeed_ast2400_soc_init,
35
- sysbus_init_irq(sbd, &s->cs_lines[i]);
29
.instance_size = sizeof(AspeedSoCState),
36
- }
30
.class_init = aspeed_soc_ast2400_class_init,
37
+ qdev_init_gpio_out_named(DEVICE(s), s->cs_lines, "cs", asc->cs_num_max);
31
};
38
32
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2500_class_init(ObjectClass *oc, void *data)
39
/* The memory region for the controller registers */
33
static const TypeInfo aspeed_soc_ast2500_type_info = {
40
memory_region_init_io(&s->mmio, OBJECT(s), &aspeed_smc_ops, s,
34
.name = "ast2500-a1",
35
.parent = TYPE_ASPEED_SOC,
36
- .instance_init = aspeed_soc_init,
37
+ .instance_init = aspeed_ast2400_soc_init,
38
.instance_size = sizeof(AspeedSoCState),
39
.class_init = aspeed_soc_ast2500_class_init,
40
};
41
--
41
--
42
2.41.0
42
2.39.2
43
43
44
44
diff view generated by jsdifflib