ia64/xen-unstable

changeset 1106:3ba8d5faadd2

bitkeeper revision 1.738 (403a08e3Uih368-VnbcDYq2QhWh-Xw)

Merge tempest.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into tempest.cl.cam.ac.uk:/local/scratch/smh22/xeno.bk
author smh22@tempest.cl.cam.ac.uk
date Mon Feb 23 14:06:27 2004 +0000 (2004-02-23)
parents 8870c27357dd a33324526ddc
children 5f3bbc9b6af5
files xen/common/domain.c xen/drivers/block/cciss.c xen/drivers/block/xen_block.c
line diff
     1.1 --- a/xen/common/domain.c	Mon Feb 23 13:57:02 2004 +0000
     1.2 +++ b/xen/common/domain.c	Mon Feb 23 14:06:27 2004 +0000
     1.3 @@ -570,6 +570,7 @@ int setup_guestos(struct task_struct *p,
     1.4  
     1.5      extern void ide_probe_devices(xen_disk_info_t *);
     1.6      extern void scsi_probe_devices(xen_disk_info_t *);
     1.7 +    extern void cciss_probe_devices(xen_disk_info_t *);
     1.8      xen_disk_info_t xdi;
     1.9      xen_disk_t *xd;
    1.10  
    1.11 @@ -803,6 +804,7 @@ int setup_guestos(struct task_struct *p,
    1.12      xdi.disks = xd;
    1.13      ide_probe_devices(&xdi);
    1.14      scsi_probe_devices(&xdi);
    1.15 +    cciss_probe_devices(&xdi);
    1.16      for ( i = 0; i < xdi.count; i++ )
    1.17      {
    1.18          xen_extent_t e;
     2.1 --- a/xen/drivers/block/cciss.c	Mon Feb 23 13:57:02 2004 +0000
     2.2 +++ b/xen/drivers/block/cciss.c	Mon Feb 23 14:06:27 2004 +0000
     2.3 @@ -433,6 +433,44 @@ static void cciss_geninit( int ctlr)
     2.4  	}
     2.5  	hba[ctlr]->gendisk.nr_real = hba[ctlr]->highest_lun+1;
     2.6  }
     2.7 +
     2.8 +
     2.9 +void cciss_probe_devices(xen_disk_info_t *xdi)
    2.10 +{
    2.11 +    int i, ctlr;
    2.12 +    drive_info_struct *drv; 
    2.13 +    xen_disk_t *xd = &xdi->disks[xdi->count];
    2.14 +
    2.15 +    ctlr = 0;  /* XXX SMH: only deal with 1 controller for now */
    2.16 +
    2.17 +    /* Loop through each real device */ 
    2.18 +    for(i=0; i < NWD; i++) {
    2.19 +	
    2.20 +        drv = &(hba[ctlr]->drv[i]);
    2.21 +	
    2.22 +	if (!(drv->nr_blocks))
    2.23 +            continue;
    2.24 +	
    2.25 +	if ( xdi->count == xdi->max )
    2.26 +	    BUG();
    2.27 +	
    2.28 +	
    2.29 +	hba[ctlr]->hd[i << NWD_SHIFT].nr_sects = 
    2.30 +	    hba[ctlr]->sizes[i << NWD_SHIFT] = drv->nr_blocks;
    2.31 +	
    2.32 +	/* We export 'raw' linux device numbers to domain 0. */
    2.33 +	xd->device   = MKDEV(hba[ctlr]->major, i << 4); 
    2.34 +	xd->info     = XD_TYPE_DISK;   /* XXX should check properly   */
    2.35 +        xd->capacity = drv->nr_blocks; /* in terms of 512byte sectors */
    2.36 +	xd->domain   = 0;
    2.37 +	
    2.38 +	xdi->count++;
    2.39 +        xd++;
    2.40 +	
    2.41 +    }
    2.42 +
    2.43 +}
    2.44 +
    2.45  /*
    2.46   * Open.  Make sure the device is really there.
    2.47   */
    2.48 @@ -2394,8 +2432,8 @@ next:
    2.49  	seg = 0;
    2.50  	lastdataend = ~0ULL;
    2.51  	while(bh) {
    2.52 -//		if (bh_phys(bh) == lastdataend)
    2.53 -		if ((page_to_phys(bh->b_page) + bh_offset(bh))== lastdataend)
    2.54 +
    2.55 +		if (bh_phys(bh) == lastdataend)
    2.56  		{  /* tack it on to the last segment */
    2.57  			tmp_sg[seg-1].length +=bh->b_size;
    2.58  			lastdataend += bh->b_size;
     3.1 --- a/xen/drivers/block/xen_block.c	Mon Feb 23 13:57:02 2004 +0000
     3.2 +++ b/xen/drivers/block/xen_block.c	Mon Feb 23 14:06:27 2004 +0000
     3.3 @@ -499,7 +499,13 @@ static void dispatch_rw_block_io(struct 
     3.4          bh->b_size          = phys_seg[i].nr_sects << 9;
     3.5          bh->b_dev           = phys_seg[i].dev;
     3.6          bh->b_rsector       = (unsigned long)phys_seg[i].sector_number;
     3.7 +
     3.8 +	/* SMH: we store a 'pseudo-virtual' bogus address in b_data since
     3.9 +	   later code will undo this transformation (i.e. +-PAGE_OFFSET). */
    3.10          bh->b_data          = phys_to_virt(phys_seg[i].buffer);
    3.11 +	
    3.12 +	/* SMH: bh_phys() uses the below field as a 'cheap' virt_to_phys */
    3.13 +	bh->b_page          = &frame_table[phys_seg[i].buffer>>PAGE_SHIFT]; 
    3.14          bh->b_end_io        = end_block_io_op;
    3.15          bh->pending_req     = pending_req;
    3.16