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