1 | The following changes since commit 0529245488865038344d64fff7ee05864d3d17f6: | 1 | The following changes since commit a95260486aa7e78d7c7194eba65cf03311ad94ad: |
---|---|---|---|
2 | 2 | ||
3 | Merge tag 'pull-target-arm-20221020' of https://git.linaro.org/people/pmaydell/qemu-arm into staging (2022-10-20 14:36:12 -0400) | 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-20221025 | 7 | https://github.com/legoater/qemu/ tags/pull-aspeed-20231025 |
8 | 8 | ||
9 | for you to fetch changes up to 703229132bb05327044368fc6d19f6acf7dde848: | 9 | for you to fetch changes up to dd41ce7a6f13ad4f45ebaf52b9fa91fe5fc961df: |
10 | 10 | ||
11 | arm/aspeed: Replace mx25l25635e chip model (2022-10-24 11:20:16 +0200) | 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 | * Performance improvement with Object class caching | 16 | * Update of Andrew's email |
17 | * Serial Flash Discovery Parameters support for m25p80 device | 17 | * Split of AspeedSoCState per 2400/2600/10x0 |
18 | * Various small adjustments on intructions and models | ||
19 | 18 | ||
20 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
21 | Alex Bennée (1): | 20 | Andrew Jeffery (1): |
22 | ssi: cache SSIPeripheralClass to avoid GET_CLASS() | 21 | MAINTAINERS: aspeed: Update Andrew's email address |
23 | 22 | ||
24 | Cédric Le Goater (12): | 23 | Philippe Mathieu-Daudé (11): |
25 | tests/avocado/machine_aspeed.py: Fix typos on buildroot | 24 | hw/arm/aspeed: Extract code common to all boards to a common file |
26 | aspeed/smc: Cache AspeedSMCClass | 25 | hw/arm/aspeed: Rename aspeed_soc_init() as AST2400/2500 specific |
27 | ast2600: Drop NEON from the CPU features | 26 | hw/arm/aspeed: Rename aspeed_soc_realize() as AST2400/2500 specific |
28 | m25p80: Add basic support for the SFDP command | 27 | hw/arm/aspeed: Dynamically allocate AspeedMachineState::soc field |
29 | m25p80: Add the n25q256a SFDP table | 28 | hw/arm/aspeed: Introduce TYPE_ASPEED10X0_SOC |
30 | m25p80: Add erase size for mx25l25635e | 29 | hw/arm/aspeed: Introduce TYPE_ASPEED2600_SOC |
31 | m25p80: Add the mx25l25635e SFPD table | 30 | hw/arm/aspeed: Introduce TYPE_ASPEED2400_SOC |
32 | m25p80: Add the mx25l25635f SFPD table | 31 | hw/arm/aspeed: Check 'memory' link is set in common aspeed_soc_realize |
33 | m25p80: Add the mx66l1g45g SFDP table | 32 | hw/arm/aspeed: Move AspeedSoCState::armv7m to Aspeed10x0SoCState |
34 | m25p80: Add the w25q256 SFPD table | 33 | hw/arm/aspeed: Move AspeedSoCState::a7mpcore to Aspeed2600SoCState |
35 | m25p80: Add the w25q512jv SFPD table | 34 | hw/arm/aspeed: Move AspeedSoCState::cpu/vic to Aspeed2400SoCState |
36 | arm/aspeed: Replace mx25l25635e chip model | ||
37 | 35 | ||
38 | Patrick Williams (2): | 36 | MAINTAINERS | 2 +- |
39 | hw/arm/aspeed: increase Bletchley memory size | 37 | include/hw/arm/aspeed_soc.h | 35 +++++- |
40 | m25p80: Add the w25q01jvq SFPD table | 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 | ||
41 | 48 | ||
42 | Peter Delevoryas (1): | ||
43 | hw/i2c/aspeed: Fix old reg slave receive | ||
44 | |||
45 | hw/block/m25p80_sfdp.h | 29 ++++ | ||
46 | include/hw/i2c/aspeed_i2c.h | 1 + | ||
47 | include/hw/ssi/aspeed_smc.h | 2 + | ||
48 | include/hw/ssi/ssi.h | 3 + | ||
49 | hw/arm/aspeed.c | 15 +- | ||
50 | hw/arm/aspeed_ast2600.c | 2 + | ||
51 | hw/block/m25p80.c | 52 ++++++- | ||
52 | hw/block/m25p80_sfdp.c | 332 ++++++++++++++++++++++++++++++++++++++++ | ||
53 | hw/i2c/aspeed_i2c.c | 8 +- | ||
54 | hw/ssi/aspeed_smc.c | 9 +- | ||
55 | hw/ssi/ssi.c | 18 +-- | ||
56 | MAINTAINERS | 2 +- | ||
57 | hw/block/meson.build | 1 + | ||
58 | hw/block/trace-events | 1 + | ||
59 | tests/avocado/machine_aspeed.py | 16 +- | ||
60 | 15 files changed, 452 insertions(+), 39 deletions(-) | ||
61 | create mode 100644 hw/block/m25p80_sfdp.h | ||
62 | create mode 100644 hw/block/m25p80_sfdp.c | ||
63 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Peter Delevoryas <peter@pjd.dev> | ||
2 | 1 | ||
3 | I think when Klaus ported his slave mode changes from the original patch | ||
4 | series to the rewritten I2C module, he changed the behavior of the first | ||
5 | byte that is received by the slave device. | ||
6 | |||
7 | What's supposed to happen is that the AspeedI2CBus's slave device's | ||
8 | i2c_event callback should run, and if the event is "send_async", then it | ||
9 | should populate the byte buffer with the 8-bit I2C address that is being | ||
10 | sent to. Since we only support "send_async", the lowest bit should | ||
11 | always be 0 (indicating that the master is requesting to send data). | ||
12 | |||
13 | This is the code Klaus had previously, for reference. [1] | ||
14 | |||
15 | switch (event) { | ||
16 | case I2C_START_SEND: | ||
17 | bus->buf = bus->dev_addr << 1; | ||
18 | |||
19 | bus->buf &= I2CD_BYTE_BUF_RX_MASK; | ||
20 | bus->buf <<= I2CD_BYTE_BUF_RX_SHIFT; | ||
21 | |||
22 | bus->intr_status |= (I2CD_INTR_SLAVE_ADDR_RX_MATCH | I2CD_INTR_RX_DONE); | ||
23 | aspeed_i2c_set_state(bus, I2CD_STXD); | ||
24 | |||
25 | break; | ||
26 | |||
27 | [1]: https://lore.kernel.org/qemu-devel/20220331165737.1073520-4-its@irrelevant.dk/ | ||
28 | |||
29 | Fixes: a8d48f59cd021b25 ("hw/i2c/aspeed: add slave device in old register mode") | ||
30 | Signed-off-by: Peter Delevoryas <peter@pjd.dev> | ||
31 | Reviewed-by: Klaus Jensen <k.jensen@samsung.com> | ||
32 | Message-Id: <20220820225712.713209-2-peter@pjd.dev> | ||
33 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | ||
34 | --- | ||
35 | include/hw/i2c/aspeed_i2c.h | 1 + | ||
36 | hw/i2c/aspeed_i2c.c | 8 +++++--- | ||
37 | 2 files changed, 6 insertions(+), 3 deletions(-) | ||
38 | |||
39 | diff --git a/include/hw/i2c/aspeed_i2c.h b/include/hw/i2c/aspeed_i2c.h | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/include/hw/i2c/aspeed_i2c.h | ||
42 | +++ b/include/hw/i2c/aspeed_i2c.h | ||
43 | @@ -XXX,XX +XXX,XX @@ REG32(I2CD_CMD, 0x14) /* I2CD Command/Status */ | ||
44 | SHARED_FIELD(M_TX_CMD, 1, 1) | ||
45 | SHARED_FIELD(M_START_CMD, 0, 1) | ||
46 | REG32(I2CD_DEV_ADDR, 0x18) /* Slave Device Address */ | ||
47 | + SHARED_FIELD(SLAVE_DEV_ADDR1, 0, 7) | ||
48 | REG32(I2CD_POOL_CTRL, 0x1C) /* Pool Buffer Control */ | ||
49 | SHARED_FIELD(RX_COUNT, 24, 5) | ||
50 | SHARED_FIELD(RX_SIZE, 16, 5) | ||
51 | diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/hw/i2c/aspeed_i2c.c | ||
54 | +++ b/hw/i2c/aspeed_i2c.c | ||
55 | @@ -XXX,XX +XXX,XX @@ static int aspeed_i2c_bus_slave_event(I2CSlave *slave, enum i2c_event event) | ||
56 | AspeedI2CBus *bus = ASPEED_I2C_BUS(qbus->parent); | ||
57 | uint32_t reg_intr_sts = aspeed_i2c_bus_intr_sts_offset(bus); | ||
58 | uint32_t reg_byte_buf = aspeed_i2c_bus_byte_buf_offset(bus); | ||
59 | - uint32_t value; | ||
60 | + uint32_t reg_dev_addr = aspeed_i2c_bus_dev_addr_offset(bus); | ||
61 | + uint32_t dev_addr = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_dev_addr, | ||
62 | + SLAVE_DEV_ADDR1); | ||
63 | |||
64 | if (aspeed_i2c_is_new_mode(bus->controller)) { | ||
65 | return aspeed_i2c_bus_new_slave_event(bus, event); | ||
66 | @@ -XXX,XX +XXX,XX @@ static int aspeed_i2c_bus_slave_event(I2CSlave *slave, enum i2c_event event) | ||
67 | |||
68 | switch (event) { | ||
69 | case I2C_START_SEND_ASYNC: | ||
70 | - value = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_byte_buf, TX_BUF); | ||
71 | - SHARED_ARRAY_FIELD_DP32(bus->regs, reg_byte_buf, RX_BUF, value << 1); | ||
72 | + /* Bit[0] == 0 indicates "send". */ | ||
73 | + SHARED_ARRAY_FIELD_DP32(bus->regs, reg_byte_buf, RX_BUF, dev_addr << 1); | ||
74 | |||
75 | ARRAY_FIELD_DP32(bus->regs, I2CD_INTR_STS, SLAVE_ADDR_RX_MATCH, 1); | ||
76 | SHARED_ARRAY_FIELD_DP32(bus->regs, reg_intr_sts, RX_DONE, 1); | ||
77 | -- | ||
78 | 2.37.3 | ||
79 | |||
80 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Replace 'buidroot' and 'builroot' by 'buildroot'. | ||
2 | 1 | ||
3 | Fixes: f7bc7da0724f ("test/avocado/machine_aspeed.py: Add tests using buildroot images") | ||
4 | Reviewed-by: Thomas Huth <thuth@redhat.com> | ||
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | Reviewed-by: Joel Stanley <joel@jms.id.au> | ||
7 | Message-Id: <20220923084803.498337-2-clg@kaod.org> | ||
8 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | ||
9 | --- | ||
10 | tests/avocado/machine_aspeed.py | 16 ++++++++-------- | ||
11 | 1 file changed, 8 insertions(+), 8 deletions(-) | ||
12 | |||
13 | diff --git a/tests/avocado/machine_aspeed.py b/tests/avocado/machine_aspeed.py | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/tests/avocado/machine_aspeed.py | ||
16 | +++ b/tests/avocado/machine_aspeed.py | ||
17 | @@ -XXX,XX +XXX,XX @@ def test_arm_ast2500_romulus_openbmc_v2_9_0(self): | ||
18 | |||
19 | self.do_test_arm_aspeed(image_path) | ||
20 | |||
21 | - def do_test_arm_aspeed_buidroot_start(self, image, cpu_id): | ||
22 | + def do_test_arm_aspeed_buildroot_start(self, image, cpu_id): | ||
23 | self.require_netdev('user') | ||
24 | |||
25 | self.vm.set_console() | ||
26 | @@ -XXX,XX +XXX,XX @@ def do_test_arm_aspeed_buidroot_start(self, image, cpu_id): | ||
27 | exec_command(self, 'root') | ||
28 | time.sleep(0.1) | ||
29 | |||
30 | - def do_test_arm_aspeed_buidroot_poweroff(self): | ||
31 | + def do_test_arm_aspeed_buildroot_poweroff(self): | ||
32 | exec_command_and_wait_for_pattern(self, 'poweroff', | ||
33 | 'reboot: System halted'); | ||
34 | |||
35 | - def test_arm_ast2500_evb_builroot(self): | ||
36 | + def test_arm_ast2500_evb_buildroot(self): | ||
37 | """ | ||
38 | :avocado: tags=arch:arm | ||
39 | :avocado: tags=machine:ast2500-evb | ||
40 | @@ -XXX,XX +XXX,XX @@ def test_arm_ast2500_evb_builroot(self): | ||
41 | |||
42 | self.vm.add_args('-device', | ||
43 | 'tmp105,bus=aspeed.i2c.bus.3,address=0x4d,id=tmp-test'); | ||
44 | - self.do_test_arm_aspeed_buidroot_start(image_path, '0x0') | ||
45 | + self.do_test_arm_aspeed_buildroot_start(image_path, '0x0') | ||
46 | |||
47 | exec_command_and_wait_for_pattern(self, | ||
48 | 'echo lm75 0x4d > /sys/class/i2c-dev/i2c-3/device/new_device', | ||
49 | @@ -XXX,XX +XXX,XX @@ def test_arm_ast2500_evb_builroot(self): | ||
50 | exec_command_and_wait_for_pattern(self, | ||
51 | 'cat /sys/class/hwmon/hwmon1/temp1_input', '18000') | ||
52 | |||
53 | - self.do_test_arm_aspeed_buidroot_poweroff() | ||
54 | + self.do_test_arm_aspeed_buildroot_poweroff() | ||
55 | |||
56 | - def test_arm_ast2600_evb_builroot(self): | ||
57 | + def test_arm_ast2600_evb_buildroot(self): | ||
58 | """ | ||
59 | :avocado: tags=arch:arm | ||
60 | :avocado: tags=machine:ast2600-evb | ||
61 | @@ -XXX,XX +XXX,XX @@ def test_arm_ast2600_evb_builroot(self): | ||
62 | 'tmp105,bus=aspeed.i2c.bus.3,address=0x4d,id=tmp-test'); | ||
63 | self.vm.add_args('-device', | ||
64 | 'ds1338,bus=aspeed.i2c.bus.3,address=0x32'); | ||
65 | - self.do_test_arm_aspeed_buidroot_start(image_path, '0xf00') | ||
66 | + self.do_test_arm_aspeed_buildroot_start(image_path, '0xf00') | ||
67 | |||
68 | exec_command_and_wait_for_pattern(self, | ||
69 | 'echo lm75 0x4d > /sys/class/i2c-dev/i2c-3/device/new_device', | ||
70 | @@ -XXX,XX +XXX,XX @@ def test_arm_ast2600_evb_builroot(self): | ||
71 | year = time.strftime("%Y") | ||
72 | exec_command_and_wait_for_pattern(self, 'hwclock -f /dev/rtc1', year); | ||
73 | |||
74 | - self.do_test_arm_aspeed_buidroot_poweroff() | ||
75 | + self.do_test_arm_aspeed_buildroot_poweroff() | ||
76 | |||
77 | |||
78 | class AST2x00MachineSDK(QemuSystemTest): | ||
79 | -- | ||
80 | 2.37.3 | ||
81 | |||
82 | diff view generated by jsdifflib |
1 | JEDEC STANDARD JESD216 for Serial Flash Discovery Parameters (SFDP) | 1 | From: Andrew Jeffery <andrew@codeconstruct.com.au> |
---|---|---|---|
2 | provides a mean to describe the features of a serial flash device | ||
3 | using a set of internal parameter tables. | ||
4 | 2 | ||
5 | This is the initial framework for the RDSFDP command giving access to | 3 | I've changed employers, have company email that deals with patch-based |
6 | a private SFDP area under the flash. This area now needs to be | 4 | workflows without too much of a headache, and am trying to steer some |
7 | populated with the flash device characteristics, using a new | 5 | content out of my personal mail. |
8 | 'sfdp_read' handler under FlashPartInfo. | ||
9 | 6 | ||
10 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | 7 | Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au> |
11 | Message-Id: <20220722063602.128144-2-clg@kaod.org> | ||
12 | Message-Id: <20221013161241.2805140-2-clg@kaod.org> | ||
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 | hw/block/m25p80_sfdp.h | 18 ++++++++++++++++++ | 10 | MAINTAINERS | 2 +- |
16 | hw/block/m25p80.c | 27 +++++++++++++++++++++++++++ | 11 | 1 file changed, 1 insertion(+), 1 deletion(-) |
17 | MAINTAINERS | 2 +- | ||
18 | hw/block/trace-events | 1 + | ||
19 | 4 files changed, 47 insertions(+), 1 deletion(-) | ||
20 | create mode 100644 hw/block/m25p80_sfdp.h | ||
21 | 12 | ||
22 | diff --git a/hw/block/m25p80_sfdp.h b/hw/block/m25p80_sfdp.h | ||
23 | new file mode 100644 | ||
24 | index XXXXXXX..XXXXXXX | ||
25 | --- /dev/null | ||
26 | +++ b/hw/block/m25p80_sfdp.h | ||
27 | @@ -XXX,XX +XXX,XX @@ | ||
28 | +/* | ||
29 | + * M25P80 SFDP | ||
30 | + * | ||
31 | + * Copyright (c) 2020, IBM Corporation. | ||
32 | + * | ||
33 | + * This code is licensed under the GPL version 2 or later. See the | ||
34 | + * COPYING file in the top-level directory. | ||
35 | + */ | ||
36 | + | ||
37 | +#ifndef HW_M25P80_SFDP_H | ||
38 | +#define HW_M25P80_SFDP_H | ||
39 | + | ||
40 | +/* | ||
41 | + * SFDP area has a 3 bytes address space. | ||
42 | + */ | ||
43 | +#define M25P80_SFDP_MAX_SIZE (1 << 24) | ||
44 | + | ||
45 | +#endif | ||
46 | diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c | ||
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/hw/block/m25p80.c | ||
49 | +++ b/hw/block/m25p80.c | ||
50 | @@ -XXX,XX +XXX,XX @@ | ||
51 | #include "qapi/error.h" | ||
52 | #include "trace.h" | ||
53 | #include "qom/object.h" | ||
54 | +#include "m25p80_sfdp.h" | ||
55 | |||
56 | /* 16 MiB max in 3 byte address mode */ | ||
57 | #define MAX_3BYTES_SIZE 0x1000000 | ||
58 | @@ -XXX,XX +XXX,XX @@ typedef struct FlashPartInfo { | ||
59 | * This field inform how many die is in the chip. | ||
60 | */ | ||
61 | uint8_t die_cnt; | ||
62 | + uint8_t (*sfdp_read)(uint32_t sfdp_addr); | ||
63 | } FlashPartInfo; | ||
64 | |||
65 | /* adapted from linux */ | ||
66 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
67 | BULK_ERASE = 0xc7, | ||
68 | READ_FSR = 0x70, | ||
69 | RDCR = 0x15, | ||
70 | + RDSFDP = 0x5a, | ||
71 | |||
72 | READ = 0x03, | ||
73 | READ4 = 0x13, | ||
74 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
75 | STATE_COLLECTING_DATA, | ||
76 | STATE_COLLECTING_VAR_LEN_DATA, | ||
77 | STATE_READING_DATA, | ||
78 | + STATE_READING_SFDP, | ||
79 | } CMDState; | ||
80 | |||
81 | typedef enum { | ||
82 | @@ -XXX,XX +XXX,XX @@ static inline int get_addr_length(Flash *s) | ||
83 | } | ||
84 | |||
85 | switch (s->cmd_in_progress) { | ||
86 | + case RDSFDP: | ||
87 | + return 3; | ||
88 | case PP4: | ||
89 | case PP4_4: | ||
90 | case QPP_4: | ||
91 | @@ -XXX,XX +XXX,XX @@ static void complete_collecting_data(Flash *s) | ||
92 | " by device\n"); | ||
93 | } | ||
94 | break; | ||
95 | + | ||
96 | + case RDSFDP: | ||
97 | + s->state = STATE_READING_SFDP; | ||
98 | + break; | ||
99 | + | ||
100 | default: | ||
101 | break; | ||
102 | } | ||
103 | @@ -XXX,XX +XXX,XX @@ static void decode_new_cmd(Flash *s, uint32_t value) | ||
104 | qemu_log_mask(LOG_GUEST_ERROR, "M25P80: Unknown cmd %x\n", value); | ||
105 | } | ||
106 | break; | ||
107 | + case RDSFDP: | ||
108 | + if (s->pi->sfdp_read) { | ||
109 | + s->needed_bytes = get_addr_length(s) + 1; /* SFDP addr + dummy */ | ||
110 | + s->pos = 0; | ||
111 | + s->len = 0; | ||
112 | + s->state = STATE_COLLECTING_DATA; | ||
113 | + break; | ||
114 | + } | ||
115 | + /* Fallthrough */ | ||
116 | + | ||
117 | default: | ||
118 | s->pos = 0; | ||
119 | s->len = 1; | ||
120 | @@ -XXX,XX +XXX,XX @@ static uint32_t m25p80_transfer8(SSIPeripheral *ss, uint32_t tx) | ||
121 | } | ||
122 | } | ||
123 | break; | ||
124 | + case STATE_READING_SFDP: | ||
125 | + assert(s->pi->sfdp_read); | ||
126 | + r = s->pi->sfdp_read(s->cur_addr); | ||
127 | + trace_m25p80_read_sfdp(s, s->cur_addr, (uint8_t)r); | ||
128 | + s->cur_addr = (s->cur_addr + 1) & (M25P80_SFDP_MAX_SIZE - 1); | ||
129 | + break; | ||
130 | |||
131 | default: | ||
132 | case STATE_IDLE: | ||
133 | diff --git a/MAINTAINERS b/MAINTAINERS | 13 | diff --git a/MAINTAINERS b/MAINTAINERS |
134 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
135 | --- a/MAINTAINERS | 15 | --- a/MAINTAINERS |
136 | +++ b/MAINTAINERS | 16 | +++ b/MAINTAINERS |
137 | @@ -XXX,XX +XXX,XX @@ SSI | 17 | @@ -XXX,XX +XXX,XX @@ F: docs/system/arm/emcraft-sf2.rst |
138 | M: Alistair Francis <alistair@alistair23.me> | 18 | ASPEED BMCs |
19 | M: Cédric Le Goater <clg@kaod.org> | ||
20 | M: Peter Maydell <peter.maydell@linaro.org> | ||
21 | -R: Andrew Jeffery <andrew@aj.id.au> | ||
22 | +R: Andrew Jeffery <andrew@codeconstruct.com.au> | ||
23 | R: Joel Stanley <joel@jms.id.au> | ||
24 | L: qemu-arm@nongnu.org | ||
139 | S: Maintained | 25 | S: Maintained |
140 | F: hw/ssi/* | ||
141 | -F: hw/block/m25p80.c | ||
142 | +F: hw/block/m25p80* | ||
143 | F: include/hw/ssi/ssi.h | ||
144 | X: hw/ssi/xilinx_* | ||
145 | F: tests/qtest/m25p80-test.c | ||
146 | diff --git a/hw/block/trace-events b/hw/block/trace-events | ||
147 | index XXXXXXX..XXXXXXX 100644 | ||
148 | --- a/hw/block/trace-events | ||
149 | +++ b/hw/block/trace-events | ||
150 | @@ -XXX,XX +XXX,XX @@ m25p80_page_program(void *s, uint32_t addr, uint8_t tx) "[%p] page program cur_a | ||
151 | m25p80_transfer(void *s, uint8_t state, uint32_t len, uint8_t needed, uint32_t pos, uint32_t cur_addr, uint8_t t) "[%p] Transfer state 0x%"PRIx8" len 0x%"PRIx32" needed 0x%"PRIx8" pos 0x%"PRIx32" addr 0x%"PRIx32" tx 0x%"PRIx8 | ||
152 | m25p80_read_byte(void *s, uint32_t addr, uint8_t v) "[%p] Read byte 0x%"PRIx32"=0x%"PRIx8 | ||
153 | m25p80_read_data(void *s, uint32_t pos, uint8_t v) "[%p] Read data 0x%"PRIx32"=0x%"PRIx8 | ||
154 | +m25p80_read_sfdp(void *s, uint32_t addr, uint8_t v) "[%p] Read SFDP 0x%"PRIx32"=0x%"PRIx8 | ||
155 | m25p80_binding(void *s) "[%p] Binding to IF_MTD drive" | ||
156 | m25p80_binding_no_bdrv(void *s) "[%p] No BDRV - binding to RAM" | ||
157 | -- | 26 | -- |
158 | 2.37.3 | 27 | 2.41.0 |
159 | 28 | ||
160 | 29 | diff view generated by jsdifflib |
1 | The same values were collected on 4 differents OpenPower systems, | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | palmettos, romulus and tacoma. | 2 | |
3 | 3 | aspeed_soc.c contains definitions specific to the AST2400 | |
4 | The SFDP table size is defined as being 0x100 bytes but it could be | 4 | and AST2500 SoCs, but also some definitions for other AST |
5 | bigger. Only the mandatory table for basic features is available at | 5 | SoCs: move them to a common file. |
6 | byte 0x30. | 6 | |
7 | 7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | |
8 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | 8 | Reviewed-by: Cédric Le Goater <clg@kaod.org> |
9 | Message-Id: <20220722063602.128144-3-clg@kaod.org> | ||
10 | Message-Id: <20221013161241.2805140-3-clg@kaod.org> | ||
11 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 9 | Signed-off-by: Cédric Le Goater <clg@kaod.org> |
12 | --- | 10 | --- |
13 | hw/block/m25p80_sfdp.h | 2 ++ | 11 | hw/arm/aspeed_soc.c | 96 ------------------------------- |
14 | hw/block/m25p80.c | 8 +++--- | 12 | hw/arm/aspeed_soc_common.c | 114 +++++++++++++++++++++++++++++++++++++ |
15 | hw/block/m25p80_sfdp.c | 58 ++++++++++++++++++++++++++++++++++++++++++ | 13 | hw/arm/meson.build | 1 + |
16 | hw/block/meson.build | 1 + | 14 | 3 files changed, 115 insertions(+), 96 deletions(-) |
17 | 4 files changed, 66 insertions(+), 3 deletions(-) | 15 | create mode 100644 hw/arm/aspeed_soc_common.c |
18 | create mode 100644 hw/block/m25p80_sfdp.c | 16 | |
19 | 17 | diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c | |
20 | diff --git a/hw/block/m25p80_sfdp.h b/hw/block/m25p80_sfdp.h | ||
21 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/hw/block/m25p80_sfdp.h | 19 | --- a/hw/arm/aspeed_soc.c |
23 | +++ b/hw/block/m25p80_sfdp.h | 20 | +++ b/hw/arm/aspeed_soc.c |
24 | @@ -XXX,XX +XXX,XX @@ | 21 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_register_types(void) |
25 | */ | 22 | }; |
26 | #define M25P80_SFDP_MAX_SIZE (1 << 24) | 23 | |
27 | 24 | type_init(aspeed_soc_register_types); | |
28 | +uint8_t m25p80_sfdp_n25q256a(uint32_t addr); | 25 | - |
29 | + | 26 | -qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev) |
30 | #endif | 27 | -{ |
31 | diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c | 28 | - return ASPEED_SOC_GET_CLASS(s)->get_irq(s, dev); |
32 | index XXXXXXX..XXXXXXX 100644 | 29 | -} |
33 | --- a/hw/block/m25p80.c | 30 | - |
34 | +++ b/hw/block/m25p80.c | 31 | -bool aspeed_soc_uart_realize(AspeedSoCState *s, Error **errp) |
35 | @@ -XXX,XX +XXX,XX @@ static const FlashPartInfo known_devices[] = { | 32 | -{ |
36 | { INFO("n25q128a11", 0x20bb18, 0, 64 << 10, 256, ER_4K) }, | 33 | - AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s); |
37 | { INFO("n25q128a13", 0x20ba18, 0, 64 << 10, 256, ER_4K) }, | 34 | - SerialMM *smm; |
38 | { INFO("n25q256a11", 0x20bb19, 0, 64 << 10, 512, ER_4K) }, | 35 | - |
39 | - { INFO("n25q256a13", 0x20ba19, 0, 64 << 10, 512, ER_4K) }, | 36 | - for (int i = 0, uart = ASPEED_DEV_UART1; i < sc->uarts_num; i++, uart++) { |
40 | + { INFO("n25q256a13", 0x20ba19, 0, 64 << 10, 512, ER_4K), | 37 | - smm = &s->uart[i]; |
41 | + .sfdp_read = m25p80_sfdp_n25q256a }, | 38 | - |
42 | { INFO("n25q512a11", 0x20bb20, 0, 64 << 10, 1024, ER_4K) }, | 39 | - /* Chardev property is set by the machine. */ |
43 | { INFO("n25q512a13", 0x20ba20, 0, 64 << 10, 1024, ER_4K) }, | 40 | - qdev_prop_set_uint8(DEVICE(smm), "regshift", 2); |
44 | { INFO("n25q128", 0x20ba18, 0, 64 << 10, 256, 0) }, | 41 | - qdev_prop_set_uint32(DEVICE(smm), "baudbase", 38400); |
45 | { INFO("n25q256a", 0x20ba19, 0, 64 << 10, 512, | 42 | - qdev_set_legacy_instance_id(DEVICE(smm), sc->memmap[uart], 2); |
46 | - ER_4K | HAS_SR_BP3_BIT6 | HAS_SR_TB) }, | 43 | - qdev_prop_set_uint8(DEVICE(smm), "endianness", DEVICE_LITTLE_ENDIAN); |
47 | - { INFO("n25q512a", 0x20ba20, 0, 64 << 10, 1024, ER_4K) }, | 44 | - if (!sysbus_realize(SYS_BUS_DEVICE(smm), errp)) { |
48 | + ER_4K | HAS_SR_BP3_BIT6 | HAS_SR_TB), | 45 | - return false; |
49 | + .sfdp_read = m25p80_sfdp_n25q256a }, | 46 | - } |
50 | + { INFO("n25q512a", 0x20ba20, 0, 64 << 10, 1024, ER_4K) }, | 47 | - |
51 | { INFO("n25q512ax3", 0x20ba20, 0x1000, 64 << 10, 1024, ER_4K) }, | 48 | - sysbus_connect_irq(SYS_BUS_DEVICE(smm), 0, aspeed_soc_get_irq(s, uart)); |
52 | { INFO("mt25ql512ab", 0x20ba20, 0x1044, 64 << 10, 1024, ER_4K | ER_32K) }, | 49 | - aspeed_mmio_map(s, SYS_BUS_DEVICE(smm), 0, sc->memmap[uart]); |
53 | { INFO_STACKED("mt35xu01g", 0x2c5b1b, 0x104100, 128 << 10, 1024, | 50 | - } |
54 | diff --git a/hw/block/m25p80_sfdp.c b/hw/block/m25p80_sfdp.c | 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 | ||
55 | new file mode 100644 | 122 | new file mode 100644 |
56 | index XXXXXXX..XXXXXXX | 123 | index XXXXXXX..XXXXXXX |
57 | --- /dev/null | 124 | --- /dev/null |
58 | +++ b/hw/block/m25p80_sfdp.c | 125 | +++ b/hw/arm/aspeed_soc_common.c |
59 | @@ -XXX,XX +XXX,XX @@ | 126 | @@ -XXX,XX +XXX,XX @@ |
60 | +/* | 127 | +/* |
61 | + * M25P80 Serial Flash Discoverable Parameter (SFDP) | 128 | + * ASPEED SoC family |
62 | + * | 129 | + * |
63 | + * Copyright (c) 2020, IBM Corporation. | 130 | + * Andrew Jeffery <andrew@aj.id.au> |
131 | + * Jeremy Kerr <jk@ozlabs.org> | ||
64 | + * | 132 | + * |
65 | + * This code is licensed under the GPL version 2 or later. See the | 133 | + * Copyright 2016 IBM Corp. |
66 | + * COPYING file in the top-level directory. | 134 | + * |
135 | + * This code is licensed under the GPL version 2 or later. See | ||
136 | + * the COPYING file in the top-level directory. | ||
67 | + */ | 137 | + */ |
68 | + | 138 | + |
69 | +#include "qemu/osdep.h" | 139 | +#include "qemu/osdep.h" |
70 | +#include "qemu/host-utils.h" | 140 | +#include "qapi/error.h" |
71 | +#include "m25p80_sfdp.h" | 141 | +#include "hw/misc/unimp.h" |
72 | + | 142 | +#include "hw/arm/aspeed_soc.h" |
73 | +#define define_sfdp_read(model) \ | 143 | +#include "hw/char/serial.h" |
74 | + uint8_t m25p80_sfdp_##model(uint32_t addr) \ | 144 | + |
75 | + { \ | 145 | + |
76 | + assert(is_power_of_2(sizeof(sfdp_##model))); \ | 146 | +qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev) |
77 | + return sfdp_##model[addr & (sizeof(sfdp_##model) - 1)]; \ | 147 | +{ |
148 | + return ASPEED_SOC_GET_CLASS(s)->get_irq(s, dev); | ||
149 | +} | ||
150 | + | ||
151 | +bool aspeed_soc_uart_realize(AspeedSoCState *s, Error **errp) | ||
152 | +{ | ||
153 | + AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s); | ||
154 | + SerialMM *smm; | ||
155 | + | ||
156 | + for (int i = 0, uart = ASPEED_DEV_UART1; i < sc->uarts_num; i++, uart++) { | ||
157 | + smm = &s->uart[i]; | ||
158 | + | ||
159 | + /* Chardev property is set by the machine. */ | ||
160 | + qdev_prop_set_uint8(DEVICE(smm), "regshift", 2); | ||
161 | + qdev_prop_set_uint32(DEVICE(smm), "baudbase", 38400); | ||
162 | + qdev_set_legacy_instance_id(DEVICE(smm), sc->memmap[uart], 2); | ||
163 | + qdev_prop_set_uint8(DEVICE(smm), "endianness", DEVICE_LITTLE_ENDIAN); | ||
164 | + if (!sysbus_realize(SYS_BUS_DEVICE(smm), errp)) { | ||
165 | + return false; | ||
166 | + } | ||
167 | + | ||
168 | + sysbus_connect_irq(SYS_BUS_DEVICE(smm), 0, aspeed_soc_get_irq(s, uart)); | ||
169 | + aspeed_mmio_map(s, SYS_BUS_DEVICE(smm), 0, sc->memmap[uart]); | ||
78 | + } | 170 | + } |
79 | + | 171 | + |
172 | + return true; | ||
173 | +} | ||
174 | + | ||
175 | +void aspeed_soc_uart_set_chr(AspeedSoCState *s, int dev, Chardev *chr) | ||
176 | +{ | ||
177 | + AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s); | ||
178 | + int i = dev - ASPEED_DEV_UART1; | ||
179 | + | ||
180 | + g_assert(0 <= i && i < ARRAY_SIZE(s->uart) && i < sc->uarts_num); | ||
181 | + qdev_prop_set_chr(DEVICE(&s->uart[i]), "chardev", chr); | ||
182 | +} | ||
183 | + | ||
80 | +/* | 184 | +/* |
81 | + * Micron | 185 | + * SDMC should be realized first to get correct RAM size and max size |
186 | + * values | ||
82 | + */ | 187 | + */ |
83 | +static const uint8_t sfdp_n25q256a[] = { | 188 | +bool aspeed_soc_dram_init(AspeedSoCState *s, Error **errp) |
84 | + 0x53, 0x46, 0x44, 0x50, 0x00, 0x01, 0x00, 0xff, | 189 | +{ |
85 | + 0x00, 0x00, 0x01, 0x09, 0x30, 0x00, 0x00, 0xff, | 190 | + AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s); |
86 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 191 | + ram_addr_t ram_size, max_ram_size; |
87 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 192 | + |
88 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 193 | + ram_size = object_property_get_uint(OBJECT(&s->sdmc), "ram-size", |
89 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 194 | + &error_abort); |
90 | + 0xe5, 0x20, 0xfb, 0xff, 0xff, 0xff, 0xff, 0x0f, | 195 | + max_ram_size = object_property_get_uint(OBJECT(&s->sdmc), "max-ram-size", |
91 | + 0x29, 0xeb, 0x27, 0x6b, 0x08, 0x3b, 0x27, 0xbb, | 196 | + &error_abort); |
92 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x27, 0xbb, | 197 | + |
93 | + 0xff, 0xff, 0x29, 0xeb, 0x0c, 0x20, 0x10, 0xd8, | 198 | + memory_region_init(&s->dram_container, OBJECT(s), "ram-container", |
94 | + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, | 199 | + max_ram_size); |
95 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 200 | + memory_region_add_subregion(&s->dram_container, 0, s->dram_mr); |
96 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 201 | + |
97 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 202 | + /* |
98 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 203 | + * Add a memory region beyond the RAM region to let firmwares scan |
99 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 204 | + * the address space with load/store and guess how much RAM the |
100 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 205 | + * SoC has. |
101 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 206 | + */ |
102 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 207 | + if (ram_size < max_ram_size) { |
103 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 208 | + DeviceState *dev = qdev_new(TYPE_UNIMPLEMENTED_DEVICE); |
104 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 209 | + |
105 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 210 | + qdev_prop_set_string(dev, "name", "ram-empty"); |
106 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 211 | + qdev_prop_set_uint64(dev, "size", max_ram_size - ram_size); |
107 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 212 | + if (!sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), errp)) { |
108 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 213 | + return false; |
109 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 214 | + } |
110 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 215 | + |
111 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 216 | + memory_region_add_subregion_overlap(&s->dram_container, ram_size, |
112 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 217 | + sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0), -1000); |
113 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 218 | + } |
114 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 219 | + |
115 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 220 | + memory_region_add_subregion(s->memory, |
116 | +}; | 221 | + sc->memmap[ASPEED_DEV_SDRAM], &s->dram_container); |
117 | +define_sfdp_read(n25q256a); | 222 | + return true; |
118 | diff --git a/hw/block/meson.build b/hw/block/meson.build | 223 | +} |
224 | + | ||
225 | +void aspeed_mmio_map(AspeedSoCState *s, SysBusDevice *dev, int n, hwaddr addr) | ||
226 | +{ | ||
227 | + memory_region_add_subregion(s->memory, addr, | ||
228 | + sysbus_mmio_get_region(dev, n)); | ||
229 | +} | ||
230 | + | ||
231 | +void aspeed_mmio_map_unimplemented(AspeedSoCState *s, SysBusDevice *dev, | ||
232 | + const char *name, hwaddr addr, uint64_t size) | ||
233 | +{ | ||
234 | + qdev_prop_set_string(DEVICE(dev), "name", name); | ||
235 | + qdev_prop_set_uint64(DEVICE(dev), "size", size); | ||
236 | + sysbus_realize(dev, &error_abort); | ||
237 | + | ||
238 | + memory_region_add_subregion_overlap(s->memory, addr, | ||
239 | + sysbus_mmio_get_region(dev, 0), -1000); | ||
240 | +} | ||
241 | diff --git a/hw/arm/meson.build b/hw/arm/meson.build | ||
119 | index XXXXXXX..XXXXXXX 100644 | 242 | index XXXXXXX..XXXXXXX 100644 |
120 | --- a/hw/block/meson.build | 243 | --- a/hw/arm/meson.build |
121 | +++ b/hw/block/meson.build | 244 | +++ b/hw/arm/meson.build |
122 | @@ -XXX,XX +XXX,XX @@ softmmu_ss.add(when: 'CONFIG_ONENAND', if_true: files('onenand.c')) | 245 | @@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'CONFIG_FSL_IMX6', if_true: files('fsl-imx6.c')) |
123 | softmmu_ss.add(when: 'CONFIG_PFLASH_CFI01', if_true: files('pflash_cfi01.c')) | 246 | arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( |
124 | softmmu_ss.add(when: 'CONFIG_PFLASH_CFI02', if_true: files('pflash_cfi02.c')) | 247 | 'aspeed_soc.c', |
125 | softmmu_ss.add(when: 'CONFIG_SSI_M25P80', if_true: files('m25p80.c')) | 248 | 'aspeed.c', |
126 | +softmmu_ss.add(when: 'CONFIG_SSI_M25P80', if_true: files('m25p80_sfdp.c')) | 249 | + 'aspeed_soc_common.c', |
127 | softmmu_ss.add(when: 'CONFIG_SWIM', if_true: files('swim.c')) | 250 | 'aspeed_ast2600.c', |
128 | softmmu_ss.add(when: 'CONFIG_XEN', if_true: files('xen-block.c')) | 251 | 'aspeed_ast10x0.c', |
129 | softmmu_ss.add(when: 'CONFIG_TC58128', if_true: files('tc58128.c')) | 252 | 'aspeed_eeprom.c', |
130 | -- | 253 | -- |
131 | 2.37.3 | 254 | 2.41.0 |
132 | 255 | ||
133 | 256 | diff view generated by jsdifflib |
1 | The SFDP table size is 0x100 bytes long. Only the mandatory table for | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | basic features is available at byte 0x80. | ||
3 | 2 | ||
4 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | 3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
5 | Message-Id: <20220722063602.128144-7-clg@kaod.org> | 4 | Reviewed-by: Cédric Le Goater <clg@kaod.org> |
6 | Message-Id: <20221013161241.2805140-8-clg@kaod.org> | ||
7 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 5 | Signed-off-by: Cédric Le Goater <clg@kaod.org> |
8 | --- | 6 | --- |
9 | hw/block/m25p80_sfdp.h | 2 ++ | 7 | hw/arm/aspeed_soc.c | 6 +++--- |
10 | hw/block/m25p80.c | 3 ++- | 8 | 1 file changed, 3 insertions(+), 3 deletions(-) |
11 | hw/block/m25p80_sfdp.c | 40 ++++++++++++++++++++++++++++++++++++++++ | ||
12 | 3 files changed, 44 insertions(+), 1 deletion(-) | ||
13 | 9 | ||
14 | diff --git a/hw/block/m25p80_sfdp.h b/hw/block/m25p80_sfdp.h | 10 | diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c |
15 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/block/m25p80_sfdp.h | 12 | --- a/hw/arm/aspeed_soc.c |
17 | +++ b/hw/block/m25p80_sfdp.h | 13 | +++ b/hw/arm/aspeed_soc.c |
18 | @@ -XXX,XX +XXX,XX @@ uint8_t m25p80_sfdp_mx25l25635e(uint32_t addr); | 14 | @@ -XXX,XX +XXX,XX @@ static qemu_irq aspeed_soc_ast2400_get_irq(AspeedSoCState *s, int dev) |
19 | uint8_t m25p80_sfdp_mx25l25635f(uint32_t addr); | 15 | return qdev_get_gpio_in(DEVICE(&s->vic), sc->irqmap[dev]); |
20 | uint8_t m25p80_sfdp_mx66l1g45g(uint32_t addr); | 16 | } |
21 | 17 | ||
22 | +uint8_t m25p80_sfdp_w25q256(uint32_t addr); | 18 | -static void aspeed_soc_init(Object *obj) |
23 | + | 19 | +static void aspeed_ast2400_soc_init(Object *obj) |
24 | #endif | 20 | { |
25 | diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c | 21 | AspeedSoCState *s = ASPEED_SOC(obj); |
26 | index XXXXXXX..XXXXXXX 100644 | 22 | AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s); |
27 | --- a/hw/block/m25p80.c | 23 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2400_class_init(ObjectClass *oc, void *data) |
28 | +++ b/hw/block/m25p80.c | 24 | static const TypeInfo aspeed_soc_ast2400_type_info = { |
29 | @@ -XXX,XX +XXX,XX @@ static const FlashPartInfo known_devices[] = { | 25 | .name = "ast2400-a1", |
30 | { INFO("w25q64", 0xef4017, 0, 64 << 10, 128, ER_4K) }, | 26 | .parent = TYPE_ASPEED_SOC, |
31 | { INFO("w25q80", 0xef5014, 0, 64 << 10, 16, ER_4K) }, | 27 | - .instance_init = aspeed_soc_init, |
32 | { INFO("w25q80bl", 0xef4014, 0, 64 << 10, 16, ER_4K) }, | 28 | + .instance_init = aspeed_ast2400_soc_init, |
33 | - { INFO("w25q256", 0xef4019, 0, 64 << 10, 512, ER_4K) }, | 29 | .instance_size = sizeof(AspeedSoCState), |
34 | + { INFO("w25q256", 0xef4019, 0, 64 << 10, 512, ER_4K), | 30 | .class_init = aspeed_soc_ast2400_class_init, |
35 | + .sfdp_read = m25p80_sfdp_w25q256 }, | ||
36 | { INFO("w25q512jv", 0xef4020, 0, 64 << 10, 1024, ER_4K) }, | ||
37 | { INFO("w25q01jvq", 0xef4021, 0, 64 << 10, 2048, ER_4K) }, | ||
38 | }; | 31 | }; |
39 | diff --git a/hw/block/m25p80_sfdp.c b/hw/block/m25p80_sfdp.c | 32 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2500_class_init(ObjectClass *oc, void *data) |
40 | index XXXXXXX..XXXXXXX 100644 | 33 | static const TypeInfo aspeed_soc_ast2500_type_info = { |
41 | --- a/hw/block/m25p80_sfdp.c | 34 | .name = "ast2500-a1", |
42 | +++ b/hw/block/m25p80_sfdp.c | 35 | .parent = TYPE_ASPEED_SOC, |
43 | @@ -XXX,XX +XXX,XX @@ static const uint8_t sfdp_mx66l1g45g[] = { | 36 | - .instance_init = aspeed_soc_init, |
44 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 37 | + .instance_init = aspeed_ast2400_soc_init, |
38 | .instance_size = sizeof(AspeedSoCState), | ||
39 | .class_init = aspeed_soc_ast2500_class_init, | ||
45 | }; | 40 | }; |
46 | define_sfdp_read(mx66l1g45g); | ||
47 | + | ||
48 | +/* | ||
49 | + * Windbond | ||
50 | + */ | ||
51 | + | ||
52 | +static const uint8_t sfdp_w25q256[] = { | ||
53 | + 0x53, 0x46, 0x44, 0x50, 0x00, 0x01, 0x00, 0xff, | ||
54 | + 0x00, 0x00, 0x01, 0x09, 0x80, 0x00, 0x00, 0xff, | ||
55 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
56 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
57 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
58 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
59 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
60 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
61 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
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 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
66 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
67 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
68 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
69 | + 0xe5, 0x20, 0xf3, 0xff, 0xff, 0xff, 0xff, 0x0f, | ||
70 | + 0x44, 0xeb, 0x08, 0x6b, 0x08, 0x3b, 0x42, 0xbb, | ||
71 | + 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, | ||
72 | + 0xff, 0xff, 0x21, 0xeb, 0x0c, 0x20, 0x0f, 0x52, | ||
73 | + 0x10, 0xd8, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, | ||
74 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
75 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
76 | + 0xff, 0xff, 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 | +}; | ||
86 | +define_sfdp_read(w25q256); | ||
87 | -- | 41 | -- |
88 | 2.37.3 | 42 | 2.41.0 |
89 | 43 | ||
90 | 44 | diff view generated by jsdifflib |
1 | The SFDP table size is 0x200 bytes long. The mandatory table for basic | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | features is available at byte 0x30 plus some more Macronix specific | ||
3 | tables. | ||
4 | 2 | ||
5 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | 3 | Keep aspeed_soc_class_init() generic, set the realize handler |
6 | Message-Id: <20220722063602.128144-6-clg@kaod.org> | 4 | to aspeed_ast2400_soc_realize() in each 2400/2500 class_init. |
7 | Message-Id: <20221013161241.2805140-7-clg@kaod.org> | 5 | |
6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
7 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
8 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 8 | Signed-off-by: Cédric Le Goater <clg@kaod.org> |
9 | --- | 9 | --- |
10 | hw/block/m25p80_sfdp.h | 2 +- | 10 | hw/arm/aspeed_soc.c | 15 +++++++++++---- |
11 | hw/block/m25p80.c | 3 +- | 11 | 1 file changed, 11 insertions(+), 4 deletions(-) |
12 | hw/block/m25p80_sfdp.c | 68 ++++++++++++++++++++++++++++++++++++++++++ | ||
13 | 3 files changed, 71 insertions(+), 2 deletions(-) | ||
14 | 12 | ||
15 | diff --git a/hw/block/m25p80_sfdp.h b/hw/block/m25p80_sfdp.h | 13 | diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c |
16 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/block/m25p80_sfdp.h | 15 | --- a/hw/arm/aspeed_soc.c |
18 | +++ b/hw/block/m25p80_sfdp.h | 16 | +++ b/hw/arm/aspeed_soc.c |
19 | @@ -XXX,XX +XXX,XX @@ uint8_t m25p80_sfdp_n25q256a(uint32_t addr); | 17 | @@ -XXX,XX +XXX,XX @@ static void aspeed_ast2400_soc_init(Object *obj) |
20 | 18 | object_initialize_child(obj, "video", &s->video, TYPE_UNIMPLEMENTED_DEVICE); | |
21 | uint8_t m25p80_sfdp_mx25l25635e(uint32_t addr); | 19 | } |
22 | uint8_t m25p80_sfdp_mx25l25635f(uint32_t addr); | 20 | |
23 | - | 21 | -static void aspeed_soc_realize(DeviceState *dev, Error **errp) |
24 | +uint8_t m25p80_sfdp_mx66l1g45g(uint32_t addr); | 22 | +static void aspeed_ast2400_soc_realize(DeviceState *dev, Error **errp) |
25 | 23 | { | |
26 | #endif | 24 | int i; |
27 | diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c | 25 | AspeedSoCState *s = ASPEED_SOC(dev); |
28 | index XXXXXXX..XXXXXXX 100644 | 26 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_class_init(ObjectClass *oc, void *data) |
29 | --- a/hw/block/m25p80.c | 27 | { |
30 | +++ b/hw/block/m25p80.c | 28 | DeviceClass *dc = DEVICE_CLASS(oc); |
31 | @@ -XXX,XX +XXX,XX @@ static const FlashPartInfo known_devices[] = { | 29 | |
32 | { INFO("mx66l51235f", 0xc2201a, 0, 64 << 10, 1024, ER_4K | ER_32K) }, | 30 | - dc->realize = aspeed_soc_realize; |
33 | { INFO("mx66u51235f", 0xc2253a, 0, 64 << 10, 1024, ER_4K | ER_32K) }, | 31 | - /* Reason: Uses serial_hds and nd_table in realize() directly */ |
34 | { INFO("mx66u1g45g", 0xc2253b, 0, 64 << 10, 2048, ER_4K | ER_32K) }, | 32 | - dc->user_creatable = false; |
35 | - { INFO("mx66l1g45g", 0xc2201b, 0, 64 << 10, 2048, ER_4K | ER_32K) }, | 33 | device_class_set_props(dc, aspeed_soc_properties); |
36 | + { INFO("mx66l1g45g", 0xc2201b, 0, 64 << 10, 2048, ER_4K | ER_32K), | 34 | } |
37 | + .sfdp_read = m25p80_sfdp_mx66l1g45g }, | 35 | |
38 | 36 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo aspeed_soc_type_info = { | |
39 | /* Micron */ | 37 | static void aspeed_soc_ast2400_class_init(ObjectClass *oc, void *data) |
40 | { INFO("n25q032a11", 0x20bb16, 0, 64 << 10, 64, ER_4K) }, | 38 | { |
41 | diff --git a/hw/block/m25p80_sfdp.c b/hw/block/m25p80_sfdp.c | 39 | AspeedSoCClass *sc = ASPEED_SOC_CLASS(oc); |
42 | index XXXXXXX..XXXXXXX 100644 | 40 | + DeviceClass *dc = DEVICE_CLASS(oc); |
43 | --- a/hw/block/m25p80_sfdp.c | ||
44 | +++ b/hw/block/m25p80_sfdp.c | ||
45 | @@ -XXX,XX +XXX,XX @@ static const uint8_t sfdp_mx25l25635f[] = { | ||
46 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
47 | }; | ||
48 | define_sfdp_read(mx25l25635f); | ||
49 | + | 41 | + |
50 | +static const uint8_t sfdp_mx66l1g45g[] = { | 42 | + dc->realize = aspeed_ast2400_soc_realize; |
51 | + 0x53, 0x46, 0x44, 0x50, 0x06, 0x01, 0x02, 0xff, | 43 | + /* Reason: Uses serial_hds and nd_table in realize() directly */ |
52 | + 0x00, 0x06, 0x01, 0x10, 0x30, 0x00, 0x00, 0xff, | 44 | + dc->user_creatable = false; |
53 | + 0xc2, 0x00, 0x01, 0x04, 0x10, 0x01, 0x00, 0xff, | 45 | |
54 | + 0x84, 0x00, 0x01, 0x02, 0xc0, 0x00, 0x00, 0xff, | 46 | sc->name = "ast2400-a1"; |
55 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 47 | sc->cpu_type = ARM_CPU_TYPE_NAME("arm926"); |
56 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 48 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo aspeed_soc_ast2400_type_info = { |
57 | + 0xe5, 0x20, 0xfb, 0xff, 0xff, 0xff, 0xff, 0x3f, | 49 | static void aspeed_soc_ast2500_class_init(ObjectClass *oc, void *data) |
58 | + 0x44, 0xeb, 0x08, 0x6b, 0x08, 0x3b, 0x04, 0xbb, | 50 | { |
59 | + 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, | 51 | AspeedSoCClass *sc = ASPEED_SOC_CLASS(oc); |
60 | + 0xff, 0xff, 0x44, 0xeb, 0x0c, 0x20, 0x0f, 0x52, | 52 | + DeviceClass *dc = DEVICE_CLASS(oc); |
61 | + 0x10, 0xd8, 0x00, 0xff, 0xd6, 0x49, 0xc5, 0x00, | 53 | + |
62 | + 0x85, 0xdf, 0x04, 0xe3, 0x44, 0x03, 0x67, 0x38, | 54 | + dc->realize = aspeed_ast2400_soc_realize; |
63 | + 0x30, 0xb0, 0x30, 0xb0, 0xf7, 0xbd, 0xd5, 0x5c, | 55 | + /* Reason: Uses serial_hds and nd_table in realize() directly */ |
64 | + 0x4a, 0x9e, 0x29, 0xff, 0xf0, 0x50, 0xf9, 0x85, | 56 | + dc->user_creatable = false; |
65 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 57 | |
66 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 58 | sc->name = "ast2500-a1"; |
67 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 59 | sc->cpu_type = ARM_CPU_TYPE_NAME("arm1176"); |
68 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
69 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
70 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
71 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
72 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
73 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
74 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
75 | + 0x7f, 0xef, 0xff, 0xff, 0x21, 0x5c, 0xdc, 0xff, | ||
76 | + 0xff, 0xff, 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 | + 0x00, 0x36, 0x00, 0x27, 0x9d, 0xf9, 0xc0, 0x64, | ||
86 | + 0x85, 0xcb, 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 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
92 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
93 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
94 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
95 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
96 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
97 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
98 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
99 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
100 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
101 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
102 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
103 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
104 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
105 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
106 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
107 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
108 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
109 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
110 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
111 | + 0xc2, 0xf5, 0x08, 0x00, 0x0c, 0x04, 0x08, 0x08, | ||
112 | + 0x01, 0x00, 0x19, 0x0f, 0x01, 0x01, 0x06, 0xff, | ||
113 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
114 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
115 | +}; | ||
116 | +define_sfdp_read(mx66l1g45g); | ||
117 | -- | 60 | -- |
118 | 2.37.3 | 61 | 2.41.0 |
119 | 62 | ||
120 | 63 | diff view generated by jsdifflib |
1 | A mx25l25635f chip model is generally found on these machines. It's | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | newer and uses 4B opcodes which is better to exercise the support in | 2 | |
3 | the Linux kernel. | 3 | We want to derivate the big AspeedSoCState object in some more |
4 | 4 | SoC-specific ones. Since the object size will vary, allocate it | |
5 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | 5 | dynamically. |
6 | Message-Id: <20220722063602.128144-9-clg@kaod.org> | 6 | |
7 | Message-Id: <20221013161241.2805140-11-clg@kaod.org> | 7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
8 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 9 | Signed-off-by: Cédric Le Goater <clg@kaod.org> |
9 | --- | 10 | --- |
10 | hw/arm/aspeed.c | 6 +++--- | 11 | hw/arm/aspeed.c | 101 +++++++++++++++++++++++++----------------------- |
11 | 1 file changed, 3 insertions(+), 3 deletions(-) | 12 | 1 file changed, 52 insertions(+), 49 deletions(-) |
12 | 13 | ||
13 | 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 |
14 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/hw/arm/aspeed.c | 16 | --- a/hw/arm/aspeed.c |
16 | +++ b/hw/arm/aspeed.c | 17 | +++ b/hw/arm/aspeed.c |
17 | @@ -XXX,XX +XXX,XX @@ static void aspeed_machine_palmetto_class_init(ObjectClass *oc, void *data) | 18 | @@ -XXX,XX +XXX,XX @@ struct AspeedMachineState { |
18 | amc->soc_name = "ast2400-a1"; | 19 | MachineState parent_obj; |
19 | amc->hw_strap1 = PALMETTO_BMC_HW_STRAP1; | 20 | /* Public */ |
20 | amc->fmc_model = "n25q256a"; | 21 | |
21 | - amc->spi_model = "mx25l25635e"; | 22 | - AspeedSoCState soc; |
22 | + amc->spi_model = "mx25l25635f"; | 23 | + AspeedSoCState *soc; |
23 | amc->num_cs = 1; | 24 | MemoryRegion boot_rom; |
24 | amc->i2c_init = palmetto_bmc_i2c_init; | 25 | bool mmio_exec; |
25 | mc->default_ram_size = 256 * MiB; | 26 | uint32_t uart_chosen; |
26 | @@ -XXX,XX +XXX,XX @@ static void aspeed_machine_ast2500_evb_class_init(ObjectClass *oc, void *data) | 27 | @@ -XXX,XX +XXX,XX @@ static void write_boot_rom(BlockBackend *blk, hwaddr addr, size_t rom_size, |
27 | amc->soc_name = "ast2500-a1"; | 28 | static void aspeed_install_boot_rom(AspeedMachineState *bmc, BlockBackend *blk, |
28 | amc->hw_strap1 = AST2500_EVB_HW_STRAP1; | 29 | uint64_t rom_size) |
29 | amc->fmc_model = "mx25l25635e"; | 30 | { |
30 | - amc->spi_model = "mx25l25635e"; | 31 | - AspeedSoCState *soc = &bmc->soc; |
31 | + amc->spi_model = "mx25l25635f"; | 32 | + AspeedSoCState *soc = bmc->soc; |
32 | amc->num_cs = 1; | 33 | |
33 | amc->i2c_init = ast2500_evb_i2c_init; | 34 | memory_region_init_rom(&bmc->boot_rom, NULL, "aspeed.boot_rom", rom_size, |
34 | mc->default_ram_size = 512 * MiB; | 35 | &error_abort); |
35 | @@ -XXX,XX +XXX,XX @@ static void aspeed_machine_witherspoon_class_init(ObjectClass *oc, void *data) | 36 | @@ -XXX,XX +XXX,XX @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo) |
36 | mc->desc = "OpenPOWER Witherspoon BMC (ARM1176)"; | 37 | static void connect_serial_hds_to_uarts(AspeedMachineState *bmc) |
37 | amc->soc_name = "ast2500-a1"; | 38 | { |
38 | amc->hw_strap1 = WITHERSPOON_BMC_HW_STRAP1; | 39 | AspeedMachineClass *amc = ASPEED_MACHINE_GET_CLASS(bmc); |
39 | - amc->fmc_model = "mx25l25635e"; | 40 | - AspeedSoCState *s = &bmc->soc; |
40 | + amc->fmc_model = "mx25l25635f"; | 41 | + AspeedSoCState *s = bmc->soc; |
41 | amc->spi_model = "mx66l1g45g"; | 42 | AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s); |
42 | amc->num_cs = 2; | 43 | int uart_chosen = bmc->uart_chosen ? bmc->uart_chosen : amc->uart_default; |
43 | amc->i2c_init = witherspoon_bmc_i2c_init; | 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); | ||
283 | } | ||
284 | |||
285 | static void qcom_dc_scm_firework_i2c_init(AspeedMachineState *bmc) | ||
286 | { | ||
287 | - AspeedSoCState *soc = &bmc->soc; | ||
288 | + AspeedSoCState *soc = bmc->soc; | ||
289 | I2CSlave *therm_mux, *cpuvr_mux; | ||
290 | |||
291 | /* Create the generic DC-SCM hardware */ | ||
292 | @@ -XXX,XX +XXX,XX @@ static void aspeed_machine_bletchley_class_init(ObjectClass *oc, void *data) | ||
293 | static void fby35_reset(MachineState *state, ShutdownCause reason) | ||
294 | { | ||
295 | AspeedMachineState *bmc = ASPEED_MACHINE(state); | ||
296 | - AspeedGPIOState *gpio = &bmc->soc.gpio; | ||
297 | + AspeedGPIOState *gpio = &bmc->soc->gpio; | ||
298 | |||
299 | qemu_devices_reset(reason); | ||
300 | |||
301 | @@ -XXX,XX +XXX,XX @@ static void aspeed_minibmc_machine_init(MachineState *machine) | ||
302 | sysclk = clock_new(OBJECT(machine), "SYSCLK"); | ||
303 | clock_set_hz(sysclk, SYSCLK_FRQ); | ||
304 | |||
305 | - object_initialize_child(OBJECT(machine), "soc", &bmc->soc, amc->soc_name); | ||
306 | - qdev_connect_clock_in(DEVICE(&bmc->soc), "sysclk", sysclk); | ||
307 | + bmc->soc = ASPEED_SOC(object_new(amc->soc_name)); | ||
308 | + object_property_add_child(OBJECT(machine), "soc", OBJECT(bmc->soc)); | ||
309 | + object_unref(OBJECT(bmc->soc)); | ||
310 | + qdev_connect_clock_in(DEVICE(bmc->soc), "sysclk", sysclk); | ||
311 | |||
312 | - object_property_set_link(OBJECT(&bmc->soc), "memory", | ||
313 | + object_property_set_link(OBJECT(bmc->soc), "memory", | ||
314 | OBJECT(get_system_memory()), &error_abort); | ||
315 | connect_serial_hds_to_uarts(bmc); | ||
316 | - qdev_realize(DEVICE(&bmc->soc), NULL, &error_abort); | ||
317 | + qdev_realize(DEVICE(bmc->soc), NULL, &error_abort); | ||
318 | |||
319 | - aspeed_board_init_flashes(&bmc->soc.fmc, | ||
320 | + aspeed_board_init_flashes(&bmc->soc->fmc, | ||
321 | bmc->fmc_model ? bmc->fmc_model : amc->fmc_model, | ||
322 | amc->num_cs, | ||
323 | 0); | ||
324 | |||
325 | - aspeed_board_init_flashes(&bmc->soc.spi[0], | ||
326 | + aspeed_board_init_flashes(&bmc->soc->spi[0], | ||
327 | bmc->spi_model ? bmc->spi_model : amc->spi_model, | ||
328 | amc->num_cs, amc->num_cs); | ||
329 | |||
330 | - aspeed_board_init_flashes(&bmc->soc.spi[1], | ||
331 | + aspeed_board_init_flashes(&bmc->soc->spi[1], | ||
332 | bmc->spi_model ? bmc->spi_model : amc->spi_model, | ||
333 | amc->num_cs, (amc->num_cs * 2)); | ||
334 | |||
335 | @@ -XXX,XX +XXX,XX @@ static void aspeed_minibmc_machine_init(MachineState *machine) | ||
336 | |||
337 | static void ast1030_evb_i2c_init(AspeedMachineState *bmc) | ||
338 | { | ||
339 | - AspeedSoCState *soc = &bmc->soc; | ||
340 | + AspeedSoCState *soc = bmc->soc; | ||
341 | |||
342 | /* U10 24C08 connects to SDA/SCL Group 1 by default */ | ||
343 | uint8_t *eeprom_buf = g_malloc0(32 * 1024); | ||
44 | -- | 344 | -- |
45 | 2.37.3 | 345 | 2.41.0 |
46 | 346 | ||
47 | 347 | diff view generated by jsdifflib |
1 | From: Patrick Williams <patrick@stwcx.xyz> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Generated from hardware using the following command and then padding | 3 | TYPE_ASPEED10X0_SOC inherits from TYPE_ASPEED_SOC. |
4 | with 0xff to fill out a power-of-2: | 4 | In few commits we'll add more fields, but to keep |
5 | hexdump -v -e '8/1 "0x%02x, " "\n"' sfdp` | 5 | review process simple, don't add any yet. |
6 | 6 | ||
7 | Signed-off-by: Patrick Williams <patrick@stwcx.xyz> | 7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | 8 | Reviewed-by: Cédric Le Goater <clg@kaod.org> |
9 | [ clg: removed extern ] | ||
10 | Message-Id: <20221006224424.3556372-1-patrick@stwcx.xyz> | ||
11 | Message-Id: <20221013161241.2805140-10-clg@kaod.org> | ||
12 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 9 | Signed-off-by: Cédric Le Goater <clg@kaod.org> |
13 | --- | 10 | --- |
14 | hw/block/m25p80_sfdp.h | 2 ++ | 11 | include/hw/arm/aspeed_soc.h | 7 +++++++ |
15 | hw/block/m25p80.c | 3 ++- | 12 | hw/arm/aspeed_ast10x0.c | 26 +++++++++++++------------- |
16 | hw/block/m25p80_sfdp.c | 36 ++++++++++++++++++++++++++++++++++++ | 13 | 2 files changed, 20 insertions(+), 13 deletions(-) |
17 | 3 files changed, 40 insertions(+), 1 deletion(-) | ||
18 | 14 | ||
19 | diff --git a/hw/block/m25p80_sfdp.h b/hw/block/m25p80_sfdp.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/hw/block/m25p80_sfdp.h | 17 | --- a/include/hw/arm/aspeed_soc.h |
22 | +++ b/hw/block/m25p80_sfdp.h | 18 | +++ b/include/hw/arm/aspeed_soc.h |
23 | @@ -XXX,XX +XXX,XX @@ uint8_t m25p80_sfdp_mx66l1g45g(uint32_t addr); | 19 | @@ -XXX,XX +XXX,XX @@ struct AspeedSoCState { |
24 | uint8_t m25p80_sfdp_w25q256(uint32_t addr); | 20 | #define TYPE_ASPEED_SOC "aspeed-soc" |
25 | uint8_t m25p80_sfdp_w25q512jv(uint32_t addr); | 21 | OBJECT_DECLARE_TYPE(AspeedSoCState, AspeedSoCClass, ASPEED_SOC) |
26 | 22 | ||
27 | +uint8_t m25p80_sfdp_w25q01jvq(uint32_t addr); | 23 | +struct Aspeed10x0SoCState { |
24 | + AspeedSoCState parent; | ||
25 | +}; | ||
28 | + | 26 | + |
29 | #endif | 27 | +#define TYPE_ASPEED10X0_SOC "aspeed10x0-soc" |
30 | diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c | 28 | +OBJECT_DECLARE_SIMPLE_TYPE(Aspeed10x0SoCState, ASPEED10X0_SOC) |
29 | + | ||
30 | struct AspeedSoCClass { | ||
31 | DeviceClass parent_class; | ||
32 | |||
33 | diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c | ||
31 | index XXXXXXX..XXXXXXX 100644 | 34 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/hw/block/m25p80.c | 35 | --- a/hw/arm/aspeed_ast10x0.c |
33 | +++ b/hw/block/m25p80.c | 36 | +++ b/hw/arm/aspeed_ast10x0.c |
34 | @@ -XXX,XX +XXX,XX @@ static const FlashPartInfo known_devices[] = { | 37 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast1030_class_init(ObjectClass *klass, void *data) |
35 | .sfdp_read = m25p80_sfdp_w25q256 }, | 38 | sc->get_irq = aspeed_soc_ast1030_get_irq; |
36 | { INFO("w25q512jv", 0xef4020, 0, 64 << 10, 1024, ER_4K), | 39 | } |
37 | .sfdp_read = m25p80_sfdp_w25q512jv }, | 40 | |
38 | - { INFO("w25q01jvq", 0xef4021, 0, 64 << 10, 2048, ER_4K) }, | 41 | -static const TypeInfo aspeed_soc_ast1030_type_info = { |
39 | + { INFO("w25q01jvq", 0xef4021, 0, 64 << 10, 2048, ER_4K), | 42 | - .name = "ast1030-a1", |
40 | + .sfdp_read = m25p80_sfdp_w25q01jvq }, | 43 | - .parent = TYPE_ASPEED_SOC, |
44 | - .instance_size = sizeof(AspeedSoCState), | ||
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 | + }, | ||
41 | }; | 60 | }; |
42 | 61 | ||
43 | typedef enum { | 62 | -static void aspeed_soc_register_types(void) |
44 | diff --git a/hw/block/m25p80_sfdp.c b/hw/block/m25p80_sfdp.c | 63 | -{ |
45 | index XXXXXXX..XXXXXXX 100644 | 64 | - type_register_static(&aspeed_soc_ast1030_type_info); |
46 | --- a/hw/block/m25p80_sfdp.c | 65 | -} |
47 | +++ b/hw/block/m25p80_sfdp.c | 66 | - |
48 | @@ -XXX,XX +XXX,XX @@ static const uint8_t sfdp_w25q512jv[] = { | 67 | -type_init(aspeed_soc_register_types) |
49 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 68 | +DEFINE_TYPES(aspeed_soc_ast10x0_types) |
50 | }; | ||
51 | define_sfdp_read(w25q512jv); | ||
52 | + | ||
53 | +static const uint8_t sfdp_w25q01jvq[] = { | ||
54 | + 0x53, 0x46, 0x44, 0x50, 0x06, 0x01, 0x01, 0xff, | ||
55 | + 0x00, 0x06, 0x01, 0x10, 0x80, 0x00, 0x00, 0xff, | ||
56 | + 0x84, 0x00, 0x01, 0x02, 0xd0, 0x00, 0x00, 0xff, | ||
57 | + 0x03, 0x00, 0x01, 0x02, 0xf0, 0x00, 0x00, 0xff, | ||
58 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
59 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
60 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
61 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
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 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
66 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
67 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
68 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
69 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
70 | + 0xe5, 0x20, 0xfb, 0xff, 0xff, 0xff, 0xff, 0x3f, | ||
71 | + 0x44, 0xeb, 0x08, 0x6b, 0x08, 0x3b, 0x42, 0xbb, | ||
72 | + 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, | ||
73 | + 0xff, 0xff, 0x40, 0xeb, 0x0c, 0x20, 0x0f, 0x52, | ||
74 | + 0x10, 0xd8, 0x00, 0x00, 0x36, 0x02, 0xa6, 0x00, | ||
75 | + 0x82, 0xea, 0x14, 0xe2, 0xe9, 0x63, 0x76, 0x33, | ||
76 | + 0x7a, 0x75, 0x7a, 0x75, 0xf7, 0xa2, 0xd5, 0x5c, | ||
77 | + 0x19, 0xf7, 0x4d, 0xff, 0xe9, 0x70, 0xf9, 0xa5, | ||
78 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
79 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
80 | + 0xff, 0x0a, 0xf0, 0xff, 0x21, 0xff, 0xdc, 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 | +}; | ||
87 | +define_sfdp_read(w25q01jvq); | ||
88 | -- | 69 | -- |
89 | 2.37.3 | 70 | 2.41.0 |
90 | 71 | ||
91 | 72 | diff view generated by jsdifflib |
1 | The SFDP table size is 0x100 bytes long. The mandatory table for basic | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | features is available at byte 0x80 and two extra Winbond specifics | ||
3 | table are available at 0xC0 and 0xF0. | ||
4 | 2 | ||
5 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | 3 | TYPE_ASPEED2600_SOC inherits from TYPE_ASPEED_SOC. |
6 | Message-Id: <20220722063602.128144-8-clg@kaod.org> | 4 | In few commits we'll add more fields, but to keep |
7 | Message-Id: <20221013161241.2805140-9-clg@kaod.org> | 5 | review process simple, don't add any yet. |
6 | |||
7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
8 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
8 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 9 | Signed-off-by: Cédric Le Goater <clg@kaod.org> |
9 | --- | 10 | --- |
10 | hw/block/m25p80_sfdp.h | 1 + | 11 | include/hw/arm/aspeed_soc.h | 7 +++++++ |
11 | hw/block/m25p80.c | 3 ++- | 12 | hw/arm/aspeed_ast2600.c | 26 +++++++++++++------------- |
12 | hw/block/m25p80_sfdp.c | 36 ++++++++++++++++++++++++++++++++++++ | 13 | 2 files changed, 20 insertions(+), 13 deletions(-) |
13 | 3 files changed, 39 insertions(+), 1 deletion(-) | ||
14 | 14 | ||
15 | diff --git a/hw/block/m25p80_sfdp.h b/hw/block/m25p80_sfdp.h | 15 | diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h |
16 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/block/m25p80_sfdp.h | 17 | --- a/include/hw/arm/aspeed_soc.h |
18 | +++ b/hw/block/m25p80_sfdp.h | 18 | +++ b/include/hw/arm/aspeed_soc.h |
19 | @@ -XXX,XX +XXX,XX @@ uint8_t m25p80_sfdp_mx25l25635f(uint32_t addr); | 19 | @@ -XXX,XX +XXX,XX @@ struct AspeedSoCState { |
20 | uint8_t m25p80_sfdp_mx66l1g45g(uint32_t addr); | 20 | #define TYPE_ASPEED_SOC "aspeed-soc" |
21 | 21 | OBJECT_DECLARE_TYPE(AspeedSoCState, AspeedSoCClass, ASPEED_SOC) | |
22 | uint8_t m25p80_sfdp_w25q256(uint32_t addr); | 22 | |
23 | +uint8_t m25p80_sfdp_w25q512jv(uint32_t addr); | 23 | +struct Aspeed2600SoCState { |
24 | 24 | + AspeedSoCState parent; | |
25 | #endif | 25 | +}; |
26 | diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c | 26 | + |
27 | +#define TYPE_ASPEED2600_SOC "aspeed2600-soc" | ||
28 | +OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2600SoCState, ASPEED2600_SOC) | ||
29 | + | ||
30 | struct Aspeed10x0SoCState { | ||
31 | AspeedSoCState parent; | ||
32 | }; | ||
33 | diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c | ||
27 | index XXXXXXX..XXXXXXX 100644 | 34 | index XXXXXXX..XXXXXXX 100644 |
28 | --- a/hw/block/m25p80.c | 35 | --- a/hw/arm/aspeed_ast2600.c |
29 | +++ b/hw/block/m25p80.c | 36 | +++ b/hw/arm/aspeed_ast2600.c |
30 | @@ -XXX,XX +XXX,XX @@ static const FlashPartInfo known_devices[] = { | 37 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_class_init(ObjectClass *oc, void *data) |
31 | { INFO("w25q80bl", 0xef4014, 0, 64 << 10, 16, ER_4K) }, | 38 | sc->get_irq = aspeed_soc_ast2600_get_irq; |
32 | { INFO("w25q256", 0xef4019, 0, 64 << 10, 512, ER_4K), | 39 | } |
33 | .sfdp_read = m25p80_sfdp_w25q256 }, | 40 | |
34 | - { INFO("w25q512jv", 0xef4020, 0, 64 << 10, 1024, ER_4K) }, | 41 | -static const TypeInfo aspeed_soc_ast2600_type_info = { |
35 | + { INFO("w25q512jv", 0xef4020, 0, 64 << 10, 1024, ER_4K), | 42 | - .name = "ast2600-a3", |
36 | + .sfdp_read = m25p80_sfdp_w25q512jv }, | 43 | - .parent = TYPE_ASPEED_SOC, |
37 | { INFO("w25q01jvq", 0xef4021, 0, 64 << 10, 2048, ER_4K) }, | 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 | + }, | ||
38 | }; | 60 | }; |
39 | 61 | ||
40 | diff --git a/hw/block/m25p80_sfdp.c b/hw/block/m25p80_sfdp.c | 62 | -static void aspeed_soc_register_types(void) |
41 | index XXXXXXX..XXXXXXX 100644 | 63 | -{ |
42 | --- a/hw/block/m25p80_sfdp.c | 64 | - type_register_static(&aspeed_soc_ast2600_type_info); |
43 | +++ b/hw/block/m25p80_sfdp.c | 65 | -}; |
44 | @@ -XXX,XX +XXX,XX @@ static const uint8_t sfdp_w25q256[] = { | 66 | - |
45 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | 67 | -type_init(aspeed_soc_register_types) |
46 | }; | 68 | +DEFINE_TYPES(aspeed_soc_ast2600_types) |
47 | define_sfdp_read(w25q256); | ||
48 | + | ||
49 | +static const uint8_t sfdp_w25q512jv[] = { | ||
50 | + 0x53, 0x46, 0x44, 0x50, 0x06, 0x01, 0x01, 0xff, | ||
51 | + 0x00, 0x06, 0x01, 0x10, 0x80, 0x00, 0x00, 0xff, | ||
52 | + 0x84, 0x00, 0x01, 0x02, 0xd0, 0x00, 0x00, 0xff, | ||
53 | + 0x03, 0x00, 0x01, 0x02, 0xf0, 0x00, 0x00, 0xff, | ||
54 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
55 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
56 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
57 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
58 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
59 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
60 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
61 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
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 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
66 | + 0xe5, 0x20, 0xfb, 0xff, 0xff, 0xff, 0xff, 0x1f, | ||
67 | + 0x44, 0xeb, 0x08, 0x6b, 0x08, 0x3b, 0x42, 0xbb, | ||
68 | + 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, | ||
69 | + 0xff, 0xff, 0x40, 0xeb, 0x0c, 0x20, 0x0f, 0x52, | ||
70 | + 0x10, 0xd8, 0x00, 0x00, 0x36, 0x02, 0xa6, 0x00, | ||
71 | + 0x82, 0xea, 0x14, 0xe2, 0xe9, 0x63, 0x76, 0x33, | ||
72 | + 0x7a, 0x75, 0x7a, 0x75, 0xf7, 0xa2, 0xd5, 0x5c, | ||
73 | + 0x19, 0xf7, 0x4d, 0xff, 0xe9, 0x70, 0xf9, 0xa5, | ||
74 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
75 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
76 | + 0xff, 0x0a, 0xf0, 0xff, 0x21, 0xff, 0xdc, 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 | +}; | ||
83 | +define_sfdp_read(w25q512jv); | ||
84 | -- | 69 | -- |
85 | 2.37.3 | 70 | 2.41.0 |
86 | 71 | ||
87 | 72 | diff view generated by jsdifflib |
1 | The SFDP table is 0x80 bytes long. The mandatory table for basic | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | features is available at byte 0x30 and an extra Macronix specific | ||
3 | table is available at 0x60. | ||
4 | 2 | ||
5 | 4B opcodes are not supported. | 3 | TYPE_ASPEED2400_SOC inherits from TYPE_ASPEED_SOC. |
4 | In few commits we'll add more fields, but to keep | ||
5 | review process simple, don't add any yet. | ||
6 | 6 | ||
7 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | 7 | TYPE_ASPEED_SOC is common to various Aspeed SoCs, |
8 | Message-Id: <20220722063602.128144-4-clg@kaod.org> | 8 | define it in aspeed_soc_common.c. |
9 | Message-Id: <20221013161241.2805140-5-clg@kaod.org> | 9 | |
10 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
11 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
10 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 12 | Signed-off-by: Cédric Le Goater <clg@kaod.org> |
11 | --- | 13 | --- |
12 | hw/block/m25p80_sfdp.h | 3 +++ | 14 | include/hw/arm/aspeed_soc.h | 7 +++++ |
13 | hw/block/m25p80.c | 2 +- | 15 | hw/arm/aspeed_soc.c | 61 +++++++++++-------------------------- |
14 | hw/block/m25p80_sfdp.c | 26 ++++++++++++++++++++++++++ | 16 | hw/arm/aspeed_soc_common.c | 29 ++++++++++++++++++ |
15 | 3 files changed, 30 insertions(+), 1 deletion(-) | 17 | 3 files changed, 53 insertions(+), 44 deletions(-) |
16 | 18 | ||
17 | diff --git a/hw/block/m25p80_sfdp.h b/hw/block/m25p80_sfdp.h | 19 | diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h |
18 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/block/m25p80_sfdp.h | 21 | --- a/include/hw/arm/aspeed_soc.h |
20 | +++ b/hw/block/m25p80_sfdp.h | 22 | +++ b/include/hw/arm/aspeed_soc.h |
23 | @@ -XXX,XX +XXX,XX @@ struct AspeedSoCState { | ||
24 | #define TYPE_ASPEED_SOC "aspeed-soc" | ||
25 | OBJECT_DECLARE_TYPE(AspeedSoCState, AspeedSoCClass, ASPEED_SOC) | ||
26 | |||
27 | +struct Aspeed2400SoCState { | ||
28 | + AspeedSoCState parent; | ||
29 | +}; | ||
30 | + | ||
31 | +#define TYPE_ASPEED2400_SOC "aspeed2400-soc" | ||
32 | +OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2400SoCState, ASPEED2400_SOC) | ||
33 | + | ||
34 | struct Aspeed2600SoCState { | ||
35 | AspeedSoCState parent; | ||
36 | }; | ||
37 | diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c | ||
38 | index XXXXXXX..XXXXXXX 100644 | ||
39 | --- a/hw/arm/aspeed_soc.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 | ||
21 | @@ -XXX,XX +XXX,XX @@ | 126 | @@ -XXX,XX +XXX,XX @@ |
22 | 127 | ||
23 | uint8_t m25p80_sfdp_n25q256a(uint32_t addr); | 128 | #include "qemu/osdep.h" |
24 | 129 | #include "qapi/error.h" | |
25 | +uint8_t m25p80_sfdp_mx25l25635e(uint32_t addr); | 130 | +#include "hw/qdev-properties.h" |
131 | #include "hw/misc/unimp.h" | ||
132 | #include "hw/arm/aspeed_soc.h" | ||
133 | #include "hw/char/serial.h" | ||
134 | @@ -XXX,XX +XXX,XX @@ void aspeed_mmio_map_unimplemented(AspeedSoCState *s, SysBusDevice *dev, | ||
135 | memory_region_add_subregion_overlap(s->memory, addr, | ||
136 | sysbus_mmio_get_region(dev, 0), -1000); | ||
137 | } | ||
26 | + | 138 | + |
139 | +static Property aspeed_soc_properties[] = { | ||
140 | + DEFINE_PROP_LINK("dram", AspeedSoCState, dram_mr, TYPE_MEMORY_REGION, | ||
141 | + MemoryRegion *), | ||
142 | + DEFINE_PROP_LINK("memory", AspeedSoCState, memory, TYPE_MEMORY_REGION, | ||
143 | + MemoryRegion *), | ||
144 | + DEFINE_PROP_END_OF_LIST(), | ||
145 | +}; | ||
27 | + | 146 | + |
28 | #endif | 147 | +static void aspeed_soc_class_init(ObjectClass *oc, void *data) |
29 | diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c | 148 | +{ |
30 | index XXXXXXX..XXXXXXX 100644 | 149 | + DeviceClass *dc = DEVICE_CLASS(oc); |
31 | --- a/hw/block/m25p80.c | ||
32 | +++ b/hw/block/m25p80.c | ||
33 | @@ -XXX,XX +XXX,XX @@ static const FlashPartInfo known_devices[] = { | ||
34 | { INFO("mx25l12805d", 0xc22018, 0, 64 << 10, 256, 0) }, | ||
35 | { INFO("mx25l12855e", 0xc22618, 0, 64 << 10, 256, 0) }, | ||
36 | { INFO6("mx25l25635e", 0xc22019, 0xc22019, 64 << 10, 512, | ||
37 | - ER_4K | ER_32K) }, | ||
38 | + ER_4K | ER_32K), .sfdp_read = m25p80_sfdp_mx25l25635e }, | ||
39 | { INFO("mx25l25655e", 0xc22619, 0, 64 << 10, 512, 0) }, | ||
40 | { INFO("mx66l51235f", 0xc2201a, 0, 64 << 10, 1024, ER_4K | ER_32K) }, | ||
41 | { INFO("mx66u51235f", 0xc2253a, 0, 64 << 10, 1024, ER_4K | ER_32K) }, | ||
42 | diff --git a/hw/block/m25p80_sfdp.c b/hw/block/m25p80_sfdp.c | ||
43 | index XXXXXXX..XXXXXXX 100644 | ||
44 | --- a/hw/block/m25p80_sfdp.c | ||
45 | +++ b/hw/block/m25p80_sfdp.c | ||
46 | @@ -XXX,XX +XXX,XX @@ static const uint8_t sfdp_n25q256a[] = { | ||
47 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
48 | }; | ||
49 | define_sfdp_read(n25q256a); | ||
50 | + | 150 | + |
151 | + device_class_set_props(dc, aspeed_soc_properties); | ||
152 | +} | ||
51 | + | 153 | + |
52 | +/* | 154 | +static const TypeInfo aspeed_soc_types[] = { |
53 | + * Matronix | 155 | + { |
54 | + */ | 156 | + .name = TYPE_ASPEED_SOC, |
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 | +}; | ||
55 | + | 164 | + |
56 | +/* mx25l25635e. No 4B opcodes */ | 165 | +DEFINE_TYPES(aspeed_soc_types) |
57 | +static const uint8_t sfdp_mx25l25635e[] = { | ||
58 | + 0x53, 0x46, 0x44, 0x50, 0x00, 0x01, 0x01, 0xff, | ||
59 | + 0x00, 0x00, 0x01, 0x09, 0x30, 0x00, 0x00, 0xff, | ||
60 | + 0xc2, 0x00, 0x01, 0x04, 0x60, 0x00, 0x00, 0xff, | ||
61 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
62 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
63 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
64 | + 0xe5, 0x20, 0xf3, 0xff, 0xff, 0xff, 0xff, 0x0f, | ||
65 | + 0x44, 0xeb, 0x08, 0x6b, 0x08, 0x3b, 0x04, 0xbb, | ||
66 | + 0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, | ||
67 | + 0xff, 0xff, 0x00, 0xff, 0x0c, 0x20, 0x0f, 0x52, | ||
68 | + 0x10, 0xd8, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
69 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
70 | + 0x00, 0x36, 0x00, 0x27, 0xf7, 0x4f, 0xff, 0xff, | ||
71 | + 0xd9, 0xc8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
72 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
73 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
74 | +}; | ||
75 | +define_sfdp_read(mx25l25635e) | ||
76 | -- | 166 | -- |
77 | 2.37.3 | 167 | 2.41.0 |
78 | 168 | ||
79 | 169 | diff view generated by jsdifflib |
1 | Store a reference on the AspeedSMC class under the flash object and | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | use it when accessing the flash contents. Avoiding the class cast | ||
3 | checkers in these hot paths improves performance by 10% when running | ||
4 | the aspeed avocado tests. | ||
5 | 2 | ||
6 | Message-Id: <20220923084803.498337-7-clg@kaod.org> | 3 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
4 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | ||
7 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 5 | Signed-off-by: Cédric Le Goater <clg@kaod.org> |
8 | --- | 6 | --- |
9 | include/hw/ssi/aspeed_smc.h | 2 ++ | 7 | hw/arm/aspeed_soc_common.c | 11 +++++++++++ |
10 | hw/ssi/aspeed_smc.c | 9 ++++----- | 8 | 1 file changed, 11 insertions(+) |
11 | 2 files changed, 6 insertions(+), 5 deletions(-) | ||
12 | 9 | ||
13 | diff --git a/include/hw/ssi/aspeed_smc.h b/include/hw/ssi/aspeed_smc.h | 10 | diff --git a/hw/arm/aspeed_soc_common.c b/hw/arm/aspeed_soc_common.c |
14 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/hw/ssi/aspeed_smc.h | 12 | --- a/hw/arm/aspeed_soc_common.c |
16 | +++ b/include/hw/ssi/aspeed_smc.h | 13 | +++ b/hw/arm/aspeed_soc_common.c |
17 | @@ -XXX,XX +XXX,XX @@ | 14 | @@ -XXX,XX +XXX,XX @@ void aspeed_mmio_map_unimplemented(AspeedSoCState *s, SysBusDevice *dev, |
18 | #include "qom/object.h" | 15 | sysbus_mmio_get_region(dev, 0), -1000); |
19 | 16 | } | |
20 | struct AspeedSMCState; | 17 | |
21 | +struct AspeedSMCClass; | 18 | +static void aspeed_soc_realize(DeviceState *dev, Error **errp) |
22 | 19 | +{ | |
23 | #define TYPE_ASPEED_SMC_FLASH "aspeed.smc.flash" | 20 | + AspeedSoCState *s = ASPEED_SOC(dev); |
24 | OBJECT_DECLARE_SIMPLE_TYPE(AspeedSMCFlash, ASPEED_SMC_FLASH) | 21 | + |
25 | @@ -XXX,XX +XXX,XX @@ struct AspeedSMCFlash { | 22 | + if (!s->memory) { |
26 | SysBusDevice parent_obj; | 23 | + error_setg(errp, "'memory' link is not set"); |
27 | 24 | + return; | |
28 | struct AspeedSMCState *controller; | 25 | + } |
29 | + struct AspeedSMCClass *asc; | 26 | +} |
30 | uint8_t cs; | 27 | + |
31 | 28 | static Property aspeed_soc_properties[] = { | |
32 | MemoryRegion mmio; | 29 | DEFINE_PROP_LINK("dram", AspeedSoCState, dram_mr, TYPE_MEMORY_REGION, |
33 | diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c | 30 | MemoryRegion *), |
34 | index XXXXXXX..XXXXXXX 100644 | 31 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_class_init(ObjectClass *oc, void *data) |
35 | --- a/hw/ssi/aspeed_smc.c | ||
36 | +++ b/hw/ssi/aspeed_smc.c | ||
37 | @@ -XXX,XX +XXX,XX @@ static inline int aspeed_smc_flash_cmd(const AspeedSMCFlash *fl) | ||
38 | static inline int aspeed_smc_flash_addr_width(const AspeedSMCFlash *fl) | ||
39 | { | 32 | { |
40 | const AspeedSMCState *s = fl->controller; | 33 | DeviceClass *dc = DEVICE_CLASS(oc); |
41 | - AspeedSMCClass *asc = ASPEED_SMC_GET_CLASS(s); | 34 | |
42 | + AspeedSMCClass *asc = fl->asc; | 35 | + dc->realize = aspeed_soc_realize; |
43 | 36 | device_class_set_props(dc, aspeed_soc_properties); | |
44 | if (asc->addr_width) { | ||
45 | return asc->addr_width(s); | ||
46 | @@ -XXX,XX +XXX,XX @@ static uint32_t aspeed_smc_check_segment_addr(const AspeedSMCFlash *fl, | ||
47 | uint32_t addr) | ||
48 | { | ||
49 | const AspeedSMCState *s = fl->controller; | ||
50 | - AspeedSMCClass *asc = ASPEED_SMC_GET_CLASS(s); | ||
51 | + AspeedSMCClass *asc = fl->asc; | ||
52 | AspeedSegments seg; | ||
53 | |||
54 | asc->reg_to_segment(s, s->regs[R_SEG_ADDR0 + fl->cs], &seg); | ||
55 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo aspeed_smc_info = { | ||
56 | static void aspeed_smc_flash_realize(DeviceState *dev, Error **errp) | ||
57 | { | ||
58 | AspeedSMCFlash *s = ASPEED_SMC_FLASH(dev); | ||
59 | - AspeedSMCClass *asc; | ||
60 | g_autofree char *name = g_strdup_printf(TYPE_ASPEED_SMC_FLASH ".%d", s->cs); | ||
61 | |||
62 | if (!s->controller) { | ||
63 | @@ -XXX,XX +XXX,XX @@ static void aspeed_smc_flash_realize(DeviceState *dev, Error **errp) | ||
64 | return; | ||
65 | } | ||
66 | |||
67 | - asc = ASPEED_SMC_GET_CLASS(s->controller); | ||
68 | + s->asc = ASPEED_SMC_GET_CLASS(s->controller); | ||
69 | |||
70 | /* | ||
71 | * Use the default segment value to size the memory region. This | ||
72 | * can be changed by FW at runtime. | ||
73 | */ | ||
74 | memory_region_init_io(&s->mmio, OBJECT(s), &aspeed_smc_flash_ops, | ||
75 | - s, name, asc->segments[s->cs].size); | ||
76 | + s, name, s->asc->segments[s->cs].size); | ||
77 | sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mmio); | ||
78 | } | 37 | } |
79 | 38 | ||
80 | -- | 39 | -- |
81 | 2.37.3 | 40 | 2.41.0 |
82 | 41 | ||
83 | 42 | diff view generated by jsdifflib |
1 | From: Patrick Williams <patrick@stwcx.xyz> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | For the PVT-class hardware we have increased the memory size of | 3 | The v7-M core is specific to the Aspeed 10x0 series, |
4 | this device to 2 GiB. Adjust the device model accordingly. | 4 | remove it from the common AspeedSoCState. |
5 | 5 | ||
6 | Signed-off-by: Patrick Williams <patrick@stwcx.xyz> | 6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
7 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 7 | Reviewed-by: Cédric Le Goater <clg@kaod.org> |
8 | Message-Id: <20221007110529.3657749-1-patrick@stwcx.xyz> | ||
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/arm/aspeed.c | 9 ++++++++- | 10 | include/hw/arm/aspeed_soc.h | 5 ++--- |
12 | 1 file changed, 8 insertions(+), 1 deletion(-) | 11 | hw/arm/aspeed_ast10x0.c | 27 +++++++++++++++------------ |
12 | hw/arm/fby35.c | 13 ++++++++----- | ||
13 | 3 files changed, 25 insertions(+), 20 deletions(-) | ||
13 | 14 | ||
14 | diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c | 15 | diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h |
15 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/arm/aspeed.c | 17 | --- a/include/hw/arm/aspeed_soc.h |
17 | +++ b/hw/arm/aspeed.c | 18 | +++ b/include/hw/arm/aspeed_soc.h |
18 | @@ -XXX,XX +XXX,XX @@ static void aspeed_machine_fuji_class_init(ObjectClass *oc, void *data) | 19 | @@ -XXX,XX +XXX,XX @@ |
19 | aspeed_soc_num_cpus(amc->soc_name); | 20 | #define ASPEED_JTAG_NUM 2 |
21 | |||
22 | struct AspeedSoCState { | ||
23 | - /*< private >*/ | ||
24 | DeviceState parent; | ||
25 | |||
26 | - /*< public >*/ | ||
27 | ARMCPU cpu[ASPEED_CPUS_NUM]; | ||
28 | A15MPPrivState a7mpcore; | ||
29 | - ARMv7MState armv7m; | ||
30 | MemoryRegion *memory; | ||
31 | MemoryRegion *dram_mr; | ||
32 | MemoryRegion dram_container; | ||
33 | @@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2600SoCState, ASPEED2600_SOC) | ||
34 | |||
35 | struct Aspeed10x0SoCState { | ||
36 | AspeedSoCState parent; | ||
37 | + | ||
38 | + ARMv7MState armv7m; | ||
20 | }; | 39 | }; |
21 | 40 | ||
22 | +/* On 32-bit hosts, lower RAM to 1G because of the 2047 MB limit */ | 41 | #define TYPE_ASPEED10X0_SOC "aspeed10x0-soc" |
23 | +#if HOST_LONG_BITS == 32 | 42 | diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c |
24 | +#define BLETCHLEY_BMC_RAM_SIZE (1 * GiB) | 43 | index XXXXXXX..XXXXXXX 100644 |
25 | +#else | 44 | --- a/hw/arm/aspeed_ast10x0.c |
26 | +#define BLETCHLEY_BMC_RAM_SIZE (2 * GiB) | 45 | +++ b/hw/arm/aspeed_ast10x0.c |
27 | +#endif | 46 | @@ -XXX,XX +XXX,XX @@ static const int aspeed_soc_ast1030_irqmap[] = { |
47 | |||
48 | static qemu_irq aspeed_soc_ast1030_get_irq(AspeedSoCState *s, int dev) | ||
49 | { | ||
50 | + Aspeed10x0SoCState *a = ASPEED10X0_SOC(s); | ||
51 | AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s); | ||
52 | |||
53 | - return qdev_get_gpio_in(DEVICE(&s->armv7m), sc->irqmap[dev]); | ||
54 | + return qdev_get_gpio_in(DEVICE(&a->armv7m), sc->irqmap[dev]); | ||
55 | } | ||
56 | |||
57 | static void aspeed_soc_ast1030_init(Object *obj) | ||
58 | { | ||
59 | + Aspeed10x0SoCState *a = ASPEED10X0_SOC(obj); | ||
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; | ||
156 | }; | ||
157 | @@ -XXX,XX +XXX,XX @@ static void fby35_bmc_init(Fby35State *s) | ||
158 | |||
159 | static void fby35_bic_init(Fby35State *s) | ||
160 | { | ||
161 | + AspeedSoCState *soc; | ||
28 | + | 162 | + |
29 | static void aspeed_machine_bletchley_class_init(ObjectClass *oc, void *data) | 163 | s->bic_sysclk = clock_new(OBJECT(s), "SYSCLK"); |
30 | { | 164 | clock_set_hz(s->bic_sysclk, 200000000ULL); |
31 | MachineClass *mc = MACHINE_CLASS(oc); | 165 | |
32 | @@ -XXX,XX +XXX,XX @@ static void aspeed_machine_bletchley_class_init(ObjectClass *oc, void *data) | 166 | object_initialize_child(OBJECT(s), "bic", &s->bic, "ast1030-a1"); |
33 | amc->num_cs = 2; | 167 | + soc = ASPEED_SOC(&s->bic); |
34 | amc->macs_mask = ASPEED_MAC2_ON; | 168 | |
35 | amc->i2c_init = bletchley_bmc_i2c_init; | 169 | memory_region_init(&s->bic_memory, OBJECT(&s->bic), "bic-memory", |
36 | - mc->default_ram_size = 512 * MiB; | 170 | UINT64_MAX); |
37 | + mc->default_ram_size = BLETCHLEY_BMC_RAM_SIZE; | 171 | @@ -XXX,XX +XXX,XX @@ static void fby35_bic_init(Fby35State *s) |
38 | mc->default_cpus = mc->min_cpus = mc->max_cpus = | 172 | qdev_connect_clock_in(DEVICE(&s->bic), "sysclk", s->bic_sysclk); |
39 | aspeed_soc_num_cpus(amc->soc_name); | 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); | ||
40 | } | 185 | } |
186 | |||
187 | static void fby35_init(MachineState *machine) | ||
41 | -- | 188 | -- |
42 | 2.37.3 | 189 | 2.41.0 |
43 | 190 | ||
44 | 191 | diff view generated by jsdifflib |
1 | Currently, the CPU features exposed to the AST2600 QEMU machines are : | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt | 3 | The v7-A cluster is specific to the Aspeed 2600 series, |
4 | vfpd32 lpae evtstrm | 4 | remove it from the common AspeedSoCState. |
5 | 5 | ||
6 | But, the features of the Cortex A7 CPU on the Aspeed AST2600 A3 SoC | 6 | The ARM cores belong to the MP cluster, but the array |
7 | are : | 7 | is currently used by TYPE_ASPEED2600_SOC. We'll clean |
8 | 8 | that soon, but for now keep it in Aspeed2600SoCState. | |
9 | half thumb fastmult vfp edsp vfpv3 vfpv3d16 tls vfpv4 idiva idivt | 9 | |
10 | lpae evtstrm | 10 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
11 | 11 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | |
12 | Drop NEON support in the Aspeed AST2600 SoC. | ||
13 | |||
14 | Reviewed-by: Joel Stanley <joel@jms.id.au> | ||
15 | Message-Id: <20220928164719.655586-3-clg@kaod.org> | ||
16 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 12 | Signed-off-by: Cédric Le Goater <clg@kaod.org> |
17 | --- | 13 | --- |
18 | hw/arm/aspeed_ast2600.c | 2 ++ | 14 | include/hw/arm/aspeed_soc.h | 4 ++- |
19 | 1 file changed, 2 insertions(+) | 15 | hw/arm/aspeed_ast2600.c | 49 ++++++++++++++++++++----------------- |
20 | 16 | hw/arm/fby35.c | 14 ++++++----- | |
17 | 3 files changed, 37 insertions(+), 30 deletions(-) | ||
18 | |||
19 | diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/include/hw/arm/aspeed_soc.h | ||
22 | +++ b/include/hw/arm/aspeed_soc.h | ||
23 | @@ -XXX,XX +XXX,XX @@ struct AspeedSoCState { | ||
24 | DeviceState parent; | ||
25 | |||
26 | ARMCPU cpu[ASPEED_CPUS_NUM]; | ||
27 | - A15MPPrivState a7mpcore; | ||
28 | MemoryRegion *memory; | ||
29 | MemoryRegion *dram_mr; | ||
30 | MemoryRegion dram_container; | ||
31 | @@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(Aspeed2400SoCState, ASPEED2400_SOC) | ||
32 | |||
33 | struct Aspeed2600SoCState { | ||
34 | AspeedSoCState parent; | ||
35 | + | ||
36 | + A15MPPrivState a7mpcore; | ||
37 | + ARMCPU cpu[ASPEED_CPUS_NUM]; /* XXX belong to a7mpcore */ | ||
38 | }; | ||
39 | |||
40 | #define TYPE_ASPEED2600_SOC "aspeed2600-soc" | ||
21 | 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 |
22 | index XXXXXXX..XXXXXXX 100644 | 42 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/hw/arm/aspeed_ast2600.c | 43 | --- a/hw/arm/aspeed_ast2600.c |
24 | +++ b/hw/arm/aspeed_ast2600.c | 44 | +++ b/hw/arm/aspeed_ast2600.c |
25 | @@ -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[] = { |
26 | 46 | ||
27 | object_property_set_int(OBJECT(&s->cpu[i]), "cntfrq", 1125000000, | 47 | static qemu_irq aspeed_soc_ast2600_get_irq(AspeedSoCState *s, int dev) |
48 | { | ||
49 | + Aspeed2600SoCState *a = ASPEED2600_SOC(s); | ||
50 | AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s); | ||
51 | |||
52 | - return qdev_get_gpio_in(DEVICE(&s->a7mpcore), sc->irqmap[dev]); | ||
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, | ||
28 | &error_abort); | 102 | &error_abort); |
29 | + object_property_set_bool(OBJECT(&s->cpu[i]), "neon", false, | 103 | - object_property_set_bool(OBJECT(&s->cpu[i]), "neon", false, |
30 | + &error_abort); | 104 | + object_property_set_bool(OBJECT(&a->cpu[i]), "neon", false, |
31 | object_property_set_link(OBJECT(&s->cpu[i]), "memory", | 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", | ||
32 | OBJECT(s->memory), &error_abort); | 111 | OBJECT(s->memory), &error_abort); |
33 | 112 | ||
113 | - if (!qdev_realize(DEVICE(&s->cpu[i]), NULL, errp)) { | ||
114 | + if (!qdev_realize(DEVICE(&a->cpu[i]), NULL, errp)) { | ||
115 | return; | ||
116 | } | ||
117 | } | ||
118 | |||
119 | /* A7MPCORE */ | ||
120 | - object_property_set_int(OBJECT(&s->a7mpcore), "num-cpu", sc->num_cpus, | ||
121 | + object_property_set_int(OBJECT(&a->a7mpcore), "num-cpu", sc->num_cpus, | ||
122 | &error_abort); | ||
123 | - object_property_set_int(OBJECT(&s->a7mpcore), "num-irq", | ||
124 | + object_property_set_int(OBJECT(&a->a7mpcore), "num-irq", | ||
125 | ROUND_UP(AST2600_MAX_IRQ + GIC_INTERNAL, 32), | ||
126 | &error_abort); | ||
127 | |||
128 | - sysbus_realize(SYS_BUS_DEVICE(&s->a7mpcore), &error_abort); | ||
129 | - aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->a7mpcore), 0, ASPEED_A7MPCORE_ADDR); | ||
130 | + sysbus_realize(SYS_BUS_DEVICE(&a->a7mpcore), &error_abort); | ||
131 | + aspeed_mmio_map(s, SYS_BUS_DEVICE(&a->a7mpcore), 0, ASPEED_A7MPCORE_ADDR); | ||
132 | |||
133 | for (i = 0; i < sc->num_cpus; i++) { | ||
134 | - SysBusDevice *sbd = SYS_BUS_DEVICE(&s->a7mpcore); | ||
135 | - DeviceState *d = DEVICE(&s->cpu[i]); | ||
136 | + SysBusDevice *sbd = SYS_BUS_DEVICE(&a->a7mpcore); | ||
137 | + DeviceState *d = DEVICE(&a->cpu[i]); | ||
138 | |||
139 | irq = qdev_get_gpio_in(d, ARM_CPU_IRQ); | ||
140 | sysbus_connect_irq(sbd, i, irq); | ||
141 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) | ||
142 | } | ||
143 | |||
144 | /* SRAM */ | ||
145 | - sram_name = g_strdup_printf("aspeed.sram.%d", CPU(&s->cpu[0])->cpu_index); | ||
146 | + sram_name = g_strdup_printf("aspeed.sram.%d", CPU(&a->cpu[0])->cpu_index); | ||
147 | memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_size, &err); | ||
148 | if (err) { | ||
149 | error_propagate(errp, err); | ||
150 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) | ||
151 | } | ||
152 | aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->i2c), 0, sc->memmap[ASPEED_DEV_I2C]); | ||
153 | for (i = 0; i < ASPEED_I2C_GET_CLASS(&s->i2c)->num_busses; i++) { | ||
154 | - irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), | ||
155 | + irq = qdev_get_gpio_in(DEVICE(&a->a7mpcore), | ||
156 | sc->irqmap[ASPEED_DEV_I2C] + i); | ||
157 | /* The AST2600 I2C controller has one IRQ per bus. */ | ||
158 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c.busses[i]), 0, irq); | ||
159 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) | ||
160 | * offset 0. | ||
161 | */ | ||
162 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->lpc), 1 + aspeed_lpc_kcs_1, | ||
163 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), | ||
164 | + qdev_get_gpio_in(DEVICE(&a->a7mpcore), | ||
165 | sc->irqmap[ASPEED_DEV_KCS] + aspeed_lpc_kcs_1)); | ||
166 | |||
167 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->lpc), 1 + aspeed_lpc_kcs_2, | ||
168 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), | ||
169 | + qdev_get_gpio_in(DEVICE(&a->a7mpcore), | ||
170 | sc->irqmap[ASPEED_DEV_KCS] + aspeed_lpc_kcs_2)); | ||
171 | |||
172 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->lpc), 1 + aspeed_lpc_kcs_3, | ||
173 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), | ||
174 | + qdev_get_gpio_in(DEVICE(&a->a7mpcore), | ||
175 | sc->irqmap[ASPEED_DEV_KCS] + aspeed_lpc_kcs_3)); | ||
176 | |||
177 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->lpc), 1 + aspeed_lpc_kcs_4, | ||
178 | - qdev_get_gpio_in(DEVICE(&s->a7mpcore), | ||
179 | + qdev_get_gpio_in(DEVICE(&a->a7mpcore), | ||
180 | sc->irqmap[ASPEED_DEV_KCS] + aspeed_lpc_kcs_4)); | ||
181 | |||
182 | /* HACE */ | ||
183 | @@ -XXX,XX +XXX,XX @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) | ||
184 | } | ||
185 | aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->i3c), 0, sc->memmap[ASPEED_DEV_I3C]); | ||
186 | for (i = 0; i < ASPEED_I3C_NR_DEVICES; i++) { | ||
187 | - irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), | ||
188 | + irq = qdev_get_gpio_in(DEVICE(&a->a7mpcore), | ||
189 | sc->irqmap[ASPEED_DEV_I3C] + i); | ||
190 | /* The AST2600 I3C controller has one IRQ per bus. */ | ||
191 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->i3c.devices[i]), 0, irq); | ||
192 | diff --git a/hw/arm/fby35.c b/hw/arm/fby35.c | ||
193 | index XXXXXXX..XXXXXXX 100644 | ||
194 | --- a/hw/arm/fby35.c | ||
195 | +++ b/hw/arm/fby35.c | ||
196 | @@ -XXX,XX +XXX,XX @@ struct Fby35State { | ||
197 | MemoryRegion bic_memory; | ||
198 | Clock *bic_sysclk; | ||
199 | |||
200 | - AspeedSoCState bmc; | ||
201 | + Aspeed2600SoCState bmc; | ||
202 | Aspeed10x0SoCState bic; | ||
203 | |||
204 | bool mmio_exec; | ||
205 | @@ -XXX,XX +XXX,XX @@ static void fby35_bmc_write_boot_rom(DriveInfo *dinfo, MemoryRegion *mr, | ||
206 | |||
207 | static void fby35_bmc_init(Fby35State *s) | ||
208 | { | ||
209 | + AspeedSoCState *soc; | ||
210 | + | ||
211 | object_initialize_child(OBJECT(s), "bmc", &s->bmc, "ast2600-a3"); | ||
212 | + soc = ASPEED_SOC(&s->bmc); | ||
213 | |||
214 | memory_region_init(&s->bmc_memory, OBJECT(&s->bmc), "bmc-memory", | ||
215 | UINT64_MAX); | ||
216 | @@ -XXX,XX +XXX,XX @@ static void fby35_bmc_init(Fby35State *s) | ||
217 | &error_abort); | ||
218 | object_property_set_int(OBJECT(&s->bmc), "hw-strap2", 0x00000003, | ||
219 | &error_abort); | ||
220 | - aspeed_soc_uart_set_chr(&s->bmc, ASPEED_DEV_UART5, serial_hd(0)); | ||
221 | + aspeed_soc_uart_set_chr(soc, ASPEED_DEV_UART5, serial_hd(0)); | ||
222 | qdev_realize(DEVICE(&s->bmc), NULL, &error_abort); | ||
223 | |||
224 | - aspeed_board_init_flashes(&s->bmc.fmc, "n25q00", 2, 0); | ||
225 | + aspeed_board_init_flashes(&soc->fmc, "n25q00", 2, 0); | ||
226 | |||
227 | /* Install first FMC flash content as a boot rom. */ | ||
228 | if (!s->mmio_exec) { | ||
229 | DriveInfo *mtd0 = drive_get(IF_MTD, 0, 0); | ||
230 | |||
231 | if (mtd0) { | ||
232 | - AspeedSoCState *bmc = &s->bmc; | ||
233 | - uint64_t rom_size = memory_region_size(&bmc->spi_boot); | ||
234 | + uint64_t rom_size = memory_region_size(&soc->spi_boot); | ||
235 | |||
236 | memory_region_init_rom(&s->bmc_boot_rom, NULL, "aspeed.boot_rom", | ||
237 | rom_size, &error_abort); | ||
238 | - memory_region_add_subregion_overlap(&bmc->spi_boot_container, 0, | ||
239 | + memory_region_add_subregion_overlap(&soc->spi_boot_container, 0, | ||
240 | &s->bmc_boot_rom, 1); | ||
241 | |||
242 | fby35_bmc_write_boot_rom(mtd0, &s->bmc_boot_rom, | ||
34 | -- | 243 | -- |
35 | 2.37.3 | 244 | 2.41.0 |
36 | 245 | ||
37 | 246 | diff view generated by jsdifflib |
1 | From: Alex Bennée <alex.bennee@linaro.org> | 1 | From: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Investigating why some BMC models are so slow compared to a plain ARM | 3 | The ARM array and VIC peripheral are only used by the |
4 | virt machines I did some profiling of: | 4 | 2400 series, remove them from the common AspeedSoCState. |
5 | 5 | ||
6 | ./qemu-system-arm -M romulus-bmc -nic user \ | 6 | Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
7 | -drive | ||
8 | file=obmc-phosphor-image-romulus.static.mtd,format=raw,if=mtd \ | ||
9 | -nographic -serial mon:stdio | ||
10 | |||
11 | And saw that object_class_dynamic_cast_assert was dominating the | ||
12 | profile times. We have a number of cases in this model of the SSI bus. | ||
13 | As the class is static once the object is created we just cache it and | ||
14 | use it instead of the dynamic case macros. | ||
15 | |||
16 | Profiling against: | ||
17 | |||
18 | ./tests/venv/bin/avocado run \ | ||
19 | tests/avocado/machine_aspeed.py:test_arm_ast2500_romulus_openbmc_v2_9_0 | ||
20 | |||
21 | Before: 35.565 s ± 0.087 s | ||
22 | After: 15.713 s ± 0.287 s | ||
23 | |||
24 | Signed-off-by: Alex Bennée <alex.bennee@linaro.org> | ||
25 | Cc: Cédric Le Goater <clg@kaod.org> | ||
26 | Tested-by: Cédric Le Goater <clg@kaod.org> | ||
27 | Reviewed-by: Cédric Le Goater <clg@kaod.org> | 7 | Reviewed-by: Cédric Le Goater <clg@kaod.org> |
28 | Message-Id: <20220811151413.3350684-6-alex.bennee@linaro.org> | ||
29 | Message-Id: <20220923084803.498337-6-clg@kaod.org> | ||
30 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | 8 | Signed-off-by: Cédric Le Goater <clg@kaod.org> |
31 | --- | 9 | --- |
32 | include/hw/ssi/ssi.h | 3 +++ | 10 | include/hw/arm/aspeed_soc.h | 5 +++-- |
33 | hw/ssi/ssi.c | 18 ++++++++---------- | 11 | hw/arm/{aspeed_soc.c => aspeed_ast2400.c} | 27 +++++++++++++---------- |
34 | 2 files changed, 11 insertions(+), 10 deletions(-) | 12 | hw/arm/meson.build | 2 +- |
13 | 3 files changed, 19 insertions(+), 15 deletions(-) | ||
14 | rename hw/arm/{aspeed_soc.c => aspeed_ast2400.c} (95%) | ||
35 | 15 | ||
36 | diff --git a/include/hw/ssi/ssi.h b/include/hw/ssi/ssi.h | 16 | diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h |
37 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
38 | --- a/include/hw/ssi/ssi.h | 18 | --- a/include/hw/arm/aspeed_soc.h |
39 | +++ b/include/hw/ssi/ssi.h | 19 | +++ b/include/hw/arm/aspeed_soc.h |
40 | @@ -XXX,XX +XXX,XX @@ struct SSIPeripheralClass { | 20 | @@ -XXX,XX +XXX,XX @@ |
41 | struct SSIPeripheral { | 21 | struct AspeedSoCState { |
42 | DeviceState parent_obj; | 22 | DeviceState parent; |
43 | 23 | ||
44 | + /* cache the class */ | 24 | - ARMCPU cpu[ASPEED_CPUS_NUM]; |
45 | + SSIPeripheralClass *spc; | 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; | ||
46 | + | 39 | + |
47 | /* Chip select state */ | 40 | + ARMCPU cpu[ASPEED_CPUS_NUM]; |
48 | bool cs; | 41 | + AspeedVICState vic; |
49 | }; | 42 | }; |
50 | diff --git a/hw/ssi/ssi.c b/hw/ssi/ssi.c | 43 | |
44 | #define TYPE_ASPEED2400_SOC "aspeed2400-soc" | ||
45 | diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_ast2400.c | ||
46 | similarity index 95% | ||
47 | rename from hw/arm/aspeed_soc.c | ||
48 | rename to hw/arm/aspeed_ast2400.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | 49 | index XXXXXXX..XXXXXXX 100644 |
52 | --- a/hw/ssi/ssi.c | 50 | --- a/hw/arm/aspeed_soc.c |
53 | +++ b/hw/ssi/ssi.c | 51 | +++ b/hw/arm/aspeed_ast2400.c |
54 | @@ -XXX,XX +XXX,XX @@ static void ssi_cs_default(void *opaque, int n, int level) | 52 | @@ -XXX,XX +XXX,XX @@ static const int aspeed_soc_ast2400_irqmap[] = { |
55 | bool cs = !!level; | 53 | |
56 | assert(n == 0); | 54 | static qemu_irq aspeed_soc_ast2400_get_irq(AspeedSoCState *s, int dev) |
57 | if (s->cs != cs) { | 55 | { |
58 | - SSIPeripheralClass *ssc = SSI_PERIPHERAL_GET_CLASS(s); | 56 | + Aspeed2400SoCState *a = ASPEED2400_SOC(s); |
59 | - if (ssc->set_cs) { | 57 | AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s); |
60 | - ssc->set_cs(s, cs); | 58 | |
61 | + if (s->spc->set_cs) { | 59 | - return qdev_get_gpio_in(DEVICE(&s->vic), sc->irqmap[dev]); |
62 | + s->spc->set_cs(s, cs); | 60 | + return qdev_get_gpio_in(DEVICE(&a->vic), sc->irqmap[dev]); |
61 | } | ||
62 | |||
63 | static void aspeed_ast2400_soc_init(Object *obj) | ||
64 | { | ||
65 | + Aspeed2400SoCState *a = ASPEED2400_SOC(obj); | ||
66 | AspeedSoCState *s = ASPEED_SOC(obj); | ||
67 | AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s); | ||
68 | int i; | ||
69 | @@ -XXX,XX +XXX,XX @@ static void aspeed_ast2400_soc_init(Object *obj) | ||
70 | } | ||
71 | |||
72 | for (i = 0; i < sc->num_cpus; i++) { | ||
73 | - object_initialize_child(obj, "cpu[*]", &s->cpu[i], sc->cpu_type); | ||
74 | + object_initialize_child(obj, "cpu[*]", &a->cpu[i], sc->cpu_type); | ||
75 | } | ||
76 | |||
77 | snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname); | ||
78 | @@ -XXX,XX +XXX,XX @@ static void aspeed_ast2400_soc_init(Object *obj) | ||
79 | object_property_add_alias(obj, "hw-prot-key", OBJECT(&s->scu), | ||
80 | "hw-prot-key"); | ||
81 | |||
82 | - object_initialize_child(obj, "vic", &s->vic, TYPE_ASPEED_VIC); | ||
83 | + object_initialize_child(obj, "vic", &a->vic, TYPE_ASPEED_VIC); | ||
84 | |||
85 | object_initialize_child(obj, "rtc", &s->rtc, TYPE_ASPEED_RTC); | ||
86 | |||
87 | @@ -XXX,XX +XXX,XX @@ static void aspeed_ast2400_soc_init(Object *obj) | ||
88 | static void aspeed_ast2400_soc_realize(DeviceState *dev, Error **errp) | ||
89 | { | ||
90 | int i; | ||
91 | + Aspeed2400SoCState *a = ASPEED2400_SOC(dev); | ||
92 | AspeedSoCState *s = ASPEED_SOC(dev); | ||
93 | AspeedSoCClass *sc = ASPEED_SOC_GET_CLASS(s); | ||
94 | Error *err = NULL; | ||
95 | @@ -XXX,XX +XXX,XX @@ static void aspeed_ast2400_soc_realize(DeviceState *dev, Error **errp) | ||
96 | |||
97 | /* CPU */ | ||
98 | for (i = 0; i < sc->num_cpus; i++) { | ||
99 | - object_property_set_link(OBJECT(&s->cpu[i]), "memory", | ||
100 | + object_property_set_link(OBJECT(&a->cpu[i]), "memory", | ||
101 | OBJECT(s->memory), &error_abort); | ||
102 | - if (!qdev_realize(DEVICE(&s->cpu[i]), NULL, errp)) { | ||
103 | + if (!qdev_realize(DEVICE(&a->cpu[i]), NULL, errp)) { | ||
104 | return; | ||
63 | } | 105 | } |
64 | } | 106 | } |
65 | s->cs = cs; | 107 | |
66 | @@ -XXX,XX +XXX,XX @@ static void ssi_cs_default(void *opaque, int n, int level) | 108 | /* SRAM */ |
67 | 109 | - sram_name = g_strdup_printf("aspeed.sram.%d", CPU(&s->cpu[0])->cpu_index); | |
68 | static uint32_t ssi_transfer_raw_default(SSIPeripheral *dev, uint32_t val) | 110 | + sram_name = g_strdup_printf("aspeed.sram.%d", CPU(&a->cpu[0])->cpu_index); |
69 | { | 111 | memory_region_init_ram(&s->sram, OBJECT(s), sram_name, sc->sram_size, &err); |
70 | - SSIPeripheralClass *ssc = SSI_PERIPHERAL_GET_CLASS(dev); | 112 | if (err) { |
71 | + SSIPeripheralClass *ssc = dev->spc; | 113 | error_propagate(errp, err); |
72 | 114 | @@ -XXX,XX +XXX,XX @@ static void aspeed_ast2400_soc_realize(DeviceState *dev, Error **errp) | |
73 | if ((dev->cs && ssc->cs_polarity == SSI_CS_HIGH) || | 115 | aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->scu), 0, sc->memmap[ASPEED_DEV_SCU]); |
74 | - (!dev->cs && ssc->cs_polarity == SSI_CS_LOW) || | 116 | |
75 | - ssc->cs_polarity == SSI_CS_NONE) { | 117 | /* VIC */ |
76 | + (!dev->cs && ssc->cs_polarity == SSI_CS_LOW) || | 118 | - if (!sysbus_realize(SYS_BUS_DEVICE(&s->vic), errp)) { |
77 | + ssc->cs_polarity == SSI_CS_NONE) { | 119 | + if (!sysbus_realize(SYS_BUS_DEVICE(&a->vic), errp)) { |
78 | return ssc->transfer(dev, val); | 120 | return; |
79 | } | 121 | } |
80 | return 0; | 122 | - aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->vic), 0, sc->memmap[ASPEED_DEV_VIC]); |
81 | @@ -XXX,XX +XXX,XX @@ static void ssi_peripheral_realize(DeviceState *dev, Error **errp) | 123 | - sysbus_connect_irq(SYS_BUS_DEVICE(&s->vic), 0, |
82 | ssc->cs_polarity != SSI_CS_NONE) { | 124 | - qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_IRQ)); |
83 | qdev_init_gpio_in_named(dev, ssi_cs_default, SSI_GPIO_CS, 1); | 125 | - sysbus_connect_irq(SYS_BUS_DEVICE(&s->vic), 1, |
84 | } | 126 | - qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_FIQ)); |
85 | + s->spc = ssc; | 127 | + aspeed_mmio_map(s, SYS_BUS_DEVICE(&a->vic), 0, sc->memmap[ASPEED_DEV_VIC]); |
86 | 128 | + sysbus_connect_irq(SYS_BUS_DEVICE(&a->vic), 0, | |
87 | ssc->realize(s, errp); | 129 | + qdev_get_gpio_in(DEVICE(&a->cpu), ARM_CPU_IRQ)); |
88 | } | 130 | + sysbus_connect_irq(SYS_BUS_DEVICE(&a->vic), 1, |
89 | @@ -XXX,XX +XXX,XX @@ uint32_t ssi_transfer(SSIBus *bus, uint32_t val) | 131 | + qdev_get_gpio_in(DEVICE(&a->cpu), ARM_CPU_FIQ)); |
90 | { | 132 | |
91 | BusState *b = BUS(bus); | 133 | /* RTC */ |
92 | BusChild *kid; | 134 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->rtc), errp)) { |
93 | - SSIPeripheralClass *ssc; | 135 | diff --git a/hw/arm/meson.build b/hw/arm/meson.build |
94 | uint32_t r = 0; | 136 | index XXXXXXX..XXXXXXX 100644 |
95 | 137 | --- a/hw/arm/meson.build | |
96 | QTAILQ_FOREACH(kid, &b->children, sibling) { | 138 | +++ b/hw/arm/meson.build |
97 | - SSIPeripheral *peripheral = SSI_PERIPHERAL(kid->child); | 139 | @@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'CONFIG_FSL_IMX25', if_true: files('fsl-imx25.c', 'imx25_pdk.c' |
98 | - ssc = SSI_PERIPHERAL_GET_CLASS(peripheral); | 140 | arm_ss.add(when: 'CONFIG_FSL_IMX31', if_true: files('fsl-imx31.c', 'kzm.c')) |
99 | - r |= ssc->transfer_raw(peripheral, val); | 141 | arm_ss.add(when: 'CONFIG_FSL_IMX6', if_true: files('fsl-imx6.c')) |
100 | + SSIPeripheral *p = SSI_PERIPHERAL(kid->child); | 142 | arm_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files( |
101 | + r |= p->spc->transfer_raw(p, val); | 143 | - 'aspeed_soc.c', |
102 | } | 144 | 'aspeed.c', |
103 | 145 | 'aspeed_soc_common.c', | |
104 | return r; | 146 | + 'aspeed_ast2400.c', |
147 | 'aspeed_ast2600.c', | ||
148 | 'aspeed_ast10x0.c', | ||
149 | 'aspeed_eeprom.c', | ||
105 | -- | 150 | -- |
106 | 2.37.3 | 151 | 2.41.0 |
107 | 152 | ||
108 | 153 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | ||
2 | Message-Id: <20221013161241.2805140-4-clg@kaod.org> | ||
3 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | ||
4 | --- | ||
5 | hw/block/m25p80.c | 3 ++- | ||
6 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
7 | 1 | ||
8 | diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c | ||
9 | index XXXXXXX..XXXXXXX 100644 | ||
10 | --- a/hw/block/m25p80.c | ||
11 | +++ b/hw/block/m25p80.c | ||
12 | @@ -XXX,XX +XXX,XX @@ static const FlashPartInfo known_devices[] = { | ||
13 | { INFO("mx25l6405d", 0xc22017, 0, 64 << 10, 128, 0) }, | ||
14 | { INFO("mx25l12805d", 0xc22018, 0, 64 << 10, 256, 0) }, | ||
15 | { INFO("mx25l12855e", 0xc22618, 0, 64 << 10, 256, 0) }, | ||
16 | - { INFO6("mx25l25635e", 0xc22019, 0xc22019, 64 << 10, 512, 0) }, | ||
17 | + { INFO6("mx25l25635e", 0xc22019, 0xc22019, 64 << 10, 512, | ||
18 | + ER_4K | ER_32K) }, | ||
19 | { INFO("mx25l25655e", 0xc22619, 0, 64 << 10, 512, 0) }, | ||
20 | { INFO("mx66l51235f", 0xc2201a, 0, 64 << 10, 1024, ER_4K | ER_32K) }, | ||
21 | { INFO("mx66u51235f", 0xc2253a, 0, 64 << 10, 1024, ER_4K | ER_32K) }, | ||
22 | -- | ||
23 | 2.37.3 | ||
24 | |||
25 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | The mx25l25635e and mx25l25635f chips have the same JEDEC id but the | ||
2 | mx25l25635f has more capabilities reported in the SFDP table. Support | ||
3 | for 4B opcodes is of interest because it is exploited by the Linux | ||
4 | kernel. | ||
5 | 1 | ||
6 | The SFDP table size is 0x200 bytes long. The mandatory table for basic | ||
7 | features is available at byte 0x30 and an extra Macronix specific | ||
8 | table is available at 0x60. | ||
9 | |||
10 | Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> | ||
11 | Message-Id: <20220722063602.128144-5-clg@kaod.org> | ||
12 | Message-Id: <20221013161241.2805140-6-clg@kaod.org> | ||
13 | Signed-off-by: Cédric Le Goater <clg@kaod.org> | ||
14 | --- | ||
15 | hw/block/m25p80_sfdp.h | 1 + | ||
16 | hw/block/m25p80.c | 2 ++ | ||
17 | hw/block/m25p80_sfdp.c | 68 ++++++++++++++++++++++++++++++++++++++++++ | ||
18 | 3 files changed, 71 insertions(+) | ||
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 @@ | ||
25 | uint8_t m25p80_sfdp_n25q256a(uint32_t addr); | ||
26 | |||
27 | uint8_t m25p80_sfdp_mx25l25635e(uint32_t addr); | ||
28 | +uint8_t m25p80_sfdp_mx25l25635f(uint32_t addr); | ||
29 | |||
30 | |||
31 | #endif | ||
32 | diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/hw/block/m25p80.c | ||
35 | +++ b/hw/block/m25p80.c | ||
36 | @@ -XXX,XX +XXX,XX @@ static const FlashPartInfo known_devices[] = { | ||
37 | { INFO("mx25l12855e", 0xc22618, 0, 64 << 10, 256, 0) }, | ||
38 | { INFO6("mx25l25635e", 0xc22019, 0xc22019, 64 << 10, 512, | ||
39 | ER_4K | ER_32K), .sfdp_read = m25p80_sfdp_mx25l25635e }, | ||
40 | + { INFO6("mx25l25635f", 0xc22019, 0xc22019, 64 << 10, 512, | ||
41 | + ER_4K | ER_32K), .sfdp_read = m25p80_sfdp_mx25l25635f }, | ||
42 | { INFO("mx25l25655e", 0xc22619, 0, 64 << 10, 512, 0) }, | ||
43 | { INFO("mx66l51235f", 0xc2201a, 0, 64 << 10, 1024, ER_4K | ER_32K) }, | ||
44 | { INFO("mx66u51235f", 0xc2253a, 0, 64 << 10, 1024, ER_4K | ER_32K) }, | ||
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_mx25l25635e[] = { | ||
50 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
51 | }; | ||
52 | define_sfdp_read(mx25l25635e) | ||
53 | + | ||
54 | +static const uint8_t sfdp_mx25l25635f[] = { | ||
55 | + 0x53, 0x46, 0x44, 0x50, 0x00, 0x01, 0x01, 0xff, | ||
56 | + 0x00, 0x00, 0x01, 0x09, 0x30, 0x00, 0x00, 0xff, | ||
57 | + 0xc2, 0x00, 0x01, 0x04, 0x60, 0x00, 0x00, 0xff, | ||
58 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
59 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
60 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
61 | + 0xe5, 0x20, 0xf3, 0xff, 0xff, 0xff, 0xff, 0x0f, | ||
62 | + 0x44, 0xeb, 0x08, 0x6b, 0x08, 0x3b, 0x04, 0xbb, | ||
63 | + 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, | ||
64 | + 0xff, 0xff, 0x44, 0xeb, 0x0c, 0x20, 0x0f, 0x52, | ||
65 | + 0x10, 0xd8, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
66 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
67 | + 0x00, 0x36, 0x00, 0x27, 0x9d, 0xf9, 0xc0, 0x64, | ||
68 | + 0x85, 0xcb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
69 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
70 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
71 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
72 | + 0xff, 0xff, 0xff, 0xff, 0xc2, 0xf5, 0x08, 0x0a, | ||
73 | + 0x08, 0x04, 0x03, 0x06, 0x00, 0x00, 0x07, 0x29, | ||
74 | + 0x17, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
75 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
76 | + 0xff, 0xff, 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 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
92 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
93 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
94 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
95 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
96 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
97 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
98 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
99 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
100 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
101 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
102 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
103 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
104 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
105 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
106 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
107 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
108 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
109 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
110 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
111 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
112 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
113 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
114 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
115 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
116 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
117 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
118 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, | ||
119 | +}; | ||
120 | +define_sfdp_read(mx25l25635f); | ||
121 | -- | ||
122 | 2.37.3 | ||
123 | |||
124 | diff view generated by jsdifflib |