xref: /qemu/include/hw/arm/allwinner-a10.h (revision ffda5db6)
1 #ifndef HW_ARM_ALLWINNER_A10_H
2 #define HW_ARM_ALLWINNER_A10_H
3 
4 #include "hw/char/serial.h"
5 #include "hw/arm/boot.h"
6 #include "hw/pci/pci_device.h"
7 #include "hw/timer/allwinner-a10-pit.h"
8 #include "hw/intc/allwinner-a10-pic.h"
9 #include "hw/net/allwinner_emac.h"
10 #include "hw/sd/allwinner-sdhost.h"
11 #include "hw/ide/ahci.h"
12 #include "hw/usb/hcd-ohci.h"
13 #include "hw/usb/hcd-ehci.h"
14 #include "hw/rtc/allwinner-rtc.h"
15 #include "hw/misc/allwinner-a10-ccm.h"
16 #include "hw/misc/allwinner-a10-dramc.h"
17 #include "hw/i2c/allwinner-i2c.h"
18 #include "sysemu/block-backend.h"
19 
20 #include "target/arm/cpu.h"
21 #include "qom/object.h"
22 
23 
24 #define AW_A10_SDRAM_BASE       0x40000000
25 
26 #define AW_A10_NUM_USB          2
27 
28 #define TYPE_AW_A10 "allwinner-a10"
29 OBJECT_DECLARE_SIMPLE_TYPE(AwA10State, AW_A10)
30 
31 struct AwA10State {
32     /*< private >*/
33     DeviceState parent_obj;
34     /*< public >*/
35 
36     ARMCPU cpu;
37     AwA10ClockCtlState ccm;
38     AwA10DramControllerState dramc;
39     AwA10PITState timer;
40     AwA10PICState intc;
41     AwEmacState emac;
42     AllwinnerAHCIState sata;
43     AwSdHostState mmc0;
44     AWI2CState i2c0;
45     AwRtcState rtc;
46     MemoryRegion sram_a;
47     EHCISysBusState ehci[AW_A10_NUM_USB];
48     OHCISysBusState ohci[AW_A10_NUM_USB];
49 };
50 
51 /**
52  * Emulate Boot ROM firmware setup functionality.
53  *
54  * A real Allwinner A10 SoC contains a Boot ROM
55  * which is the first code that runs right after
56  * the SoC is powered on. The Boot ROM is responsible
57  * for loading user code (e.g. a bootloader) from any
58  * of the supported external devices and writing the
59  * downloaded code to internal SRAM. After loading the SoC
60  * begins executing the code written to SRAM.
61  *
62  * This function emulates the Boot ROM by copying 32 KiB
63  * of data at offset 8 KiB from the given block device and writes it to
64  * the start of the first internal SRAM memory.
65  *
66  * @s: Allwinner A10 state object pointer
67  * @blk: Block backend device object pointer
68  */
69 void allwinner_a10_bootrom_setup(AwA10State *s, BlockBackend *blk);
70 
71 #endif
72