patch-2.3.16 linux/arch/alpha/kernel/core_polaris.c

Next file: linux/arch/alpha/kernel/core_pyxis.c
Previous file: linux/arch/alpha/kernel/core_mcpcia.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.15/linux/arch/alpha/kernel/core_polaris.c linux/arch/alpha/kernel/core_polaris.c
@@ -2,8 +2,8 @@
  *      linux/arch/alpha/kernel/core_polaris.c
  *
  * POLARIS chip-specific code
- *
  */
+
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/pci.h>
@@ -20,7 +20,7 @@
 #undef __EXTERN_INLINE
 
 #include "proto.h"
-#include "bios32.h"
+#include "pci_impl.h"
 
 /*
  * BIOS32-style PCI interface:
@@ -66,8 +66,11 @@
  */
 
 static int
-mk_conf_addr(u8 bus, u8 device_fn, u8 where, unsigned long *pci_addr, u8 *type1)
+mk_conf_addr(struct pci_dev *dev, int where, unsigned long *pci_addr, u8 *type1)
 {
+	u8 bus = dev->bus->number;
+	u8 device_fn = dev->devfn;
+
 	*type1 = (bus == 0) ? 0 : 1;
 	*pci_addr = (bus << 16) | (device_fn << 8) | (where) |
 		    POLARIS_DENSE_CONFIG_BASE;
@@ -79,59 +82,52 @@
 	return 0;
 }
 
-int
-polaris_hose_read_config_byte (u8 bus, u8 device_fn, u8 where, u8 *value,
-                             struct linux_hose_info *hose)
+static int
+polaris_read_config_byte(struct pci_dev *dev, int where, u8 *value)
 {
 	unsigned long pci_addr;
 	unsigned char type1;
 
-	if (mk_conf_addr(bus, device_fn, where, &pci_addr, &type1))
+	if (mk_conf_addr(dev, where, &pci_addr, &type1))
                 return PCIBIOS_DEVICE_NOT_FOUND;
 
 	*value = __kernel_ldbu(*(vucp)pci_addr);
 	return PCIBIOS_SUCCESSFUL;
 }
 
-
-int
-polaris_hose_read_config_word (u8 bus, u8 device_fn, u8 where, u16 *value,
-                             struct linux_hose_info *hose)
+static int
+polaris_read_config_word(struct pci_dev *dev, int where, u16 *value)
 {
 	unsigned long pci_addr;
 	unsigned char type1;
 
-	if (mk_conf_addr(bus, device_fn, where, &pci_addr, &type1))
+	if (mk_conf_addr(dev, where, &pci_addr, &type1))
                 return PCIBIOS_DEVICE_NOT_FOUND;
 
 	*value = __kernel_ldwu(*(vusp)pci_addr);
 	return PCIBIOS_SUCCESSFUL;
 }
 
-
-int
-polaris_hose_read_config_dword (u8 bus, u8 device_fn, u8 where, u32 *value,
-                              struct linux_hose_info *hose)
+static int
+polaris_read_config_dword(struct pci_dev *dev, int where, u32 *value)
 {
 	unsigned long pci_addr;
 	unsigned char type1;
 
-	if (mk_conf_addr(bus, device_fn, where, &pci_addr, &type1))
+	if (mk_conf_addr(dev, where, &pci_addr, &type1))
                 return PCIBIOS_DEVICE_NOT_FOUND;
 
 	*value = *(vuip)pci_addr;
 	return PCIBIOS_SUCCESSFUL;
 }
 
-
-int 
-polaris_hose_write_config_byte (u8 bus, u8 device_fn, u8 where, u8 value,
-                              struct linux_hose_info *hose)
+static int 
+polaris_write_config_byte(struct pci_dev *dev, int where, u8 value)
 {
 	unsigned long pci_addr;
 	unsigned char type1;
 
-	if (mk_conf_addr(bus, device_fn, where, &pci_addr, &type1))
+	if (mk_conf_addr(dev, where, &pci_addr, &type1))
                 return PCIBIOS_DEVICE_NOT_FOUND;
 
         __kernel_stb(value, *(vucp)pci_addr);
@@ -140,15 +136,13 @@
 	return PCIBIOS_SUCCESSFUL;
 }
 
-
-int 
-polaris_hose_write_config_word (u8 bus, u8 device_fn, u8 where, u16 value,
-                              struct linux_hose_info *hose)
+static int 
+polaris_write_config_word(struct pci_dev *dev, int where, u16 value)
 {
 	unsigned long pci_addr;
 	unsigned char type1;
 
-	if (mk_conf_addr(bus, device_fn, where, &pci_addr, &type1))
+	if (mk_conf_addr(dev, where, &pci_addr, &type1))
                 return PCIBIOS_DEVICE_NOT_FOUND;
 
         __kernel_stw(value, *(vusp)pci_addr);
@@ -157,15 +151,13 @@
 	return PCIBIOS_SUCCESSFUL;
 }
 
-
-int 
-polaris_hose_write_config_dword (u8 bus, u8 device_fn, u8 where, u32 value,
-                               struct linux_hose_info *hose)
+static int 
+polaris_write_config_dword(struct pci_dev *dev, int where, u32 value)
 {
 	unsigned long pci_addr;
 	unsigned char type1;
 
-	if (mk_conf_addr(bus, device_fn, where, &pci_addr, &type1))
+	if (mk_conf_addr(dev, where, &pci_addr, &type1))
                 return PCIBIOS_DEVICE_NOT_FOUND;
 
 	*(vuip)pci_addr = value;
@@ -174,9 +166,21 @@
 	return PCIBIOS_SUCCESSFUL;
 }
 
+struct pci_ops polaris_pci_ops = 
+{
+	read_byte:	polaris_read_config_byte,
+	read_word:	polaris_read_config_word,
+	read_dword:	polaris_read_config_dword,
+	write_byte:	polaris_write_config_byte,
+	write_word:	polaris_write_config_word,
+	write_dword:	polaris_write_config_dword
+};
+
 void __init
 polaris_init_arch(unsigned long *mem_start, unsigned long *mem_end)
 {
+	struct pci_controler *hose;
+
 	/* May need to initialize error reporting (see PCICTL0/1), but
 	 * for now assume that the firmware has done the right thing
 	 * already.
@@ -184,6 +188,16 @@
 #if 0
 	printk("polaris_init_arch(): trusting firmware for setup\n");
 #endif
+
+	/*
+	 * Create our single hose.
+	 */
+
+	hose = alloc_pci_controler(mem_start);
+	hose->io_space = &ioport_resource;
+	hose->mem_space = &iomem_resource;
+	hose->config_space = POLARIS_DENSE_CONFIG_BASE;
+	hose->index = 0;
 }
 
 static inline void

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)