This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / drivers / xen / pciback / conf_space_capability_vpd.c
1 /*
2  * PCI Backend - Configuration space overlay for Vital Product Data
3  *
4  * Author: Ryan Wilson <hap9@epoch.ncsc.mil>
5  */
6
7 #include <linux/pci.h>
8 #include "conf_space.h"
9 #include "conf_space_capability.h"
10
11 static int vpd_address_write(struct pci_dev *dev, int offset, u16 value,
12                              void *data)
13 {
14         /* Disallow writes to the vital product data */
15         if (value & PCI_VPD_ADDR_F)
16                 return PCIBIOS_SET_FAILED;
17         else
18                 return pci_write_config_word(dev, offset, value);
19 }
20
21 static struct config_field caplist_vpd[] = {
22         {
23          .offset    = PCI_VPD_ADDR,
24          .size      = 2,
25          .u.w.read  = pciback_read_config_word,
26          .u.w.write = vpd_address_write,
27          },
28         {
29          .offset     = PCI_VPD_DATA,
30          .size       = 4,
31          .u.dw.read  = pciback_read_config_dword,
32          .u.dw.write = NULL,
33          },
34         {
35          .size = 0,
36          },
37 };
38  
39 struct pciback_config_capability pciback_config_capability_vpd = {
40         .capability = PCI_CAP_ID_VPD,
41         .fields = caplist_vpd,
42 };