diff options
author | andreast <andreast@FreeBSD.org> | 2013-12-12 13:00:07 +0000 |
---|---|---|
committer | andreast <andreast@FreeBSD.org> | 2013-12-12 13:00:07 +0000 |
commit | 465403a5cc91e82c71efd87f017455ae0609eb30 (patch) | |
tree | 8fe4ccf0526f3ee8bacc067c8362b78d2e736895 /sys/powerpc/pseries | |
parent | caaf223f40bd53798c5077103a428622dc515976 (diff) | |
download | FreeBSD-src-465403a5cc91e82c71efd87f017455ae0609eb30.zip FreeBSD-src-465403a5cc91e82c71efd87f017455ae0609eb30.tar.gz |
MFC: r258427, r258694
r258694:
Make RTAS calls, which call setfault() to recover from machine checks,
preserve any existing fault buffer. RTAS calls are meant to be safe from
interrupt context (and are indeed used there to implement the xics PIC
driver). Without this, calling into RTAS in interrupt context would have
the effect of clearing any existing onfault state of the interrupted
thread, potentially leading to a panic.
r258427:
For PCI<->PCI bridges, #address-cells may be 3. Allow this when parsing the
ibm,dma-window properties. This is especially a concern when
#ibm,dma-address-cells is not specified and we have to use the regular
#address-cells property.
Diffstat (limited to 'sys/powerpc/pseries')
-rw-r--r-- | sys/powerpc/pseries/plpar_iommu.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/sys/powerpc/pseries/plpar_iommu.c b/sys/powerpc/pseries/plpar_iommu.c index c95d170..ccf00c9 100644 --- a/sys/powerpc/pseries/plpar_iommu.c +++ b/sys/powerpc/pseries/plpar_iommu.c @@ -73,8 +73,9 @@ phyp_iommu_set_dma_tag(device_t dev, device_t child, bus_dma_tag_t tag) { device_t p; phandle_t node; - cell_t dma_acells, dma_scells, dmawindow[5]; + cell_t dma_acells, dma_scells, dmawindow[6]; struct iommu_map *i; + int cell; for (p = child; p != NULL; p = device_get_parent(p)) { if (ofw_bus_has_prop(p, "ibm,my-dma-window")) @@ -104,16 +105,17 @@ phyp_iommu_set_dma_tag(device_t dev, device_t child, bus_dma_tag_t tag) struct dma_window *window = malloc(sizeof(struct dma_window), M_PHYPIOMMU, M_WAITOK); - if (dma_acells == 1) - window->start = dmawindow[1]; - else - window->start = ((uint64_t)(dmawindow[1]) << 32) | dmawindow[2]; - if (dma_scells == 1) - window->end = window->start + dmawindow[dma_acells + 1]; - else - window->end = window->start + - (((uint64_t)(dmawindow[dma_acells + 1]) << 32) | - dmawindow[dma_acells + 2]); + window->start = 0; + for (cell = 1; cell < 1 + dma_acells; cell++) { + window->start <<= 32; + window->start |= dmawindow[cell]; + } + window->end = 0; + for (; cell < 1 + dma_acells + dma_scells; cell++) { + window->end <<= 32; + window->end |= dmawindow[cell]; + } + window->end += window->start; if (bootverbose) device_printf(dev, "Mapping IOMMU domain %#x\n", dmawindow[0]); |