diff options
author | Conrad Meyer <cem@FreeBSD.org> | 2016-02-10 20:49:22 +0000 |
---|---|---|
committer | Conrad Meyer <cem@FreeBSD.org> | 2016-02-10 20:49:22 +0000 |
commit | 6ea028df502670b7295b17f4224ad6ca1d54c6cc (patch) | |
tree | 9c69458b96d40a8f0cebaf7de0be9aa4bd82e977 /sys/dev/ntb/ntb_hw | |
parent | b1d46e7cb0eb6f54325513bc1b95e56d0cf336f4 (diff) | |
download | src-6ea028df502670b7295b17f4224ad6ca1d54c6cc.tar.gz src-6ea028df502670b7295b17f4224ad6ca1d54c6cc.zip |
ntb_hw(4): Print correct PAT name for non-WC/WB types mapped at load
Sponsored by: EMC / Isilon Storage Division
Notes
Notes:
svn path=/head/; revision=295487
Diffstat (limited to 'sys/dev/ntb/ntb_hw')
-rw-r--r-- | sys/dev/ntb/ntb_hw/ntb_hw.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/sys/dev/ntb/ntb_hw/ntb_hw.c b/sys/dev/ntb/ntb_hw/ntb_hw.c index 44f51762a458..abfbf71acad3 100644 --- a/sys/dev/ntb/ntb_hw/ntb_hw.c +++ b/sys/dev/ntb/ntb_hw/ntb_hw.c @@ -369,6 +369,32 @@ ntb_pat_flags(void) } } +/* + * Well, this obviously doesn't belong here, but it doesn't seem to exist + * anywhere better yet. + */ +static inline const char * +ntb_vm_memattr_to_str(vm_memattr_t pat) +{ + + switch (pat) { + case VM_MEMATTR_WRITE_COMBINING: + return ("WRITE_COMBINING"); + case VM_MEMATTR_WRITE_THROUGH: + return ("WRITE_THROUGH"); + case VM_MEMATTR_WRITE_PROTECTED: + return ("WRITE_PROTECTED"); + case VM_MEMATTR_WRITE_BACK: + return ("WRITE_BACK"); + case VM_MEMATTR_WEAK_UNCACHEABLE: + return ("UNCACHED"); + case VM_MEMATTR_UNCACHEABLE: + return ("UNCACHEABLE"); + default: + return ("UNKNOWN"); + } +} + static int g_ntb_mw_idx = -1; SYSCTL_INT(_hw_ntb, OID_AUTO, b2b_mw_idx, CTLFLAG_RDTUN, &g_ntb_mw_idx, 0, "Use this memory window to access the peer NTB registers. A " @@ -828,8 +854,7 @@ map_memory_window_bar(struct ntb_softc *ntb, struct ntb_pci_bar_info *bar) PCI_RID2BAR(bar->pci_resource_id), bar->vbase, (char *)bar->vbase + bar->size - 1, (void *)bar->pbase, (void *)(bar->pbase + bar->size - 1), - (mapmode == VM_MEMATTR_WRITE_COMBINING) ? "WRITE_COMBINING" - : "WRITE_BACK"); + ntb_vm_memattr_to_str(mapmode)); } else device_printf(ntb->device, "Unable to mark BAR%d v:[%p-%p] p:[%p-%p] as " @@ -837,8 +862,7 @@ map_memory_window_bar(struct ntb_softc *ntb, struct ntb_pci_bar_info *bar) PCI_RID2BAR(bar->pci_resource_id), bar->vbase, (char *)bar->vbase + bar->size - 1, (void *)bar->pbase, (void *)(bar->pbase + bar->size - 1), - (mapmode == VM_MEMATTR_WRITE_COMBINING) ? "WRITE_COMBINING" - : "WRITE_BACK", rc); + ntb_vm_memattr_to_str(mapmode), rc); /* Proceed anyway */ return (0); } |