ia64/xen-unstable

changeset 9588:576317252bf2

There are a couple of bugs with the current handling of reads and writes
in the configuration space overlay functions. The wrong offset is passed
to the virtual field handlers. This patch uses the variable which
contains the correct offset. This patch also fixes the logic which
generates the actual value to write to a given virtual configuration
space field.

Signed-off-by: Ryan Wilson <hap9@epoch.ncsc.mil>
author kaf24@firebug.cl.cam.ac.uk
date Wed Apr 05 10:52:10 2006 +0100 (2006-04-05)
parents d1ddd7d35ed5
children ce7746d47f18
files linux-2.6-xen-sparse/drivers/xen/pciback/conf_space.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/pciback/conf_space.c	Wed Apr 05 10:41:11 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pciback/conf_space.c	Wed Apr 05 10:52:10 2006 +0100
     1.3 @@ -106,7 +106,7 @@ static inline int valid_request(int offs
     1.4  }
     1.5  
     1.6  static inline u32 merge_value(u32 val, u32 new_val, u32 new_val_mask,
     1.7 -			      u32 offset)
     1.8 +			      int offset)
     1.9  {
    1.10  	if (offset >= 0) {
    1.11  		new_val_mask <<= (offset * 8);
    1.12 @@ -180,7 +180,8 @@ int pciback_config_read(struct pci_dev *
    1.13  
    1.14  		if ((req_start >= field_start && req_start < field_end)
    1.15  		    || (req_end > field_start && req_end <= field_end)) {
    1.16 -			err = conf_space_read(dev, cfg_entry, offset, &tmp_val);
    1.17 +			err = conf_space_read(dev, cfg_entry, field_start,
    1.18 +					      &tmp_val);
    1.19  			if (err)
    1.20  				goto out;
    1.21  
    1.22 @@ -228,14 +229,16 @@ int pciback_config_write(struct pci_dev 
    1.23  		    || (req_end > field_start && req_end <= field_end)) {
    1.24  			tmp_val = 0;
    1.25  
    1.26 -			err = pciback_config_read(dev, offset, size, &tmp_val);
    1.27 +			err = pciback_config_read(dev, field_start,
    1.28 +						  field->size, &tmp_val);
    1.29  			if (err)
    1.30  				break;
    1.31  
    1.32  			tmp_val = merge_value(tmp_val, value, get_mask(size),
    1.33 -					      field_start - req_start);
    1.34 +					      req_start - field_start);
    1.35  
    1.36 -			err = conf_space_write(dev, cfg_entry, offset, tmp_val);
    1.37 +			err = conf_space_write(dev, cfg_entry, field_start,
    1.38 +					       tmp_val);
    1.39  			handled = 1;
    1.40  		}
    1.41  	}