LinuxKPI: Add more #ifdef VM_MEMATTR_WRITE_COMBINING guards

One of the three uses is already guarded; this guards the remaining ones
to support architectures like riscv that do not provide write-combining,
and is needed to build drm-kmod on riscv.

Reviewed by:	hselasky, manu
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31999
This commit is contained in:
Jessica Clarke 2021-10-03 19:34:40 +01:00
parent 7047568821
commit 8167c92f65
2 changed files with 8 additions and 0 deletions

View File

@ -411,8 +411,12 @@ void *_ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr);
#define ioremap(addr, size) \
_ioremap_attr((addr), (size), VM_MEMATTR_UNCACHEABLE)
#endif
#ifdef VM_MEMATTR_WRITE_COMBINING
#define ioremap_wc(addr, size) \
_ioremap_attr((addr), (size), VM_MEMATTR_WRITE_COMBINING)
#else
#define ioremap_wc(addr, size) ioremap_nocache(addr, size)
#endif
#define ioremap_wb(addr, size) \
_ioremap_attr((addr), (size), VM_MEMATTR_WRITE_BACK)
void iounmap(void *addr);

View File

@ -83,8 +83,12 @@ pgprot2cachemode(pgprot_t prot)
#define clear_page(page) memset(page, 0, PAGE_SIZE)
#define pgprot_noncached(prot) \
(((prot) & VM_PROT_ALL) | cachemode2protval(VM_MEMATTR_UNCACHEABLE))
#ifdef VM_MEMATTR_WRITE_COMBINING
#define pgprot_writecombine(prot) \
(((prot) & VM_PROT_ALL) | cachemode2protval(VM_MEMATTR_WRITE_COMBINING))
#else
#define pgprot_writecombine(prot) pgprot_noncached(prot)
#endif
#undef PAGE_MASK
#define PAGE_MASK (~(PAGE_SIZE-1))