mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
hw/arm: Introduce Raspberry PI 4 machine
Signed-off-by: Sergey Kambalin <sergey.kambalin@auriga.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20240226000259.2752893-11-sergey.kambalin@auriga.com [PMM: Change name to 'raspi4b', not 'raspi4b-2g'] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
1367375612
commit
7785e8ea22
8 changed files with 119 additions and 14 deletions
|
@ -18,6 +18,7 @@
|
|||
#include "qapi/error.h"
|
||||
#include "hw/arm/boot.h"
|
||||
#include "hw/arm/bcm2836.h"
|
||||
#include "hw/arm/bcm2838.h"
|
||||
#include "hw/arm/raspi_platform.h"
|
||||
#include "hw/registerfields.h"
|
||||
#include "qemu/error-report.h"
|
||||
|
@ -61,6 +62,7 @@ typedef enum RaspiProcessorId {
|
|||
PROCESSOR_ID_BCM2835 = 0,
|
||||
PROCESSOR_ID_BCM2836 = 1,
|
||||
PROCESSOR_ID_BCM2837 = 2,
|
||||
PROCESSOR_ID_BCM2838 = 3,
|
||||
} RaspiProcessorId;
|
||||
|
||||
static const struct {
|
||||
|
@ -70,13 +72,9 @@ static const struct {
|
|||
[PROCESSOR_ID_BCM2835] = {TYPE_BCM2835, 1},
|
||||
[PROCESSOR_ID_BCM2836] = {TYPE_BCM2836, BCM283X_NCPUS},
|
||||
[PROCESSOR_ID_BCM2837] = {TYPE_BCM2837, BCM283X_NCPUS},
|
||||
[PROCESSOR_ID_BCM2838] = {TYPE_BCM2838, BCM283X_NCPUS},
|
||||
};
|
||||
|
||||
static void raspi_base_machine_init(MachineState *machine,
|
||||
BCM283XBaseState *soc);
|
||||
static void raspi_machine_class_common_init(MachineClass *mc,
|
||||
uint32_t board_rev);
|
||||
|
||||
static uint64_t board_ram_size(uint32_t board_rev)
|
||||
{
|
||||
assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */
|
||||
|
@ -93,7 +91,7 @@ static RaspiProcessorId board_processor_id(uint32_t board_rev)
|
|||
return proc_id;
|
||||
}
|
||||
|
||||
static const char *board_soc_type(uint32_t board_rev)
|
||||
const char *board_soc_type(uint32_t board_rev)
|
||||
{
|
||||
return soc_property[board_processor_id(board_rev)].type;
|
||||
}
|
||||
|
@ -248,13 +246,14 @@ static void setup_boot(MachineState *machine, ARMCPU *cpu,
|
|||
arm_load_kernel(cpu, machine, &s->binfo);
|
||||
}
|
||||
|
||||
static void raspi_base_machine_init(MachineState *machine,
|
||||
void raspi_base_machine_init(MachineState *machine,
|
||||
BCM283XBaseState *soc)
|
||||
{
|
||||
RaspiBaseMachineClass *mc = RASPI_BASE_MACHINE_GET_CLASS(machine);
|
||||
uint32_t board_rev = mc->board_rev;
|
||||
uint64_t ram_size = board_ram_size(board_rev);
|
||||
uint32_t vcram_size;
|
||||
uint32_t vcram_base, vcram_size;
|
||||
size_t boot_ram_size;
|
||||
DriveInfo *di;
|
||||
BlockBackend *blk;
|
||||
BusState *bus;
|
||||
|
@ -293,11 +292,19 @@ static void raspi_base_machine_init(MachineState *machine,
|
|||
|
||||
vcram_size = object_property_get_uint(OBJECT(soc), "vcram-size",
|
||||
&error_abort);
|
||||
vcram_base = object_property_get_uint(OBJECT(soc), "vcram-base",
|
||||
&error_abort);
|
||||
|
||||
if (vcram_base == 0) {
|
||||
vcram_base = ram_size - vcram_size;
|
||||
}
|
||||
boot_ram_size = MIN(vcram_base, UPPER_RAM_BASE - vcram_size);
|
||||
|
||||
setup_boot(machine, &soc->cpu[0].core, board_processor_id(board_rev),
|
||||
machine->ram_size - vcram_size);
|
||||
boot_ram_size);
|
||||
}
|
||||
|
||||
static void raspi_machine_init(MachineState *machine)
|
||||
void raspi_machine_init(MachineState *machine)
|
||||
{
|
||||
RaspiMachineState *s = RASPI_MACHINE(machine);
|
||||
RaspiBaseMachineState *s_base = RASPI_BASE_MACHINE(machine);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue