ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / ia64 / sn / io / machvec / pci.c
1 /* 
2  * SNI64 specific PCI support for SNI IO.
3  *
4  * This file is subject to the terms and conditions of the GNU General Public
5  * License.  See the file "COPYING" in the main directory of this archive
6  * for more details.
7  *
8  * Copyright (c) 1997, 1998, 2000-2003 Silicon Graphics, Inc.  All rights reserved.
9  */
10 #include <asm/sn/hcl.h>
11 #include <asm/sn/pci/pcibr_private.h>
12
13 /*
14  * These routines are only used during sn_pci_init for probing each bus, and
15  * can probably be removed with a little more cleanup now that the SAL routines
16  * work on sn2.
17  */
18
19 extern vertex_hdl_t devfn_to_vertex(unsigned char bus, unsigned char devfn);
20
21 int sn_read_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val)
22 {
23         unsigned long res = 0;
24         vertex_hdl_t device_vertex;
25
26         device_vertex = devfn_to_vertex(bus->number, devfn);
27
28         if (!device_vertex)
29                 return PCIBIOS_DEVICE_NOT_FOUND;
30
31         res = pciio_config_get(device_vertex, (unsigned)where, size);
32         *val = (u32)res;
33         return PCIBIOS_SUCCESSFUL;
34 }
35
36 int sn_write_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val)
37 {
38         vertex_hdl_t device_vertex;
39
40         device_vertex = devfn_to_vertex(bus->number, devfn);
41
42         if (!device_vertex)
43                 return PCIBIOS_DEVICE_NOT_FOUND;
44
45         pciio_config_set(device_vertex, (unsigned)where, size, (uint64_t)val);
46         return PCIBIOS_SUCCESSFUL;
47 }
48
49 struct pci_ops sn_pci_ops = {
50         .read = sn_read_config,
51         .write = sn_write_config,
52 };