ia64/xen-unstable

changeset 9197:42a1f6ffd0e9

Allow pciback to be placed into a permissive mode of operation whereby it allows
PCI config writes to succeed by default. Currently this is the only way to allow
control of a device that has device-specific registers in the config space from
a driver domain.

echo Y >/sys/module/pciback/parameters/permissive

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Mar 08 17:32:36 2006 +0100 (2006-03-08)
parents aae274b4c1a7
children f527a18cc8c3
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 Mar 08 15:51:28 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/pciback/conf_space.c	Wed Mar 08 17:32:36 2006 +0100
     1.3 @@ -14,6 +14,9 @@
     1.4  #include "pciback.h"
     1.5  #include "conf_space.h"
     1.6  
     1.7 +static int permissive = 0;
     1.8 +module_param(permissive, bool, 0644);
     1.9 +
    1.10  #define DEFINE_PCI_CONFIG(op,size,type) 					\
    1.11  int pciback_##op##_config_##size 							\
    1.12  (struct pci_dev *dev, int offset, type value, void *data)	\
    1.13 @@ -198,7 +201,7 @@ int pciback_config_read(struct pci_dev *
    1.14  
    1.15  int pciback_config_write(struct pci_dev *dev, int offset, int size, u32 value)
    1.16  {
    1.17 -	int err = 0;
    1.18 +	int err = 0, handled = 0;
    1.19  	struct pciback_dev_data *dev_data = pci_get_drvdata(dev);
    1.20  	struct config_field_entry *cfg_entry;
    1.21  	struct config_field *field;
    1.22 @@ -233,6 +236,21 @@ int pciback_config_write(struct pci_dev 
    1.23  					      field_start - req_start);
    1.24  
    1.25  			err = conf_space_write(dev, cfg_entry, offset, tmp_val);
    1.26 +			handled = 1;
    1.27 +		}
    1.28 +	}
    1.29 +
    1.30 +	if (!handled && !err && permissive) {
    1.31 +		switch (size) {
    1.32 +		case 1:
    1.33 +			err = pci_write_config_byte(dev, offset, (u8)value);
    1.34 +			break;
    1.35 +		case 2:
    1.36 +			err = pci_write_config_word(dev, offset, (u16)value);
    1.37 +			break;
    1.38 +		case 4:
    1.39 +			err = pci_write_config_dword(dev, offset, (u32)value);
    1.40 +			break;
    1.41  		}
    1.42  	}
    1.43