blkfront.c (286062) | blkfront.c (286372) |
---|---|
1/* 2 * XenBSD block device driver 3 * 4 * Copyright (c) 2010-2013 Spectra Logic Corporation 5 * Copyright (c) 2009 Scott Long, Yahoo! 6 * Copyright (c) 2009 Frank Suchomel, Citrix 7 * Copyright (c) 2009 Doug F. Rabson, Citrix 8 * Copyright (c) 2005 Kip Macy --- 15 unchanged lines hidden (view full) --- 24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 28 * DEALINGS IN THE SOFTWARE. 29 */ 30 31#include <sys/cdefs.h> | 1/* 2 * XenBSD block device driver 3 * 4 * Copyright (c) 2010-2013 Spectra Logic Corporation 5 * Copyright (c) 2009 Scott Long, Yahoo! 6 * Copyright (c) 2009 Frank Suchomel, Citrix 7 * Copyright (c) 2009 Doug F. Rabson, Citrix 8 * Copyright (c) 2005 Kip Macy --- 15 unchanged lines hidden (view full) --- 24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 28 * DEALINGS IN THE SOFTWARE. 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/sys/dev/xen/blkfront/blkfront.c 286062 2015-07-30 03:50:01Z cperciva $"); | 32__FBSDID("$FreeBSD: head/sys/dev/xen/blkfront/blkfront.c 286372 2015-08-06 17:07:21Z jhb $"); |
33 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/malloc.h> 37#include <sys/kernel.h> 38#include <vm/vm.h> 39#include <vm/pmap.h> 40 --- 14 unchanged lines hidden (view full) --- 55#include <xen/hypervisor.h> 56#include <xen/xen_intr.h> 57#include <xen/gnttab.h> 58#include <xen/interface/grant_table.h> 59#include <xen/interface/io/protocols.h> 60#include <xen/xenbus/xenbusvar.h> 61 62#include <machine/_inttypes.h> | 33 34#include <sys/param.h> 35#include <sys/systm.h> 36#include <sys/malloc.h> 37#include <sys/kernel.h> 38#include <vm/vm.h> 39#include <vm/pmap.h> 40 --- 14 unchanged lines hidden (view full) --- 55#include <xen/hypervisor.h> 56#include <xen/xen_intr.h> 57#include <xen/gnttab.h> 58#include <xen/interface/grant_table.h> 59#include <xen/interface/io/protocols.h> 60#include <xen/xenbus/xenbusvar.h> 61 62#include <machine/_inttypes.h> |
63#include <machine/xen/xenvar.h> | |
64 65#include <geom/geom_disk.h> 66 67#include <dev/xen/blkfront/block.h> 68 69#include "xenbus_if.h" 70 71/*--------------------------- Forward Declarations ---------------------------*/ --- 685 unchanged lines hidden (view full) --- 757 SHARED_RING_INIT(sring); 758 FRONT_RING_INIT(&sc->xbd_ring, sring, sc->xbd_ring_pages * PAGE_SIZE); 759 760 for (i = 0, sring_page_addr = (uintptr_t)sring; 761 i < sc->xbd_ring_pages; 762 i++, sring_page_addr += PAGE_SIZE) { 763 764 error = xenbus_grant_ring(sc->xbd_dev, | 63 64#include <geom/geom_disk.h> 65 66#include <dev/xen/blkfront/block.h> 67 68#include "xenbus_if.h" 69 70/*--------------------------- Forward Declarations ---------------------------*/ --- 685 unchanged lines hidden (view full) --- 756 SHARED_RING_INIT(sring); 757 FRONT_RING_INIT(&sc->xbd_ring, sring, sc->xbd_ring_pages * PAGE_SIZE); 758 759 for (i = 0, sring_page_addr = (uintptr_t)sring; 760 i < sc->xbd_ring_pages; 761 i++, sring_page_addr += PAGE_SIZE) { 762 763 error = xenbus_grant_ring(sc->xbd_dev, |
765 (vtomach(sring_page_addr) >> PAGE_SHIFT), | 764 (vtophys(sring_page_addr) >> PAGE_SHIFT), |
766 &sc->xbd_ring_ref[i]); 767 if (error) { 768 xenbus_dev_fatal(sc->xbd_dev, error, 769 "granting ring_ref(%d)", i); 770 return (error); 771 } 772 } 773 if (sc->xbd_ring_pages == 1) { --- 526 unchanged lines hidden (view full) --- 1300 PAGE_SIZE * sc->xbd_max_request_indirectpages, 1301 M_XENBLOCKFRONT, M_ZERO, 0, ~0, PAGE_SIZE, 0); 1302 } else { 1303 indirectpages = NULL; 1304 } 1305 for (j = 0; j < sc->xbd_max_request_indirectpages; j++) { 1306 if (gnttab_grant_foreign_access( 1307 xenbus_get_otherend_id(sc->xbd_dev), | 765 &sc->xbd_ring_ref[i]); 766 if (error) { 767 xenbus_dev_fatal(sc->xbd_dev, error, 768 "granting ring_ref(%d)", i); 769 return (error); 770 } 771 } 772 if (sc->xbd_ring_pages == 1) { --- 526 unchanged lines hidden (view full) --- 1299 PAGE_SIZE * sc->xbd_max_request_indirectpages, 1300 M_XENBLOCKFRONT, M_ZERO, 0, ~0, PAGE_SIZE, 0); 1301 } else { 1302 indirectpages = NULL; 1303 } 1304 for (j = 0; j < sc->xbd_max_request_indirectpages; j++) { 1305 if (gnttab_grant_foreign_access( 1306 xenbus_get_otherend_id(sc->xbd_dev), |
1308 (vtomach(indirectpages) >> PAGE_SHIFT) + j, | 1307 (vtophys(indirectpages) >> PAGE_SHIFT) + j, |
1309 1 /* grant read-only access */, 1310 &cm->cm_indirectionrefs[j])) 1311 break; 1312 } 1313 if (j < sc->xbd_max_request_indirectpages) 1314 break; 1315 cm->cm_indirectionpages = indirectpages; 1316 xbd_free_command(cm); --- 253 unchanged lines hidden --- | 1308 1 /* grant read-only access */, 1309 &cm->cm_indirectionrefs[j])) 1310 break; 1311 } 1312 if (j < sc->xbd_max_request_indirectpages) 1313 break; 1314 cm->cm_indirectionpages = indirectpages; 1315 xbd_free_command(cm); --- 253 unchanged lines hidden --- |