From: Frank Mori Hess Date: Fri, 15 Feb 2002 22:39:17 +0000 (+0000) Subject: fixed pci_resource_start compatibility macro so it returns address without X-Git-Tag: r0_7_64~113 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7e16a2697779398387488c547586c1bbfc3aa961;p=comedi.git fixed pci_resource_start compatibility macro so it returns address without and extra flag bits set. Some hacks to fix amcc_s5933.c stuff on 2.4 --- diff --git a/comedi/drivers/amcc_s5933.c b/comedi/drivers/amcc_s5933.c index 4b8abb1b..e06b7ca9 100644 --- a/comedi/drivers/amcc_s5933.c +++ b/comedi/drivers/amcc_s5933.c @@ -49,12 +49,12 @@ void pci_card_list_init(unsigned short pci_vendor, char display) amcc->pci_slot=PCI_SLOT(pcidev->devfn); amcc->pci_func=PCI_FUNC(pcidev->devfn); for (i=0;i<5;i++) - amcc->io_addr[i]=pci_resource_start(pcidev, i) & PCI_BASE_ADDRESS_IO_MASK; + amcc->io_addr[i]=pci_resource_start(pcidev, i); amcc->irq=pcidev->irq; #if LINUX_VERSION_CODE < 0x020300 amcc->master=pcidev->master; #else -// amcc->master=pcidev->master; // how get this information under 2.4 kernels? + amcc->master=1; #endif } @@ -121,7 +121,10 @@ int pci_card_alloc(struct pcilst_struct *amcc) if (!amcc) return -1; if (amcc->used) return 1; + if(pci_enable_device(amcc->pcidev)) return -1; + pci_set_master(amcc->pcidev); amcc->used=1; + return 0; } diff --git a/comedi/drivers/amplc_pci230.c b/comedi/drivers/amplc_pci230.c index 308ca4de..4f4b5c42 100644 --- a/comedi/drivers/amplc_pci230.c +++ b/comedi/drivers/amplc_pci230.c @@ -335,8 +335,8 @@ static int pci230_attach(comedi_device *dev,comedi_devconfig *it) /* Read base addressses of the PCI230's two I/O regions from PCI configuration register. */ if(pci_enable_device(pci_dev)<0)return -EIO; - pci_iobase = pci_resource_start(pci_dev, 2) & PCI_BASE_ADDRESS_IO_MASK; - iobase = pci_resource_start(pci_dev, 3) & PCI_BASE_ADDRESS_IO_MASK; + pci_iobase = pci_resource_start(pci_dev, 2); + iobase = pci_resource_start(pci_dev, 3); printk("comedi%d: amplc_pci230: I/O region 1 0x%04x I/O region 2 0x%04x\n",dev->minor, pci_iobase, iobase); diff --git a/comedi/drivers/cb_pcidas.c b/comedi/drivers/cb_pcidas.c index 2f2f36c6..c3350e67 100644 --- a/comedi/drivers/cb_pcidas.c +++ b/comedi/drivers/cb_pcidas.c @@ -534,16 +534,11 @@ found: */ if(pci_enable_device(devpriv->pci_dev)) return -EIO; - s5933_config = pci_resource_start(devpriv->pci_dev, S5933_BADRINDEX) & - PCI_BASE_ADDRESS_IO_MASK; - control_status = pci_resource_start(devpriv->pci_dev, CONT_STAT_BADRINDEX) & - PCI_BASE_ADDRESS_IO_MASK; - adc_fifo = pci_resource_start(devpriv->pci_dev, ADC_FIFO_BADRINDEX) & - PCI_BASE_ADDRESS_IO_MASK; - pacer_counter_dio = pci_resource_start(devpriv->pci_dev, PACER_BADRINDEX) & - PCI_BASE_ADDRESS_IO_MASK; - ao_registers = pci_resource_start(devpriv->pci_dev, AO_BADRINDEX) & - PCI_BASE_ADDRESS_IO_MASK; + s5933_config = pci_resource_start(devpriv->pci_dev, S5933_BADRINDEX); + control_status = pci_resource_start(devpriv->pci_dev, CONT_STAT_BADRINDEX); + adc_fifo = pci_resource_start(devpriv->pci_dev, ADC_FIFO_BADRINDEX); + pacer_counter_dio = pci_resource_start(devpriv->pci_dev, PACER_BADRINDEX); + ao_registers = pci_resource_start(devpriv->pci_dev, AO_BADRINDEX); // reserve io ports err = 0; diff --git a/comedi/drivers/cb_pcidas64.c b/comedi/drivers/cb_pcidas64.c index 80ad91a3..863799bb 100644 --- a/comedi/drivers/cb_pcidas64.c +++ b/comedi/drivers/cb_pcidas64.c @@ -533,12 +533,9 @@ found: #ifdef PCIDMA pci_set_master(pcidev); #endif - plx9080_iobase = pci_resource_start(pcidev, PLX9080_BADRINDEX) & - PCI_BASE_ADDRESS_MEM_MASK; - main_iobase = pci_resource_start(pcidev, MAIN_BADRINDEX) & - PCI_BASE_ADDRESS_MEM_MASK; - dio_counter_iobase = pci_resource_start(pcidev, DIO_COUNTER_BADRINDEX) & - PCI_BASE_ADDRESS_MEM_MASK; + plx9080_iobase = pci_resource_start(pcidev, PLX9080_BADRINDEX); + main_iobase = pci_resource_start(pcidev, MAIN_BADRINDEX); + dio_counter_iobase = pci_resource_start(pcidev, DIO_COUNTER_BADRINDEX); if(check_mem_region(plx9080_iobase, PLX9080_IOSIZE)) { diff --git a/comedi/drivers/cb_pcidda.c b/comedi/drivers/cb_pcidda.c index 80a29e8b..ce8644f8 100644 --- a/comedi/drivers/cb_pcidda.c +++ b/comedi/drivers/cb_pcidda.c @@ -337,10 +337,8 @@ found: */ if(pci_enable_device(devpriv->pci_dev)) return -EIO; - digitalio = pci_resource_start(devpriv->pci_dev, DIGITALIO_BADRINDEX) & - PCI_BASE_ADDRESS_IO_MASK; - dac = pci_resource_start(devpriv->pci_dev, DAC_BADRINDEX) & - PCI_BASE_ADDRESS_IO_MASK; + digitalio = pci_resource_start(devpriv->pci_dev, DIGITALIO_BADRINDEX); + dac = pci_resource_start(devpriv->pci_dev, DAC_BADRINDEX); /* * Allocate the I/O ports. diff --git a/comedi/drivers/das08.c b/comedi/drivers/das08.c index ae0b797c..dab46232 100644 --- a/comedi/drivers/das08.c +++ b/comedi/drivers/das08.c @@ -772,8 +772,8 @@ static int das08_attach(comedi_device *dev,comedi_devconfig *it) // read base addresses if(pci_enable_device(pdev)) return -EIO; - pci_iobase = pci_resource_start(pdev, 1) & PCI_BASE_ADDRESS_IO_MASK; - iobase = pci_resource_start(pdev, 2) & PCI_BASE_ADDRESS_IO_MASK; + pci_iobase = pci_resource_start(pdev, 1); + iobase = pci_resource_start(pdev, 2); printk("pcibase 0x%x ", pci_iobase); // reserve io ports for 9052 pci chip if(check_region(pci_iobase,PCIDAS08_SIZE)<0){ diff --git a/comedi/drivers/icp_multi.h b/comedi/drivers/icp_multi.h index b7e80e78..dd1b95d5 100644 --- a/comedi/drivers/icp_multi.h +++ b/comedi/drivers/icp_multi.h @@ -74,30 +74,19 @@ void pci_card_list_init(unsigned short pci_vendor, char display) else { inova_devices=inova; } last=inova; -#if LINUX_VERSION_CODE < 0x020300 inova->vendor=pcidev->vendor; inova->device=pcidev->device; +#if LINUX_VERSION_CODE < 0x020300 inova->master=pcidev->master; - inova->pci_bus=pcidev->bus->number; - inova->pci_slot=PCI_SLOT(pcidev->devfn); - inova->pci_func=PCI_FUNC(pcidev->devfn); - for (i=0;i<5;i++) - inova->io_addr[i]=pcidev->base_address[i] & PCI_BASE_ADDRESS_MEM_MASK; - inova->irq=pcidev->irq; #else - inova->vendor=pcidev->vendor; - inova->device=pcidev->device; -#if 0 - inova->master=pcidev->master; // how get this information under 2.4 kernels? +inova->master = 1; //XXX #endif inova->pci_bus=pcidev->bus->number; inova->pci_slot=PCI_SLOT(pcidev->devfn); inova->pci_func=PCI_FUNC(pcidev->devfn); for (i=0;i<5;i++) - inova->io_addr[i]=pcidev->resource[i].start & PCI_BASE_ADDRESS_MEM_MASK; + inova->io_addr[i]=pci_resource_start(pcidev, i); inova->irq=pcidev->irq; -#endif - } } @@ -188,7 +177,7 @@ void pci_card_list_display(void) for (inova=inova_devices; inova; inova=next) { next=inova->next; - printk("%2d %2d %2d 0x%4x 0x%4x %3s 0x%8xl 0x%8xl %2d %2d\n", + printk("%2d %2d %2d 0x%4x 0x%4x %3s 0x%8lx 0x%8lx %2d %2d\n", inova->pci_bus,inova->pci_slot,inova->pci_func,inova->vendor,inova->device,inova->master?"yes":"no", inova->io_addr[0],inova->io_addr[2],inova->irq,inova->used); diff --git a/comedi/drivers/rtd520.c b/comedi/drivers/rtd520.c index 0f5a1eb7..64618467 100644 --- a/comedi/drivers/rtd520.c +++ b/comedi/drivers/rtd520.c @@ -659,12 +659,9 @@ static int rtd_attach ( * Initialize base addresses */ /* Get the physical address from PCI config */ - physLas0 = pci_resource_start(devpriv->pci_dev, LAS0_PCIINDEX) & - PCI_BASE_ADDRESS_MEM_MASK; - physLas1 = pci_resource_start(devpriv->pci_dev, LAS1_PCIINDEX) & - PCI_BASE_ADDRESS_MEM_MASK; - physLcfg = pci_resource_start(devpriv->pci_dev, LCFG_PCIINDEX) & - PCI_BASE_ADDRESS_MEM_MASK; + physLas0 = pci_resource_start(devpriv->pci_dev, LAS0_PCIINDEX); + physLas1 = pci_resource_start(devpriv->pci_dev, LAS1_PCIINDEX); + physLcfg = pci_resource_start(devpriv->pci_dev, LCFG_PCIINDEX); /* Now have the kernel map this into memory */ /* ASSUME page aligned */ devpriv->las0 = ioremap(physLas0, LAS0_PCISIZE); diff --git a/include/linux/pci.h b/include/linux/pci.h index 7f01307b..77a2610a 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -66,7 +66,12 @@ extern inline void pci_free_consistent(struct pci_dev *hwdev, size_t size, #define pci_dma_sync_single(cookie, address, size, dir) // for getting base addresses -#define pci_resource_start(dev,bar) ((dev)->base_address[(bar)]) +extern inline unsigned long pci_resource_start(struct pci_dev *dev, unsigned int bar) +{ + if(dev->base_address[bar] & PCI_BASE_ADDRESS_SPACE_IO) + return dev->base_address[bar] & PCI_BASE_ADDRESS_IO_MASK; + return dev->base_address[bar] & PCI_BASE_ADDRESS_MEM_MASK; +} #else diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h index de4b57ee..f959e51b 100644 --- a/include/linux/vmalloc.h +++ b/include/linux/vmalloc.h @@ -7,7 +7,8 @@ #include -#if LINUX_VERSION_CODE < 0x020300 +// XXX 2.2.19 already has vmalloc_32() compatibility, not sure when it was introduced +#if LINUX_VERSION_CODE < 0x020200 #define vmalloc_32(x) vmalloc((x)) #endif