patch-2.3.48 linux/arch/mips/sni/pci.c
Next file: linux/arch/mips/sni/pcimt_scache.c
Previous file: linux/arch/mips/sni/io.c
Back to the patch index
Back to the overall index
- Lines: 165
- Date:
Thu Feb 24 22:52:30 2000
- Orig file:
v2.3.47/linux/arch/mips/sni/pci.c
- Orig date:
Thu Jan 6 12:57:47 2000
diff -u --recursive --new-file v2.3.47/linux/arch/mips/sni/pci.c linux/arch/mips/sni/pci.c
@@ -1,4 +1,4 @@
-/* $Id: pci.c,v 1.7 1999/01/04 16:03:58 ralf Exp $
+/* $Id: pci.c,v 1.10 2000/02/05 06:47:09 ralf Exp $
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
@@ -6,7 +6,7 @@
*
* SNI specific PCI support for RM200/RM300.
*
- * Copyright (C) 1997, 1998 Ralf Baechle
+ * Copyright (C) 1997, 1998, 1999 Ralf Baechle
*/
#include <linux/config.h>
#include <linux/kernel.h>
@@ -17,16 +17,18 @@
#ifdef CONFIG_PCI
-#define mkaddr(bus, dev_fn, where) \
+#define mkaddr(dev, where) \
do { \
- if (bus == 0 && dev_fn >= PCI_DEVFN(8, 0)) \
+ if ((dev)->bus->number == 0) \
return -1; \
- *(volatile u32 *)PCIMT_CONFIG_ADDRESS = ((bus & 0xff) << 0x10) | \
- ((dev_fn & 0xff) << 0x08) | \
- (where & 0xfc); \
+ *(volatile u32 *)PCIMT_CONFIG_ADDRESS = \
+ ((dev->bus->number & 0xff) << 0x10) | \
+ ((dev->dev_fn & 0xff) << 0x08) | \
+ (where & 0xfc); \
} while(0);
-static void sni_rm200_pcibios_fixup (void)
+/* To do: Bring this uptodate ... */
+static void pcimt_pcibios_fixup (void)
{
struct pci_dev *dev;
@@ -65,14 +67,12 @@
* We can't address 8 and 16 bit words directly. Instead we have to
* read/write a 32bit word and mask/modify the data we actually want.
*/
-static int sni_rm200_pcibios_read_config_byte (unsigned char bus,
- unsigned char dev_fn,
- unsigned char where,
- unsigned char *val)
+static int pcimt_read_config_byte (struct pci_dev *dev,
+ int where, unsigned char *val)
{
u32 res;
- mkaddr(bus, dev_fn, where);
+ mkaddr(dev, where);
res = *(volatile u32 *)PCIMT_CONFIG_DATA;
res = (le32_to_cpu(res) >> ((where & 3) << 3)) & 0xff;
*val = res;
@@ -80,16 +80,14 @@
return PCIBIOS_SUCCESSFUL;
}
-static int sni_rm200_pcibios_read_config_word (unsigned char bus,
- unsigned char dev_fn,
- unsigned char where,
- unsigned short *val)
+static int pcimt_read_config_word (struct pci_dev *dev,
+ int where, unsigned short *val)
{
u32 res;
if (where & 1)
return PCIBIOS_BAD_REGISTER_NUMBER;
- mkaddr(bus, dev_fn, where);
+ mkaddr(dev, where);
res = *(volatile u32 *)PCIMT_CONFIG_DATA;
res = (le32_to_cpu(res) >> ((where & 3) << 3)) & 0xffff;
*val = res;
@@ -97,16 +95,14 @@
return PCIBIOS_SUCCESSFUL;
}
-static int sni_rm200_pcibios_read_config_dword (unsigned char bus,
- unsigned char dev_fn,
- unsigned char where,
- unsigned int *val)
+static int pcimt_read_config_dword (struct pci_dev *dev,
+ int where, unsigned int *val)
{
u32 res;
if (where & 3)
return PCIBIOS_BAD_REGISTER_NUMBER;
- mkaddr(bus, dev_fn, where);
+ mkaddr(dev, where);
res = *(volatile u32 *)PCIMT_CONFIG_DATA;
res = le32_to_cpu(res);
*val = res;
@@ -114,51 +110,44 @@
return PCIBIOS_SUCCESSFUL;
}
-static int sni_rm200_pcibios_write_config_byte (unsigned char bus,
- unsigned char dev_fn,
- unsigned char where,
- unsigned char val)
+static int pcimt_write_config_byte (struct pci_dev *dev,
+ int where, unsigned char val)
{
- mkaddr(bus, dev_fn, where);
+ mkaddr(dev, where);
*(volatile u8 *)(PCIMT_CONFIG_DATA + (where & 3)) = val;
return PCIBIOS_SUCCESSFUL;
}
-static int sni_rm200_pcibios_write_config_word (unsigned char bus,
- unsigned char dev_fn,
- unsigned char where,
- unsigned short val)
+static int pcimt_write_config_word (struct pci_dev *dev,
+ int where, unsigned short val)
{
if (where & 1)
return PCIBIOS_BAD_REGISTER_NUMBER;
- mkaddr(bus, dev_fn, where);
+ mkaddr(dev, where);
*(volatile u16 *)(PCIMT_CONFIG_DATA + (where & 3)) = le16_to_cpu(val);
return PCIBIOS_SUCCESSFUL;
}
-static int sni_rm200_pcibios_write_config_dword (unsigned char bus,
- unsigned char dev_fn,
- unsigned char where,
- unsigned int val)
+static int pcimt_write_config_dword (struct pci_dev *dev,
+ int where, unsigned int val)
{
if (where & 3)
return PCIBIOS_BAD_REGISTER_NUMBER;
- mkaddr(bus, dev_fn, where);
+ mkaddr(dev, where);
*(volatile u32 *)PCIMT_CONFIG_DATA = le32_to_cpu(val);
return PCIBIOS_SUCCESSFUL;
}
struct pci_ops sni_pci_ops = {
- sni_rm200_pcibios_fixup,
- sni_rm200_pcibios_read_config_byte,
- sni_rm200_pcibios_read_config_word,
- sni_rm200_pcibios_read_config_dword,
- sni_rm200_pcibios_write_config_byte,
- sni_rm200_pcibios_write_config_word,
- sni_rm200_pcibios_write_config_dword
+ pcimt_read_config_byte,
+ pcimt_read_config_word,
+ pcimt_read_config_dword,
+ pcimt_write_config_byte,
+ pcimt_write_config_word,
+ pcimt_write_config_dword
};
#endif /* CONFIG_PCI */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)