ia64/xen-unstable

view xen/arch/x86/pci.c @ 19697:42fe00c6f8b4

Enable pci mmcfg and ATS for x86_64

This patch enables PCI MMCONFIG in xen and turns on hooks for ATS.

Signed-off-by: Allen Kay <allen.m.kay@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jun 02 11:49:34 2009 +0100 (2009-06-02)
parents 69f670979660
children
line source
1 /******************************************************************************
2 * pci.c
3 *
4 * Architecture-dependent PCI access functions.
5 */
7 #include <xen/spinlock.h>
8 #include <asm/io.h>
10 static DEFINE_SPINLOCK(pci_config_lock);
12 uint32_t pci_conf_read(uint32_t cf8, uint8_t offset, uint8_t bytes)
13 {
14 unsigned long flags;
15 uint32_t value;
17 BUG_ON((offset + bytes) > 4);
19 spin_lock_irqsave(&pci_config_lock, flags);
21 outl(cf8, 0xcf8);
23 switch ( bytes )
24 {
25 case 1:
26 value = inb(0xcfc + offset);
27 break;
28 case 2:
29 value = inw(0xcfc + offset);
30 break;
31 case 4:
32 value = inl(0xcfc + offset);
33 break;
34 default:
35 value = 0;
36 BUG();
37 }
39 spin_unlock_irqrestore(&pci_config_lock, flags);
41 return value;
42 }
44 void pci_conf_write(uint32_t cf8, uint8_t offset, uint8_t bytes, uint32_t data)
45 {
46 unsigned long flags;
48 BUG_ON((offset + bytes) > 4);
50 spin_lock_irqsave(&pci_config_lock, flags);
52 outl(cf8, 0xcf8);
54 switch ( bytes )
55 {
56 case 1:
57 outb((uint8_t)data, 0xcfc + offset);
58 break;
59 case 2:
60 outw((uint16_t)data, 0xcfc + offset);
61 break;
62 case 4:
63 outl(data, 0xcfc + offset);
64 break;
65 }
67 spin_unlock_irqrestore(&pci_config_lock, flags);
68 }