2 * bcm2711 (e.g.raspberry pi 4) architecture-specific stuff
6 #include "../port/lib.h"
10 #include "../port/error.h"
12 #include "../port/pci.h"
15 typedef struct Mbox Mbox;
16 typedef struct Mboxes Mboxes;
18 #define POWERREGS (VIRTIO+0x100000)
21 .dramsize = 0xFC000000,
22 .busdram = 0xC0000000,
27 .armlocal = 0xFF800000,
28 .pciwin = 0x0600000000ULL,
34 Wdogtime = 10, /* seconds, ≤ 15 */
38 * Power management / watchdog registers
50 * Arm local regs for smp
77 r = (u32int*)POWERREGS;
78 r[Wdog] = Password | 1;
79 r[Rstc] = Password | (r[Rstc] & ~CfgMask) | CfgReset;
90 r = (u32int*)POWERREGS;
91 r[Wdog] = Password | (Wdogtime * Wdogfreq);
92 r[Rstc] = Password | (r[Rstc] & ~CfgMask) | CfgReset;
100 r = (u32int*)POWERREGS;
101 r[Rstc] = Password | (r[Rstc] & ~CfgMask);
106 cputype2name(char *buf, int size)
112 part = (r >> 4) & 0xFFF;
115 p = seprint(buf, buf + size, "Cortex-A7");
118 p = seprint(buf, buf + size, "Cortex-A53");
121 p = seprint(buf, buf + size, "Cortex-A72");
124 p = seprint(buf, buf + size, "Unknown-%#x", part);
127 seprint(p, buf + size, " r%udp%ud", (r >> 20) & 0xF, r & 0xF);
136 cputype2name(name, sizeof name);
137 iprint("cpu%d: %dMHz ARM %s\n", m->machno, m->cpumhz, name);
149 p = getconf("*ncpu");
150 if(p && (max = atoi(p)) > 0 && n > max)
160 mb = (Mboxes*)(ARMLOCAL + Mboxregs);
161 mb->clr[cpu].mbox1 = 1;
169 mb = (Mboxes*)(ARMLOCAL + Mboxregs);
170 mb->set[cpu].mbox1 = 1;
179 * The firmware resets PCI before starting the host OS because
180 * without SDRAM the VL805 makes inbound requests to page-in firmware
181 * from SDRAM. If the OS has a different PCI mapping that would all break.
182 * There's no way to pause and move the mappings and it's not really desirable
183 * for the firmware to dictate the PCI configuration. Consequently, the mailbox
184 * is required so that the OS can reset the VLI after asserting PCI chip reset.
186 if((p = pcimatch(nil, 0x1106, 0x3483)) != nil)
187 xhcireset(BUSBNO(p->tbdf)<<20 | BUSDNO(p->tbdf)<<15 | BUSFNO(p->tbdf)<<12);
189 // addclock0link(wdogfeed, HZ);