pcibios removal changes for 2.5.48
PATCH 1/1 pcibios removal changes for 2.5.48
Hi,
Here are a few changesets that removes almost all of the remaining usages of pcibios_read_config* and pcibios_write_config* calls. It also removes them from pci.h and deletes drivers/pci/compat.c.
These changes have been in the -ac tree for a while, and I have been running a lot of different types of machines with them for a number of weeks (servers to laptops).
Please pull from: bk://linuxusb.bkbits.net/pci-2.5
There are still a small number of places in the tree where these functions show up, but the usage falls into one of three categories:
- compatibility code for older kernels. This includes the following files:
drivers/scsi/gdth.c
drivers/scsi/sym53c8xx.c drivers/scsi/sym53c8xx_comm.h drivers/scsi/tmscsim.c
drivers/scsi/megaraid.c
drivers/net/wan/sdladrv.c
drivers/char/ip2main.c
linux/compatmac.h
- drivers that are outdated and do not build anyway:
drivers/isdn/hisax/hfc_pci.c drivers/isdn/eicon/lincfg.c drivers/isdn/eicon/linio.c
- arch specific code that I can not build, nor test. A number of these instances contain code that directly touches hardware (the network driver is an example of that), or is doing other platform specific stuff that I do not know how to fix:
drivers/video/S3triofb.c drivers/net/gt96100eth.c alpha/kernel/sys_nautilus.c alpha/kernel/sys_sio.c
I also think that a number of older pcibios functions can be removed from m68knommu/kernel/comempci.c, but will have to ask the author of that file first.
thanks,
greg k-h
drivers/pci/compat.c | 37 ------------------------------------- drivers/isdn/hisax/bkm_a8.c | 23 ++++++++--------------- drivers/pci/Makefile | 4 ++-- drivers/pcmcia/cistpl.c | 5 ++++- include/linux/pci.h | 17 ----------------- 5 files changed, 14 insertions(+), 72 deletions(-)
-----
[email protected], 2002-11-19 20:30:40-08:00, [email protected]
PCI: removed pcibios_read_config_* and pcibios_write_config_* functions.
drivers/pci/compat.c | 37 ------------------------------------- drivers/pci/Makefile | 4 ++-- include/linux/pci.h | 17 ----------------- 3 files changed, 2 insertions(+), 56 deletions(-)
------
[email protected], 2002-11-19 20:24:56-08:00, [email protected]
PCMCIA: remove usage of pcibios_read_config_dword
drivers/pcmcia/cistpl.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-)
------
[email protected], 2002-11-19 20:23:31-08:00, [email protected]
ISDN: Convert usages of pcibios_* functions to pci_*
drivers/isdn/hisax/bkm_a8.c | 23 ++++++++--------------- 1 files changed, 8 insertions(+), 15 deletions(-)
------
PATCH 1/1 pcibios removal changes for 2.5.48
ChangeSet 1.872.3.1, 2002/11/19 20:23:31-08:00, [email protected]
ISDN: Convert usages of pcibios_* functions to pci_*
drivers/isdn/hisax/bkm_a8.c +8 -15
@@ -278,8 +278,6 @@static struct pci_dev *dev_a8__initdata =NULL ;static u16 sub_vendor_id__initdata =0 ;static u16 sub_sys_id__initdata =0 ; -static u_char pci_bus__initdata =0 ; -static u_char pci_device_fn__initdata =0 ;static u_char pci_irq__initdata =0 ;#endif /* CONFIG_PCI */
@@ -328,8 +326,6 @@return (0 ); pci_ioaddr1 =pci_resource_start (dev_a8,1 ); pci_irq = dev_a8->irq; - pci_bus = dev_a8->bus->number; - pci_device_fn = dev_a8->devfn; found =1 ;break ; }
@@ -342,20 +338,17 @@ }#ifdef ATTEMPT_PCI_REMAPPING /* HACK: PLX revision 1 bug: PLX address bit 7 must not be set */ -pcibios_read_config_byte (pci_bus, pci_device_fn, -PCI_REVISION_ID , &pci_rev_id); +pci_read_config_byte (dev_a8,PCI_REVISION_ID , &pci_rev_id);if ((pci_ioaddr1 &0x80 ) && (pci_rev_id ==1 )) {printk (KERN_WARNING "HiSax: %s (%s): PLX rev 1, remapping required!\n" , CardType[card->typ], sct_quadro_subtypes[cs->subtyp]);/* Restart PCI negotiation */ -pcibios_write_config_dword (pci_bus, pci_device_fn, -PCI_BASE_ADDRESS_1 , (u_int) -1 ); +pci_write_config_dword (dev_a8,PCI_BASE_ADDRESS_1 , (u_int) -1 );/* Move up by 0x80 byte */ pci_ioaddr1 +=0x80 ; pci_ioaddr1 &=PCI_BASE_ADDRESS_IO_MASK ; -pcibios_write_config_dword (pci_bus, pci_device_fn, -PCI_BASE_ADDRESS_1 , pci_ioaddr1); +pci_write_config_dword (dev_a8,PCI_BASE_ADDRESS_1 , pci_ioaddr1); dev_a8->resource[1 ].start = pci_ioaddr1; }#endif /* End HACK */
@@ -366,11 +359,11 @@ sct_quadro_subtypes[cs->subtyp]);return (0 ); } -pcibios_read_config_dword (pci_bus, pci_device_fn,PCI_BASE_ADDRESS_1 , &pci_ioaddr1); -pcibios_read_config_dword (pci_bus, pci_device_fn,PCI_BASE_ADDRESS_2 , &pci_ioaddr2); -pcibios_read_config_dword (pci_bus, pci_device_fn,PCI_BASE_ADDRESS_3 , &pci_ioaddr3); -pcibios_read_config_dword (pci_bus, pci_device_fn,PCI_BASE_ADDRESS_4 , &pci_ioaddr4); -pcibios_read_config_dword (pci_bus, pci_device_fn,PCI_BASE_ADDRESS_5 , &pci_ioaddr5); +pci_read_config_dword (dev_a8,PCI_BASE_ADDRESS_1 , &pci_ioaddr1); +pci_read_config_dword (dev_a8,PCI_BASE_ADDRESS_2 , &pci_ioaddr2); +pci_read_config_dword (dev_a8,PCI_BASE_ADDRESS_3 , &pci_ioaddr3); +pci_read_config_dword (dev_a8,PCI_BASE_ADDRESS_4 , &pci_ioaddr4); +pci_read_config_dword (dev_a8,PCI_BASE_ADDRESS_5 , &pci_ioaddr5);if (!pci_ioaddr1 || !pci_ioaddr2 || !pci_ioaddr3 || !pci_ioaddr4 || !pci_ioaddr5) { printk(KERN_WARNING "HiSax: %s (%s): No IO base address(es)\n", CardType[card->typ],
ChangeSet 1.872.3.2, 2002/11/19 20:24:56-08:00, [email protected]
PCMCIA: remove usage of pcibios_read_config_dword
drivers/pcmcia/cistpl.c +4 -1
@@ -430,7 +430,10 @@#ifdef CONFIG_CARDBUS if (s->state &SOCKET_CARDBUS ) {u_int ptr; -pcibios_read_config_dword (s->cap.cb_dev->subordinate->number,0 ,0x28 , &ptr); +struct pci_dev *dev =pci_find_slot (s->cap.cb_dev->subordinate->number,0 ); +if (!dev) +return CS_BAD_HANDLE ; +pci_read_config_dword (dev,0x28 , &ptr); tuple->CISOffset = ptr & ~7 ;SPACE (tuple->Flags) = (ptr &7 ); }else
ChangeSet 1.872.3.3, 2002/11/19 20:30:40-08:00, [email protected]
PCI: removed pcibios_read_config_* and pcibios_write_config_* functions.
drivers/pci/Makefile +2 -2
@@ -3,10 +3,10 @@ # export-objs := access.o hotplug.o pci-driver.o pci.o pool.o \ - probe.o proc.o search.o compat.o setup-bus.o + probe.o proc.o search.o setup-bus.o obj-y += access.o probe.o pci.o pool.o quirks.o \ - compat.o names.o pci-driver.o search.o hotplug.o + names.o pci-driver.o search.o hotplug.o obj-$(CONFIG_PM) += power.o obj-$(CONFIG_PROC_FS) += proc.o
drivers/pci/compat.c deleted +0 -37
@@ -1,37 +0,0 @@ -/* -* $Id: compat.c,v 1.1 1998/02/16 10:35:50 mj Exp $ -* -* PCI Bus Services -- Function For Backward Compatibility -* -* Copyright 1998--2000 Martin Mares <[email protected]> -*/ - -#include <linux/types.h> -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/pci.h> - -/* Obsolete functions, these will be going away... */ - -#define PCI_OP (rw,size,type) \ -int pcibios_##rw##_config_##size (unsigned char bus, unsigned char dev_fn, \ - unsigned char where, unsigned type val) \ -{ \ - struct pci_dev *dev = pci_find_slot(bus, dev_fn); \ - if (!dev) return PCIBIOS_DEVICE_NOT_FOUND; \ - return pci_##rw##_config_##size(dev, where, val); \ -} - -PCI_OP(read, byte, char *) -PCI_OP(read, word, short *) -PCI_OP(read, dword, int *) -PCI_OP(write, byte, char) -PCI_OP(write, word, short) -PCI_OP(write, dword, int) - -EXPORT_SYMBOL(pcibios_read_config_byte); -EXPORT_SYMBOL(pcibios_read_config_word); -EXPORT_SYMBOL(pcibios_read_config_dword); -EXPORT_SYMBOL (pcibios_write_config_byte); -EXPORT_SYMBOL (pcibios_write_config_word); -EXPORT_SYMBOL (pcibios_write_config_dword);
include/linux/pci.h +0 -17
@@ -517,21 +517,6 @@void pcibios_update_irq (struct pci_dev *,int irq);void pcibios_fixup_pbus_ranges (struct pci_bus *,struct pbus_set_ranges_data *); -/* Backward compatibility, don't use in new code! */ - -int pcibios_read_config_byte (unsigned char bus,unsigned char dev_fn, -unsigned char where,unsigned char *val); -int pcibios_read_config_word (unsigned char bus,unsigned char dev_fn, -unsigned char where,unsigned short *val); -int pcibios_read_config_dword (unsigned char bus,unsigned char dev_fn, -unsigned char where,unsigned int *val); -int pcibios_write_config_byte (unsigned char bus,unsigned char dev_fn, -unsigned char where,unsigned char val); -int pcibios_write_config_word (unsigned char bus,unsigned char dev_fn, -unsigned char where,unsigned short val); -int pcibios_write_config_dword (unsigned char bus,unsigned char dev_fn, -unsigned char where,unsigned int val); -/* Generic PCI functions used internally */ int pci_bus_exists (const struct list_head *list,int nr);
@@ -668,8 +653,6 @@static inline int pci_present (void ) {return 0 ; }#define _PCI_NOP (o,s,t) \ - static inline int pcibios_##o##_config_##s (u8 bus, u8 dfn, u8 where, t val) \ - { return PCIBIOS_FUNC_NOT_SUPPORTED; } \ static inline int pci_##o##_config_##s (struct pci_dev *dev, int where, t val) \ { return PCIBIOS_FUNC_NOT_SUPPORTED; }#define _PCI_NOP_ALL (o,x) _PCI_NOP(o,byte,u8 x) \
drivers/pcmcia/cistpl.c line 439
Quoted 11 lines · Greg KH
#ifdef CONFIG_CARDBUS if (s->state & SOCKET_CARDBUS) {drivers/pcmcia/cistpl.c +4
-1u_int ptr; -pcibios_read_config_dword (s->cap.cb_dev->subordinate->number,0 ,0x28 , &ptr); +struct pci_dev *dev =pci_find_slot (s->cap.cb_dev->subordinate->number,0 ); +if (!dev) +return CS_BAD_HANDLE ; +pci_read_config_dword (dev,0x28 , &ptr); tuple->CISOffset = ptr & ~7 ;SPACE (tuple->Flags) = (ptr &7 ); }else
pci_find_slot seems to be an overkill. Why not just
- pcibios_read_config_dword(s->cap.cb_dev->subordinate->number, 0, 0x28, &ptr);
+ pci_bus_read_config_dword(s->cap.cb_dev->subordinate, 0, 0x28, &ptr);
?
Ivan.
Quoted 14 lines · Ivan Kokshaysky
drivers/pcmcia/cistpl.c line 439
Quoted 11 lines · Greg KH
#ifdef CONFIG_CARDBUS if (s->state & SOCKET_CARDBUS) {drivers/pcmcia/cistpl.c +4
-1u_int ptr; -pcibios_read_config_dword (s->cap.cb_dev->subordinate->number,0 ,0x28 , &ptr); +struct pci_dev *dev =pci_find_slot (s->cap.cb_dev->subordinate->number,0 ); +if (!dev) +return CS_BAD_HANDLE ; +pci_read_config_dword (dev,0x28 , &ptr); tuple->CISOffset = ptr & ~7 ;SPACE (tuple->Flags) = (ptr &7 ); }else
pci_find_slotseems to be an overkill. Why not just
Review
Quoted 2 lines
(quoted diff) +1
-1- pcibios_read_config_dword(s->cap.cb_dev->subordinate->number, 0, 0x28, &ptr); + pci_bus_read_config_dword(s->cap.cb_dev->subordinate, 0, 0x28, &ptr);
Heh, didn't think of that one, I guess it would work too :)
thanks,
greg k-h