X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/0a7de7458d150b5d4dffc935ba399be265ef0a1a..c3c9b80d004dbbfdf763edeb97968c6997e3b45b:/bsd/dev/memdev.c?ds=inline diff --git a/bsd/dev/memdev.c b/bsd/dev/memdev.c index ffac54d04..fd7e8fa3d 100644 --- a/bsd/dev/memdev.c +++ b/bsd/dev/memdev.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004-2006 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2004-2019 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * @@ -130,31 +130,31 @@ extern ppnum_t pmap_find_phys(pmap_t pmap, addr64_t va); * D_CANFREE We support B_FREEBUF */ -static struct bdevsw mdevbdevsw = { - /* open */ mdevopen, - /* close */ mdevclose, - /* strategy */ mdevstrategy, - /* ioctl */ mdevbioctl, - /* dump */ eno_dump, - /* psize */ mdevsize, - /* flags */ D_DISK, +static const struct bdevsw mdevbdevsw = { + .d_open = mdevopen, + .d_close = mdevclose, + .d_strategy = mdevstrategy, + .d_ioctl = mdevbioctl, + .d_dump = eno_dump, + .d_psize = mdevsize, + .d_type = D_DISK, }; -static struct cdevsw mdevcdevsw = { - /* open */ mdevopen, - /* close */ mdevclose, - /* read */ mdevrw, - /* write */ mdevrw, - /* ioctl */ mdevcioctl, - /* stop */ eno_stop, - /* reset */ eno_reset, - /* ttys */ NULL, - /* select */ eno_select, - /* mmap */ eno_mmap, - /* strategy */ eno_strat, - /* getc */ eno_getc, - /* putc */ eno_putc, - /* flags */ D_DISK, +static const struct cdevsw mdevcdevsw = { + .d_open = mdevopen, + .d_close = mdevclose, + .d_read = mdevrw, + .d_write = mdevrw, + .d_ioctl = mdevcioctl, + .d_stop = eno_stop, + .d_reset = eno_reset, + .d_ttys = NULL, + .d_select = eno_select, + .d_mmap = eno_mmap, + .d_strategy = eno_strat, + .d_reserved_1 = eno_getc, + .d_reserved_2 = eno_putc, + .d_type = D_DISK, }; struct mdev { @@ -239,7 +239,7 @@ mdevrw(dev_t dev, struct uio *uio, __unused int ioflag) uio->uio_segflg = UIO_PHYS_USERSPACE; } } - status = uiomove64(mdata, uio_resid(uio), uio); /* Move the data */ + status = uiomove64(mdata, (int)uio_resid(uio), uio); /* Move the data */ uio->uio_segflg = saveflag; /* Restore the flag */ return status; @@ -280,7 +280,7 @@ mdevstrategy(struct buf *bp) } if ((blkoff + buf_count(bp)) > (mdev[devid].mdSize << 12)) { /* Will this read go past end? */ - buf_setcount(bp, ((mdev[devid].mdSize << 12) - blkoff)); /* Yes, trim to max */ + buf_setcount(bp, (uint32_t)((mdev[devid].mdSize << 12) - blkoff)); /* Yes, trim to max */ } /* * make sure the buffer's data area is @@ -308,7 +308,7 @@ mdevstrategy(struct buf *bp) } paddr = (addr64_t)(((addr64_t)pp << 12) | (addr64_t)(vaddr & 4095)); /* Get actual address */ bcopy_phys(fvaddr, paddr, csize); /* Copy this on in */ - mapping_set_mod(paddr >> 12); /* Make sure we know that it is modified */ + mapping_set_mod((ppnum_t)(paddr >> 12)); /* Make sure we know that it is modified */ left = left - csize; /* Calculate what is left */ vaddr = vaddr + csize; /* Move to next sink address */ @@ -441,7 +441,7 @@ mdevioctl(dev_t dev, u_long cmd, caddr_t data, __unused int flag, } memdev_info->mi_mdev = TRUE; memdev_info->mi_phys = (mdev[devid].mdFlags & mdPhys) ? TRUE : FALSE; - memdev_info->mi_base = mdev[devid].mdBase; + memdev_info->mi_base = (uint32_t)mdev[devid].mdBase; memdev_info->mi_size = mdev[devid].mdSize; break;