title: about access to pci configuration space, the macro PCI_CONF1_ADDRESS confuse me
body: <p>I am learning the linux kernel code,about the part of pci, and I read the file <code>/arch/x86/pci/Direct.c</code>, some code confuse me:</p>
  
  <pre><code>/*
  * Functions for accessing PCI base (first 256 bytes) and extended
  * (4096 bytes per PCI function) configuration space with type 1
  * accesses.
  */
  #define PCI_CONF1_ADDRESS(bus, devfn, reg) \
  (0x80000000 | ((reg &amp; 0xF00) &lt;&lt; 16) | (bus &lt;&lt; 16) \
  | (devfn &lt;&lt; 8) | (reg &amp; 0xFC))
  
  static int pci_conf1_read(unsigned int seg, unsigned int bus,
            unsigned int devfn, int reg, int len, u32 *value)
  {
  unsigned long flags;
  
  if ((bus &gt; 255) || (devfn &gt; 255) || (reg &gt; 4095)) {
      *value = -1;
      return -EINVAL;
  }
  
  spin_lock_irqsave(&amp;pci_config_lock, flags);
  
  outl(PCI_CONF1_ADDRESS(bus, devfn, reg), 0xCF8);
  
  switch (len) {
  case 1:
      *value = inb(0xCFC + (reg &amp; 3));
      break;
  case 2:
      *value = inw(0xCFC + (reg &amp; 2));
      break;
  case 4:
      *value = inl(0xCFC);
      break;
  }
  
  spin_unlock_irqrestore(&amp;pci_config_lock, flags);
  
  return 0;
  }
  </code></pre>
  
  <p>The kernel version is 2.6.18,so, the macro PCI_CONF1_ADDRESS confuse me. As you know, it can only access to the first 256-byte of the pci confiuration space when using the IO port CF8/CFC, if you want to access the space between 256~4095-byte, you must use ECAM (Enhanced Configuration Access Mechanism), but the annotation above says:</p>
  
  <blockquote>
    <p>extended (4096 bytes per PCI function) configuration space with type 1 accesses.</p>
  </blockquote>
  
  <p>Does this mean that it can access all the 4096-byte of the pci configuration space when using IO port CF8/CFC? But why does the PCI LOCAL BUS SPECIFICATION never mention this?</p>
  
  <p>Meanwhile,i also feel puzzled about the expression:</p>
  
  <blockquote>
    <p>((reg &amp; 0xF00) &lt;&lt; 16)</p>
  </blockquote>
  
  <p>It use this way to generate a pci config address,I never saw this expression in any book or SPECIFICATION.</p>