1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#include "qemu/osdep.h"
22#include "hw/hw.h"
23#include "hw/arm/omap.h"
24
25
26static uint64_t omap_tap_read(void *opaque, hwaddr addr,
27 unsigned size)
28{
29 struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
30
31 if (size != 4) {
32 return omap_badwidth_read32(opaque, addr);
33 }
34
35 switch (addr) {
36 case 0x204:
37 switch (s->mpu_model) {
38 case omap2420:
39 case omap2422:
40 case omap2423:
41 return 0x5b5d902f;
42 case omap2430:
43 return 0x5b68a02f;
44 case omap3430:
45 return 0x1b7ae02f;
46 default:
47 hw_error("%s: Bad mpu model\n", __func__);
48 }
49
50 case 0x208:
51 case 0x210:
52 switch (s->mpu_model) {
53 case omap2420:
54 return 0x000254f0;
55 case omap2422:
56 return 0x000400f0;
57 case omap2423:
58 return 0x000800f0;
59 case omap2430:
60 return 0x000000f0;
61 case omap3430:
62 return 0x000000f0;
63 default:
64 hw_error("%s: Bad mpu model\n", __func__);
65 }
66
67 case 0x20c:
68 switch (s->mpu_model) {
69 case omap2420:
70 case omap2422:
71 case omap2423:
72 return 0xcafeb5d9;
73 case omap2430:
74 return 0xcafeb68a;
75 case omap3430:
76 return 0xcafeb7ae;
77 default:
78 hw_error("%s: Bad mpu model\n", __func__);
79 }
80
81 case 0x218:
82 return ('Q' << 24) | ('E' << 16) | ('M' << 8) | ('U' << 0);
83 case 0x21c:
84 return 0x54 << 24;
85 case 0x220:
86 return ('Q' << 24) | ('E' << 16) | ('M' << 8) | ('U' << 0);
87 case 0x224:
88 return ('Q' << 24) | ('E' << 16) | ('M' << 8) | ('U' << 0);
89 }
90
91 OMAP_BAD_REG(addr);
92 return 0;
93}
94
95static void omap_tap_write(void *opaque, hwaddr addr,
96 uint64_t value, unsigned size)
97{
98 if (size != 4) {
99 omap_badwidth_write32(opaque, addr, value);
100 return;
101 }
102
103 OMAP_BAD_REG(addr);
104}
105
106static const MemoryRegionOps omap_tap_ops = {
107 .read = omap_tap_read,
108 .write = omap_tap_write,
109 .endianness = DEVICE_NATIVE_ENDIAN,
110};
111
112void omap_tap_init(struct omap_target_agent_s *ta,
113 struct omap_mpu_state_s *mpu)
114{
115 memory_region_init_io(&mpu->tap_iomem, NULL, &omap_tap_ops, mpu, "omap.tap",
116 omap_l4_region_size(ta, 0));
117 omap_l4_attach(ta, 0, &mpu->tap_iomem);
118}
119