1
The following changes since commit 6661b8c7fe3f8b5687d2d90f7b4f3f23d70e3e8b:
1
The following changes since commit a95260486aa7e78d7c7194eba65cf03311ad94ad:
2
2
3
Merge tag 'pull-ppc-20230205' of https://gitlab.com/danielhb/qemu into staging (2023-02-05 16:49:09 +0000)
3
Merge tag 'pull-tcg-20231023' of https://gitlab.com/rth7680/qemu into staging (2023-10-23 14:45:46 -0700)
4
4
5
are available in the Git repository at:
5
are available in the Git repository at:
6
6
7
https://github.com/legoater/qemu/ tags/pull-aspeed-20230207
7
https://github.com/legoater/qemu/ tags/pull-aspeed-20231025
8
8
9
for you to fetch changes up to bf81b8f8acda4f1f774adc5f8e76225d472c6ae5:
9
for you to fetch changes up to dd41ce7a6f13ad4f45ebaf52b9fa91fe5fc961df:
10
10
11
aspeed/sdmc: Drop unnecessary scu include (2023-02-07 09:02:05 +0100)
11
hw/arm/aspeed: Move AspeedSoCState::cpu/vic to Aspeed2400SoCState (2023-10-25 09:52:44 +0200)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
aspeed queue:
14
aspeed queue:
15
15
16
* various small cleanups and fixes
16
* Update of Andrew's email
17
* new variant of the supermicrox11-bmc machine using an ast2500-a1 SoC
17
* Split of AspeedSoCState per 2400/2600/10x0
18
* at24c_eeprom extension to define eeprom contents with static arrays
19
* ast10x0 model and test improvements
20
* avocado update of images to use the latest
21
18
22
----------------------------------------------------------------
19
----------------------------------------------------------------
23
Cédric Le Goater (3):
20
Andrew Jeffery (1):
24
tests/avocado/machine_aspeed.py: update buildroot tests
21
MAINTAINERS: aspeed: Update Andrew's email address
25
tests/avocado/machine_aspeed.py: Mask systemd services to speed up SDK boot
26
hw/core/loader: Remove declarations of option_rom_has_mr/rom_file_has_mr
27
22
28
Guenter Roeck (2):
23
Philippe Mathieu-Daudé (11):
29
aspeed: Add Supermicro X11 SPI machine type
24
hw/arm/aspeed: Extract code common to all boards to a common file
30
m25p80: Add the is25wp256 SFPD table
25
hw/arm/aspeed: Rename aspeed_soc_init() as AST2400/2500 specific
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
31
35
32
Joel Stanley (2):
36
MAINTAINERS | 2 +-
33
avocado/boot_linux_console.py: Update ast2600 test
37
include/hw/arm/aspeed_soc.h | 35 +++++-
34
aspeed/sdmc: Drop unnecessary scu include
38
hw/arm/aspeed.c | 101 +++++++--------
39
hw/arm/aspeed_ast10x0.c | 53 ++++----
40
hw/arm/{aspeed_soc.c => aspeed_ast2400.c} | 197 +++++++-----------------------
41
hw/arm/aspeed_ast2600.c | 75 ++++++------
42
hw/arm/aspeed_soc_common.c | 154 +++++++++++++++++++++++
43
hw/arm/fby35.c | 27 ++--
44
hw/arm/meson.build | 3 +-
45
9 files changed, 363 insertions(+), 284 deletions(-)
46
rename hw/arm/{aspeed_soc.c => aspeed_ast2400.c} (76%)
47
create mode 100644 hw/arm/aspeed_soc_common.c
35
48
36
Peter Delevoryas (5):
37
hw/arm: Extract at24c_eeprom_init helper from Aspeed and Nuvoton boards
38
hw/arm/aspeed: Replace aspeed_eeprom_init with at24c_eeprom_init
39
hw/nvram/eeprom_at24c: Add init_rom field and at24c_eeprom_init_rom helper
40
hw/arm/aspeed: Add aspeed_eeprom.c
41
hw/nvram/eeprom_at24c: Make reset behavior more like hardware
42
43
Philippe Mathieu-Daudé (12):
44
tests/avocado: Introduce file_truncate()
45
tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB
46
hw/watchdog/wdt_aspeed: Rename MMIO region size as 'iosize'
47
hw/watchdog/wdt_aspeed: Extend MMIO range to cover more registers
48
hw/watchdog/wdt_aspeed: Log unimplemented registers as UNIMP level
49
hw/misc/aspeed_hace: Do not crash if address_space_map() failed
50
hw/arm/aspeed_ast10x0: Add various unimplemented peripherals
51
hw/arm/aspeed_ast10x0: Map I3C peripheral
52
hw/arm/aspeed_ast10x0: Map the secure SRAM
53
hw/arm/aspeed_ast10x0: Map HACE peripheral
54
hw/arm/aspeed_ast10x0: Add TODO comment to use Cortex-M4F
55
tests/avocado: Test Aspeed Zephyr SDK v00.01.08 on AST1030 board
56
57
Stephen Longfield (1):
58
hw/net: Fix read of uninitialized memory in ftgmac100
59
60
hw/arm/aspeed_eeprom.h | 19 +++++
61
hw/block/m25p80_sfdp.h | 2 +
62
include/hw/arm/aspeed_soc.h | 14 ++++
63
include/hw/loader.h | 3 -
64
include/hw/nvram/eeprom_at24c.h | 39 ++++++++++
65
include/hw/watchdog/wdt_aspeed.h | 4 +-
66
hw/arm/aspeed.c | 142 ++++++++++++++++++++----------------
67
hw/arm/aspeed_ast10x0.c | 83 ++++++++++++++++++++-
68
hw/arm/aspeed_ast2600.c | 4 +-
69
hw/arm/aspeed_eeprom.c | 82 +++++++++++++++++++++
70
hw/arm/aspeed_soc.c | 4 +-
71
hw/arm/msf2-som.c | 5 +-
72
hw/arm/npcm7xx_boards.c | 20 ++---
73
hw/block/m25p80.c | 3 +-
74
hw/block/m25p80_sfdp.c | 40 ++++++++++
75
hw/misc/aspeed_hace.c | 21 ++++--
76
hw/misc/aspeed_sdmc.c | 1 -
77
hw/net/ftgmac100.c | 4 +-
78
hw/nvram/eeprom_at24c.c | 58 ++++++++++++---
79
hw/watchdog/wdt_aspeed.c | 24 ++++--
80
hw/arm/meson.build | 1 +
81
tests/avocado/boot_linux_console.py | 19 +++--
82
tests/avocado/machine_aspeed.py | 60 +++++++++++++--
83
23 files changed, 523 insertions(+), 129 deletions(-)
84
create mode 100644 hw/arm/aspeed_eeprom.h
85
create mode 100644 include/hw/nvram/eeprom_at24c.h
86
create mode 100644 hw/arm/aspeed_eeprom.c
87
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
1
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
Link: https://lore.kernel.org/r/20230120134314.81956-2-philmd@linaro.org
5
[ clg: remove image_pow2ceil_expand() factoring ]
6
Signed-off-by: Cédric Le Goater <clg@kaod.org>
7
---
8
tests/avocado/boot_linux_console.py | 5 +++++
9
1 file changed, 5 insertions(+)
10
11
diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py
12
index XXXXXXX..XXXXXXX 100644
13
--- a/tests/avocado/boot_linux_console.py
14
+++ b/tests/avocado/boot_linux_console.py
15
@@ -XXX,XX +XXX,XX @@
16
def pow2ceil(x):
17
return 1 if x == 0 else 2**(x - 1).bit_length()
18
19
+def file_truncate(path, size):
20
+ if size != os.path.getsize(path):
21
+ with open(path, 'ab+') as fd:
22
+ fd.truncate(size)
23
+
24
"""
25
Expand file size to next power of 2
26
"""
27
--
28
2.39.1
29
30
diff view generated by jsdifflib
1
From: Joel Stanley <joel@jms.id.au>
1
From: Andrew Jeffery <andrew@codeconstruct.com.au>
2
2
3
The model includes aspeed_scu.h but doesn't appear to require it.
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.
4
6
5
Signed-off-by: Joel Stanley <joel@jms.id.au>
7
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
6
Reviewed-by: Cédric Le Goater <clg@kaod.org>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Message-Id: <20230124062022.298230-1-joel@jms.id.au>
9
Signed-off-by: Cédric Le Goater <clg@kaod.org>
8
Signed-off-by: Cédric Le Goater <clg@kaod.org>
10
---
9
---
11
hw/misc/aspeed_sdmc.c | 1 -
10
MAINTAINERS | 2 +-
12
1 file changed, 1 deletion(-)
11
1 file changed, 1 insertion(+), 1 deletion(-)
13
12
14
diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c
13
diff --git a/MAINTAINERS b/MAINTAINERS
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/misc/aspeed_sdmc.c
15
--- a/MAINTAINERS
17
+++ b/hw/misc/aspeed_sdmc.c
16
+++ b/MAINTAINERS
18
@@ -XXX,XX +XXX,XX @@
17
@@ -XXX,XX +XXX,XX @@ F: docs/system/arm/emcraft-sf2.rst
19
#include "qemu/module.h"
18
ASPEED BMCs
20
#include "qemu/error-report.h"
19
M: Cédric Le Goater <clg@kaod.org>
21
#include "hw/misc/aspeed_sdmc.h"
20
M: Peter Maydell <peter.maydell@linaro.org>
22
-#include "hw/misc/aspeed_scu.h"
21
-R: Andrew Jeffery <andrew@aj.id.au>
23
#include "hw/qdev-properties.h"
22
+R: Andrew Jeffery <andrew@codeconstruct.com.au>
24
#include "migration/vmstate.h"
23
R: Joel Stanley <joel@jms.id.au>
25
#include "qapi/error.h"
24
L: qemu-arm@nongnu.org
25
S: Maintained
26
--
26
--
27
2.39.1
27
2.41.0
28
28
29
29
diff view generated by jsdifflib
1
From: Peter Delevoryas <peter@pjd.dev>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
- Create aspeed_eeprom.c and aspeed_eeprom.h
3
aspeed_soc.c contains definitions specific to the AST2400
4
- Include aspeed_eeprom.c in CONFIG_ASPEED meson source files
4
and AST2500 SoCs, but also some definitions for other AST
5
- Include aspeed_eeprom.h in aspeed.c
5
SoCs: move them to a common file.
6
- Add fby35_bmc_fruid data
6
7
- Use new at24c_eeprom_init_rom helper to initialize BMC FRUID EEPROM with data
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
from aspeed_eeprom.c
9
10
wget https://github.com/facebook/openbmc/releases/download/openbmc-e2294ff5d31d/fby35.mtd
11
qemu-system-aarch64 -machine fby35-bmc -nographic -mtdblock fby35.mtd
12
...
13
user: root
14
pass: 0penBmc
15
...
16
root@bmc-oob:~# fruid-util bb
17
18
FRU Information : Baseboard
19
--------------- : ------------------
20
Chassis Type : Rack Mount Chassis
21
Chassis Part Number : N/A
22
Chassis Serial Number : N/A
23
Board Mfg Date : Fri Jan 7 10:30:00 2022
24
Board Mfg : XXXXXX
25
Board Product : Management Board wBMC
26
Board Serial : XXXXXXXXXXXXX
27
Board Part Number : XXXXXXXXXXXXXX
28
Board FRU ID : 1.0
29
Board Custom Data 1 : XXXXXXXXX
30
Board Custom Data 2 : XXXXXXXXXXXXXXXXXX
31
Product Manufacturer : XXXXXX
32
Product Name : Yosemite V3.5 EVT2
33
Product Part Number : XXXXXXXXXXXXXX
34
Product Version : EVT2
35
Product Serial : XXXXXXXXXXXXX
36
Product Asset Tag : XXXXXXX
37
Product FRU ID : 1.0
38
Product Custom Data 1 : XXXXXXXXX
39
Product Custom Data 2 : N/A
40
root@bmc-oob:~# fruid-util bmc
41
42
FRU Information : BMC
43
--------------- : ------------------
44
Board Mfg Date : Mon Jan 10 21:42:00 2022
45
Board Mfg : XXXXXX
46
Board Product : BMC Storage Module
47
Board Serial : XXXXXXXXXXXXX
48
Board Part Number : XXXXXXXXXXXXXX
49
Board FRU ID : 1.0
50
Board Custom Data 1 : XXXXXXXXX
51
Board Custom Data 2 : XXXXXXXXXXXXXXXXXX
52
Product Manufacturer : XXXXXX
53
Product Name : Yosemite V3.5 EVT2
54
Product Part Number : XXXXXXXXXXXXXX
55
Product Version : EVT2
56
Product Serial : XXXXXXXXXXXXX
57
Product Asset Tag : XXXXXXX
58
Product FRU ID : 1.0
59
Product Custom Data 1 : XXXXXXXXX
60
Product Custom Data 2 : Config A
61
root@bmc-oob:~# fruid-util nic
62
63
FRU Information : NIC
64
--------------- : ------------------
65
Board Mfg Date : Tue Nov 2 08:51:00 2021
66
Board Mfg : XXXXXXXX
67
Board Product : Mellanox ConnectX-6 DX OCP3.0
68
Board Serial : XXXXXXXXXXXXXXXXXXXXXXXX
69
Board Part Number : XXXXXXXXXXXXXXXXXXXXX
70
Board FRU ID : FRU Ver 0.02
71
Product Manufacturer : XXXXXXXX
72
Product Name : Mellanox ConnectX-6 DX OCP3.0
73
Product Part Number : XXXXXXXXXXXXXXXXXXXXX
74
Product Version : A9
75
Product Serial : XXXXXXXXXXXXXXXXXXXXXXXX
76
Product Custom Data 3 : ConnectX-6 DX
77
78
Signed-off-by: Peter Delevoryas <peter@pjd.dev>
79
Reviewed-by: Cédric Le Goater <clg@kaod.org>
8
Reviewed-by: Cédric Le Goater <clg@kaod.org>
80
Reviewed-by: Joel Stanley <joel@jms.id.au>
81
Reviewed-by: Corey Minyard <cminyard@mvista.com>
82
Link: https://lore.kernel.org/r/20230128060543.95582-5-peter@pjd.dev
83
Signed-off-by: Cédric Le Goater <clg@kaod.org>
9
Signed-off-by: Cédric Le Goater <clg@kaod.org>
84
---
10
---
85
hw/arm/aspeed_eeprom.h | 19 ++++++++++
11
hw/arm/aspeed_soc.c | 96 -------------------------------
86
hw/arm/aspeed.c | 10 ++++--
12
hw/arm/aspeed_soc_common.c | 114 +++++++++++++++++++++++++++++++++++++
87
hw/arm/aspeed_eeprom.c | 82 ++++++++++++++++++++++++++++++++++++++++++
13
hw/arm/meson.build | 1 +
88
hw/arm/meson.build | 1 +
14
3 files changed, 115 insertions(+), 96 deletions(-)
89
4 files changed, 109 insertions(+), 3 deletions(-)
15
create mode 100644 hw/arm/aspeed_soc_common.c
90
create mode 100644 hw/arm/aspeed_eeprom.h
16
91
create mode 100644 hw/arm/aspeed_eeprom.c
17
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
92
18
index XXXXXXX..XXXXXXX 100644
93
diff --git a/hw/arm/aspeed_eeprom.h b/hw/arm/aspeed_eeprom.h
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
94
new file mode 100644
122
new file mode 100644
95
index XXXXXXX..XXXXXXX
123
index XXXXXXX..XXXXXXX
96
--- /dev/null
124
--- /dev/null
97
+++ b/hw/arm/aspeed_eeprom.h
125
+++ b/hw/arm/aspeed_soc_common.c
98
@@ -XXX,XX +XXX,XX @@
126
@@ -XXX,XX +XXX,XX @@
99
+/*
127
+/*
100
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
128
+ * ASPEED SoC family
101
+ *
129
+ *
102
+ * SPDX-License-Identifier: GPL-2.0-only
130
+ * Andrew Jeffery <andrew@aj.id.au>
131
+ * Jeremy Kerr <jk@ozlabs.org>
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.
103
+ */
137
+ */
104
+
138
+
105
+#ifndef ASPEED_EEPROM_H
106
+#define ASPEED_EEPROM_H
107
+
108
+#include "qemu/osdep.h"
139
+#include "qemu/osdep.h"
109
+
140
+#include "qapi/error.h"
110
+extern const uint8_t fby35_nic_fruid[];
141
+#include "hw/misc/unimp.h"
111
+extern const uint8_t fby35_bb_fruid[];
142
+#include "hw/arm/aspeed_soc.h"
112
+extern const uint8_t fby35_bmc_fruid[];
143
+#include "hw/char/serial.h"
113
+extern const size_t fby35_nic_fruid_len;
144
+
114
+extern const size_t fby35_bb_fruid_len;
145
+
115
+extern const size_t fby35_bmc_fruid_len;
146
+qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev)
116
+
147
+{
117
+#endif
148
+ return ASPEED_SOC_GET_CLASS(s)->get_irq(s, dev);
118
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
149
+}
119
index XXXXXXX..XXXXXXX 100644
150
+
120
--- a/hw/arm/aspeed.c
151
+bool aspeed_soc_uart_realize(AspeedSoCState *s, Error **errp)
121
+++ b/hw/arm/aspeed.c
152
+{
122
@@ -XXX,XX +XXX,XX @@
153
+ AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
123
#include "hw/arm/boot.h"
154
+ SerialMM *smm;
124
#include "hw/arm/aspeed.h"
155
+
125
#include "hw/arm/aspeed_soc.h"
156
+ for (int i = 0, uart = ASPEED_DEV_UART1; i < sc->uarts_num; i++, uart++) {
126
+#include "hw/arm/aspeed_eeprom.h"
157
+ smm = &s->uart[i];
127
#include "hw/i2c/i2c_mux_pca954x.h"
158
+
128
#include "hw/i2c/smbus_eeprom.h"
159
+ /* Chardev property is set by the machine. */
129
#include "hw/misc/pca9552.h"
160
+ qdev_prop_set_uint8(DEVICE(smm), "regshift", 2);
130
@@ -XXX,XX +XXX,XX @@ static void fby35_i2c_init(AspeedMachineState *bmc)
161
+ qdev_prop_set_uint32(DEVICE(smm), "baudbase", 38400);
131
162
+ qdev_set_legacy_instance_id(DEVICE(smm), sc->memmap[uart], 2);
132
at24c_eeprom_init(i2c[4], 0x51, 128 * KiB);
163
+ qdev_prop_set_uint8(DEVICE(smm), "endianness", DEVICE_LITTLE_ENDIAN);
133
at24c_eeprom_init(i2c[6], 0x51, 128 * KiB);
164
+ if (!sysbus_realize(SYS_BUS_DEVICE(smm), errp)) {
134
- at24c_eeprom_init(i2c[8], 0x50, 32 * KiB);
165
+ return false;
135
- at24c_eeprom_init(i2c[11], 0x51, 128 * KiB);
166
+ }
136
- at24c_eeprom_init(i2c[11], 0x54, 128 * KiB);
167
+
137
+ at24c_eeprom_init_rom(i2c[8], 0x50, 32 * KiB, fby35_nic_fruid,
168
+ sysbus_connect_irq(SYS_BUS_DEVICE(smm), 0, aspeed_soc_get_irq(s, uart));
138
+ fby35_nic_fruid_len);
169
+ aspeed_mmio_map(s, SYS_BUS_DEVICE(smm), 0, sc->memmap[uart]);
139
+ at24c_eeprom_init_rom(i2c[11], 0x51, 128 * KiB, fby35_bb_fruid,
170
+ }
140
+ fby35_bb_fruid_len);
171
+
141
+ at24c_eeprom_init_rom(i2c[11], 0x54, 128 * KiB, fby35_bmc_fruid,
172
+ return true;
142
+ fby35_bmc_fruid_len);
173
+}
143
174
+
144
/*
175
+void aspeed_soc_uart_set_chr(AspeedSoCState *s, int dev, Chardev *chr)
145
* TODO: There is a multi-master i2c connection to an AST1030 MiniBMC on
176
+{
146
diff --git a/hw/arm/aspeed_eeprom.c b/hw/arm/aspeed_eeprom.c
177
+ AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
147
new file mode 100644
178
+ int i = dev - ASPEED_DEV_UART1;
148
index XXXXXXX..XXXXXXX
179
+
149
--- /dev/null
180
+ g_assert(0 <= i && i < ARRAY_SIZE(s->uart) && i < sc->uarts_num);
150
+++ b/hw/arm/aspeed_eeprom.c
181
+ qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", chr);
151
@@ -XXX,XX +XXX,XX @@
182
+}
183
+
152
+/*
184
+/*
153
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
185
+ * SDMC should be realized first to get correct RAM size and max size
154
+ *
186
+ * values
155
+ * SPDX-License-Identifier: GPL-2.0-only
156
+ */
187
+ */
157
+
188
+bool aspeed_soc_dram_init(AspeedSoCState *s, Error **errp)
158
+#include "aspeed_eeprom.h"
189
+{
159
+
190
+ AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
160
+const uint8_t fby35_nic_fruid[] = {
191
+ ram_addr_t ram_size, max_ram_size;
161
+ 0x01, 0x00, 0x00, 0x01, 0x0f, 0x20, 0x00, 0xcf, 0x01, 0x0e, 0x19, 0xd7,
192
+
162
+ 0x5e, 0xcf, 0xc8, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xdd,
193
+ ram_size = object_property_get_uint(OBJECT(&s->sdmc), "ram-size",
163
+ 0x4d, 0x65, 0x6c, 0x6c, 0x61, 0x6e, 0x6f, 0x78, 0x20, 0x43, 0x6f, 0x6e,
194
+ &error_abort);
164
+ 0x6e, 0x65, 0x63, 0x74, 0x58, 0x2d, 0x36, 0x20, 0x44, 0x58, 0x20, 0x4f,
195
+ max_ram_size = object_property_get_uint(OBJECT(&s->sdmc), "max-ram-size",
165
+ 0x43, 0x50, 0x33, 0x2e, 0x30, 0xd8, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
196
+ &error_abort);
166
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
197
+
167
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd5, 0x58, 0x58, 0x58, 0x58, 0x58,
198
+ memory_region_init(&s->dram_container, OBJECT(s), "ram-container",
168
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
199
+ max_ram_size);
169
+ 0x58, 0x58, 0x58, 0x58, 0xcc, 0x46, 0x52, 0x55, 0x20, 0x56, 0x65, 0x72,
200
+ memory_region_add_subregion(&s->dram_container, 0, s->dram_mr);
170
+ 0x20, 0x30, 0x2e, 0x30, 0x32, 0xc0, 0xc0, 0xc0, 0xc1, 0x00, 0x00, 0x2f,
201
+
171
+ 0x01, 0x11, 0x19, 0xc8, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
202
+ /*
172
+ 0xdd, 0x4d, 0x65, 0x6c, 0x6c, 0x61, 0x6e, 0x6f, 0x78, 0x20, 0x43, 0x6f,
203
+ * Add a memory region beyond the RAM region to let firmwares scan
173
+ 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x58, 0x2d, 0x36, 0x20, 0x44, 0x58, 0x20,
204
+ * the address space with load/store and guess how much RAM the
174
+ 0x4f, 0x43, 0x50, 0x33, 0x2e, 0x30, 0xd5, 0x58, 0x58, 0x58, 0x58, 0x58,
205
+ * SoC has.
175
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
206
+ */
176
+ 0x58, 0x58, 0x58, 0x58, 0xd3, 0x41, 0x39, 0x20, 0x20, 0x20, 0x20, 0x20,
207
+ if (ram_size < max_ram_size) {
177
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
208
+ DeviceState *dev = qdev_new(TYPE_UNIMPLEMENTED_DEVICE);
178
+ 0xd8, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
209
+
179
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
210
+ qdev_prop_set_string(dev, "name", "ram-empty");
180
+ 0x58, 0xc0, 0xc0, 0xc0, 0xc0, 0xcd, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63,
211
+ qdev_prop_set_uint64(dev, "size", max_ram_size - ram_size);
181
+ 0x74, 0x58, 0x2d, 0x36, 0x20, 0x44, 0x58, 0xc1, 0x00, 0x00, 0x00, 0x00,
212
+ if (!sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), errp)) {
182
+ 0x00, 0x00, 0x00, 0xdb, 0xc0, 0x82, 0x30, 0x15, 0x79, 0x7f, 0xa6, 0x00,
213
+ return false;
183
+ 0x01, 0x18, 0x0b, 0xff, 0x08, 0x00, 0xff, 0xff, 0x64, 0x00, 0x00, 0x00,
214
+ }
184
+ 0x00, 0x03, 0x20, 0x01, 0xff, 0xff, 0x04, 0x46, 0x00, 0xff, 0xff, 0xff,
215
+
185
+ 0xff, 0xff, 0xff, 0xff, 0x01, 0x81, 0x09, 0x15, 0xb3, 0x10, 0x1d, 0x00,
216
+ memory_region_add_subregion_overlap(&s->dram_container, ram_size,
186
+ 0x24, 0x15, 0xb3, 0x00, 0x02, 0xeb, 0x8a, 0x95, 0x5c,
217
+ sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0), -1000);
187
+};
218
+ }
188
+
219
+
189
+const uint8_t fby35_bb_fruid[] = {
220
+ memory_region_add_subregion(s->memory,
190
+ 0x01, 0x00, 0x01, 0x03, 0x10, 0x00, 0x00, 0xeb, 0x01, 0x02, 0x17, 0xc3,
221
+ sc->memmap[ASPEED_DEV_SDRAM], &s->dram_container);
191
+ 0x4e, 0x2f, 0x41, 0xc3, 0x4e, 0x2f, 0x41, 0xc1, 0x00, 0x00, 0x00, 0x23,
222
+ return true;
192
+ 0x01, 0x0d, 0x00, 0xb6, 0xd2, 0xd0, 0xc6, 0x58, 0x58, 0x58, 0x58, 0x58,
223
+}
193
+ 0x58, 0xd5, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x6d, 0x65, 0x6e, 0x74,
224
+
194
+ 0x20, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x20, 0x77, 0x42, 0x4d, 0x43, 0xcd,
225
+void aspeed_mmio_map(AspeedSoCState *s, SysBusDevice *dev, int n, hwaddr addr)
195
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
226
+{
196
+ 0x58, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
227
+ memory_region_add_subregion(s->memory, addr,
197
+ 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e, 0x30, 0xc9, 0x58, 0x58, 0x58,
228
+ sysbus_mmio_get_region(dev, n));
198
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x58, 0x58, 0x58, 0x58, 0x58,
229
+}
199
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
230
+
200
+ 0x58, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x01, 0x0c, 0x00, 0xc6,
231
+void aspeed_mmio_map_unimplemented(AspeedSoCState *s, SysBusDevice *dev,
201
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x59, 0x6f, 0x73, 0x65, 0x6d,
232
+ const char *name, hwaddr addr, uint64_t size)
202
+ 0x69, 0x74, 0x65, 0x20, 0x56, 0x33, 0x2e, 0x35, 0x20, 0x45, 0x56, 0x54,
233
+{
203
+ 0x32, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
234
+ qdev_prop_set_string(DEVICE(dev), "name", name);
204
+ 0x58, 0x58, 0x58, 0x58, 0xc4, 0x45, 0x56, 0x54, 0x32, 0xcd, 0x58, 0x58,
235
+ qdev_prop_set_uint64(DEVICE(dev), "size", size);
205
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc7,
236
+ sysbus_realize(dev, &error_abort);
206
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e, 0x30, 0xc9,
237
+
207
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x4e, 0x2f,
238
+ memory_region_add_subregion_overlap(s->memory, addr,
208
+ 0x41, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43,
239
+ sysbus_mmio_get_region(dev, 0), -1000);
209
+};
240
+}
210
+
211
+const uint8_t fby35_bmc_fruid[] = {
212
+ 0x01, 0x00, 0x00, 0x01, 0x0d, 0x00, 0x00, 0xf1, 0x01, 0x0c, 0x00, 0x36,
213
+ 0xe6, 0xd0, 0xc6, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x42, 0x4d,
214
+ 0x43, 0x20, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, 0x4d, 0x6f,
215
+ 0x64, 0x75, 0x6c, 0x65, 0xcd, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
216
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58,
217
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e,
218
+ 0x30, 0xc9, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2,
219
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
220
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc1, 0x39, 0x01, 0x0c, 0x00, 0xc6,
221
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xd2, 0x59, 0x6f, 0x73, 0x65, 0x6d,
222
+ 0x69, 0x74, 0x65, 0x20, 0x56, 0x33, 0x2e, 0x35, 0x20, 0x45, 0x56, 0x54,
223
+ 0x32, 0xce, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58,
224
+ 0x58, 0x58, 0x58, 0x58, 0xc4, 0x45, 0x56, 0x54, 0x32, 0xcd, 0x58, 0x58,
225
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc7,
226
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc3, 0x31, 0x2e, 0x30, 0xc9,
227
+ 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0xc8, 0x43, 0x6f,
228
+ 0x6e, 0x66, 0x69, 0x67, 0x20, 0x41, 0xc1, 0x45,
229
+};
230
+
231
+const size_t fby35_nic_fruid_len = sizeof(fby35_nic_fruid);
232
+const size_t fby35_bb_fruid_len = sizeof(fby35_bb_fruid);
233
+const size_t fby35_bmc_fruid_len = sizeof(fby35_bmc_fruid);
234
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
241
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
235
index XXXXXXX..XXXXXXX 100644
242
index XXXXXXX..XXXXXXX 100644
236
--- a/hw/arm/meson.build
243
--- a/hw/arm/meson.build
237
+++ b/hw/arm/meson.build
244
+++ b/hw/arm/meson.build
238
@@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
245
@@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'CONFIG_FSL_IMX6', if_true: files('fsl-imx6.c'))
246
arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files(
247
'aspeed_soc.c',
239
'aspeed.c',
248
'aspeed.c',
249
+ 'aspeed_soc_common.c',
240
'aspeed_ast2600.c',
250
'aspeed_ast2600.c',
241
'aspeed_ast10x0.c',
251
'aspeed_ast10x0.c',
242
+ 'aspeed_eeprom.c',
252
'aspeed_eeprom.c',
243
'fby35.c'))
244
arm_ss.add(when: 'CONFIG_MPS2', if_true: files('mps2.c'))
245
arm_ss.add(when: 'CONFIG_MPS2', if_true: files('mps2-tz.c'))
246
--
253
--
247
2.39.1
254
2.41.0
248
255
249
256
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
The M2S-FG484 SOM uses a 16 MiB SPI flash (Spansion
4
S25FL128SDPBHICO). Since the test asset is bigger,
5
truncate it to the correct size to avoid when running
6
the test_arm_emcraft_sf2 test:
7
8
qemu-system-arm: device requires 16777216 bytes, block backend provides 67108864 bytes
9
10
Add comment regarding the M2S-FG484 SOM hardware in
11
hw/arm/msf2-som.c.
12
13
Reported-by: Cédric Le Goater <clg@kaod.org>
14
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
15
Reviewed-by: Cédric Le Goater <clg@kaod.org>
4
Reviewed-by: Cédric Le Goater <clg@kaod.org>
16
Tested-by: Cédric Le Goater <clg@kaod.org>
17
Signed-off-by: Cédric Le Goater <clg@kaod.org>
5
Signed-off-by: Cédric Le Goater <clg@kaod.org>
18
---
6
---
19
hw/arm/msf2-som.c | 5 ++++-
7
hw/arm/aspeed_soc.c | 6 +++---
20
tests/avocado/boot_linux_console.py | 2 ++
8
1 file changed, 3 insertions(+), 3 deletions(-)
21
2 files changed, 6 insertions(+), 1 deletion(-)
22
9
23
diff --git a/hw/arm/msf2-som.c b/hw/arm/msf2-som.c
10
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
24
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/arm/msf2-som.c
12
--- a/hw/arm/aspeed_soc.c
26
+++ b/hw/arm/msf2-som.c
13
+++ b/hw/arm/aspeed_soc.c
27
@@ -XXX,XX +XXX,XX @@
14
@@ -XXX,XX +XXX,XX @@ static qemu_irq aspeed_soc_ast2400_get_irq(AspeedSoCState *s, int dev)
28
/*
15
return qdev_get_gpio_in(DEVICE(&s->vic), sc->irqmap[dev]);
29
* SmartFusion2 SOM starter kit(from Emcraft) emulation.
16
}
30
*
17
31
+ * M2S-FG484 SOM hardware architecture specification:
18
-static void aspeed_soc_init(Object *obj)
32
+ * https://www.emcraft.com/jdownloads/som/m2s/m2s-som-ha.pdf
19
+static void aspeed_ast2400_soc_init(Object *obj)
33
+ *
20
{
34
* Copyright (c) 2017 Subbaraya Sundeep <sundeep.lkml@gmail.com>
21
AspeedSoCState *s = ASPEED_SOC(obj);
35
*
22
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
36
* Permission is hereby granted, free of charge, to any person obtaining a copy
23
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2400_class_init(ObjectClass *oc, void *data)
37
@@ -XXX,XX +XXX,XX @@ static void emcraft_sf2_s2s010_init(MachineState *machine)
24
static const TypeInfo aspeed_soc_ast2400_type_info = {
38
25
.name = "ast2400-a1",
39
/* Attach SPI flash to SPI0 controller */
26
.parent = TYPE_ASPEED_SOC,
40
spi_bus = qdev_get_child_bus(dev, "spi0");
27
- .instance_init = aspeed_soc_init,
41
- spi_flash = qdev_new("s25sl12801");
28
+ .instance_init = aspeed_ast2400_soc_init,
42
+ spi_flash = qdev_new("s25sl12801"); /* Spansion S25FL128SDPBHICO */
29
.instance_size = sizeof(AspeedSoCState),
43
qdev_prop_set_uint8(spi_flash, "spansion-cr2nv", 1);
30
.class_init = aspeed_soc_ast2400_class_init,
44
if (dinfo) {
31
};
45
qdev_prop_set_drive_err(spi_flash, "drive",
32
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2500_class_init(ObjectClass *oc, void *data)
46
diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py
33
static const TypeInfo aspeed_soc_ast2500_type_info = {
47
index XXXXXXX..XXXXXXX 100644
34
.name = "ast2500-a1",
48
--- a/tests/avocado/boot_linux_console.py
35
.parent = TYPE_ASPEED_SOC,
49
+++ b/tests/avocado/boot_linux_console.py
36
- .instance_init = aspeed_soc_init,
50
@@ -XXX,XX +XXX,XX @@ def test_arm_emcraft_sf2(self):
37
+ .instance_init = aspeed_ast2400_soc_init,
51
spi_hash = '65523a1835949b6f4553be96dec1b6a38fb05501'
38
.instance_size = sizeof(AspeedSoCState),
52
spi_path = self.fetch_asset(spi_url, asset_hash=spi_hash)
39
.class_init = aspeed_soc_ast2500_class_init,
53
40
};
54
+ file_truncate(spi_path, 16 << 20) # Spansion S25FL128SDPBHICO is 16 MiB
55
+
56
self.vm.set_console()
57
kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE
58
self.vm.add_args('-kernel', uboot_path,
59
--
41
--
60
2.39.1
42
2.41.0
61
43
62
44
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Add a very quick test that runs some commands in a Zephyr shell:
3
Keep aspeed_soc_class_init() generic, set the realize handler
4
4
to aspeed_ast2400_soc_realize() in each 2400/2500 class_init.
5
$ tests/venv/bin/avocado --show=app,console run -t os:zephyr tests/avocado
6
(2/2) tests/avocado/machine_aspeed.py:AST1030Machine.test_ast1030_zephyros_1_07:
7
console: *** Booting Zephyr OS build v00.01.07 ***
8
console: ast1030_evb demo
9
console: SOC: AST1030-A1
10
console: uart:~$ kernel stacks
11
console: 0x36910 wdt_background (real size 1024):    unused 988    usage 36 / 1024 (3 %)
12
console: 0x36ad8 shell_uart (real size 4096):    unused 3084    usage 1012 / 4096 (24 %)
13
console: 0x2edb8 ADC0 (real size 400):    unused 260    usage 140 / 400 (35 %)
14
console: 0x2f0f0 ADC1 (real size 400):    unused 260    usage 140 / 400 (35 %)
15
console: 0x3b098 sysworkq (real size 1024):    unused 860    usage 164 / 1024 (16 %)
16
console: 0x36cc0 usbdworkq (real size 1024):    unused 860    usage 164 / 1024 (16 %)
17
console: 0x36bd8 usbworkq (real size 1024):    unused 860    usage 164 / 1024 (16 %)
18
console: 0x36a10 logging (real size 768):    unused 548    usage 220 / 768 (28 %)
19
console: 0x36ef8 idle 00 (real size 320):    unused 268    usage 52 / 320 (16 %)
20
console: 0x47800 IRQ 00 (real size 2048):    unused 1504    usage 544 / 2048 (26 %)
21
console: uart:~$ otp info scu
22
console: SCU BIT reg_protect Description
23
console: ____________________________________________________________________
24
console: 0x500 0x0 0x0 Disable ARM CM4 CPU boot (TXD5)
25
console: 0x500 0x1 0x0 /Reserved
26
console: 0x500 0x2 0x0 \ "
27
console: 0x500 0x3 0x0 Address offset of single chip ABR mode
28
console: 0x500 0x4 0x0 /Reserved
29
console: 0x500 0x5 0x0 | "
30
console: 0x500 0x6 0x0 | "
31
console: 0x500 0x7 0x0 | "
32
console: 0x500 0x8 0x0 | "
33
console: 0x500 0x9 0x0 | "
34
console: 0x500 0xA 0x0 | "
35
console: 0x500 0xB 0x0 | "
36
console: 0x500 0xC 0x0 | "
37
console: 0x500 0xD 0x0 | "
38
console: 0x500 0xE 0x0 | "
39
console: 0x500 0xF 0x0 | "
40
console: 0x500 0x10 0x0 \ "
41
console: 0x500 0x11 0x0 Disabl3 ARM JTAG debug
42
console: 0x500 0x12 0x0 /Reserved
43
console: 0x500 0x13 0x0 | "
44
console: 0x500 0x14 0x0 | "
45
console: 0x500 0x15 0x0 | "
46
console: 0x500 0x16 0x0 | "
47
console: 0x500 0x17 0x0 | "
48
console: 0x500 0x18 0x0 | "
49
console: 0x500 0x19 0x0 | "
50
console: 0x500 0x1A 0x0 | "
51
console: 0x500 0x1B 0x0 | "
52
console: 0x500 0x1C 0x0 | "
53
console: 0x500 0x1D 0x0 | "
54
console: 0x500 0x1E 0x0 | "
55
console: 0x500 0x1F 0x0 \ "
56
console: 0x510 0x0 0x0 /Reserved
57
console: 0x510 0x1 0x0 | "
58
console: 0x510 0x2 0x0 | "
59
console: 0x510 0x3 0x0 \ "
60
console: 0x510 0x4 0x0 Disable debug interfaces
61
console: 0x510 0x5 0x0 /Reserved
62
console: 0x510 0x6 0x0 | "
63
console: 0x510 0x7 0x0 \ "
64
console: 0x510 0x8 0x0 Enable boot from Uart5 by Pin Strap
65
console: 0x510 0x9 0x0 /Reserved
66
console: 0x510 0xA 0x0 \ "
67
console: 0x510 0xB 0x0 Enable boot SPI ABR
68
console: 0x510 0xC 0x0 Boot SPI ABR Mode
69
console: 0x510 0xD 0x0 /Boot SPI flash size
70
console: 0x510 0xE 0x0 | "
71
console: 0x510 0xF 0x0 \ "
72
console: 0x510 0x10 0x0 /Reserved
73
console: 0x510 0x11 0x0 | "
74
console: 0x510 0x12 0x0 | "
75
console: 0x510 0x13 0x0 | "
76
console: 0x510 0x14 0x0 | "
77
console: 0x510 0x15 0x0 \ "
78
console: 0x510 0x16 0x0 Enable boot SPI auxiliary control pins
79
console: 0x510 0x19 0x0 /Reserved
80
console: 0x510 0x1A 0x0 | "
81
console: 0x510 0x1B 0x0 | "
82
console: 0x510 0x1C 0x0 | "
83
console: 0x510 0x1D 0x0 | "
84
console: 0x510 0x1E 0x0 | "
85
console: 0x510 0x1F 0x0 \ "
86
console: 0x510 0x1E 0x0 Enable dedicate GPIO strap pins
87
console: 0x510 0x1F 0x0 Enable Secure Boot by Pin Strap
88
console: uart:~$ hwinfo devid
89
console: Length: 8
90
console: ID: 0x0000018000000180
91
console: uart:~$ crypto aes256_cbc_vault
92
console: aes256_cbc vault key 1
93
console: Was waiting for:
94
console: 6b c1 be e2 2e 40 9f 96 e9 3d 7e 11 73 93 17 2a
95
console: ae 2d 8a 57 1e 03 ac 9c 9e b7 6f ac 45 af 8e 51
96
console: 30 c8 1c 46 a3 5c e4 11 e5 fb c1 19 1a 0a 52 ef
97
console: f6 9f 24 45 df 4f 9b 17 ad 2b 41 7b e6 6c 37 10
98
console: But got:
99
console: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
100
console: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
101
console: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
102
console: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
103
console: uart:~$ random get
104
console: 0x862460d
105
console: uart:~$ i2c scan I2C_0
106
console: 0 1 2 3 4 5 6 7 8 9 a b c d e f
107
console: 00: -- -- -- -- -- -- -- -- -- -- -- --
108
console: 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
109
console: 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
110
console: 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
111
console: 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
112
console: 50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
113
console: 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
114
console: 70: -- -- -- -- -- -- -- --
115
console: 1 devices found on I2C_0
116
console: uart:~$ kernel uptime
117
console: Uptime: 9897 ms
118
console: uart:~$ kernel reboot warm
119
console: *** Booting Zephyr OS build v00.01.07 ***
120
PASS (1.08 s)
121
122
Ref: https://github.com/AspeedTech-BMC/zephyr/releases/download/v00.01.07/Aspeed_Zephy_SDK_User_Guide_v00.01.07.pdf
123
5
124
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
125
Reviewed-by: Peter Delevoryas <peter@pjd.dev>
126
Reviewed-by: Cédric Le Goater <clg@kaod.org>
7
Reviewed-by: Cédric Le Goater <clg@kaod.org>
127
Signed-off-by: Cédric Le Goater <clg@kaod.org>
8
Signed-off-by: Cédric Le Goater <clg@kaod.org>
128
---
9
---
129
tests/avocado/machine_aspeed.py | 41 ++++++++++++++++++++++++++++++++-
10
hw/arm/aspeed_soc.c | 15 +++++++++++----
130
1 file changed, 40 insertions(+), 1 deletion(-)
11
1 file changed, 11 insertions(+), 4 deletions(-)
131
12
132
diff --git a/tests/avocado/machine_aspeed.py b/tests/avocado/machine_aspeed.py
13
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
133
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
134
--- a/tests/avocado/machine_aspeed.py
15
--- a/hw/arm/aspeed_soc.c
135
+++ b/tests/avocado/machine_aspeed.py
16
+++ b/hw/arm/aspeed_soc.c
136
@@ -XXX,XX +XXX,XX @@ class AST1030Machine(QemuSystemTest):
17
@@ -XXX,XX +XXX,XX @@ static void aspeed_ast2400_soc_init(Object *obj)
137
18
object_initialize_child(obj, "video", &s->video, TYPE_UNIMPLEMENTED_DEVICE);
138
timeout = 10
19
}
139
20
140
- def test_ast1030_zephyros(self):
21
-static void aspeed_soc_realize(DeviceState *dev, Error **errp)
141
+ def test_ast1030_zephyros_1_04(self):
22
+static void aspeed_ast2400_soc_realize(DeviceState *dev, Error **errp)
142
"""
23
{
143
:avocado: tags=arch:arm
24
int i;
144
:avocado: tags=machine:ast1030-evb
25
AspeedSoCState *s = ASPEED_SOC(dev);
145
+ :avocado: tags=os:zephyr
26
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_class_init(ObjectClass *oc, void *data)
146
"""
27
{
147
tar_url = ('https://github.com/AspeedTech-BMC'
28
DeviceClass *dc = DEVICE_CLASS(oc);
148
'/zephyr/releases/download/v00.01.04/ast1030-evb-demo.zip')
29
149
@@ -XXX,XX +XXX,XX @@ def test_ast1030_zephyros(self):
30
- dc->realize = aspeed_soc_realize;
150
exec_command_and_wait_for_pattern(self, "help",
31
- /* Reason: Uses serial_hds and nd_table in realize() directly */
151
"Available commands")
32
- dc->user_creatable = false;
152
33
device_class_set_props(dc, aspeed_soc_properties);
153
+ def test_ast1030_zephyros_1_07(self):
34
}
154
+ """
35
155
+ :avocado: tags=arch:arm
36
@@ -XXX,XX +XXX,XX @@ static const TypeInfo aspeed_soc_type_info = {
156
+ :avocado: tags=machine:ast1030-evb
37
static void aspeed_soc_ast2400_class_init(ObjectClass *oc, void *data)
157
+ :avocado: tags=os:zephyr
38
{
158
+ """
39
AspeedSoCClass *sc = ASPEED_SOC_CLASS(oc);
159
+ tar_url = ('https://github.com/AspeedTech-BMC'
40
+ DeviceClass *dc = DEVICE_CLASS(oc);
160
+ '/zephyr/releases/download/v00.01.07/ast1030-evb-demo.zip')
161
+ tar_hash = '40ac87eabdcd3b3454ce5aad11fedc72a33ecda2'
162
+ tar_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
163
+ archive.extract(tar_path, self.workdir)
164
+ kernel_file = self.workdir + "/ast1030-evb-demo/zephyr.bin"
165
+ self.vm.set_console()
166
+ self.vm.add_args('-kernel', kernel_file,
167
+ '-nographic')
168
+ self.vm.launch()
169
+ wait_for_console_pattern(self, "Booting Zephyr OS")
170
+ for shell_cmd in [
171
+ 'kernel stacks',
172
+ 'otp info conf',
173
+ 'otp info scu',
174
+ 'hwinfo devid',
175
+ 'crypto aes256_cbc_vault',
176
+ 'random get',
177
+ 'jtag JTAG1 sw_xfer high TMS',
178
+ 'adc ADC0 resolution 12',
179
+ 'adc ADC0 read 42',
180
+ 'adc ADC1 read 69',
181
+ 'i2c scan I2C_0',
182
+ 'i3c attach I3C_0',
183
+ 'hash test',
184
+ 'kernel uptime',
185
+ 'kernel reboot warm',
186
+ 'kernel uptime',
187
+ 'kernel reboot cold',
188
+ 'kernel uptime',
189
+ ]: exec_command_and_wait_for_pattern(self, shell_cmd, "uart:~$")
190
+
41
+
191
class AST2x00Machine(QemuSystemTest):
42
+ dc->realize = aspeed_ast2400_soc_realize;
192
43
+ /* Reason: Uses serial_hds and nd_table in realize() directly */
193
timeout = 90
44
+ dc->user_creatable = false;
45
46
sc->name = "ast2400-a1";
47
sc->cpu_type = ARM_CPU_TYPE_NAME("arm926");
48
@@ -XXX,XX +XXX,XX @@ static const TypeInfo aspeed_soc_ast2400_type_info = {
49
static void aspeed_soc_ast2500_class_init(ObjectClass *oc, void *data)
50
{
51
AspeedSoCClass *sc = ASPEED_SOC_CLASS(oc);
52
+ DeviceClass *dc = DEVICE_CLASS(oc);
53
+
54
+ dc->realize = aspeed_ast2400_soc_realize;
55
+ /* Reason: Uses serial_hds and nd_table in realize() directly */
56
+ dc->user_creatable = false;
57
58
sc->name = "ast2500-a1";
59
sc->cpu_type = ARM_CPU_TYPE_NAME("arm1176");
194
--
60
--
195
2.39.1
61
2.41.0
196
62
197
63
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
supermicrox11-bmc is configured with ast2400-a1 SoC. This does not match
3
We want to derivate the big AspeedSoCState object in some more
4
the Supermicro documentation for X11 BMCs, and it does not match the
4
SoC-specific ones. Since the object size will vary, allocate it
5
devicetree file in the Linux kernel.
5
dynamically.
6
6
7
As it turns out, some Supermicro X11 motherboards use AST2400 SoCs,
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
while others use AST2500.
8
Reviewed-by: Cédric Le Goater <clg@kaod.org>
9
10
Introduce new machine type supermicrox11-spi-bmc with AST2500 SoC
11
to match the devicetree description in the Linux kernel. Hardware
12
configuration details for this machine type are guesswork and taken
13
from defaults as well as from the Linux kernel devicetree file.
14
15
The new machine type was tested with aspeed-bmc-supermicro-x11spi.dts
16
from the Linux kernel and with Linux versions 6.0.3 and 6.1-rc2.
17
Linux booted successfully from initrd and from both SPI interfaces.
18
Ethernet interfaces were confirmed to be operational.
19
20
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
21
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
22
Link: https://lore.kernel.org/r/20221025165109.1226001-1-linux@roeck-us.net
23
[ clg: Renamed machine to 'supermicro-x11spi-bmc' ]
24
Message-Id: <20221025165109.1226001-1-linux@roeck-us.net>
25
Signed-off-by: Cédric Le Goater <clg@kaod.org>
9
Signed-off-by: Cédric Le Goater <clg@kaod.org>
26
---
10
---
27
hw/arm/aspeed.c | 33 +++++++++++++++++++++++++++++++++
11
hw/arm/aspeed.c | 101 +++++++++++++++++++++++++-----------------------
28
1 file changed, 33 insertions(+)
12
1 file changed, 52 insertions(+), 49 deletions(-)
29
13
30
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
14
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
31
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
32
--- a/hw/arm/aspeed.c
16
--- a/hw/arm/aspeed.c
33
+++ b/hw/arm/aspeed.c
17
+++ b/hw/arm/aspeed.c
34
@@ -XXX,XX +XXX,XX @@ struct AspeedMachineState {
18
@@ -XXX,XX +XXX,XX @@ struct AspeedMachineState {
35
SCU_HW_STRAP_VGA_SIZE_SET(VGA_16M_DRAM) | \
19
MachineState parent_obj;
36
SCU_AST2400_HW_STRAP_BOOT_MODE(AST2400_SPI_BOOT))
20
/* Public */
37
21
38
+/* TODO: Find the actual hardware value */
22
- AspeedSoCState soc;
39
+#define SUPERMICRO_X11SPI_BMC_HW_STRAP1 ( \
23
+ AspeedSoCState *soc;
40
+ AST2500_HW_STRAP1_DEFAULTS | \
24
MemoryRegion boot_rom;
41
+ SCU_AST2500_HW_STRAP_SPI_AUTOFETCH_ENABLE | \
25
bool mmio_exec;
42
+ SCU_AST2500_HW_STRAP_GPIO_STRAP_ENABLE | \
26
uint32_t uart_chosen;
43
+ SCU_AST2500_HW_STRAP_UART_DEBUG | \
27
@@ -XXX,XX +XXX,XX @@ static void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size,
44
+ SCU_AST2500_HW_STRAP_DDR4_ENABLE | \
28
static void aspeed_install_boot_rom(AspeedMachineState *bmc, BlockBackend *blk,
45
+ SCU_HW_STRAP_SPI_WIDTH | \
29
uint64_t rom_size)
46
+ SCU_HW_STRAP_SPI_MODE(SCU_HW_STRAP_SPI_M_S_EN))
30
{
47
+
31
- AspeedSoCState *soc = &bmc->soc;
48
/* AST2500 evb hardware value: 0xF100C2E6 */
32
+ AspeedSoCState *soc = bmc->soc;
49
#define AST2500_EVB_HW_STRAP1 (( \
33
50
AST2500_HW_STRAP1_DEFAULTS | \
34
memory_region_init_rom(&bmc->boot_rom, NULL, "aspeed.boot_rom", rom_size,
51
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_supermicrox11_bmc_class_init(ObjectClass *oc,
35
&error_abort);
52
mc->default_ram_size = 256 * MiB;
36
@@ -XXX,XX +XXX,XX @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo)
37
static void connect_serial_hds_to_uarts(AspeedMachineState *bmc)
38
{
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)
46
int i;
47
NICInfo *nd = &nd_table[0];
48
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)
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,
108
1, amc->num_cs);
109
}
110
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_init(MachineState *machine)
111
amc->i2c_init(bmc);
112
}
113
114
- for (i = 0; i < bmc->soc.sdhci.num_slots; i++) {
115
- sdhci_attach_drive(&bmc->soc.sdhci.slots[i],
116
+ for (i = 0; i < bmc->soc->sdhci.num_slots; i++) {
117
+ sdhci_attach_drive(&bmc->soc->sdhci.slots[i],
118
drive_get(IF_SD, 0, i));
119
}
120
121
- if (bmc->soc.emmc.num_slots) {
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);
53
}
283
}
54
284
55
+static void aspeed_machine_supermicro_x11spi_bmc_class_init(ObjectClass *oc,
285
static void qcom_dc_scm_firework_i2c_init(AspeedMachineState *bmc)
56
+ void *data)
286
{
57
+{
287
- AspeedSoCState *soc = &bmc->soc;
58
+ MachineClass *mc = MACHINE_CLASS(oc);
288
+ AspeedSoCState *soc = bmc->soc;
59
+ AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
289
I2CSlave *therm_mux, *cpuvr_mux;
60
+
290
61
+ mc->desc = "Supermicro X11 SPI BMC (ARM1176)";
291
/* Create the generic DC-SCM hardware */
62
+ amc->soc_name = "ast2500-a1";
292
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_bletchley_class_init(ObjectClass *oc, void *data)
63
+ amc->hw_strap1 = SUPERMICRO_X11SPI_BMC_HW_STRAP1;
293
static void fby35_reset(MachineState *state, ShutdownCause reason)
64
+ amc->fmc_model = "mx25l25635e";
294
{
65
+ amc->spi_model = "mx25l25635e";
295
AspeedMachineState *bmc = ASPEED_MACHINE(state);
66
+ amc->num_cs = 1;
296
- AspeedGPIOState *gpio = &bmc->soc.gpio;
67
+ amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON;
297
+ AspeedGPIOState *gpio = &bmc->soc->gpio;
68
+ amc->i2c_init = palmetto_bmc_i2c_init;
298
69
+ mc->default_ram_size = 512 * MiB;
299
qemu_devices_reset(reason);
70
+ mc->default_cpus = mc->min_cpus = mc->max_cpus =
300
71
+ aspeed_soc_num_cpus(amc->soc_name);
301
@@ -XXX,XX +XXX,XX @@ static void aspeed_minibmc_machine_init(MachineState *machine)
72
+}
302
sysclk = clock_new(OBJECT(machine), "SYSCLK");
73
+
303
clock_set_hz(sysclk, SYSCLK_FRQ);
74
static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc, void *data)
304
75
{
305
- object_initialize_child(OBJECT(machine), "soc", &bmc->soc, amc->soc_name);
76
MachineClass *mc = MACHINE_CLASS(oc);
306
- qdev_connect_clock_in(DEVICE(&bmc->soc), "sysclk", sysclk);
77
@@ -XXX,XX +XXX,XX @@ static const TypeInfo aspeed_machine_types[] = {
307
+ bmc->soc = ASPEED_SOC(object_new(amc->soc_name));
78
.name = MACHINE_TYPE_NAME("supermicrox11-bmc"),
308
+ object_property_add_child(OBJECT(machine), "soc", OBJECT(bmc->soc));
79
.parent = TYPE_ASPEED_MACHINE,
309
+ object_unref(OBJECT(bmc->soc));
80
.class_init = aspeed_machine_supermicrox11_bmc_class_init,
310
+ qdev_connect_clock_in(DEVICE(bmc->soc), "sysclk", sysclk);
81
+ }, {
311
82
+ .name = MACHINE_TYPE_NAME("supermicro-x11spi-bmc"),
312
- object_property_set_link(OBJECT(&bmc->soc), "memory",
83
+ .parent = TYPE_ASPEED_MACHINE,
313
+ object_property_set_link(OBJECT(bmc->soc), "memory",
84
+ .class_init = aspeed_machine_supermicro_x11spi_bmc_class_init,
314
OBJECT(get_system_memory()), &error_abort);
85
}, {
315
connect_serial_hds_to_uarts(bmc);
86
.name = MACHINE_TYPE_NAME("ast2500-evb"),
316
- qdev_realize(DEVICE(&bmc->soc), NULL, &error_abort);
87
.parent = TYPE_ASPEED_MACHINE,
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);
88
--
344
--
89
2.39.1
345
2.41.0
90
346
91
347
diff view generated by jsdifflib
Deleted patch
1
From: Stephen Longfield <slongfield@google.com>
2
1
3
With the `size += 4` before the call to `crc32`, the CRC calculation
4
would overrun the buffer. Size is used in the while loop starting on
5
line 1009 to determine how much data to write back, with the last
6
four bytes coming from `crc_ptr`, so do need to increase it, but should
7
do this after the computation.
8
9
I'm unsure why this use of uninitialized memory in the CRC doesn't
10
result in CRC errors, but it seems clear to me that it should not be
11
included in the calculation.
12
13
Signed-off-by: Stephen Longfield <slongfield@google.com>
14
Reviewed-by: Hao Wu <wuhaotsh@google.com>
15
Reviewed-by: Joel Stanley <joel@jms.id.au>
16
Message-Id: <20221220221437.3303721-1-slongfield@google.com>
17
Signed-off-by: Cédric Le Goater <clg@kaod.org>
18
---
19
hw/net/ftgmac100.c | 4 ++--
20
1 file changed, 2 insertions(+), 2 deletions(-)
21
22
diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
23
index XXXXXXX..XXXXXXX 100644
24
--- a/hw/net/ftgmac100.c
25
+++ b/hw/net/ftgmac100.c
26
@@ -XXX,XX +XXX,XX @@ static ssize_t ftgmac100_receive(NetClientState *nc, const uint8_t *buf,
27
return size;
28
}
29
30
- /* 4 bytes for the CRC. */
31
- size += 4;
32
crc = cpu_to_be32(crc32(~0, buf, size));
33
+ /* Increase size by 4, loop below reads the last 4 bytes from crc_ptr. */
34
+ size += 4;
35
crc_ptr = (uint8_t *) &crc;
36
37
/* Huge frames are truncated. */
38
--
39
2.39.1
40
41
diff view generated by jsdifflib
Deleted patch
1
From: Joel Stanley <joel@jms.id.au>
2
1
3
Update the test_arm_ast2600_debian test to
4
5
- the latest Debian kernel
6
- use the Rainier machine instead of Tacoma
7
8
Both of which contains support for more hardware and thus exercises more
9
of the hardware Qemu models.
10
11
Signed-off-by: Joel Stanley <joel@jms.id.au>
12
Reviewed-by: Cédric Le Goater <clg@kaod.org>
13
Message-Id: <20220607011938.1676459-1-joel@jms.id.au>
14
Signed-off-by: Cédric Le Goater <clg@kaod.org>
15
---
16
tests/avocado/boot_linux_console.py | 12 ++++++------
17
1 file changed, 6 insertions(+), 6 deletions(-)
18
19
diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py
20
index XXXXXXX..XXXXXXX 100644
21
--- a/tests/avocado/boot_linux_console.py
22
+++ b/tests/avocado/boot_linux_console.py
23
@@ -XXX,XX +XXX,XX @@ def test_arm_vexpressa9(self):
24
def test_arm_ast2600_debian(self):
25
"""
26
:avocado: tags=arch:arm
27
- :avocado: tags=machine:tacoma-bmc
28
+ :avocado: tags=machine:rainier-bmc
29
"""
30
deb_url = ('http://snapshot.debian.org/archive/debian/'
31
- '20210302T203551Z/'
32
+ '20220606T211338Z/'
33
'pool/main/l/linux/'
34
- 'linux-image-5.10.0-3-armmp_5.10.13-1_armhf.deb')
35
- deb_hash = 'db40d32fe39255d05482bea48d72467b67d6225bb2a2a4d6f618cb8976f1e09e'
36
+ 'linux-image-5.17.0-2-armmp_5.17.6-1%2Bb1_armhf.deb')
37
+ deb_hash = '8acb2b4439faedc2f3ed4bdb2847ad4f6e0491f73debaeb7f660c8abe4dcdc0e'
38
deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash,
39
algorithm='sha256')
40
- kernel_path = self.extract_from_deb(deb_path, '/boot/vmlinuz-5.10.0-3-armmp')
41
+ kernel_path = self.extract_from_deb(deb_path, '/boot/vmlinuz-5.17.0-2-armmp')
42
dtb_path = self.extract_from_deb(deb_path,
43
- '/usr/lib/linux-image-5.10.0-3-armmp/aspeed-bmc-opp-tacoma.dtb')
44
+ '/usr/lib/linux-image-5.17.0-2-armmp/aspeed-bmc-ibm-rainier.dtb')
45
46
self.vm.set_console()
47
self.vm.add_args('-kernel', kernel_path,
48
--
49
2.39.1
50
51
diff view generated by jsdifflib
Deleted patch
1
From: Guenter Roeck <linux@roeck-us.net>
2
1
3
Generated from hardware using the following command and then padding
4
with 0xff to fill out a power-of-2:
5
    xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
6
7
Cc: Michael Walle <michael@walle.cc>
8
Cc: Tudor Ambarus <tudor.ambarus@linaro.org>
9
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
10
Reviewed-by: Cédric Le Goater <clg@kaod.org>
11
Reviewed-by: Joel Stanley <joel@jms.id.au>
12
Message-Id: <20221221122213.1458540-1-linux@roeck-us.net>
13
Signed-off-by: Cédric Le Goater <clg@kaod.org>
14
---
15
hw/block/m25p80_sfdp.h | 2 ++
16
hw/block/m25p80.c | 3 ++-
17
hw/block/m25p80_sfdp.c | 40 ++++++++++++++++++++++++++++++++++++++++
18
3 files changed, 44 insertions(+), 1 deletion(-)
19
20
diff --git a/hw/block/m25p80_sfdp.h b/hw/block/m25p80_sfdp.h
21
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/block/m25p80_sfdp.h
23
+++ b/hw/block/m25p80_sfdp.h
24
@@ -XXX,XX +XXX,XX @@ uint8_t m25p80_sfdp_w25q512jv(uint32_t addr);
25
26
uint8_t m25p80_sfdp_w25q01jvq(uint32_t addr);
27
28
+uint8_t m25p80_sfdp_is25wp256(uint32_t addr);
29
+
30
#endif
31
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
32
index XXXXXXX..XXXXXXX 100644
33
--- a/hw/block/m25p80.c
34
+++ b/hw/block/m25p80.c
35
@@ -XXX,XX +XXX,XX @@ static const FlashPartInfo known_devices[] = {
36
{ INFO("is25wp032", 0x9d7016, 0, 64 << 10, 64, ER_4K) },
37
{ INFO("is25wp064", 0x9d7017, 0, 64 << 10, 128, ER_4K) },
38
{ INFO("is25wp128", 0x9d7018, 0, 64 << 10, 256, ER_4K) },
39
- { INFO("is25wp256", 0x9d7019, 0, 64 << 10, 512, ER_4K) },
40
+ { INFO("is25wp256", 0x9d7019, 0, 64 << 10, 512, ER_4K),
41
+ .sfdp_read = m25p80_sfdp_is25wp256 },
42
43
/* Macronix */
44
{ INFO("mx25l2005a", 0xc22012, 0, 64 << 10, 4, ER_4K) },
45
diff --git a/hw/block/m25p80_sfdp.c b/hw/block/m25p80_sfdp.c
46
index XXXXXXX..XXXXXXX 100644
47
--- a/hw/block/m25p80_sfdp.c
48
+++ b/hw/block/m25p80_sfdp.c
49
@@ -XXX,XX +XXX,XX @@ static const uint8_t sfdp_w25q01jvq[] = {
50
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
51
};
52
define_sfdp_read(w25q01jvq);
53
+
54
+/*
55
+ * Integrated Silicon Solution (ISSI)
56
+ */
57
+
58
+static const uint8_t sfdp_is25wp256[] = {
59
+ 0x53, 0x46, 0x44, 0x50, 0x06, 0x01, 0x01, 0xff,
60
+ 0x00, 0x06, 0x01, 0x10, 0x30, 0x00, 0x00, 0xff,
61
+ 0x9d, 0x05, 0x01, 0x03, 0x80, 0x00, 0x00, 0x02,
62
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
63
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
64
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
65
+ 0xe5, 0x20, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x0f,
66
+ 0x44, 0xeb, 0x08, 0x6b, 0x08, 0x3b, 0x80, 0xbb,
67
+ 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff,
68
+ 0xff, 0xff, 0x44, 0xeb, 0x0c, 0x20, 0x0f, 0x52,
69
+ 0x10, 0xd8, 0x00, 0xff, 0x23, 0x4a, 0xc9, 0x00,
70
+ 0x82, 0xd8, 0x11, 0xce, 0xcc, 0xcd, 0x68, 0x46,
71
+ 0x7a, 0x75, 0x7a, 0x75, 0xf7, 0xae, 0xd5, 0x5c,
72
+ 0x4a, 0x42, 0x2c, 0xff, 0xf0, 0x30, 0xfa, 0xa9,
73
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
74
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
75
+ 0x50, 0x19, 0x50, 0x16, 0x9f, 0xf9, 0xc0, 0x64,
76
+ 0x8f, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
77
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
78
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
79
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
80
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
81
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
82
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
83
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
84
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
85
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
86
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
87
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
88
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
89
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
90
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
91
+};
92
+define_sfdp_read(is25wp256);
93
--
94
2.39.1
95
96
diff view generated by jsdifflib
Deleted patch
1
Use buildroot 2022.11 based images plus some customization :
2
1
3
- Linux version is bumped to 6.0.9 and kernel is built with a custom
4
config similar to what OpenBMC provides.
5
- U-Boot is switched to the one provided by OpenBMC for better support.
6
- defconfigs includes more target tools for dev.
7
8
Reviewed-by: Joel Stanley <joel@jms.id.au>
9
Message-Id: <20230119123449.531826-7-clg@kaod.org>
10
Signed-off-by: Cédric Le Goater <clg@kaod.org>
11
---
12
tests/avocado/machine_aspeed.py | 8 ++++----
13
1 file changed, 4 insertions(+), 4 deletions(-)
14
15
diff --git a/tests/avocado/machine_aspeed.py b/tests/avocado/machine_aspeed.py
16
index XXXXXXX..XXXXXXX 100644
17
--- a/tests/avocado/machine_aspeed.py
18
+++ b/tests/avocado/machine_aspeed.py
19
@@ -XXX,XX +XXX,XX @@ def test_arm_ast2500_evb_buildroot(self):
20
"""
21
22
image_url = ('https://github.com/legoater/qemu-aspeed-boot/raw/master/'
23
- 'images/ast2500-evb/buildroot-2022.05/flash.img')
24
- image_hash = ('549db6e9d8cdaf4367af21c36385a68bb465779c18b5e37094fc7343decccd3f')
25
+ 'images/ast2500-evb/buildroot-2022.11-2-g15d3648df9/flash.img')
26
+ image_hash = ('f96d11db521fe7a2787745e9e391225deeeec3318ee0fc07c8b799b8833dd474')
27
image_path = self.fetch_asset(image_url, asset_hash=image_hash,
28
algorithm='sha256')
29
30
@@ -XXX,XX +XXX,XX @@ def test_arm_ast2600_evb_buildroot(self):
31
"""
32
33
image_url = ('https://github.com/legoater/qemu-aspeed-boot/raw/master/'
34
- 'images/ast2600-evb/buildroot-2022.05/flash.img')
35
- image_hash = ('6cc9e7d128fd4fa1fd01c883af67593cae8072c3239a0b8b6ace857f3538a92d')
36
+ 'images/ast2600-evb/buildroot-2022.11-2-g15d3648df9/flash.img')
37
+ image_hash = ('e598d86e5ea79671ca8b59212a326c911bc8bea728dec1a1f5390d717a28bb8b')
38
image_path = self.fetch_asset(image_url, asset_hash=image_hash,
39
algorithm='sha256')
40
41
--
42
2.39.1
43
44
diff view generated by jsdifflib
Deleted patch
1
Reviewed-by: Joel Stanley <joel@jms.id.au>
2
Message-Id: <20230119123449.531826-8-clg@kaod.org>
3
Signed-off-by: Cédric Le Goater <clg@kaod.org>
4
---
5
tests/avocado/machine_aspeed.py | 11 +++++++++--
6
1 file changed, 9 insertions(+), 2 deletions(-)
7
1
8
diff --git a/tests/avocado/machine_aspeed.py b/tests/avocado/machine_aspeed.py
9
index XXXXXXX..XXXXXXX 100644
10
--- a/tests/avocado/machine_aspeed.py
11
+++ b/tests/avocado/machine_aspeed.py
12
@@ -XXX,XX +XXX,XX @@ def test_arm_ast2600_evb_buildroot(self):
13
14
class AST2x00MachineSDK(QemuSystemTest):
15
16
- EXTRA_BOOTARGS = ' quiet'
17
+ EXTRA_BOOTARGS = (
18
+ 'quiet '
19
+ 'systemd.mask=org.openbmc.HostIpmi.service '
20
+ 'systemd.mask=xyz.openbmc_project.Chassis.Control.Power@0.service '
21
+ 'systemd.mask=modprobe@fuse.service '
22
+ 'systemd.mask=rngd.service '
23
+ 'systemd.mask=obmc-console@ttyS2.service '
24
+ )
25
26
# FIXME: Although these tests boot a whole distro they are still
27
# slower than comparable machine models. There may be some
28
@@ -XXX,XX +XXX,XX @@ def do_test_arm_aspeed_sdk_start(self, image):
29
interrupt_interactive_console_until_pattern(
30
self, 'Hit any key to stop autoboot:', 'ast#')
31
exec_command_and_wait_for_pattern(
32
- self, 'setenv bootargs ${bootargs}' + self.EXTRA_BOOTARGS, 'ast#')
33
+ self, 'setenv bootargs ${bootargs} ' + self.EXTRA_BOOTARGS, 'ast#')
34
exec_command_and_wait_for_pattern(
35
self, 'boot', '## Loading kernel from FIT Image')
36
self.wait_for_console_pattern('Starting kernel ...')
37
--
38
2.39.1
39
40
diff view generated by jsdifflib
Deleted patch
1
These globals were moved to MachineClass by commit 71ae9e94d9 ("pc: Move
2
option_rom_has_mr/rom_file_has_mr globals to MachineClass"). Finish cleanup.
3
1
4
Cc: Eduardo Habkost <ehabkost@redhat.com>
5
Cc: Marcel Apfelbaum <marcel@redhat.com>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Reviewed-by: Joel Stanley <joel@jms.id.au>
9
Signed-off-by: Cédric Le Goater <clg@kaod.org>
10
---
11
include/hw/loader.h | 3 ---
12
1 file changed, 3 deletions(-)
13
14
diff --git a/include/hw/loader.h b/include/hw/loader.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/include/hw/loader.h
17
+++ b/include/hw/loader.h
18
@@ -XXX,XX +XXX,XX @@ void pstrcpy_targphys(const char *name,
19
hwaddr dest, int buf_size,
20
const char *source);
21
22
-extern bool option_rom_has_mr;
23
-extern bool rom_file_has_mr;
24
-
25
ssize_t rom_add_file(const char *file, const char *fw_dir,
26
hwaddr addr, int32_t bootindex,
27
bool option_rom, MemoryRegion *mr, AddressSpace *as);
28
--
29
2.39.1
30
31
diff view generated by jsdifflib
Deleted patch
1
From: Peter Delevoryas <peter@pjd.dev>
2
1
3
This helper is useful in board initialization because lets users initialize and
4
realize an EEPROM on an I2C bus with a single function call.
5
6
Signed-off-by: Peter Delevoryas <peter@pjd.dev>
7
Reviewed-by: Cédric Le Goater <clg@kaod.org>
8
Reviewed-by: Joel Stanley <joel@jms.id.au>
9
Reviewed-by: Corey Minyard <cminyard@mvista.com>
10
Link: https://lore.kernel.org/r/20230128060543.95582-2-peter@pjd.dev
11
Signed-off-by: Cédric Le Goater <clg@kaod.org>
12
---
13
include/hw/nvram/eeprom_at24c.h | 23 +++++++++++++++++++++++
14
hw/arm/aspeed.c | 10 +---------
15
hw/arm/npcm7xx_boards.c | 20 +++++---------------
16
hw/nvram/eeprom_at24c.c | 12 ++++++++++++
17
4 files changed, 41 insertions(+), 24 deletions(-)
18
create mode 100644 include/hw/nvram/eeprom_at24c.h
19
20
diff --git a/include/hw/nvram/eeprom_at24c.h b/include/hw/nvram/eeprom_at24c.h
21
new file mode 100644
22
index XXXXXXX..XXXXXXX
23
--- /dev/null
24
+++ b/include/hw/nvram/eeprom_at24c.h
25
@@ -XXX,XX +XXX,XX @@
26
+/*
27
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
28
+ *
29
+ * SPDX-License-Identifier: GPL-2.0-only
30
+ */
31
+
32
+#ifndef EEPROM_AT24C_H
33
+#define EEPROM_AT24C_H
34
+
35
+#include "hw/i2c/i2c.h"
36
+
37
+/*
38
+ * Create and realize an AT24C EEPROM device on the heap.
39
+ * @bus: I2C bus to put it on
40
+ * @address: I2C address of the EEPROM slave when put on a bus
41
+ * @rom_size: size of the EEPROM
42
+ *
43
+ * Create the device state structure, initialize it, put it on the specified
44
+ * @bus, and drop the reference to it (the device is realized).
45
+ */
46
+I2CSlave *at24c_eeprom_init(I2CBus *bus, uint8_t address, uint32_t rom_size);
47
+
48
+#endif
49
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
50
index XXXXXXX..XXXXXXX 100644
51
--- a/hw/arm/aspeed.c
52
+++ b/hw/arm/aspeed.c
53
@@ -XXX,XX +XXX,XX @@
54
#include "hw/i2c/i2c_mux_pca954x.h"
55
#include "hw/i2c/smbus_eeprom.h"
56
#include "hw/misc/pca9552.h"
57
+#include "hw/nvram/eeprom_at24c.h"
58
#include "hw/sensor/tmp105.h"
59
#include "hw/misc/led.h"
60
#include "hw/qdev-properties.h"
61
@@ -XXX,XX +XXX,XX @@ static void aspeed_machine_init(MachineState *machine)
62
arm_load_kernel(ARM_CPU(first_cpu), machine, &aspeed_board_binfo);
63
}
64
65
-static void at24c_eeprom_init(I2CBus *bus, uint8_t addr, uint32_t rsize)
66
-{
67
- I2CSlave *i2c_dev = i2c_slave_new("at24c-eeprom", addr);
68
- DeviceState *dev = DEVICE(i2c_dev);
69
-
70
- qdev_prop_set_uint32(dev, "rom-size", rsize);
71
- i2c_slave_realize_and_unref(i2c_dev, bus, &error_abort);
72
-}
73
-
74
static void palmetto_bmc_i2c_init(AspeedMachineState *bmc)
75
{
76
AspeedSoCState *soc = &bmc->soc;
77
diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c
78
index XXXXXXX..XXXXXXX 100644
79
--- a/hw/arm/npcm7xx_boards.c
80
+++ b/hw/arm/npcm7xx_boards.c
81
@@ -XXX,XX +XXX,XX @@
82
#include "hw/i2c/i2c_mux_pca954x.h"
83
#include "hw/i2c/smbus_eeprom.h"
84
#include "hw/loader.h"
85
+#include "hw/nvram/eeprom_at24c.h"
86
#include "hw/qdev-core.h"
87
#include "hw/qdev-properties.h"
88
#include "qapi/error.h"
89
@@ -XXX,XX +XXX,XX @@ static I2CBus *npcm7xx_i2c_get_bus(NPCM7xxState *soc, uint32_t num)
90
return I2C_BUS(qdev_get_child_bus(DEVICE(&soc->smbus[num]), "i2c-bus"));
91
}
92
93
-static void at24c_eeprom_init(NPCM7xxState *soc, int bus, uint8_t addr,
94
- uint32_t rsize)
95
-{
96
- I2CBus *i2c_bus = npcm7xx_i2c_get_bus(soc, bus);
97
- I2CSlave *i2c_dev = i2c_slave_new("at24c-eeprom", addr);
98
- DeviceState *dev = DEVICE(i2c_dev);
99
-
100
- qdev_prop_set_uint32(dev, "rom-size", rsize);
101
- i2c_slave_realize_and_unref(i2c_dev, i2c_bus, &error_abort);
102
-}
103
-
104
static void npcm7xx_init_pwm_splitter(NPCM7xxMachine *machine,
105
NPCM7xxState *soc, const int *fan_counts)
106
{
107
@@ -XXX,XX +XXX,XX @@ static void quanta_gsj_i2c_init(NPCM7xxState *soc)
108
i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 3), "tmp105", 0x5c);
109
i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 4), "tmp105", 0x5c);
110
111
- at24c_eeprom_init(soc, 9, 0x55, 8192);
112
- at24c_eeprom_init(soc, 10, 0x55, 8192);
113
+ at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 9), 0x55, 8192);
114
+ at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 10), 0x55, 8192);
115
116
/*
117
* i2c-11:
118
@@ -XXX,XX +XXX,XX @@ static void kudo_bmc_i2c_init(NPCM7xxState *soc)
119
120
i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 4), TYPE_PCA9548, 0x77);
121
122
- at24c_eeprom_init(soc, 4, 0x50, 8192); /* mbfru */
123
+ at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 4), 0x50, 8192); /* mbfru */
124
125
i2c_mux = i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 13),
126
TYPE_PCA9548, 0x77);
127
@@ -XXX,XX +XXX,XX @@ static void kudo_bmc_i2c_init(NPCM7xxState *soc)
128
i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 4), "tmp105", 0x48);
129
i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 5), "tmp105", 0x49);
130
131
- at24c_eeprom_init(soc, 14, 0x55, 8192); /* bmcfru */
132
+ at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 14), 0x55, 8192); /* bmcfru */
133
134
/* TODO: Add remaining i2c devices. */
135
}
136
diff --git a/hw/nvram/eeprom_at24c.c b/hw/nvram/eeprom_at24c.c
137
index XXXXXXX..XXXXXXX 100644
138
--- a/hw/nvram/eeprom_at24c.c
139
+++ b/hw/nvram/eeprom_at24c.c
140
@@ -XXX,XX +XXX,XX @@
141
#include "qapi/error.h"
142
#include "qemu/module.h"
143
#include "hw/i2c/i2c.h"
144
+#include "hw/nvram/eeprom_at24c.h"
145
#include "hw/qdev-properties.h"
146
#include "hw/qdev-properties-system.h"
147
#include "sysemu/block-backend.h"
148
@@ -XXX,XX +XXX,XX @@ int at24c_eeprom_send(I2CSlave *s, uint8_t data)
149
return 0;
150
}
151
152
+I2CSlave *at24c_eeprom_init(I2CBus *bus, uint8_t address, uint32_t rom_size)
153
+{
154
+ I2CSlave *i2c_dev = i2c_slave_new(TYPE_AT24C_EE, address);
155
+ DeviceState *dev = DEVICE(i2c_dev);
156
+
157
+ qdev_prop_set_uint32(dev, "rom-size", rom_size);
158
+ i2c_slave_realize_and_unref(i2c_dev, bus, &error_abort);
159
+
160
+ return i2c_dev;
161
+}
162
+
163
static void at24c_eeprom_realize(DeviceState *dev, Error **errp)
164
{
165
EEPROMState *ee = AT24C_EE(dev);
166
--
167
2.39.1
168
169
diff view generated by jsdifflib
Deleted patch
1
From: Peter Delevoryas <peter@pjd.dev>
2
1
3
aspeed_eeprom_init is an exact copy of at24c_eeprom_init, not needed.
4
5
Signed-off-by: Peter Delevoryas <peter@pjd.dev>
6
Reviewed-by: Cédric Le Goater <clg@kaod.org>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Reviewed-by: Joel Stanley <joel@jms.id.au>
9
Reviewed-by: Corey Minyard <cminyard@mvista.com>
10
Link: https://lore.kernel.org/r/20230128060543.95582-3-peter@pjd.dev
11
Signed-off-by: Cédric Le Goater <clg@kaod.org>
12
---
13
hw/arm/aspeed.c | 95 ++++++++++++++++++++++---------------------------
14
1 file changed, 43 insertions(+), 52 deletions(-)
15
16
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/arm/aspeed.c
19
+++ b/hw/arm/aspeed.c
20
@@ -XXX,XX +XXX,XX @@ static void g220a_bmc_i2c_init(AspeedMachineState *bmc)
21
eeprom_buf);
22
}
23
24
-static void aspeed_eeprom_init(I2CBus *bus, uint8_t addr, uint32_t rsize)
25
-{
26
- I2CSlave *i2c_dev = i2c_slave_new("at24c-eeprom", addr);
27
- DeviceState *dev = DEVICE(i2c_dev);
28
-
29
- qdev_prop_set_uint32(dev, "rom-size", rsize);
30
- i2c_slave_realize_and_unref(i2c_dev, bus, &error_abort);
31
-}
32
-
33
static void fp5280g2_bmc_i2c_init(AspeedMachineState *bmc)
34
{
35
AspeedSoCState *soc = &bmc->soc;
36
@@ -XXX,XX +XXX,XX @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
37
AspeedSoCState *soc = &bmc->soc;
38
I2CSlave *i2c_mux;
39
40
- aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 0), 0x51, 32 * KiB);
41
+ at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 0), 0x51, 32 * KiB);
42
43
create_pca9552(soc, 3, 0x61);
44
45
@@ -XXX,XX +XXX,XX @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
46
0x4a);
47
i2c_mux = i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 4),
48
"pca9546", 0x70);
49
- aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
50
- aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
51
- aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 2), 0x52, 64 * KiB);
52
+ at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
53
+ at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
54
+ at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 2), 0x52, 64 * KiB);
55
create_pca9552(soc, 4, 0x60);
56
57
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 5), TYPE_TMP105,
58
@@ -XXX,XX +XXX,XX @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
59
create_pca9552(soc, 5, 0x61);
60
i2c_mux = i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 5),
61
"pca9546", 0x70);
62
- aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
63
- aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
64
+ at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
65
+ at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
66
67
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), TYPE_TMP105,
68
0x48);
69
@@ -XXX,XX +XXX,XX @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
70
0x4b);
71
i2c_mux = i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6),
72
"pca9546", 0x70);
73
- aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
74
- aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
75
- aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 2), 0x50, 64 * KiB);
76
- aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 3), 0x51, 64 * KiB);
77
+ at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
78
+ at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
79
+ at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 2), 0x50, 64 * KiB);
80
+ at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 3), 0x51, 64 * KiB);
81
82
create_pca9552(soc, 7, 0x30);
83
create_pca9552(soc, 7, 0x31);
84
@@ -XXX,XX +XXX,XX @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
85
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 7), TYPE_TMP105,
86
0x48);
87
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 7), "max31785", 0x52);
88
- aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 7), 0x50, 64 * KiB);
89
- aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 7), 0x51, 64 * KiB);
90
+ at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 7), 0x50, 64 * KiB);
91
+ at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 7), 0x51, 64 * KiB);
92
93
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 8), TYPE_TMP105,
94
0x48);
95
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 8), TYPE_TMP105,
96
0x4a);
97
- aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 8), 0x50, 64 * KiB);
98
- aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 8), 0x51, 64 * KiB);
99
+ at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 8), 0x50, 64 * KiB);
100
+ at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 8), 0x51, 64 * KiB);
101
create_pca9552(soc, 8, 0x60);
102
create_pca9552(soc, 8, 0x61);
103
/* Bus 8: ucd90320@11 */
104
@@ -XXX,XX +XXX,XX @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
105
106
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp423", 0x4c);
107
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp423", 0x4d);
108
- aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 9), 0x50, 128 * KiB);
109
+ at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 9), 0x50, 128 * KiB);
110
111
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 10), "tmp423", 0x4c);
112
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 10), "tmp423", 0x4d);
113
- aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 10), 0x50, 128 * KiB);
114
+ at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 10), 0x50, 128 * KiB);
115
116
i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), TYPE_TMP105,
117
0x48);
118
@@ -XXX,XX +XXX,XX @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc)
119
0x49);
120
i2c_mux = i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11),
121
"pca9546", 0x70);
122
- aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
123
- aspeed_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
124
+ at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, 64 * KiB);
125
+ at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, 64 * KiB);
126
create_pca9552(soc, 11, 0x60);
127
128
129
- aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 13), 0x50, 64 * KiB);
130
+ at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 13), 0x50, 64 * KiB);
131
create_pca9552(soc, 13, 0x60);
132
133
- aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 14), 0x50, 64 * KiB);
134
+ at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 14), 0x50, 64 * KiB);
135
create_pca9552(soc, 14, 0x60);
136
137
- aspeed_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 15), 0x50, 64 * KiB);
138
+ at24c_eeprom_init(aspeed_i2c_get_bus(&soc->i2c, 15), 0x50, 64 * KiB);
139
create_pca9552(soc, 15, 0x60);
140
}
141
142
@@ -XXX,XX +XXX,XX @@ static void fuji_bmc_i2c_init(AspeedMachineState *bmc)
143
i2c_slave_create_simple(i2c[17], TYPE_LM75, 0x4c);
144
i2c_slave_create_simple(i2c[17], TYPE_LM75, 0x4d);
145
146
- aspeed_eeprom_init(i2c[19], 0x52, 64 * KiB);
147
- aspeed_eeprom_init(i2c[20], 0x50, 2 * KiB);
148
- aspeed_eeprom_init(i2c[22], 0x52, 2 * KiB);
149
+ at24c_eeprom_init(i2c[19], 0x52, 64 * KiB);
150
+ at24c_eeprom_init(i2c[20], 0x50, 2 * KiB);
151
+ at24c_eeprom_init(i2c[22], 0x52, 2 * KiB);
152
153
i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x48);
154
i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x49);
155
i2c_slave_create_simple(i2c[3], TYPE_LM75, 0x4a);
156
i2c_slave_create_simple(i2c[3], TYPE_TMP422, 0x4c);
157
158
- aspeed_eeprom_init(i2c[8], 0x51, 64 * KiB);
159
+ at24c_eeprom_init(i2c[8], 0x51, 64 * KiB);
160
i2c_slave_create_simple(i2c[8], TYPE_LM75, 0x4a);
161
162
i2c_slave_create_simple(i2c[50], TYPE_LM75, 0x4c);
163
- aspeed_eeprom_init(i2c[50], 0x52, 64 * KiB);
164
+ at24c_eeprom_init(i2c[50], 0x52, 64 * KiB);
165
i2c_slave_create_simple(i2c[51], TYPE_TMP75, 0x48);
166
i2c_slave_create_simple(i2c[52], TYPE_TMP75, 0x49);
167
168
i2c_slave_create_simple(i2c[59], TYPE_TMP75, 0x48);
169
i2c_slave_create_simple(i2c[60], TYPE_TMP75, 0x49);
170
171
- aspeed_eeprom_init(i2c[65], 0x53, 64 * KiB);
172
+ at24c_eeprom_init(i2c[65], 0x53, 64 * KiB);
173
i2c_slave_create_simple(i2c[66], TYPE_TMP75, 0x49);
174
i2c_slave_create_simple(i2c[66], TYPE_TMP75, 0x48);
175
- aspeed_eeprom_init(i2c[68], 0x52, 64 * KiB);
176
- aspeed_eeprom_init(i2c[69], 0x52, 64 * KiB);
177
- aspeed_eeprom_init(i2c[70], 0x52, 64 * KiB);
178
- aspeed_eeprom_init(i2c[71], 0x52, 64 * KiB);
179
+ at24c_eeprom_init(i2c[68], 0x52, 64 * KiB);
180
+ at24c_eeprom_init(i2c[69], 0x52, 64 * KiB);
181
+ at24c_eeprom_init(i2c[70], 0x52, 64 * KiB);
182
+ at24c_eeprom_init(i2c[71], 0x52, 64 * KiB);
183
184
- aspeed_eeprom_init(i2c[73], 0x53, 64 * KiB);
185
+ at24c_eeprom_init(i2c[73], 0x53, 64 * KiB);
186
i2c_slave_create_simple(i2c[74], TYPE_TMP75, 0x49);
187
i2c_slave_create_simple(i2c[74], TYPE_TMP75, 0x48);
188
- aspeed_eeprom_init(i2c[76], 0x52, 64 * KiB);
189
- aspeed_eeprom_init(i2c[77], 0x52, 64 * KiB);
190
- aspeed_eeprom_init(i2c[78], 0x52, 64 * KiB);
191
- aspeed_eeprom_init(i2c[79], 0x52, 64 * KiB);
192
- aspeed_eeprom_init(i2c[28], 0x50, 2 * KiB);
193
+ at24c_eeprom_init(i2c[76], 0x52, 64 * KiB);
194
+ at24c_eeprom_init(i2c[77], 0x52, 64 * KiB);
195
+ at24c_eeprom_init(i2c[78], 0x52, 64 * KiB);
196
+ at24c_eeprom_init(i2c[79], 0x52, 64 * KiB);
197
+ at24c_eeprom_init(i2c[28], 0x50, 2 * KiB);
198
199
for (int i = 0; i < 8; i++) {
200
- aspeed_eeprom_init(i2c[81 + i * 8], 0x56, 64 * KiB);
201
+ at24c_eeprom_init(i2c[81 + i * 8], 0x56, 64 * KiB);
202
i2c_slave_create_simple(i2c[82 + i * 8], TYPE_TMP75, 0x48);
203
i2c_slave_create_simple(i2c[83 + i * 8], TYPE_TMP75, 0x4b);
204
i2c_slave_create_simple(i2c[84 + i * 8], TYPE_TMP75, 0x4a);
205
@@ -XXX,XX +XXX,XX @@ static void fby35_i2c_init(AspeedMachineState *bmc)
206
i2c_slave_create_simple(i2c[12], TYPE_LM75, 0x4e);
207
i2c_slave_create_simple(i2c[12], TYPE_LM75, 0x4f);
208
209
- aspeed_eeprom_init(i2c[4], 0x51, 128 * KiB);
210
- aspeed_eeprom_init(i2c[6], 0x51, 128 * KiB);
211
- aspeed_eeprom_init(i2c[8], 0x50, 32 * KiB);
212
- aspeed_eeprom_init(i2c[11], 0x51, 128 * KiB);
213
- aspeed_eeprom_init(i2c[11], 0x54, 128 * KiB);
214
+ at24c_eeprom_init(i2c[4], 0x51, 128 * KiB);
215
+ at24c_eeprom_init(i2c[6], 0x51, 128 * KiB);
216
+ at24c_eeprom_init(i2c[8], 0x50, 32 * KiB);
217
+ at24c_eeprom_init(i2c[11], 0x51, 128 * KiB);
218
+ at24c_eeprom_init(i2c[11], 0x54, 128 * KiB);
219
220
/*
221
* TODO: There is a multi-master i2c connection to an AST1030 MiniBMC on
222
--
223
2.39.1
224
225
diff view generated by jsdifflib
Deleted patch
1
From: Peter Delevoryas <peter@pjd.dev>
2
1
3
Allows users to specify binary data to initialize an EEPROM, allowing users to
4
emulate data programmed at manufacturing time.
5
6
- Added init_rom and init_rom_size attributes to TYPE_AT24C_EE
7
- Added at24c_eeprom_init_rom helper function to initialize attributes
8
- If -drive property is provided, it overrides init_rom data
9
10
Signed-off-by: Peter Delevoryas <peter@pjd.dev>
11
Reviewed-by: Joel Stanley <joel@jms.id.au>
12
Reviewed-by: Corey Minyard <cminyard@mvista.com>
13
Reviewed-by: Cédric Le Goater <clg@kaod.org>
14
Tested-by: Ninad Palsule <ninadpalsule@us.ibm.com>
15
Link: https://lore.kernel.org/r/20230128060543.95582-4-peter@pjd.dev
16
Signed-off-by: Cédric Le Goater <clg@kaod.org>
17
---
18
include/hw/nvram/eeprom_at24c.h | 16 +++++++++++++++
19
hw/nvram/eeprom_at24c.c | 36 ++++++++++++++++++++++++++++-----
20
2 files changed, 47 insertions(+), 5 deletions(-)
21
22
diff --git a/include/hw/nvram/eeprom_at24c.h b/include/hw/nvram/eeprom_at24c.h
23
index XXXXXXX..XXXXXXX 100644
24
--- a/include/hw/nvram/eeprom_at24c.h
25
+++ b/include/hw/nvram/eeprom_at24c.h
26
@@ -XXX,XX +XXX,XX @@
27
*/
28
I2CSlave *at24c_eeprom_init(I2CBus *bus, uint8_t address, uint32_t rom_size);
29
30
+
31
+/*
32
+ * Create and realize an AT24C EEPROM device on the heap with initial data.
33
+ * @bus: I2C bus to put it on
34
+ * @address: I2C address of the EEPROM slave when put on a bus
35
+ * @rom_size: size of the EEPROM
36
+ * @init_rom: Array of bytes to initialize EEPROM memory with
37
+ * @init_rom_size: Size of @init_rom, must be less than or equal to @rom_size
38
+ *
39
+ * Create the device state structure, initialize it, put it on the specified
40
+ * @bus, and drop the reference to it (the device is realized). Copies the data
41
+ * from @init_rom to the beginning of the EEPROM memory buffer.
42
+ */
43
+I2CSlave *at24c_eeprom_init_rom(I2CBus *bus, uint8_t address, uint32_t rom_size,
44
+ const uint8_t *init_rom, uint32_t init_rom_size);
45
+
46
#endif
47
diff --git a/hw/nvram/eeprom_at24c.c b/hw/nvram/eeprom_at24c.c
48
index XXXXXXX..XXXXXXX 100644
49
--- a/hw/nvram/eeprom_at24c.c
50
+++ b/hw/nvram/eeprom_at24c.c
51
@@ -XXX,XX +XXX,XX @@ struct EEPROMState {
52
uint8_t *mem;
53
54
BlockBackend *blk;
55
+
56
+ const uint8_t *init_rom;
57
+ uint32_t init_rom_size;
58
};
59
60
static
61
@@ -XXX,XX +XXX,XX @@ int at24c_eeprom_send(I2CSlave *s, uint8_t data)
62
63
I2CSlave *at24c_eeprom_init(I2CBus *bus, uint8_t address, uint32_t rom_size)
64
{
65
- I2CSlave *i2c_dev = i2c_slave_new(TYPE_AT24C_EE, address);
66
- DeviceState *dev = DEVICE(i2c_dev);
67
+ return at24c_eeprom_init_rom(bus, address, rom_size, NULL, 0);
68
+}
69
+
70
+I2CSlave *at24c_eeprom_init_rom(I2CBus *bus, uint8_t address, uint32_t rom_size,
71
+ const uint8_t *init_rom, uint32_t init_rom_size)
72
+{
73
+ EEPROMState *s;
74
+
75
+ s = AT24C_EE(i2c_slave_new(TYPE_AT24C_EE, address));
76
+
77
+ qdev_prop_set_uint32(DEVICE(s), "rom-size", rom_size);
78
79
- qdev_prop_set_uint32(dev, "rom-size", rom_size);
80
- i2c_slave_realize_and_unref(i2c_dev, bus, &error_abort);
81
+ /* TODO: Model init_rom with QOM properties. */
82
+ s->init_rom = init_rom;
83
+ s->init_rom_size = init_rom_size;
84
85
- return i2c_dev;
86
+ i2c_slave_realize_and_unref(I2C_SLAVE(s), bus, &error_abort);
87
+
88
+ return I2C_SLAVE(s);
89
}
90
91
static void at24c_eeprom_realize(DeviceState *dev, Error **errp)
92
{
93
EEPROMState *ee = AT24C_EE(dev);
94
95
+ if (ee->init_rom_size > ee->rsize) {
96
+ error_setg(errp, "%s: init rom is larger than rom: %u > %u",
97
+ TYPE_AT24C_EE, ee->init_rom_size, ee->rsize);
98
+ return;
99
+ }
100
+
101
if (ee->blk) {
102
int64_t len = blk_getlength(ee->blk);
103
104
@@ -XXX,XX +XXX,XX @@ static void at24c_eeprom_realize(DeviceState *dev, Error **errp)
105
}
106
107
ee->mem = g_malloc0(ee->rsize);
108
+
109
}
110
111
static
112
@@ -XXX,XX +XXX,XX @@ void at24c_eeprom_reset(DeviceState *state)
113
114
memset(ee->mem, 0, ee->rsize);
115
116
+ if (ee->init_rom) {
117
+ memcpy(ee->mem, ee->init_rom, MIN(ee->init_rom_size, ee->rsize));
118
+ }
119
+
120
if (ee->blk) {
121
int ret = blk_pread(ee->blk, 0, ee->rsize, ee->mem, 0);
122
123
--
124
2.39.1
125
126
diff view generated by jsdifflib
Deleted patch
1
From: Peter Delevoryas <peter@pjd.dev>
2
1
3
EEPROM's are a form of non-volatile memory. After power-cycling an EEPROM,
4
I would expect the I2C state machine to be reset to default values, but I
5
wouldn't really expect the memory to change at all.
6
7
The current implementation of the at24c EEPROM resets its internal memory on
8
reset. This matches the specification in docs/devel/reset.rst:
9
10
Cold reset is supported by every resettable object. In QEMU, it means we reset
11
to the initial state corresponding to the start of QEMU; this might differ
12
from what is a real hardware cold reset. It differs from other resets (like
13
warm or bus resets) which may keep certain parts untouched.
14
15
But differs from my intuition. For example, if someone writes some information
16
to an EEPROM, then AC power cycles their board, they would expect the EEPROM to
17
retain that information. It's very useful to be able to test things like this
18
in QEMU as well, to verify software instrumentation like determining the cause
19
of a reboot.
20
21
Fixes: 5d8424dbd3e8 ("nvram: add AT24Cx i2c eeprom")
22
Signed-off-by: Peter Delevoryas <peter@pjd.dev>
23
Reviewed-by: Joel Stanley <joel@jms.id.au>
24
Reviewed-by: Cédric Le Goater <clg@kaod.org>
25
Reviewed-by: Corey Minyard <cminyard@mvista.com>
26
Link: https://lore.kernel.org/r/20230128060543.95582-6-peter@pjd.dev
27
Signed-off-by: Cédric Le Goater <clg@kaod.org>
28
---
29
hw/nvram/eeprom_at24c.c | 22 ++++++++++------------
30
1 file changed, 10 insertions(+), 12 deletions(-)
31
32
diff --git a/hw/nvram/eeprom_at24c.c b/hw/nvram/eeprom_at24c.c
33
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/nvram/eeprom_at24c.c
35
+++ b/hw/nvram/eeprom_at24c.c
36
@@ -XXX,XX +XXX,XX @@ static void at24c_eeprom_realize(DeviceState *dev, Error **errp)
37
}
38
39
ee->mem = g_malloc0(ee->rsize);
40
-
41
-}
42
-
43
-static
44
-void at24c_eeprom_reset(DeviceState *state)
45
-{
46
- EEPROMState *ee = AT24C_EE(state);
47
-
48
- ee->changed = false;
49
- ee->cur = 0;
50
- ee->haveaddr = 0;
51
-
52
memset(ee->mem, 0, ee->rsize);
53
54
if (ee->init_rom) {
55
@@ -XXX,XX +XXX,XX @@ void at24c_eeprom_reset(DeviceState *state)
56
}
57
}
58
59
+static
60
+void at24c_eeprom_reset(DeviceState *state)
61
+{
62
+ EEPROMState *ee = AT24C_EE(state);
63
+
64
+ ee->changed = false;
65
+ ee->cur = 0;
66
+ ee->haveaddr = 0;
67
+}
68
+
69
static Property at24c_eeprom_props[] = {
70
DEFINE_PROP_UINT32("rom-size", EEPROMState, rsize, 0),
71
DEFINE_PROP_BOOL("writable", EEPROMState, writable, true),
72
--
73
2.39.1
74
75
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
This SoC uses a Cortex-M4F. QEMU only implements a M4,
3
TYPE_ASPEED10X0_SOC inherits from TYPE_ASPEED_SOC.
4
which is good enough. Add a TODO note in case the M4F
4
In few commits we'll add more fields, but to keep
5
is added.
5
review process simple, don't add any yet.
6
6
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Reviewed-by: Peter Delevoryas <peter@pjd.dev>
9
Reviewed-by: Cédric Le Goater <clg@kaod.org>
8
Reviewed-by: Cédric Le Goater <clg@kaod.org>
10
Signed-off-by: Cédric Le Goater <clg@kaod.org>
9
Signed-off-by: Cédric Le Goater <clg@kaod.org>
11
---
10
---
12
hw/arm/aspeed_ast10x0.c | 2 +-
11
include/hw/arm/aspeed_soc.h | 7 +++++++
13
1 file changed, 1 insertion(+), 1 deletion(-)
12
hw/arm/aspeed_ast10x0.c | 26 +++++++++++++-------------
13
2 files changed, 20 insertions(+), 13 deletions(-)
14
14
15
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
16
index XXXXXXX..XXXXXXX 100644
17
--- a/include/hw/arm/aspeed_soc.h
18
+++ b/include/hw/arm/aspeed_soc.h
19
@@ -XXX,XX +XXX,XX @@ struct AspeedSoCState {
20
#define TYPE_ASPEED_SOC "aspeed-soc"
21
OBJECT_DECLARE_TYPE(AspeedSoCState, AspeedSoCClass, ASPEED_SOC)
22
23
+struct Aspeed10x0SoCState {
24
+ AspeedSoCState parent;
25
+};
26
+
27
+#define TYPE_ASPEED10X0_SOC "aspeed10x0-soc"
28
+OBJECT_DECLARE_SIMPLE_TYPE(Aspeed10x0SoCState, ASPEED10X0_SOC)
29
+
30
struct AspeedSoCClass {
31
DeviceClass parent_class;
32
15
diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c
33
diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c
16
index XXXXXXX..XXXXXXX 100644
34
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/aspeed_ast10x0.c
35
--- a/hw/arm/aspeed_ast10x0.c
18
+++ b/hw/arm/aspeed_ast10x0.c
36
+++ b/hw/arm/aspeed_ast10x0.c
19
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_class_init(ObjectClass *klass, void *data)
37
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_class_init(ObjectClass *klass, void *data)
20
dc->realize = aspeed_soc_ast1030_realize;
38
sc->get_irq = aspeed_soc_ast1030_get_irq;
21
39
}
22
sc->name = "ast1030-a1";
40
23
- sc->cpu_type = ARM_CPU_TYPE_NAME("cortex-m4");
41
-static const TypeInfo aspeed_soc_ast1030_type_info = {
24
+ sc->cpu_type = ARM_CPU_TYPE_NAME("cortex-m4"); /* TODO cortex-m4f */
42
- .name = "ast1030-a1",
25
sc->silicon_rev = AST1030_A1_SILICON_REV;
43
- .parent = TYPE_ASPEED_SOC,
26
sc->sram_size = 0xc0000;
44
- .instance_size = sizeof(AspeedSoCState),
27
sc->secsram_size = 0x40000; /* 256 * KiB */
45
- .instance_init = aspeed_soc_ast1030_init,
46
- .class_init = aspeed_soc_ast1030_class_init,
47
- .class_size = sizeof(AspeedSoCClass),
48
+static const TypeInfo aspeed_soc_ast10x0_types[] = {
49
+ {
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)
28
--
69
--
29
2.39.1
70
2.41.0
30
71
31
72
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
address_space_map() can fail:
3
TYPE_ASPEED2600_SOC inherits from TYPE_ASPEED_SOC.
4
4
In few commits we'll add more fields, but to keep
5
uart:~$ hash test
5
review process simple, don't add any yet.
6
sha256_test
7
tv[0]:
8
Segmentation fault: 11
9
Thread 3 "qemu-system-arm" received signal SIGSEGV, Segmentation fault.
10
gen_acc_mode_iov (req_len=0x7ffff18b7778, id=<optimized out>, iov=0x7ffff18b7780, s=0x555556ce0bd0)
11
at ../hw/misc/aspeed_hace.c:171
12
171 if (has_padding(s, &iov[id], *req_len, &total_msg_len, &pad_offset)) {
13
(gdb) bt
14
#0 gen_acc_mode_iov (req_len=0x7ffff18b7778, id=<optimized out>, iov=0x7ffff18b7780, s=0x555556ce0bd0)
15
at ../hw/misc/aspeed_hace.c:171
16
#1 do_hash_operation (s=s@entry=0x555556ce0bd0, algo=3, sg_mode=sg_mode@entry=true, acc_mode=acc_mode@entry=true)
17
at ../hw/misc/aspeed_hace.c:224
18
#2 0x00005555559bdbb8 in aspeed_hace_write (opaque=<optimized out>, addr=12, data=262488, size=<optimized out>)
19
at ../hw/misc/aspeed_hace.c:358
20
21
This change doesn't fix much, but at least the guest
22
can't crash QEMU anymore. Instead it is still usable:
23
24
uart:~$ hash test
25
sha256_test
26
tv[0]:hash_final error
27
sha384_test
28
tv[0]:hash_final error
29
sha512_test
30
tv[0]:hash_final error
31
[00:00:06.278,000] <err> hace_global: HACE poll timeout
32
[00:00:09.324,000] <err> hace_global: HACE poll timeout
33
[00:00:12.261,000] <err> hace_global: HACE poll timeout
34
uart:~$
35
6
36
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
37
Reviewed-by: Peter Delevoryas <peter@pjd.dev>
38
Reviewed-by: Cédric Le Goater <clg@kaod.org>
8
Reviewed-by: Cédric Le Goater <clg@kaod.org>
39
Signed-off-by: Cédric Le Goater <clg@kaod.org>
9
Signed-off-by: Cédric Le Goater <clg@kaod.org>
40
---
10
---
41
hw/misc/aspeed_hace.c | 21 +++++++++++++++------
11
include/hw/arm/aspeed_soc.h | 7 +++++++
42
1 file changed, 15 insertions(+), 6 deletions(-)
12
hw/arm/aspeed_ast2600.c | 26 +++++++++++++-------------
13
2 files changed, 20 insertions(+), 13 deletions(-)
43
14
44
diff --git a/hw/misc/aspeed_hace.c b/hw/misc/aspeed_hace.c
15
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
45
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
46
--- a/hw/misc/aspeed_hace.c
17
--- a/include/hw/arm/aspeed_soc.h
47
+++ b/hw/misc/aspeed_hace.c
18
+++ b/include/hw/arm/aspeed_soc.h
48
@@ -XXX,XX +XXX,XX @@ static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode,
19
@@ -XXX,XX +XXX,XX @@ struct AspeedSoCState {
49
size_t digest_len = 0;
20
#define TYPE_ASPEED_SOC "aspeed-soc"
50
int niov = 0;
21
OBJECT_DECLARE_TYPE(AspeedSoCState, AspeedSoCClass, ASPEED_SOC)
51
int i;
22
52
+ void *haddr;
23
+struct Aspeed2600SoCState {
53
24
+ AspeedSoCState parent;
54
if (sg_mode) {
25
+};
55
uint32_t len = 0;
26
+
56
@@ -XXX,XX +XXX,XX @@ static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode,
27
+#define TYPE_ASPEED2600_SOC "aspeed2600-soc"
57
addr &= SG_LIST_ADDR_MASK;
28
+OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2600SoCState, ASPEED2600_SOC)
58
29
+
59
plen = len & SG_LIST_LEN_MASK;
30
struct Aspeed10x0SoCState {
60
- iov[i].iov_base = address_space_map(&s->dram_as, addr, &plen, false,
31
AspeedSoCState parent;
61
- MEMTXATTRS_UNSPECIFIED);
32
};
33
diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
34
index XXXXXXX..XXXXXXX 100644
35
--- a/hw/arm/aspeed_ast2600.c
36
+++ b/hw/arm/aspeed_ast2600.c
37
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_class_init(ObjectClass *oc, void *data)
38
sc->get_irq = aspeed_soc_ast2600_get_irq;
39
}
40
41
-static const TypeInfo aspeed_soc_ast2600_type_info = {
42
- .name = "ast2600-a3",
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
-};
62
-
66
-
63
+ haddr = address_space_map(&s->dram_as, addr, &plen, false,
67
-type_init(aspeed_soc_register_types)
64
+ MEMTXATTRS_UNSPECIFIED);
68
+DEFINE_TYPES(aspeed_soc_ast2600_types)
65
+ if (haddr == NULL) {
66
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: qcrypto failed\n", __func__);
67
+ return;
68
+ }
69
+ iov[i].iov_base = haddr;
70
if (acc_mode) {
71
niov = gen_acc_mode_iov(s, iov, i, &plen);
72
73
@@ -XXX,XX +XXX,XX @@ static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode,
74
} else {
75
hwaddr len = s->regs[R_HASH_SRC_LEN];
76
77
+ haddr = address_space_map(&s->dram_as, s->regs[R_HASH_SRC],
78
+ &len, false, MEMTXATTRS_UNSPECIFIED);
79
+ if (haddr == NULL) {
80
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: qcrypto failed\n", __func__);
81
+ return;
82
+ }
83
+ iov[0].iov_base = haddr;
84
iov[0].iov_len = len;
85
- iov[0].iov_base = address_space_map(&s->dram_as, s->regs[R_HASH_SRC],
86
- &len, false,
87
- MEMTXATTRS_UNSPECIFIED);
88
i = 1;
89
90
if (s->iov_count) {
91
--
69
--
92
2.39.1
70
2.41.0
93
71
94
72
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Some SRAM appears to be used by the Secure Boot unit and
3
TYPE_ASPEED2400_SOC inherits from TYPE_ASPEED_SOC.
4
crypto accelerators. Name it 'secure sram'.
4
In few commits we'll add more fields, but to keep
5
review process simple, don't add any yet.
5
6
6
Note, the SRAM base address was already present but unused
7
TYPE_ASPEED_SOC is common to various Aspeed SoCs,
7
(the 'SBC' index is used for the MMIO peripheral).
8
define it in aspeed_soc_common.c.
8
9
Interestingly using CFLAGS=-Winitializer-overrides reports:
10
11
../hw/arm/aspeed_ast10x0.c:32:30: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
12
[ASPEED_DEV_SBC] = 0x7E6F2000,
13
^~~~~~~~~~
14
../hw/arm/aspeed_ast10x0.c:24:30: note: previous initialization is here
15
[ASPEED_DEV_SBC] = 0x79000000,
16
^~~~~~~~~~
17
This fixes with Zephyr:
18
19
uart:~$ rsa test
20
rsa test vector[0]:
21
[00:00:26.156,000] <err> os: ***** BUS FAULT *****
22
[00:00:26.157,000] <err> os: Precise data bus error
23
[00:00:26.157,000] <err> os: BFAR Address: 0x79000000
24
[00:00:26.158,000] <err> os: r0/a1: 0x79000000 r1/a2: 0x00000000 r2/a3: 0x00001800
25
[00:00:26.158,000] <err> os: r3/a4: 0x79001800 r12/ip: 0x00000800 r14/lr: 0x0001098d
26
[00:00:26.158,000] <err> os: xpsr: 0x81000000
27
[00:00:26.158,000] <err> os: Faulting instruction address (r15/pc): 0x0001e1bc
28
[00:00:26.158,000] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
29
[00:00:26.158,000] <err> os: Current thread: 0x38248 (shell_uart)
30
[00:00:26.165,000] <err> os: Halting system
31
9
32
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
33
Reviewed-by: Peter Delevoryas <peter@pjd.dev>
11
Reviewed-by: Cédric Le Goater <clg@kaod.org>
34
[ clg: Fixed size of Secure Boot Controller Memory ]
35
Signed-off-by: Cédric Le Goater <clg@kaod.org>
12
Signed-off-by: Cédric Le Goater <clg@kaod.org>
36
---
13
---
37
include/hw/arm/aspeed_soc.h | 3 +++
14
include/hw/arm/aspeed_soc.h | 7 +++++
38
hw/arm/aspeed_ast10x0.c | 11 ++++++++++-
15
hw/arm/aspeed_soc.c | 61 +++++++++++--------------------------
39
2 files changed, 13 insertions(+), 1 deletion(-)
16
hw/arm/aspeed_soc_common.c | 29 ++++++++++++++++++
17
3 files changed, 53 insertions(+), 44 deletions(-)
40
18
41
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
42
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
43
--- a/include/hw/arm/aspeed_soc.h
21
--- a/include/hw/arm/aspeed_soc.h
44
+++ b/include/hw/arm/aspeed_soc.h
22
+++ b/include/hw/arm/aspeed_soc.h
45
@@ -XXX,XX +XXX,XX @@ struct AspeedSoCState {
23
@@ -XXX,XX +XXX,XX @@ struct AspeedSoCState {
46
AspeedSMCState spi[ASPEED_SPIS_NUM];
24
#define TYPE_ASPEED_SOC "aspeed-soc"
47
EHCISysBusState ehci[ASPEED_EHCIS_NUM];
25
OBJECT_DECLARE_TYPE(AspeedSoCState, AspeedSoCClass, ASPEED_SOC)
48
AspeedSBCState sbc;
26
49
+ MemoryRegion secsram;
27
+struct Aspeed2400SoCState {
50
UnimplementedDeviceState sbc_unimplemented;
28
+ AspeedSoCState parent;
51
AspeedSDMCState sdmc;
29
+};
52
AspeedWDTState wdt[ASPEED_WDTS_NUM];
30
+
53
@@ -XXX,XX +XXX,XX @@ struct AspeedSoCClass {
31
+#define TYPE_ASPEED2400_SOC "aspeed2400-soc"
54
const char *cpu_type;
32
+OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2400SoCState, ASPEED2400_SOC)
55
uint32_t silicon_rev;
33
+
56
uint64_t sram_size;
34
struct Aspeed2600SoCState {
57
+ uint64_t secsram_size;
35
AspeedSoCState parent;
58
int spis_num;
36
};
59
int ehcis_num;
37
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
60
int wdts_num;
61
@@ -XXX,XX +XXX,XX @@ enum {
62
ASPEED_DEV_SCU,
63
ASPEED_DEV_ADC,
64
ASPEED_DEV_SBC,
65
+ ASPEED_DEV_SECSRAM,
66
ASPEED_DEV_EMMC_BC,
67
ASPEED_DEV_VIDEO,
68
ASPEED_DEV_SRAM,
69
diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c
70
index XXXXXXX..XXXXXXX 100644
38
index XXXXXXX..XXXXXXX 100644
71
--- a/hw/arm/aspeed_ast10x0.c
39
--- a/hw/arm/aspeed_soc.c
72
+++ b/hw/arm/aspeed_ast10x0.c
40
+++ b/hw/arm/aspeed_soc.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
73
@@ -XXX,XX +XXX,XX @@
126
@@ -XXX,XX +XXX,XX @@
74
127
75
static const hwaddr aspeed_soc_ast1030_memmap[] = {
128
#include "qemu/osdep.h"
76
[ASPEED_DEV_SRAM] = 0x00000000,
129
#include "qapi/error.h"
77
- [ASPEED_DEV_SBC] = 0x79000000,
130
+#include "hw/qdev-properties.h"
78
+ [ASPEED_DEV_SECSRAM] = 0x79000000,
131
#include "hw/misc/unimp.h"
79
[ASPEED_DEV_IOMEM] = 0x7E600000,
132
#include "hw/arm/aspeed_soc.h"
80
[ASPEED_DEV_PWM] = 0x7E610000,
133
#include "hw/char/serial.h"
81
[ASPEED_DEV_FMC] = 0x7E620000,
134
@@ -XXX,XX +XXX,XX @@ void aspeed_mmio_map_unimplemented(AspeedSoCState *s, SysBusDevice *dev,
82
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
135
memory_region_add_subregion_overlap(s->memory, addr,
83
memory_region_add_subregion(s->memory,
136
sysbus_mmio_get_region(dev, 0), -1000);
84
sc->memmap[ASPEED_DEV_SRAM],
137
}
85
&s->sram);
138
+
86
+ memory_region_init_ram(&s->secsram, OBJECT(s), "sec.sram",
139
+static Property aspeed_soc_properties[] = {
87
+ sc->secsram_size, &err);
140
+ DEFINE_PROP_LINK("dram", AspeedSoCState, dram_mr, TYPE_MEMORY_REGION,
88
+ if (err != NULL) {
141
+ MemoryRegion *),
89
+ error_propagate(errp, err);
142
+ DEFINE_PROP_LINK("memory", AspeedSoCState, memory, TYPE_MEMORY_REGION,
90
+ return;
143
+ MemoryRegion *),
91
+ }
144
+ DEFINE_PROP_END_OF_LIST(),
92
+ memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_SECSRAM],
145
+};
93
+ &s->secsram);
146
+
94
147
+static void aspeed_soc_class_init(ObjectClass *oc, void *data)
95
/* SCU */
148
+{
96
if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) {
149
+ DeviceClass *dc = DEVICE_CLASS(oc);
97
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_class_init(ObjectClass *klass, void *data)
150
+
98
sc->cpu_type = ARM_CPU_TYPE_NAME("cortex-m4");
151
+ device_class_set_props(dc, aspeed_soc_properties);
99
sc->silicon_rev = AST1030_A1_SILICON_REV;
152
+}
100
sc->sram_size = 0xc0000;
153
+
101
+ sc->secsram_size = 0x40000; /* 256 * KiB */
154
+static const TypeInfo aspeed_soc_types[] = {
102
sc->spis_num = 2;
155
+ {
103
sc->ehcis_num = 0;
156
+ .name = TYPE_ASPEED_SOC,
104
sc->wdts_num = 4;
157
+ .parent = TYPE_DEVICE,
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)
105
--
166
--
106
2.39.1
167
2.41.0
107
168
108
169
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
When booting the Zephyr demo in [1] we get:
4
5
aspeed.io: unimplemented device write (size 4, offset 0x185128, value 0x030f1ff1) <--
6
aspeed.io: unimplemented device write (size 4, offset 0x18512c, value 0x03fffff1)
7
8
This corresponds to this Zephyr code [2]:
9
10
static int aspeed_wdt_init(const struct device *dev)
11
{
12
const struct aspeed_wdt_config *config = dev->config;
13
struct aspeed_wdt_data *const data = dev->data;
14
uint32_t reg_val;
15
16
/* disable WDT by default */
17
reg_val = sys_read32(config->ctrl_base + WDT_CTRL_REG);
18
reg_val &= ~WDT_CTRL_ENABLE;
19
sys_write32(reg_val, config->ctrl_base + WDT_CTRL_REG);
20
21
sys_write32(data->rst_mask1,
22
config->ctrl_base + WDT_SW_RESET_MASK1_REG); <------
23
sys_write32(data->rst_mask2,
24
config->ctrl_base + WDT_SW_RESET_MASK2_REG);
25
26
return 0;
27
}
28
29
The register definitions are [3]:
30
31
#define WDT_RELOAD_VAL_REG 0x0004
32
#define WDT_RESTART_REG 0x0008
33
#define WDT_CTRL_REG 0x000C
34
#define WDT_TIMEOUT_STATUS_REG 0x0010
35
#define WDT_TIMEOUT_STATUS_CLR_REG 0x0014
36
#define WDT_RESET_MASK1_REG 0x001C
37
#define WDT_RESET_MASK2_REG 0x0020
38
#define WDT_SW_RESET_MASK1_REG 0x0028 <------
39
#define WDT_SW_RESET_MASK2_REG 0x002C
40
#define WDT_SW_RESET_CTRL_REG 0x0024
41
42
Currently QEMU only cover a MMIO region of size 0x20:
43
44
#define ASPEED_WDT_REGS_MAX (0x20 / 4)
45
46
Change to map the whole 'iosize' which might be bigger, covering
47
the other registers. The MemoryRegionOps read/write handlers will
48
report the accesses as out-of-bounds guest-errors, but the next
49
commit will report them as unimplemented.
50
51
[1] https://github.com/AspeedTech-BMC/zephyr/releases/tag/v00.01.07
52
[2] https://github.com/AspeedTech-BMC/zephyr/commit/2e99f10ac27b
53
[3] https://github.com/AspeedTech-BMC/zephyr/blob/v00.01.08/drivers/watchdog/wdt_aspeed.c#L31
54
55
Reviewed-by: Peter Delevoryas <peter@pjd.dev>
56
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
Reviewed-by: Cédric Le Goater <clg@kaod.org>
57
Signed-off-by: Cédric Le Goater <clg@kaod.org>
5
Signed-off-by: Cédric Le Goater <clg@kaod.org>
58
---
6
---
59
hw/watchdog/wdt_aspeed.c | 3 ++-
7
hw/arm/aspeed_soc_common.c | 11 +++++++++++
60
1 file changed, 2 insertions(+), 1 deletion(-)
8
1 file changed, 11 insertions(+)
61
9
62
diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c
10
diff --git a/hw/arm/aspeed_soc_common.c b/hw/arm/aspeed_soc_common.c
63
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
64
--- a/hw/watchdog/wdt_aspeed.c
12
--- a/hw/arm/aspeed_soc_common.c
65
+++ b/hw/watchdog/wdt_aspeed.c
13
+++ b/hw/arm/aspeed_soc_common.c
66
@@ -XXX,XX +XXX,XX @@ static void aspeed_wdt_realize(DeviceState *dev, Error **errp)
14
@@ -XXX,XX +XXX,XX @@ void aspeed_mmio_map_unimplemented(AspeedSoCState *s, SysBusDevice *dev,
15
sysbus_mmio_get_region(dev, 0), -1000);
16
}
17
18
+static void aspeed_soc_realize(DeviceState *dev, Error **errp)
19
+{
20
+ AspeedSoCState *s = ASPEED_SOC(dev);
21
+
22
+ if (!s->memory) {
23
+ error_setg(errp, "'memory' link is not set");
24
+ return;
25
+ }
26
+}
27
+
28
static Property aspeed_soc_properties[] = {
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)
67
{
32
{
68
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
33
DeviceClass *dc = DEVICE_CLASS(oc);
69
AspeedWDTState *s = ASPEED_WDT(dev);
34
70
+ AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(dev);
35
+ dc->realize = aspeed_soc_realize;
71
36
device_class_set_props(dc, aspeed_soc_properties);
72
assert(s->scu);
73
74
@@ -XXX,XX +XXX,XX @@ static void aspeed_wdt_realize(DeviceState *dev, Error **errp)
75
s->pclk_freq = PCLK_HZ;
76
77
memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_wdt_ops, s,
78
- TYPE_ASPEED_WDT, ASPEED_WDT_REGS_MAX * 4);
79
+ TYPE_ASPEED_WDT, awc->iosize);
80
sysbus_init_mmio(sbd, &s->iomem);
81
}
37
}
82
38
83
--
39
--
84
2.39.1
40
2.41.0
85
41
86
42
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Based on booting Zephyr demo from [1] running QEMU with
3
The v7-M core is specific to the Aspeed 10x0 series,
4
'-d unimp' and checking missing devices in [2].
4
remove it from the common AspeedSoCState.
5
6
[1] https://github.com/AspeedTech-BMC/zephyr/releases/tag/v00.01.07
7
[2] https://github.com/AspeedTech-BMC/zephyr/blob/v00.01.08/dts/arm/aspeed/ast10x0.dtsi
8
5
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Reviewed-by: Peter Delevoryas <peter@pjd.dev>
11
Reviewed-by: Cédric Le Goater <clg@kaod.org>
7
Reviewed-by: Cédric Le Goater <clg@kaod.org>
12
Reviewed-by: Joel Stanley <joel@jms.id.au>
13
Signed-off-by: Cédric Le Goater <clg@kaod.org>
8
Signed-off-by: Cédric Le Goater <clg@kaod.org>
14
---
9
---
15
include/hw/arm/aspeed_soc.h | 11 +++++++++++
10
include/hw/arm/aspeed_soc.h | 5 ++---
16
hw/arm/aspeed_ast10x0.c | 35 +++++++++++++++++++++++++++++++++++
11
hw/arm/aspeed_ast10x0.c | 27 +++++++++++++++------------
17
2 files changed, 46 insertions(+)
12
hw/arm/fby35.c | 13 ++++++++-----
13
3 files changed, 25 insertions(+), 20 deletions(-)
18
14
19
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
15
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
20
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
21
--- a/include/hw/arm/aspeed_soc.h
17
--- a/include/hw/arm/aspeed_soc.h
22
+++ b/include/hw/arm/aspeed_soc.h
18
+++ b/include/hw/arm/aspeed_soc.h
23
@@ -XXX,XX +XXX,XX @@
19
@@ -XXX,XX +XXX,XX @@
24
#define ASPEED_CPUS_NUM 2
20
#define ASPEED_JTAG_NUM 2
25
#define ASPEED_MACS_NUM 4
26
#define ASPEED_UARTS_NUM 13
27
+#define ASPEED_JTAG_NUM 2
28
21
29
struct AspeedSoCState {
22
struct AspeedSoCState {
30
/*< private >*/
23
- /*< private >*/
31
@@ -XXX,XX +XXX,XX @@ struct AspeedSoCState {
24
DeviceState parent;
32
UnimplementedDeviceState video;
25
33
UnimplementedDeviceState emmc_boot_controller;
26
- /*< public >*/
34
UnimplementedDeviceState dpmcu;
27
ARMCPU cpu[ASPEED_CPUS_NUM];
35
+ UnimplementedDeviceState pwm;
28
A15MPPrivState a7mpcore;
36
+ UnimplementedDeviceState espi;
29
- ARMv7MState armv7m;
37
+ UnimplementedDeviceState udc;
30
MemoryRegion *memory;
38
+ UnimplementedDeviceState sgpiom;
31
MemoryRegion *dram_mr;
39
+ UnimplementedDeviceState jtag[ASPEED_JTAG_NUM];
32
MemoryRegion dram_container;
33
@@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2600SoCState, ASPEED2600_SOC)
34
35
struct Aspeed10x0SoCState {
36
AspeedSoCState parent;
37
+
38
+ ARMv7MState armv7m;
40
};
39
};
41
40
42
#define TYPE_ASPEED_SOC "aspeed-soc"
41
#define TYPE_ASPEED10X0_SOC "aspeed10x0-soc"
43
@@ -XXX,XX +XXX,XX @@ enum {
44
ASPEED_DEV_DPMCU,
45
ASPEED_DEV_DP,
46
ASPEED_DEV_I3C,
47
+ ASPEED_DEV_ESPI,
48
+ ASPEED_DEV_UDC,
49
+ ASPEED_DEV_SGPIOM,
50
+ ASPEED_DEV_JTAG0,
51
+ ASPEED_DEV_JTAG1,
52
};
53
54
qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev);
55
diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c
42
diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c
56
index XXXXXXX..XXXXXXX 100644
43
index XXXXXXX..XXXXXXX 100644
57
--- a/hw/arm/aspeed_ast10x0.c
44
--- a/hw/arm/aspeed_ast10x0.c
58
+++ b/hw/arm/aspeed_ast10x0.c
45
+++ b/hw/arm/aspeed_ast10x0.c
59
@@ -XXX,XX +XXX,XX @@ static const hwaddr aspeed_soc_ast1030_memmap[] = {
60
[ASPEED_DEV_FMC] = 0x7E620000,
61
[ASPEED_DEV_SPI1] = 0x7E630000,
62
[ASPEED_DEV_SPI2] = 0x7E640000,
63
+ [ASPEED_DEV_UDC] = 0x7E6A2000,
64
[ASPEED_DEV_SCU] = 0x7E6E2000,
65
+ [ASPEED_DEV_JTAG0] = 0x7E6E4000,
66
+ [ASPEED_DEV_JTAG1] = 0x7E6E4100,
67
[ASPEED_DEV_ADC] = 0x7E6E9000,
68
+ [ASPEED_DEV_ESPI] = 0x7E6EE000,
69
[ASPEED_DEV_SBC] = 0x7E6F2000,
70
[ASPEED_DEV_GPIO] = 0x7E780000,
71
+ [ASPEED_DEV_SGPIOM] = 0x7E780500,
72
[ASPEED_DEV_TIMER1] = 0x7E782000,
73
[ASPEED_DEV_UART1] = 0x7E783000,
74
[ASPEED_DEV_UART2] = 0x7E78D000,
75
@@ -XXX,XX +XXX,XX @@ static const int aspeed_soc_ast1030_irqmap[] = {
46
@@ -XXX,XX +XXX,XX @@ static const int aspeed_soc_ast1030_irqmap[] = {
76
[ASPEED_DEV_LPC] = 35,
47
77
[ASPEED_DEV_PECI] = 38,
48
static qemu_irq aspeed_soc_ast1030_get_irq(AspeedSoCState *s, int dev)
78
[ASPEED_DEV_FMC] = 39,
49
{
79
+ [ASPEED_DEV_ESPI] = 42,
50
+ Aspeed10x0SoCState *a = ASPEED10X0_SOC(s);
80
[ASPEED_DEV_PWM] = 44,
51
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
81
[ASPEED_DEV_ADC] = 46,
52
82
[ASPEED_DEV_SPI1] = 65,
53
- return qdev_get_gpio_in(DEVICE(&s->armv7m), sc->irqmap[dev]);
83
[ASPEED_DEV_SPI2] = 66,
54
+ return qdev_get_gpio_in(DEVICE(&a->armv7m), sc->irqmap[dev]);
84
[ASPEED_DEV_I2C] = 110, /* 110 ~ 123 */
55
}
85
[ASPEED_DEV_KCS] = 138, /* 138 -> 142 */
56
86
+ [ASPEED_DEV_UDC] = 9,
57
static void aspeed_soc_ast1030_init(Object *obj)
87
+ [ASPEED_DEV_SGPIOM] = 51,
58
{
88
+ [ASPEED_DEV_JTAG0] = 27,
59
+ Aspeed10x0SoCState *a = ASPEED10X0_SOC(obj);
89
+ [ASPEED_DEV_JTAG1] = 53,
60
AspeedSoCState *s = ASPEED_SOC(obj);
61
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
62
char socname[8];
63
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_init(Object *obj)
64
g_assert_not_reached();
65
}
66
67
- object_initialize_child(obj, "armv7m", &s->armv7m, TYPE_ARMV7M);
68
+ object_initialize_child(obj, "armv7m", &a->armv7m, TYPE_ARMV7M);
69
70
s->sysclk = qdev_init_clock_in(DEVICE(s), "sysclk", NULL, NULL, 0);
71
72
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_init(Object *obj)
73
74
static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
75
{
76
+ Aspeed10x0SoCState *a = ASPEED10X0_SOC(dev_soc);
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;
90
};
156
};
91
157
@@ -XXX,XX +XXX,XX @@ static void fby35_bmc_init(Fby35State *s)
92
static qemu_irq aspeed_soc_ast1030_get_irq(AspeedSoCState *s, int dev)
158
93
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_init(Object *obj)
159
static void fby35_bic_init(Fby35State *s)
94
object_initialize_child(obj, "iomem", &s->iomem, TYPE_UNIMPLEMENTED_DEVICE);
160
{
95
object_initialize_child(obj, "sbc-unimplemented", &s->sbc_unimplemented,
161
+ AspeedSoCState *soc;
96
TYPE_UNIMPLEMENTED_DEVICE);
162
+
97
+ object_initialize_child(obj, "pwm", &s->pwm, TYPE_UNIMPLEMENTED_DEVICE);
163
s->bic_sysclk = clock_new(OBJECT(s), "SYSCLK");
98
+ object_initialize_child(obj, "espi", &s->espi, TYPE_UNIMPLEMENTED_DEVICE);
164
clock_set_hz(s->bic_sysclk, 200000000ULL);
99
+ object_initialize_child(obj, "udc", &s->udc, TYPE_UNIMPLEMENTED_DEVICE);
165
100
+ object_initialize_child(obj, "sgpiom", &s->sgpiom,
166
object_initialize_child(OBJECT(s), "bic", &s->bic, "ast1030-a1");
101
+ TYPE_UNIMPLEMENTED_DEVICE);
167
+ soc = ASPEED_SOC(&s->bic);
102
+ object_initialize_child(obj, "jtag[0]", &s->jtag[0],
168
103
+ TYPE_UNIMPLEMENTED_DEVICE);
169
memory_region_init(&s->bic_memory, OBJECT(&s->bic), "bic-memory",
104
+ object_initialize_child(obj, "jtag[1]", &s->jtag[1],
170
UINT64_MAX);
105
+ TYPE_UNIMPLEMENTED_DEVICE);
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);
106
}
185
}
107
186
108
static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
187
static void fby35_init(MachineState *machine)
109
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
110
sc->memmap[ASPEED_DEV_GPIO]);
111
sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio), 0,
112
aspeed_soc_get_irq(s, ASPEED_DEV_GPIO));
113
+
114
+ aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->pwm), "aspeed.pwm",
115
+ sc->memmap[ASPEED_DEV_PWM], 0x100);
116
+
117
+ aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->espi), "aspeed.espi",
118
+ sc->memmap[ASPEED_DEV_ESPI], 0x800);
119
+
120
+ aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->udc), "aspeed.udc",
121
+ sc->memmap[ASPEED_DEV_UDC], 0x1000);
122
+ aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->sgpiom), "aspeed.sgpiom",
123
+ sc->memmap[ASPEED_DEV_SGPIOM], 0x100);
124
+
125
+ aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->jtag[0]), "aspeed.jtag",
126
+ sc->memmap[ASPEED_DEV_JTAG0], 0x20);
127
+ aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->jtag[1]), "aspeed.jtag",
128
+ sc->memmap[ASPEED_DEV_JTAG1], 0x20);
129
}
130
131
static void aspeed_soc_ast1030_class_init(ObjectClass *klass, void *data)
132
--
188
--
133
2.39.1
189
2.41.0
134
190
135
191
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Avoid confusing two different things:
3
The v7-A cluster is specific to the Aspeed 2600 series,
4
- the WDT I/O region size ('iosize')
4
remove it from the common AspeedSoCState.
5
- at which offset the SoC map the WDT ('offset')
5
6
While it is often the same, we can map smaller region sizes
6
The ARM cores belong to the MP cluster, but the array
7
at larger offsets.
7
is currently used by TYPE_ASPEED2600_SOC. We'll clean
8
8
that soon, but for now keep it in Aspeed2600SoCState.
9
Here we are interested in the I/O region size, so rename as
9
10
'iosize'.
11
12
Reviewed-by: Peter Delevoryas <peter@pjd.dev>
13
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
14
[ clg: Introduced temporary wdt_offset variable ]
11
Reviewed-by: Cédric Le Goater <clg@kaod.org>
15
Signed-off-by: Cédric Le Goater <clg@kaod.org>
12
Signed-off-by: Cédric Le Goater <clg@kaod.org>
16
---
13
---
17
include/hw/watchdog/wdt_aspeed.h | 2 +-
14
include/hw/arm/aspeed_soc.h | 4 ++-
18
hw/arm/aspeed_ast10x0.c | 4 ++--
15
hw/arm/aspeed_ast2600.c | 49 ++++++++++++++++++++-----------------
19
hw/arm/aspeed_ast2600.c | 4 ++--
16
hw/arm/fby35.c | 14 ++++++-----
20
hw/arm/aspeed_soc.c | 4 ++--
17
3 files changed, 37 insertions(+), 30 deletions(-)
21
hw/watchdog/wdt_aspeed.c | 8 ++++----
18
22
5 files changed, 11 insertions(+), 11 deletions(-)
19
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
23
24
diff --git a/include/hw/watchdog/wdt_aspeed.h b/include/hw/watchdog/wdt_aspeed.h
25
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
26
--- a/include/hw/watchdog/wdt_aspeed.h
21
--- a/include/hw/arm/aspeed_soc.h
27
+++ b/include/hw/watchdog/wdt_aspeed.h
22
+++ b/include/hw/arm/aspeed_soc.h
28
@@ -XXX,XX +XXX,XX @@ struct AspeedWDTState {
23
@@ -XXX,XX +XXX,XX @@ struct AspeedSoCState {
29
struct AspeedWDTClass {
24
DeviceState parent;
30
SysBusDeviceClass parent_class;
25
31
26
ARMCPU cpu[ASPEED_CPUS_NUM];
32
- uint32_t offset;
27
- A15MPPrivState a7mpcore;
33
+ uint32_t iosize;
28
MemoryRegion *memory;
34
uint32_t ext_pulse_width_mask;
29
MemoryRegion *dram_mr;
35
uint32_t reset_ctrl_reg;
30
MemoryRegion dram_container;
36
void (*reset_pulse)(AspeedWDTState *s, uint32_t property);
31
@@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2400SoCState, ASPEED2400_SOC)
37
diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c
32
38
index XXXXXXX..XXXXXXX 100644
33
struct Aspeed2600SoCState {
39
--- a/hw/arm/aspeed_ast10x0.c
34
AspeedSoCState parent;
40
+++ b/hw/arm/aspeed_ast10x0.c
35
+
41
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
36
+ A15MPPrivState a7mpcore;
42
/* Watch dog */
37
+ ARMCPU cpu[ASPEED_CPUS_NUM]; /* XXX belong to a7mpcore */
43
for (i = 0; i < sc->wdts_num; i++) {
38
};
44
AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(&s->wdt[i]);
39
45
+ hwaddr wdt_offset = sc->memmap[ASPEED_DEV_WDT] + i * awc->iosize;
40
#define TYPE_ASPEED2600_SOC "aspeed2600-soc"
46
47
object_property_set_link(OBJECT(&s->wdt[i]), "scu", OBJECT(&s->scu),
48
&error_abort);
49
if (!sysbus_realize(SYS_BUS_DEVICE(&s->wdt[i]), errp)) {
50
return;
51
}
52
- aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->wdt[i]), 0,
53
- sc->memmap[ASPEED_DEV_WDT] + i * awc->offset);
54
+ aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->wdt[i]), 0, wdt_offset);
55
}
56
57
/* GPIO */
58
diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
41
diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
59
index XXXXXXX..XXXXXXX 100644
42
index XXXXXXX..XXXXXXX 100644
60
--- a/hw/arm/aspeed_ast2600.c
43
--- a/hw/arm/aspeed_ast2600.c
61
+++ b/hw/arm/aspeed_ast2600.c
44
+++ b/hw/arm/aspeed_ast2600.c
62
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
45
@@ -XXX,XX +XXX,XX @@ static const int aspeed_soc_ast2600_irqmap[] = {
63
/* Watch dog */
46
64
for (i = 0; i < sc->wdts_num; i++) {
47
static qemu_irq aspeed_soc_ast2600_get_irq(AspeedSoCState *s, int dev)
65
AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(&s->wdt[i]);
48
{
66
+ hwaddr wdt_offset = sc->memmap[ASPEED_DEV_WDT] + i * awc->iosize;
49
+ Aspeed2600SoCState *a = ASPEED2600_SOC(s);
67
50
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
68
object_property_set_link(OBJECT(&s->wdt[i]), "scu", OBJECT(&s->scu),
51
69
&error_abort);
52
- return qdev_get_gpio_in(DEVICE(&s->a7mpcore), sc->irqmap[dev]);
70
if (!sysbus_realize(SYS_BUS_DEVICE(&s->wdt[i]), errp)) {
53
+ return qdev_get_gpio_in(DEVICE(&a->a7mpcore), sc->irqmap[dev]);
54
}
55
56
static void aspeed_soc_ast2600_init(Object *obj)
57
{
58
+ Aspeed2600SoCState *a = ASPEED2600_SOC(obj);
59
AspeedSoCState *s = ASPEED_SOC(obj);
60
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
61
int i;
62
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_init(Object *obj)
63
}
64
65
for (i = 0; i < sc->num_cpus; i++) {
66
- object_initialize_child(obj, "cpu[*]", &s->cpu[i], sc->cpu_type);
67
+ object_initialize_child(obj, "cpu[*]", &a->cpu[i], sc->cpu_type);
68
}
69
70
snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname);
71
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_init(Object *obj)
72
object_property_add_alias(obj, "hw-prot-key", OBJECT(&s->scu),
73
"hw-prot-key");
74
75
- object_initialize_child(obj, "a7mpcore", &s->a7mpcore,
76
+ object_initialize_child(obj, "a7mpcore", &a->a7mpcore,
77
TYPE_A15MPCORE_PRIV);
78
79
object_initialize_child(obj, "rtc", &s->rtc, TYPE_ASPEED_RTC);
80
@@ -XXX,XX +XXX,XX @@ static uint64_t aspeed_calc_affinity(int cpu)
81
static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
82
{
83
int i;
84
+ Aspeed2600SoCState *a = ASPEED2600_SOC(dev);
85
AspeedSoCState *s = ASPEED_SOC(dev);
86
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
87
Error *err = NULL;
88
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
89
/* CPU */
90
for (i = 0; i < sc->num_cpus; i++) {
91
if (sc->num_cpus > 1) {
92
- object_property_set_int(OBJECT(&s->cpu[i]), "reset-cbar",
93
+ object_property_set_int(OBJECT(&a->cpu[i]), "reset-cbar",
94
ASPEED_A7MPCORE_ADDR, &error_abort);
95
}
96
- object_property_set_int(OBJECT(&s->cpu[i]), "mp-affinity",
97
+ object_property_set_int(OBJECT(&a->cpu[i]), "mp-affinity",
98
aspeed_calc_affinity(i), &error_abort);
99
100
- object_property_set_int(OBJECT(&s->cpu[i]), "cntfrq", 1125000000,
101
+ object_property_set_int(OBJECT(&a->cpu[i]), "cntfrq", 1125000000,
102
&error_abort);
103
- object_property_set_bool(OBJECT(&s->cpu[i]), "neon", false,
104
+ object_property_set_bool(OBJECT(&a->cpu[i]), "neon", false,
105
&error_abort);
106
- object_property_set_bool(OBJECT(&s->cpu[i]), "vfp-d32", false,
107
+ object_property_set_bool(OBJECT(&a->cpu[i]), "vfp-d32", false,
108
&error_abort);
109
- object_property_set_link(OBJECT(&s->cpu[i]), "memory",
110
+ object_property_set_link(OBJECT(&a->cpu[i]), "memory",
111
OBJECT(s->memory), &error_abort);
112
113
- if (!qdev_realize(DEVICE(&s->cpu[i]), NULL, errp)) {
114
+ if (!qdev_realize(DEVICE(&a->cpu[i]), NULL, errp)) {
71
return;
115
return;
72
}
116
}
73
- aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->wdt[i]), 0,
117
}
74
- sc->memmap[ASPEED_DEV_WDT] + i * awc->offset);
118
75
+ aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->wdt[i]), 0, wdt_offset);
119
/* A7MPCORE */
76
}
120
- object_property_set_int(OBJECT(&s->a7mpcore), "num-cpu", sc->num_cpus,
77
121
+ object_property_set_int(OBJECT(&a->a7mpcore), "num-cpu", sc->num_cpus,
78
/* RAM */
122
&error_abort);
79
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
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
80
index XXXXXXX..XXXXXXX 100644
193
index XXXXXXX..XXXXXXX 100644
81
--- a/hw/arm/aspeed_soc.c
194
--- a/hw/arm/fby35.c
82
+++ b/hw/arm/aspeed_soc.c
195
+++ b/hw/arm/fby35.c
83
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
196
@@ -XXX,XX +XXX,XX @@ struct Fby35State {
84
/* Watch dog */
197
MemoryRegion bic_memory;
85
for (i = 0; i < sc->wdts_num; i++) {
198
Clock *bic_sysclk;
86
AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(&s->wdt[i]);
199
87
+ hwaddr wdt_offset = sc->memmap[ASPEED_DEV_WDT] + i * awc->iosize;
200
- AspeedSoCState bmc;
88
201
+ Aspeed2600SoCState bmc;
89
object_property_set_link(OBJECT(&s->wdt[i]), "scu", OBJECT(&s->scu),
202
Aspeed10x0SoCState bic;
90
&error_abort);
203
91
if (!sysbus_realize(SYS_BUS_DEVICE(&s->wdt[i]), errp)) {
204
bool mmio_exec;
92
return;
205
@@ -XXX,XX +XXX,XX @@ static void fby35_bmc_write_boot_rom(DriveInfo *dinfo, MemoryRegion *mr,
93
}
206
94
- aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->wdt[i]), 0,
207
static void fby35_bmc_init(Fby35State *s)
95
- sc->memmap[ASPEED_DEV_WDT] + i * awc->offset);
208
{
96
+ aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->wdt[i]), 0, wdt_offset);
209
+ AspeedSoCState *soc;
97
}
210
+
98
211
object_initialize_child(OBJECT(s), "bmc", &s->bmc, "ast2600-a3");
99
/* RAM */
212
+ soc = ASPEED_SOC(&s->bmc);
100
diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c
213
101
index XXXXXXX..XXXXXXX 100644
214
memory_region_init(&s->bmc_memory, OBJECT(&s->bmc), "bmc-memory",
102
--- a/hw/watchdog/wdt_aspeed.c
215
UINT64_MAX);
103
+++ b/hw/watchdog/wdt_aspeed.c
216
@@ -XXX,XX +XXX,XX @@ static void fby35_bmc_init(Fby35State *s)
104
@@ -XXX,XX +XXX,XX @@ static void aspeed_2400_wdt_class_init(ObjectClass *klass, void *data)
217
&error_abort);
105
AspeedWDTClass *awc = ASPEED_WDT_CLASS(klass);
218
object_property_set_int(OBJECT(&s->bmc), "hw-strap2", 0x00000003,
106
219
&error_abort);
107
dc->desc = "ASPEED 2400 Watchdog Controller";
220
- aspeed_soc_uart_set_chr(&s->bmc, ASPEED_DEV_UART5, serial_hd(0));
108
- awc->offset = 0x20;
221
+ aspeed_soc_uart_set_chr(soc, ASPEED_DEV_UART5, serial_hd(0));
109
+ awc->iosize = 0x20;
222
qdev_realize(DEVICE(&s->bmc), NULL, &error_abort);
110
awc->ext_pulse_width_mask = 0xff;
223
111
awc->reset_ctrl_reg = SCU_RESET_CONTROL1;
224
- aspeed_board_init_flashes(&s->bmc.fmc, "n25q00", 2, 0);
112
awc->wdt_reload = aspeed_wdt_reload;
225
+ aspeed_board_init_flashes(&soc->fmc, "n25q00", 2, 0);
113
@@ -XXX,XX +XXX,XX @@ static void aspeed_2500_wdt_class_init(ObjectClass *klass, void *data)
226
114
AspeedWDTClass *awc = ASPEED_WDT_CLASS(klass);
227
/* Install first FMC flash content as a boot rom. */
115
228
if (!s->mmio_exec) {
116
dc->desc = "ASPEED 2500 Watchdog Controller";
229
DriveInfo *mtd0 = drive_get(IF_MTD, 0, 0);
117
- awc->offset = 0x20;
230
118
+ awc->iosize = 0x20;
231
if (mtd0) {
119
awc->ext_pulse_width_mask = 0xfffff;
232
- AspeedSoCState *bmc = &s->bmc;
120
awc->reset_ctrl_reg = SCU_RESET_CONTROL1;
233
- uint64_t rom_size = memory_region_size(&bmc->spi_boot);
121
awc->reset_pulse = aspeed_2500_wdt_reset_pulse;
234
+ uint64_t rom_size = memory_region_size(&soc->spi_boot);
122
@@ -XXX,XX +XXX,XX @@ static void aspeed_2600_wdt_class_init(ObjectClass *klass, void *data)
235
123
AspeedWDTClass *awc = ASPEED_WDT_CLASS(klass);
236
memory_region_init_rom(&s->bmc_boot_rom, NULL, "aspeed.boot_rom",
124
237
rom_size, &error_abort);
125
dc->desc = "ASPEED 2600 Watchdog Controller";
238
- memory_region_add_subregion_overlap(&bmc->spi_boot_container, 0,
126
- awc->offset = 0x40;
239
+ memory_region_add_subregion_overlap(&soc->spi_boot_container, 0,
127
+ awc->iosize = 0x40;
240
&s->bmc_boot_rom, 1);
128
awc->ext_pulse_width_mask = 0xfffff; /* TODO */
241
129
awc->reset_ctrl_reg = AST2600_SCU_RESET_CONTROL1;
242
fby35_bmc_write_boot_rom(mtd0, &s->bmc_boot_rom,
130
awc->reset_pulse = aspeed_2500_wdt_reset_pulse;
131
@@ -XXX,XX +XXX,XX @@ static void aspeed_1030_wdt_class_init(ObjectClass *klass, void *data)
132
AspeedWDTClass *awc = ASPEED_WDT_CLASS(klass);
133
134
dc->desc = "ASPEED 1030 Watchdog Controller";
135
- awc->offset = 0x80;
136
+ awc->iosize = 0x80;
137
awc->ext_pulse_width_mask = 0xfffff; /* TODO */
138
awc->reset_ctrl_reg = AST2600_SCU_RESET_CONTROL1;
139
awc->reset_pulse = aspeed_2500_wdt_reset_pulse;
140
--
243
--
141
2.39.1
244
2.41.0
142
245
143
246
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
1
3
Add more Aspeed watchdog registers from [*].
4
5
Since guests can righteously access them, log the access at
6
'unimplemented' level instead of 'guest-errors'.
7
8
[*] https://github.com/AspeedTech-BMC/zephyr/blob/v00.01.08/drivers/watchdog/wdt_aspeed.c#L31
9
10
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Reviewed-by: Peter Delevoryas <peter@pjd.dev>
12
Signed-off-by: Cédric Le Goater <clg@kaod.org>
13
---
14
include/hw/watchdog/wdt_aspeed.h | 2 +-
15
hw/watchdog/wdt_aspeed.c | 13 +++++++++++++
16
2 files changed, 14 insertions(+), 1 deletion(-)
17
18
diff --git a/include/hw/watchdog/wdt_aspeed.h b/include/hw/watchdog/wdt_aspeed.h
19
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/watchdog/wdt_aspeed.h
21
+++ b/include/hw/watchdog/wdt_aspeed.h
22
@@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_TYPE(AspeedWDTState, AspeedWDTClass, ASPEED_WDT)
23
#define TYPE_ASPEED_2600_WDT TYPE_ASPEED_WDT "-ast2600"
24
#define TYPE_ASPEED_1030_WDT TYPE_ASPEED_WDT "-ast1030"
25
26
-#define ASPEED_WDT_REGS_MAX (0x20 / 4)
27
+#define ASPEED_WDT_REGS_MAX (0x30 / 4)
28
29
struct AspeedWDTState {
30
/*< private >*/
31
diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c
32
index XXXXXXX..XXXXXXX 100644
33
--- a/hw/watchdog/wdt_aspeed.c
34
+++ b/hw/watchdog/wdt_aspeed.c
35
@@ -XXX,XX +XXX,XX @@
36
#define WDT_PUSH_PULL_MAGIC (0xA8 << 24)
37
#define WDT_OPEN_DRAIN_MAGIC (0x8A << 24)
38
#define WDT_RESET_MASK1 (0x1c / 4)
39
+#define WDT_RESET_MASK2 (0x20 / 4)
40
+
41
+#define WDT_SW_RESET_CTRL (0x24 / 4)
42
+#define WDT_SW_RESET_MASK1 (0x28 / 4)
43
+#define WDT_SW_RESET_MASK2 (0x2c / 4)
44
45
#define WDT_TIMEOUT_STATUS (0x10 / 4)
46
#define WDT_TIMEOUT_CLEAR (0x14 / 4)
47
@@ -XXX,XX +XXX,XX @@ static uint64_t aspeed_wdt_read(void *opaque, hwaddr offset, unsigned size)
48
return s->regs[WDT_RESET_MASK1];
49
case WDT_TIMEOUT_STATUS:
50
case WDT_TIMEOUT_CLEAR:
51
+ case WDT_RESET_MASK2:
52
+ case WDT_SW_RESET_CTRL:
53
+ case WDT_SW_RESET_MASK1:
54
+ case WDT_SW_RESET_MASK2:
55
qemu_log_mask(LOG_UNIMP,
56
"%s: uninmplemented read at offset 0x%" HWADDR_PRIx "\n",
57
__func__, offset);
58
@@ -XXX,XX +XXX,XX @@ static void aspeed_wdt_write(void *opaque, hwaddr offset, uint64_t data,
59
60
case WDT_TIMEOUT_STATUS:
61
case WDT_TIMEOUT_CLEAR:
62
+ case WDT_RESET_MASK2:
63
+ case WDT_SW_RESET_CTRL:
64
+ case WDT_SW_RESET_MASK1:
65
+ case WDT_SW_RESET_MASK2:
66
qemu_log_mask(LOG_UNIMP,
67
"%s: uninmplemented write at offset 0x%" HWADDR_PRIx "\n",
68
__func__, offset);
69
--
70
2.39.1
71
72
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Since I don't have access to the datasheet, the relevant
3
The ARM array and VIC peripheral are only used by the
4
values were found in:
4
2400 series, remove them from the common AspeedSoCState.
5
https://github.com/AspeedTech-BMC/zephyr/blob/v00.01.08/dts/arm/aspeed/ast10x0.dtsi
6
5
7
Reviewed-by: Peter Delevoryas <peter@pjd.dev>
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Reviewed-by: Cédric Le Goater <clg@kaod.org>
7
Reviewed-by: Cédric Le Goater <clg@kaod.org>
10
Signed-off-by: Cédric Le Goater <clg@kaod.org>
8
Signed-off-by: Cédric Le Goater <clg@kaod.org>
11
---
9
---
12
hw/arm/aspeed_ast10x0.c | 16 ++++++++++++++++
10
include/hw/arm/aspeed_soc.h | 5 +++--
13
1 file changed, 16 insertions(+)
11
hw/arm/{aspeed_soc.c => aspeed_ast2400.c} | 27 +++++++++++++----------
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%)
14
15
15
diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c
16
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
16
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/aspeed_ast10x0.c
18
--- a/include/hw/arm/aspeed_soc.h
18
+++ b/hw/arm/aspeed_ast10x0.c
19
+++ b/include/hw/arm/aspeed_soc.h
19
@@ -XXX,XX +XXX,XX @@ static const hwaddr aspeed_soc_ast1030_memmap[] = {
20
@@ -XXX,XX +XXX,XX @@
20
[ASPEED_DEV_WDT] = 0x7E785000,
21
struct AspeedSoCState {
21
[ASPEED_DEV_LPC] = 0x7E789000,
22
DeviceState parent;
22
[ASPEED_DEV_PECI] = 0x7E78B000,
23
23
+ [ASPEED_DEV_I3C] = 0x7E7A0000,
24
- ARMCPU cpu[ASPEED_CPUS_NUM];
24
[ASPEED_DEV_I2C] = 0x7E7B0000,
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;
25
};
42
};
26
43
27
@@ -XXX,XX +XXX,XX @@ static const int aspeed_soc_ast1030_irqmap[] = {
44
#define TYPE_ASPEED2400_SOC "aspeed2400-soc"
28
[ASPEED_DEV_ADC] = 46,
45
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_ast2400.c
29
[ASPEED_DEV_SPI1] = 65,
46
similarity index 95%
30
[ASPEED_DEV_SPI2] = 66,
47
rename from hw/arm/aspeed_soc.c
31
+ [ASPEED_DEV_I3C] = 102, /* 102 -> 105 */
48
rename to hw/arm/aspeed_ast2400.c
32
[ASPEED_DEV_I2C] = 110, /* 110 ~ 123 */
49
index XXXXXXX..XXXXXXX 100644
33
[ASPEED_DEV_KCS] = 138, /* 138 -> 142 */
50
--- a/hw/arm/aspeed_soc.c
34
[ASPEED_DEV_UDC] = 9,
51
+++ b/hw/arm/aspeed_ast2400.c
35
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_init(Object *obj)
52
@@ -XXX,XX +XXX,XX @@ static const int aspeed_soc_ast2400_irqmap[] = {
36
snprintf(typename, sizeof(typename), "aspeed.i2c-%s", socname);
53
37
object_initialize_child(obj, "i2c", &s->i2c, typename);
54
static qemu_irq aspeed_soc_ast2400_get_irq(AspeedSoCState *s, int dev)
38
55
{
39
+ object_initialize_child(obj, "i3c", &s->i3c, TYPE_ASPEED_I3C);
56
+ Aspeed2400SoCState *a = ASPEED2400_SOC(s);
40
+
57
AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s);
41
snprintf(typename, sizeof(typename), "aspeed.timer-%s", socname);
58
42
object_initialize_child(obj, "timerctrl", &s->timerctrl, typename);
59
- return qdev_get_gpio_in(DEVICE(&s->vic), sc->irqmap[dev]);
43
60
+ return qdev_get_gpio_in(DEVICE(&a->vic), sc->irqmap[dev]);
44
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
61
}
45
sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c.busses[i]), 0, irq);
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)
46
}
70
}
47
71
48
+ /* I3C */
72
for (i = 0; i < sc->num_cpus; i++) {
49
+ if (!sysbus_realize(SYS_BUS_DEVICE(&s->i3c), errp)) {
73
- object_initialize_child(obj, "cpu[*]", &s->cpu[i], sc->cpu_type);
50
+ return;
74
+ object_initialize_child(obj, "cpu[*]", &a->cpu[i], sc->cpu_type);
51
+ }
75
}
52
+ aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->i3c), 0, sc->memmap[ASPEED_DEV_I3C]);
76
53
+ for (i = 0; i < ASPEED_I3C_NR_DEVICES; i++) {
77
snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname);
54
+ qemu_irq irq = qdev_get_gpio_in(DEVICE(&s->armv7m),
78
@@ -XXX,XX +XXX,XX @@ static void aspeed_ast2400_soc_init(Object *obj)
55
+ sc->irqmap[ASPEED_DEV_I3C] + i);
79
object_property_add_alias(obj, "hw-prot-key", OBJECT(&s->scu),
56
+ /* The AST1030 I3C controller has one IRQ per bus. */
80
"hw-prot-key");
57
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->i3c.devices[i]), 0, irq);
81
58
+ }
82
- object_initialize_child(obj, "vic", &s->vic, TYPE_ASPEED_VIC);
59
+
83
+ object_initialize_child(obj, "vic", &a->vic, TYPE_ASPEED_VIC);
60
/* PECI */
84
61
if (!sysbus_realize(SYS_BUS_DEVICE(&s->peci), errp)) {
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
}
106
}
107
108
/* SRAM */
109
- sram_name = g_strdup_printf("aspeed.sram.%d", CPU(&s->cpu[0])->cpu_index);
110
+ sram_name = g_strdup_printf("aspeed.sram.%d", CPU(&a->cpu[0])->cpu_index);
111
memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_size, &err);
112
if (err) {
113
error_propagate(errp, err);
114
@@ -XXX,XX +XXX,XX @@ static void aspeed_ast2400_soc_realize(DeviceState *dev, Error **errp)
115
aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->scu), 0, sc->memmap[ASPEED_DEV_SCU]);
116
117
/* VIC */
118
- if (!sysbus_realize(SYS_BUS_DEVICE(&s->vic), errp)) {
119
+ if (!sysbus_realize(SYS_BUS_DEVICE(&a->vic), errp)) {
62
return;
120
return;
121
}
122
- aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->vic), 0, sc->memmap[ASPEED_DEV_VIC]);
123
- sysbus_connect_irq(SYS_BUS_DEVICE(&s->vic), 0,
124
- qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_IRQ));
125
- sysbus_connect_irq(SYS_BUS_DEVICE(&s->vic), 1,
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',
63
--
150
--
64
2.39.1
151
2.41.0
65
152
66
153
diff view generated by jsdifflib
Deleted patch
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
1
3
Since I don't have access to the datasheet, the relevant
4
values were found in:
5
https://github.com/AspeedTech-BMC/zephyr/blob/v00.01.08/dts/arm/aspeed/ast10x0.dtsi
6
7
Before on Zephyr:
8
9
uart:~$ hash test
10
sha256_test
11
tv[0]:hash_final error
12
sha384_test
13
tv[0]:hash_final error
14
sha512_test
15
tv[0]:hash_final error
16
[00:00:06.278,000] <err> hace_global: HACE poll timeout
17
[00:00:09.324,000] <err> hace_global: HACE poll timeout
18
[00:00:12.261,000] <err> hace_global: HACE poll timeout
19
20
uart:~$ crypto aes256_cbc_vault
21
aes256_cbc vault key 1
22
[00:00:06.699,000] <inf> hace_global: aspeed_crypto_session_setup
23
[00:00:06.699,000] <inf> hace_global: data->cmd: 1c2098
24
[00:00:06.699,000] <inf> hace_global: crypto_data_src: 93340
25
[00:00:06.699,000] <inf> hace_global: crypto_data_dst: 93348
26
[00:00:06.699,000] <inf> hace_global: crypto_ctx_base: 93300
27
[00:00:06.699,000] <inf> hace_global: crypto_data_len: 80000040
28
[00:00:06.699,000] <inf> hace_global: crypto_cmd_reg: 11c2098
29
[00:00:09.743,000] <inf> hace_global: HACE_STS: 0
30
[00:00:09.743,000] <err> hace_global: HACE poll timeout
31
[00:00:09.743,000] <err> crypto: CBC mode ENCRYPT - Failed
32
[00:00:09.743,000] <inf> hace_global: aspeed_crypto_session_free
33
uart:~$
34
35
After:
36
37
uart:~$ hash test
38
sha256_test
39
tv[0]:PASS
40
tv[1]:PASS
41
tv[2]:PASS
42
tv[3]:PASS
43
tv[4]:PASS
44
sha384_test
45
tv[0]:PASS
46
tv[1]:PASS
47
tv[2]:PASS
48
tv[3]:PASS
49
tv[4]:PASS
50
tv[5]:PASS
51
sha512_test
52
tv[0]:PASS
53
tv[1]:PASS
54
tv[2]:PASS
55
tv[3]:PASS
56
tv[4]:PASS
57
tv[5]:PASS
58
59
uart:~$ crypto aes256_cbc_vault
60
aes256_cbc vault key 1
61
Was waiting for:
62
6b c1 be e2 2e 40 9f 96 e9 3d 7e 11 73 93 17 2a
63
ae 2d 8a 57 1e 03 ac 9c 9e b7 6f ac 45 af 8e 51
64
30 c8 1c 46 a3 5c e4 11 e5 fb c1 19 1a 0a 52 ef
65
f6 9f 24 45 df 4f 9b 17 ad 2b 41 7b e6 6c 37 10
66
67
But got:
68
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
69
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
70
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
71
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
72
73
[00:00:05.771,000] <inf> hace_global: aspeed_crypto_session_setup
74
[00:00:05.772,000] <inf> hace_global: data->cmd: 1c2098
75
[00:00:05.772,000] <inf> hace_global: crypto_data_src: 93340
76
[00:00:05.772,000] <inf> hace_global: crypto_data_dst: 93348
77
[00:00:05.772,000] <inf> hace_global: crypto_ctx_base: 93300
78
[00:00:05.772,000] <inf> hace_global: crypto_data_len: 80000040
79
[00:00:05.772,000] <inf> hace_global: crypto_cmd_reg: 11c2098
80
[00:00:05.772,000] <inf> hace_global: HACE_STS: 1000
81
[00:00:05.772,000] <inf> crypto: Output length (encryption): 80
82
[00:00:05.772,000] <inf> hace_global: aspeed_crypto_session_free
83
[00:00:05.772,000] <inf> hace_global: aspeed_crypto_session_setup
84
[00:00:05.772,000] <inf> hace_global: data->cmd: 1c2018
85
[00:00:05.772,000] <inf> hace_global: crypto_data_src: 93340
86
[00:00:05.772,000] <inf> hace_global: crypto_data_dst: 93348
87
[00:00:05.772,000] <inf> hace_global: crypto_ctx_base: 93300
88
[00:00:05.772,000] <inf> hace_global: crypto_data_len: 80000040
89
[00:00:05.772,000] <inf> hace_global: crypto_cmd_reg: 11c2018
90
[00:00:05.772,000] <inf> hace_global: HACE_STS: 1000
91
[00:00:05.772,000] <inf> crypto: Output length (decryption): 64
92
[00:00:05.772,000] <err> crypto: CBC mode DECRYPT - Mismatch between plaintext and decrypted cipher text
93
[00:00:05.774,000] <inf> hace_global: aspeed_crypto_session_free
94
uart:~$
95
96
Reviewed-by: Peter Delevoryas <peter@pjd.dev>
97
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
98
Signed-off-by: Cédric Le Goater <clg@kaod.org>
99
---
100
hw/arm/aspeed_ast10x0.c | 15 +++++++++++++++
101
1 file changed, 15 insertions(+)
102
103
diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c
104
index XXXXXXX..XXXXXXX 100644
105
--- a/hw/arm/aspeed_ast10x0.c
106
+++ b/hw/arm/aspeed_ast10x0.c
107
@@ -XXX,XX +XXX,XX @@ static const hwaddr aspeed_soc_ast1030_memmap[] = {
108
[ASPEED_DEV_SPI1] = 0x7E630000,
109
[ASPEED_DEV_SPI2] = 0x7E640000,
110
[ASPEED_DEV_UDC] = 0x7E6A2000,
111
+ [ASPEED_DEV_HACE] = 0x7E6D0000,
112
[ASPEED_DEV_SCU] = 0x7E6E2000,
113
[ASPEED_DEV_JTAG0] = 0x7E6E4000,
114
[ASPEED_DEV_JTAG1] = 0x7E6E4100,
115
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_init(Object *obj)
116
snprintf(typename, sizeof(typename), "aspeed.gpio-%s", socname);
117
object_initialize_child(obj, "gpio", &s->gpio, typename);
118
119
+ snprintf(typename, sizeof(typename), "aspeed.hace-%s", socname);
120
+ object_initialize_child(obj, "hace", &s->hace, typename);
121
+
122
object_initialize_child(obj, "iomem", &s->iomem, TYPE_UNIMPLEMENTED_DEVICE);
123
object_initialize_child(obj, "sbc-unimplemented", &s->sbc_unimplemented,
124
TYPE_UNIMPLEMENTED_DEVICE);
125
@@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp)
126
}
127
aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->sbc), 0, sc->memmap[ASPEED_DEV_SBC]);
128
129
+ /* HACE */
130
+ object_property_set_link(OBJECT(&s->hace), "dram", OBJECT(&s->sram),
131
+ &error_abort);
132
+ if (!sysbus_realize(SYS_BUS_DEVICE(&s->hace), errp)) {
133
+ return;
134
+ }
135
+ aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->hace), 0,
136
+ sc->memmap[ASPEED_DEV_HACE]);
137
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->hace), 0,
138
+ aspeed_soc_get_irq(s, ASPEED_DEV_HACE));
139
+
140
/* Watch dog */
141
for (i = 0; i < sc->wdts_num; i++) {
142
AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(&s->wdt[i]);
143
--
144
2.39.1
145
146
diff view generated by jsdifflib