Create VM_MEMATTR_DEVICE on all architectures

This is intended to be used with memory mapped IO, e.g. from
bus_space_map with no flags, or pmap_mapdev.

Use this new memory type in the map request configured by
resource_init_map_request, and in pciconf.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D29692
This commit is contained in:
Andrew Turner 2021-04-10 07:59:29 +00:00
parent bf5057691b
commit 5d2d599d3f
6 changed files with 6 additions and 5 deletions

View File

@ -43,5 +43,6 @@
#define VM_MEMATTR_WEAK_UNCACHEABLE ((vm_memattr_t)PAT_UNCACHED)
#define VM_MEMATTR_DEFAULT VM_MEMATTR_WRITE_BACK
#define VM_MEMATTR_DEVICE VM_MEMATTR_UNCACHEABLE
#endif /* !_MACHINE_VM_H_ */

View File

@ -43,5 +43,6 @@
#define VM_MEMATTR_WEAK_UNCACHEABLE ((vm_memattr_t)PAT_UNCACHED)
#define VM_MEMATTR_DEFAULT VM_MEMATTR_WRITE_BACK
#define VM_MEMATTR_DEVICE VM_MEMATTR_UNCACHEABLE
#endif /* !_MACHINE_VM_H_ */

View File

@ -3155,7 +3155,7 @@ resource_init_map_request_impl(struct resource_map_request *args, size_t sz)
{
bzero(args, sz);
args->size = sz;
args->memattr = VM_MEMATTR_UNCACHEABLE;
args->memattr = VM_MEMATTR_DEVICE;
}
/**

View File

@ -38,6 +38,7 @@
#define VM_MEMATTR_UNCACHEABLE ((vm_memattr_t)MIPS_CCA_UNCACHED)
#define VM_MEMATTR_WRITE_BACK ((vm_memattr_t)MIPS_CCA_CACHED)
#define VM_MEMATTR_DEFAULT VM_MEMATTR_WRITE_BACK
#define VM_MEMATTR_DEVICE VM_MEMATTR_UNCACHEABLE
#ifdef MIPS_CCA_WC
#define VM_MEMATTR_WRITE_COMBINING ((vm_memattr_t)MIPS_CCA_WC)
#endif

View File

@ -42,4 +42,6 @@
#define VM_MEMATTR_WRITE_THROUGH 0x10
#define VM_MEMATTR_PREFETCHABLE 0x20
#define VM_MEMATTR_DEVICE VM_MEMATTR_DEFAULT
#endif /* !_MACHINE_VM_H_ */

View File

@ -1126,11 +1126,7 @@ dump_bar(const char *name, const char *reg, const char *bar_start,
if (*reg == '\0' || *el != '\0')
errx(1, "Invalid bar specification %s", reg);
pbm.pbm_flags = 0;
#ifdef VM_MEMATTR_DEVICE
pbm.pbm_memattr = VM_MEMATTR_DEVICE;
#else
pbm.pbm_memattr = VM_MEMATTR_UNCACHEABLE;
#endif
fd = open(_PATH_DEVPCI, O_RDWR, 0);
if (fd < 0)