diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -2468,7 +2468,7 @@ out_offset = 0; flags = FOF_OFFSET | FOF_NOUPDATE; - bufsz = min(count, MAXPHYS); + bufsz = min(count, maxphys); buf = malloc(bufsz, M_LINUX, M_WAITOK); bytes_sent = 0; while (bytes_sent < count) { diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -965,7 +965,7 @@ PAGE_MASK)))); iolen = min(ptoa(npages) - (ma_offs & PAGE_MASK), len); KASSERT(iolen > 0, ("zero iolen")); - KASSERT(npages <= atop(MAXPHYS + PAGE_SIZE), + KASSERT(npages <= atop(maxphys + PAGE_SIZE), ("npages %d too large", npages)); pmap_qenter(sc->kva, &bp->bio_ma[atop(ma_offs)], npages); aiov.iov_base = (void *)(sc->kva + (ma_offs & PAGE_MASK)); @@ -1487,7 +1487,7 @@ goto bad; } - sc->kva = kva_alloc(MAXPHYS + PAGE_SIZE); + sc->kva = kva_alloc(maxphys + PAGE_SIZE); return (0); bad: VOP_UNLOCK(nd.ni_vp); @@ -1547,7 +1547,7 @@ if (sc->uma) uma_zdestroy(sc->uma); if (sc->kva) - kva_free(sc->kva, MAXPHYS + PAGE_SIZE); + kva_free(sc->kva, maxphys + PAGE_SIZE); LIST_REMOVE(sc, list); free_unr(md_uh, sc->unit); diff --git a/sys/dev/rtsx/rtsx.c b/sys/dev/rtsx/rtsx.c --- a/sys/dev/rtsx/rtsx.c +++ b/sys/dev/rtsx/rtsx.c @@ -311,7 +311,7 @@ #define RTSX_DMA_ALIGN 4 #define RTSX_HOSTCMD_MAX 256 #define RTSX_DMA_CMD_BIFSIZE (sizeof(uint32_t) * RTSX_HOSTCMD_MAX) -#define RTSX_DMA_DATA_BUFSIZE MAXPHYS +#define RTSX_DMA_DATA_BUFSIZE maxphys #define ISSET(t, f) ((t) & (f)) @@ -2762,7 +2762,7 @@ (unsigned long)cmd->data->len, (unsigned long)cmd->data->xfer_len); if (cmd->data->len > RTSX_DMA_DATA_BUFSIZE) { - device_printf(sc->rtsx_dev, "rtsx_xfer() length too large: %ld > %d\n", + device_printf(sc->rtsx_dev, "rtsx_xfer() length too large: %ld > %ld\n", (unsigned long)cmd->data->len, RTSX_DMA_DATA_BUFSIZE); cmd->error = MMC_ERR_INVALID; return (MMC_ERR_INVALID); diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c --- a/sys/kern/subr_param.c +++ b/sys/kern/subr_param.c @@ -41,6 +41,7 @@ #include "opt_maxusers.h" #include +#include #include #include #include diff --git a/sys/sys/_maxphys.h b/sys/sys/_maxphys.h new file mode 100644 --- /dev/null +++ b/sys/sys/_maxphys.h @@ -0,0 +1,10 @@ +/*- + * This file is in the public domain. + */ +#ifndef MAXPHYS +#ifdef __ILP32__ +#define MAXPHYS (128 * 1024) +#else +#define MAXPHYS (1024 * 1024) +#endif +#endif diff --git a/sys/sys/param.h b/sys/sys/param.h --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -161,6 +161,7 @@ #include #ifndef _KERNEL #include +#include #endif #ifndef DEV_BSHIFT @@ -174,13 +175,6 @@ #ifndef DFLTPHYS #define DFLTPHYS (64 * 1024) /* default max raw I/O transfer size */ #endif -#ifndef MAXPHYS /* max raw I/O transfer size */ -#ifdef __ILP32__ -#define MAXPHYS (128 * 1024) -#else -#define MAXPHYS (1024 * 1024) -#endif -#endif #ifndef MAXDUMPPGS #define MAXDUMPPGS (DFLTPHYS/PAGE_SIZE) #endif