-/* $OpenBSD: smmu.c,v 1.4 2021/03/02 01:34:43 patrick Exp $ */
+/* $OpenBSD: smmu.c,v 1.5 2021/03/05 00:18:26 patrick Exp $ */
/*
* Copyright (c) 2008-2009,2014-2016 Dale Rahn <drahn@dalerahn.com>
* Copyright (c) 2021 Patrick Wildt <patrick@blueri.se>
M_DEVBUF, NULL, 0, EX_WAITOK | EX_NOCOALESCE);
#if 0
- /* FIXME MSI map on */
+ /* FIXME MSI map & PCIe address space */
{
- paddr_t msi_pa = 0x78020000; /* Ampere */
- paddr_t msi_pa = 0x6020000; /* LX2K */
+#if 0
+ /* Reserve and map Ampere MSI */
+ paddr_t msi_pa = 0x78020000;
size_t msi_len = 0x20000;
- paddr_t msi_pa = 0xf0280000; /* 8040 GICv2 */
+#endif
+#if 0
+ /* Reserve and map LX2K MSI */
+ paddr_t msi_pa = 0x6020000;
+ size_t msi_len = 0x20000;
+#endif
+#if 1
+ /* Reserve and map 8040 GICv2M */
+ paddr_t msi_pa = 0xf0280000;
size_t msi_len = 0x40000;
+#endif
+ extent_alloc_region(dom->sd_iovamap, msi_pa, msi_len, EX_WAITOK);
while (msi_len) {
smmu_enter(dom, msi_pa, msi_pa, PROT_READ | PROT_WRITE,
PROT_READ | PROT_WRITE, PMAP_CACHE_WB);
msi_pa += PAGE_SIZE;
msi_len -= PAGE_SIZE;
}
- msi_pa = 0xf03f0000; /* 8040 GICP */
+#if 1
+ /* Reserve and map 8040 GICP */
+ msi_pa = 0xf03f0000;
msi_len = 0x1000;
+ extent_alloc_region(dom->sd_iovamap, msi_pa, msi_len, EX_WAITOK);
smmu_enter(dom, msi_pa, msi_pa, PROT_READ | PROT_WRITE,
PROT_READ | PROT_WRITE, PMAP_CACHE_WB);
+ /* Reserve 8040 PCI address space */
+ extent_alloc_region(dom->sd_iovamap, 0xc0000000, 0x20000000,
+ EX_WAITOK);
+#endif
}
#endif