remove ISA legacy functions
Subsystems (8)
cover remove ISA legacy functions
This patch series contains 8 patches by Al Viro to remove both usage and definition of the ISA legacy functions plus two additional cleanup patches.
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedPATCH 1/10 remove ISA legacy functions: drivers/char/toshiba.c
From: Al Viro <[email protected]>
switch from isa_read...() to ioremap() and read...()
---
drivers/char/toshiba.c | 38 +++++++++++++++++++++++--------------- 1 files changed, 23 insertions(+), 15 deletions(-)
0bb582c17832859733b3dd6d408f64234cccf860
drivers/char/toshiba.c +23 -15
@@ -355,14 +355,14 @@ static void tosh_set_fn_port(void)/* * Get the machine identification number of the current model */ -static int tosh_get_machine_id (void ) +static int tosh_get_machine_id (void __iomem *bios) {int id;SMMRegisters regs;unsigned short bx,cx;unsigned long address; - id = (0x100 *(int )isa_readb (0xffffe ))+((int )isa_readb (0xffffa )); + id = (0x100 *(int )readb (bios+0xfffe ))+((int )readb (bios+0xfffa ));/* do we have a SCTTable machine identication number on our hands */
@@ -388,12 +388,12 @@ static int tosh_get_machine_id(void)/* now twiddle with our pointer a bit */ - address =0x000f0000 +bx; - cx =isa_readw (address); - address =0x000f0009 +bx+cx; - cx =isa_readw (address); - address =0x000f000a +cx; - cx =isa_readw (address); + address = bx; + cx =readw (bios + address); + address =9 +bx+cx; + cx =readw (bios + address); + address =0xa +cx; + cx =readw (bios + address);/* now construct our machine identification number */
@@ -416,13 +416,18 @@ static int tosh_probe(void)int i,major,minor,day,year,month,flag;unsigned char signature[7 ] = {0x54 ,0x4f ,0x53 ,0x48 ,0x49 ,0x42 ,0x41 };SMMRegisters regs; +void __iomem *bios =ioremap (0xf0000 ,0x10000 ); + +if (!bios) +return -ENOMEM ;/* extra sanity check for the string "TOSHIBA" in the BIOS because some machines that are not Toshiba's pass the next test */ for (i=0 ;i<7 ;i++) { -if (isa_readb (0xfe010 +i)!=signature[i]) { +if (readb (bios+0xe010 +i)!=signature[i]) {printk ("toshiba: not a supported Toshiba laptop\n" ); +iounmap (bios);return -ENODEV ; } }
@@ -438,6 +443,7 @@ static int tosh_probe(void)if ((flag==1 ) || ((regs.eax &0xff00 )==0x8600 )) {printk ("toshiba: not a supported Toshiba laptop\n" ); +iounmap (bios);return -ENODEV ; }
@@ -447,19 +453,19 @@ static int tosh_probe(void)/* next get the machine ID of the current laptop */ - tosh_id =tosh_get_machine_id (); + tosh_id =tosh_get_machine_id (bios);/* get the BIOS version */ - major =isa_readb (0xfe009 )-'0' ; - minor = ((isa_readb (0xfe00b )-'0' )*10 )+(isa_readb (0xfe00c )-'0' ); + major =readb (bios+0xe009 )-'0' ; + minor = ((readb (bios+0xe00b )-'0' )*10 )+(readb (bios+0xe00c )-'0' ); tosh_bios = (major*0x100 )+minor;/* get the BIOS date */ - day = ((isa_readb (0xffff5 )-'0' )*10 )+(isa_readb (0xffff6 )-'0' ); - month = ((isa_readb (0xffff8 )-'0' )*10 )+(isa_readb (0xffff9 )-'0' ); - year = ((isa_readb (0xffffb )-'0' )*10 )+(isa_readb (0xffffc )-'0' ); + day = ((readb (bios+0xfff5 )-'0' )*10 )+(readb (bios+0xfff6 )-'0' ); + month = ((readb (bios+0xfff8 )-'0' )*10 )+(readb (bios+0xfff9 )-'0' ); + year = ((readb (bios+0xfffb )-'0' )*10 )+(readb (bios+0xfffc )-'0' ); tosh_date = (((year-90 ) &0x1f )<<10 ) | ((month &0xf )<<6 ) | ((day &0x1f )<<1 );
@@ -476,6 +482,8 @@ static int tosh_probe(void)if ((tosh_id==0xfccb ) || (tosh_id==0xfccc )) tosh_fan =1 ; +iounmap (bios); +return 0 ; }
PATCH 2/10 remove ISA legacy functions: drivers/net/arcnet/
In reply to Adrian BunkFrom: Al Viro <[email protected]>
sanitized probing code, made sure we claim regions before poking into them (original tried that to some extent, but hadn't got it right), switched to ioremap() use in probing.
---
drivers/net/arcnet/arc-rimi.c | 68 +++++++++++++++------ drivers/net/arcnet/com90xx.c | 132 +++++++++++++++++++++++++++++------------ 2 files changed, 143 insertions(+), 57 deletions(-)
6a0100f551bbd751fba9d68575dcb15e5554e130
drivers/net/arcnet/arc-rimi.c +49 -19
@@ -97,25 +97,44 @@ static int __init arcrimi_probe(struct n "must specify the shmem and irq!\n");return -ENODEV ; } +if (dev->dev_addr[0 ] ==0 ) { +BUGMSG (D_NORMAL ,"You need to specify your card's station " +"ID!\n" ); +return -ENODEV ; + }/* -* Grab the memory region at mem_start for BUFFER_SIZE bytes. +* Grab the memory region at mem_start for MIRROR_SIZE bytes. * Later in arcrimi_found() the real size will be determined * and this reserve will be released and the correct size * will be taken. */ -if (!request_mem_region (dev->mem_start,BUFFER_SIZE ,"arcnet (90xx)" )) { +if (!request_mem_region (dev->mem_start,MIRROR_SIZE ,"arcnet (90xx)" )) {BUGMSG (D_NORMAL ,"Card memory already allocated\n" );return -ENODEV ; } -if (dev->dev_addr[0 ] ==0 ) { -release_mem_region (dev->mem_start,BUFFER_SIZE ); -BUGMSG (D_NORMAL ,"You need to specify your card's station " -"ID!\n" ); -return -ENODEV ; - }return arcrimi_found (dev); } +static int check_mirror (unsigned long addr,size_t size) +{ +void __iomem *p; +int res =-1 ; + +if (!request_mem_region (addr, size,"arcnet (90xx)" )) +return -1 ; + + p =ioremap (addr, size); +if (p) { +if (readb (p) == TESTvalue) + res =1 ; +else + res =0 ; +iounmap (p); + } + +release_mem_region (addr, size); +return res; +}/* * Set up the struct net_device associated with this card. Called after
@@ -125,19 +144,28 @@ static int __init arcrimi_found(struct n {struct arcnet_local *lp;unsigned long first_mirror, last_mirror, shmem; +void __iomem *p;int mirror_size;int err; + p =ioremap (dev->mem_start,MIRROR_SIZE ); +if (!p) { +release_mem_region (dev->mem_start,MIRROR_SIZE ); +BUGMSG (D_NORMAL ,"Can't ioremap\n" ); +return -ENODEV ; + } +/* reserve the irq */ if (request_irq (dev->irq, &arcnet_interrupt,0 ,"arcnet (RIM I)" , dev)) { -release_mem_region (dev->mem_start,BUFFER_SIZE ); +iounmap (p); +release_mem_region (dev->mem_start,MIRROR_SIZE );BUGMSG (D_NORMAL ,"Can't get IRQ %d!\n" , dev->irq);return -ENODEV ; } shmem = dev->mem_start; -isa_writeb (TESTvalue, shmem); -isa_writeb (dev->dev_addr[0 ], shmem +1 );/* actually the node ID */ +writeb (TESTvalue, p); +writeb (dev->dev_addr[0 ], p +1 );/* actually the node ID */ /* find the real shared memory start/end points, including mirrors */
@@ -146,17 +174,18 @@ static int __init arcrimi_found(struct n* 2k (or there are no mirrors at all) but on some, it's 4k. */ mirror_size =MIRROR_SIZE ; -if (isa_readb (shmem) == TESTvalue - &&isa_readb (shmem - mirror_size) != TESTvalue - &&isa_readb (shmem -2 * mirror_size) == TESTvalue) - mirror_size *=2 ; +if (readb (p) == TESTvalue + &&check_mirror (shmem -MIRROR_SIZE ,MIRROR_SIZE ) ==0 + &&check_mirror (shmem -2 *MIRROR_SIZE ,MIRROR_SIZE ) ==1 ) + mirror_size =2 *MIRROR_SIZE ; - first_mirror = last_mirror = shmem; -while (isa_readb (first_mirror) == TESTvalue) + first_mirror = shmem - mirror_size; +while (check_mirror (first_mirror, mirror_size) ==1 ) first_mirror -= mirror_size; first_mirror += mirror_size; -while (isa_readb (last_mirror) == TESTvalue) + last_mirror = shmem + mirror_size; +while (check_mirror (last_mirror, mirror_size) ==1 ) last_mirror += mirror_size; last_mirror -= mirror_size;
@@ -181,7 +210,8 @@ static int __init arcrimi_found(struct n* with the correct size. There is a VERY slim chance this could * fail. */ -release_mem_region (shmem,BUFFER_SIZE ); +iounmap (p); +release_mem_region (shmem,MIRROR_SIZE );if (!request_mem_region (dev->mem_start, dev->mem_end - dev->mem_start +1 ,"arcnet (90xx)" )) {
drivers/net/arcnet/com90xx.c +94 -38
251 lines not on this page · raw message
PATCH 3/10 remove ISA legacy functions: drivers/scsi/g_NCR5380.c
In reply to Adrian BunkFrom: Al Viro <[email protected]>
switched CONFIG_SCSI_G_NCR5380_MEM code in g_NCR5380 to ioremap(); massaged g_NCR5380.h accordingly.
---
drivers/scsi/g_NCR5380.c | 28 +++++++++++++++++++++------- drivers/scsi/g_NCR5380.h | 23 +++++++++++++++++------ 2 files changed, 38 insertions(+), 13 deletions(-)
6432444077b99d420f973ce8f1e748792f50a161
drivers/scsi/g_NCR5380.c +21 -7
@@ -127,7 +127,7 @@ static int ncr_53c400a = NCR_NOT_SET;static int dtc_3181e =NCR_NOT_SET ; static struct override { - NCR5380_implementation_fields; + NCR5380_map_type NCR5380_map_name; int irq; int dma; int board; /* Use NCR53c400, Ricoh, etc. extensions ? */
@@ -299,6 +299,10 @@ int __init generic_NCR5380_detect(struct };int flags =0 ;struct Scsi_Host *instance; +#ifdef CONFIG_SCSI_G_NCR5380_MEM +unsigned long base; +void __iomem *iomem; +#endif if (ncr_irq !=NCR_NOT_SET ) overrides[0 ].irq = ncr_irq;
@@ -424,15 +428,22 @@ int __init generic_NCR5380_detect(struct region_size = NCR5380_region_size; }#else -if (!request_mem_region (overrides[current_override].NCR5380_map_name, NCR5380_region_size,"ncr5380" )) + base = overrides[current_override].NCR5380_map_name; +if (!request_mem_region (base, NCR5380_region_size,"ncr5380" )) +continue ; + iomem =ioremap (base, NCR5380_region_size); +if (!iomem) { +release_mem_region (base, NCR5380_region_size);continue ; + }#endif instance =scsi_register (tpnt,sizeof (struct NCR5380_hostdata ));if (instance ==NULL ) {#ifndef CONFIG_SCSI_G_NCR5380_MEM release_region (overrides[current_override].NCR5380_map_name, region_size);#else -release_mem_region (overrides[current_override].NCR5380_map_name, NCR5380_region_size); +iounmap (iomem); +release_mem_region (base, NCR5380_region_size);#endif continue ; }
@@ -440,6 +451,8 @@ int __init generic_NCR5380_detect(struct instance->NCR5380_instance_name = overrides[current_override].NCR5380_map_name;#ifndef CONFIG_SCSI_G_NCR5380_MEM instance->n_io_port = region_size; +#else + ((struct NCR5380_hostdata *)instance->hostdata).iomem = iomem;#endif NCR5380_init (instance, flags);
@@ -509,6 +522,7 @@ int generic_NCR5380_release_resources(st#ifndef CONFIG_SCSI_G_NCR5380_MEM release_region (instance->NCR5380_instance_name, instance->n_io_port);#else +iounmap (((struct NCR5380_hostdata *)instance->hostdata).iomem);release_mem_region (instance->NCR5380_instance_name, NCR5380_region_size);#endif
@@ -586,7 +600,7 @@ static inline int NCR5380_pread(struct S }#else /* implies CONFIG_SCSI_G_NCR5380_MEM */ -isa_memcpy_fromio (dst + start, NCR53C400_host_buffer + NCR5380_map_name,128 ); +memcpy_fromio (dst + start, iomem + NCR53C400_host_buffer,128 );#endif start +=128 ; blocks--;
@@ -606,7 +620,7 @@ static inline int NCR5380_pread(struct S }#else /* implies CONFIG_SCSI_G_NCR5380_MEM */ -isa_memcpy_fromio (dst + start, NCR53C400_host_buffer + NCR5380_map_name,128 ); +memcpy_fromio (dst + start, iomem + NCR53C400_host_buffer,128 );#endif start +=128 ; blocks--;
@@ -671,7 +685,7 @@ static inline int NCR5380_pwrite(struct }#else /* implies CONFIG_SCSI_G_NCR5380_MEM */ -isa_memcpy_toio (NCR53C400_host_buffer + NCR5380_map_name, src + start,128 ); +memcpy_toio (iomem + NCR53C400_host_buffer, src + start,128 );#endif start +=128 ; blocks--;
@@ -687,7 +701,7 @@ static inline int NCR5380_pwrite(struct }#else /* implies CONFIG_SCSI_G_NCR5380_MEM */ -isa_memcpy_toio (NCR53C400_host_buffer + NCR5380_map_name, src + start,128 ); +memcpy_toio (iomem + NCR53C400_host_buffer, src + start,128 );#endif start +=128 ; blocks--;
drivers/scsi/g_NCR5380.h +17 -6
@@ -82,6 +82,15 @@ static const char* generic_NCR5380_info(#define NCR5380_read (reg) (inb(NCR5380_map_name + (reg)))#define NCR5380_write (reg, value) (outb((value), (NCR5380_map_name + (reg)))) +#define NCR5380_implementation_fields \ + NCR5380_map_type NCR5380_map_name + +#define NCR5380_local_declare () \ + register NCR5380_implementation_fields + +#define NCR5380_setup (instance) \ + NCR5380_map_name = (NCR5380_map_type)((instance)->NCR5380_instance_name) +#else /* therefore CONFIG_SCSI_G_NCR5380_MEM */
@@ -95,18 +104,20 @@ static const char* generic_NCR5380_info(#define NCR53C400_host_buffer 0x3900#define NCR5380_region_size 0x3a00 -#define NCR5380_read (reg) isa_readb(NCR5380_map_name + NCR53C400_mem_base + (reg)) -#define NCR5380_write (reg, value) isa_writeb(value, NCR5380_map_name + NCR53C400_mem_base + (reg)) -#endif +#define NCR5380_read (reg) readb(iomem + NCR53C400_mem_base + (reg)) +#define NCR5380_write (reg, value) writeb(value, iomem + NCR53C400_mem_base + (reg))#define NCR5380_implementation_fields \ - NCR5380_map_type NCR5380_map_name + NCR5380_map_type NCR5380_map_name; \ + void __iomem *iomem;#define NCR5380_local_declare () \ - register NCR5380_implementation_fields + register void __iomem *iomem#define NCR5380_setup (instance) \ - NCR5380_map_name = (NCR5380_map_type)((instance)->NCR5380_instance_name) + iomem = (((struct NCR5380_hostdata *)(instance)->hostdata).iomem) + +#endif #define NCR5380_intr generic_NCR5380_intr#define NCR5380_queue_command generic_NCR5380_queue_command
PATCH 4/10 remove ISA legacy functions: drivers/scsi/in2000.c
In reply to Adrian BunkFrom: Al Viro <[email protected]>
switched to ioremap(), cleaned the probing up a bit.
---
drivers/scsi/in2000.c | 24 ++++++++++++++++++------ 1 files changed, 18 insertions(+), 6 deletions(-)
e44467683e39fd741741d07d49515e3b20e3e104
drivers/scsi/in2000.c +18 -6
@@ -1898,6 +1898,21 @@ static int int_tab[] in2000__INITDATA = 10 }; +static int probe_bios (u32 addr,u32 *s1,uchar *switches) +{ +void __iomem *p =ioremap (addr,0x34 ); +if (!p) +return 0 ; + *s1 =readl (p +0x10 ); +if (*s1 ==0x41564f4e ||readl (p +0x30 ) ==0x61776c41 ) { +/* Read the switch image that's mapped into EPROM space */ + *switches = ~readb (p +0x20 ); +iounmap (p); +return 1 ; + } +iounmap (p); +return 0 ; +}static int __init in2000_detect (struct scsi_host_template * tpnt) {
@@ -1930,6 +1945,7 @@ static int __init in2000_detect(struct s detect_count =0 ;for (bios =0 ; bios_tab[bios]; bios++) { +u32 s1 =0 ;if (check_setup_args ("ioport" , &val, buf)) { base = val; switches = ~inb (base +IO_SWITCHES ) &0xff ;
@@ -1941,13 +1957,9 @@ static int __init in2000_detect(struct s* for the obvious ID strings. We look for the 2 most common ones and * hope that they cover all the cases... */ - else if (isa_readl(bios_tab[bios] + 0x10) == 0x41564f4e || isa_readl(bios_tab[bios] + 0x30) == 0x61776c41) { + else if (probe_bios(bios_tab[bios], &s1, &switches)) {printk ("Found IN2000 BIOS at 0x%x " , (unsigned int ) bios_tab[bios]); -/* Read the switch image that's mapped into EPROM space */ - - switches = ~((isa_readb (bios_tab[bios] +0x20 ) &0xff )); -/* Find out where the IO space is */ x = switches & (SW_ADDR0 |SW_ADDR1 );
@@ -2037,7 +2049,7 @@ static int __init in2000_detect(struct s/* Older BIOS's had a 'sync on/off' switch - use its setting */ -if (isa_readl (bios_tab[bios] +0x10 ) ==0x41564f4e && (switches &SW_SYNC_DOS5 )) +if (s1 ==0x41564f4e && (switches &SW_SYNC_DOS5 )) hostdata->sync_off =0x00 ;/* sync defaults to on */ else hostdata->sync_off =0xff ;/* sync defaults to off */
PATCH 5/10 remove ISA legacy functions: drivers/net/hp-plus.c
In reply to Adrian BunkFrom: Al Viro <[email protected]>
switch to ioremap()
Adrian Bunk:
The order of the hunks in the patch was slightly rearranged due to an unrelated change in the driver.
---
drivers/net/hp-plus.c | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-)
202702a915ccef02d54b57e39a4545e4f310ac76
drivers/net/hp-plus.c +13 -4
@@ -256,6 +257,12 @@ static int __init hpp_probe1(struct net_ ei_status.block_output = &hpp_mem_block_output; ei_status.get_8390_hdr = &hpp_mem_get_8390_hdr; dev->mem_start = mem_start; + ei_status.mem =ioremap (mem_start, + (HP_STOP_PG -HP_START_PG )*256 ); +if (!ei_status.mem) { + retval = -ENOMEM ; + goto out; + } ei_status.rmem_start = dev->mem_start +TX_PAGES /2 *256 ; dev->mem_end = ei_status.rmem_end = dev->mem_start + (HP_STOP_PG -HP_START_PG )*256 ;
@@ -268,8 +275,10 @@ static int __init hpp_probe1(struct net_ retval =register_netdev (dev);if (retval) - goto out; + goto out1;return 0 ; +out1: +iounmap (ei_status.mem); out:release_region (ioaddr,HP_IO_EXTENT );return retval;
@@ -378,7 +387,7 @@ hpp_mem_get_8390_hdr(struct net_device *outw ((ring_page<<8 ), ioaddr +HPP_IN_ADDR );outw (option_reg & ~(MemDisable + BootROMEnb), ioaddr +HPP_OPTION ); -isa_memcpy_fromio (hdr, dev->mem_start,sizeof (struct e8390_pkt_hdr )); +memcpy_fromio (hdr, ei_status.mem,sizeof (struct e8390_pkt_hdr ));outw (option_reg, ioaddr +HPP_OPTION ); hdr->count = (le16_to_cpu (hdr->count) +3 ) & ~3 ;/* Round up allocation. */ }
@@ -397,7 +406,7 @@ hpp_mem_block_input(struct net_device *dAlso note that we *can't* use eth_io_copy_and_sum() because it will not always copy "count" bytes (e.g. padded IP). */ -isa_memcpy_fromio (skb->data, dev->mem_start, count); +memcpy_fromio (skb->data, ei_status.mem, count);outw (option_reg, ioaddr +HPP_OPTION ); }
@@ -422,7 +431,7 @@ hpp_mem_block_output(struct net_device *outw (start_page <<8 , ioaddr +HPP_OUT_ADDR );outw (option_reg & ~(MemDisable + BootROMEnb), ioaddr +HPP_OPTION ); -isa_memcpy_toio (dev->mem_start, buf, (count +3 ) & ~3 ); +memcpy_toio (ei_status.mem, buf, (count +3 ) & ~3 );outw (option_reg, ioaddr +HPP_OPTION );return ;
@@ -541,6 +541,7 @@ static int __init do_hpp_probe(struct nestatic void cleanup_card (struct net_device *dev) {/* NB: hpp_close() handles free_irq */ +iounmap (ei_status.mem);release_region (dev->base_addr -NIC_OFFSET ,HP_IO_EXTENT ); }
PATCH 6/10 remove ISA legacy functions: drivers/net/hp100.c
In reply to Adrian BunkFrom: Al Viro <[email protected]>
hp100 has ->mem_ptr_virt set for all memory-mapped cases; removed rudiment of old version that used ioremap() only when physical address wasn't an ISA one. These days it's simply a dead code.
---
drivers/net/hp100.c | 30 ++++++++---------------------- 1 files changed, 8 insertions(+), 22 deletions(-)
c9a2c709fa782a0dd7b1bbb0160b325e446ae523
drivers/net/hp100.c +8 -22
@@ -1718,17 +1718,10 @@ static int hp100_start_xmit(struct sk_buhp100_outw (i,FRAGMENT_LEN );/* and first/only fragment length */ if (lp->mode ==2 ) {/* memory mapped */ -if (lp->mem_ptr_virt) {/* high pci memory was remapped */ -/* Note: The J2585B needs alignment to 32bits here! */ -memcpy_toio (lp->mem_ptr_virt, skb->data, (skb->len +3 ) & ~3 ); -if (!ok_flag) -memset_io (lp->mem_ptr_virt,0 ,HP100_MIN_PACKET_SIZE - skb->len); - }else { -/* Note: The J2585B needs alignment to 32bits here! */ -isa_memcpy_toio (lp->mem_ptr_phys, skb->data, (skb->len +3 ) & ~3 ); -if (!ok_flag) -isa_memset_io (lp->mem_ptr_phys,0 ,HP100_MIN_PACKET_SIZE - skb->len); - } +/* Note: The J2585B needs alignment to 32bits here! */ +memcpy_toio (lp->mem_ptr_virt, skb->data, (skb->len +3 ) & ~3 ); +if (!ok_flag) +memset_io (lp->mem_ptr_virt,0 ,HP100_MIN_PACKET_SIZE - skb->len); }else {/* programmed i/o */ outsl (ioaddr +HP100_REG_DATA32 , skb->data, (skb->len +3 ) >>2 );
@@ -1798,10 +1791,7 @@ static void hp100_rx(struct net_device */* First we get the header, which contains information about the */ /* actual length of the received packet. */ if (lp->mode ==2 ) {/* memory mapped mode */ -if (lp->mem_ptr_virt)/* if memory was remapped */ - header =readl (lp->mem_ptr_virt); -else - header =isa_readl (lp->mem_ptr_phys); + header =readl (lp->mem_ptr_virt); }else /* programmed i/o */ header =hp100_inl (DATA32 );
@@ -1833,13 +1823,9 @@ static void hp100_rx(struct net_device * ptr = skb->data;/* Now transfer the data from the card into that area */ -if (lp->mode ==2 ) { -if (lp->mem_ptr_virt) -memcpy_fromio (ptr, lp->mem_ptr_virt,pkt_len); -/* Note alignment to 32bit transfers */ -else -isa_memcpy_fromio (ptr, lp->mem_ptr_phys, pkt_len); - }else /* io mapped */ +if (lp->mode ==2 ) +memcpy_fromio (ptr, lp->mem_ptr_virt,pkt_len); +else /* io mapped */ insl (ioaddr +HP100_REG_DATA32 , ptr, pkt_len >>2 ); skb->protocol =eth_type_trans (skb, dev);
PATCH 7/10 remove ISA legacy functions: drivers/net/lance.c
In reply to Adrian BunkFrom: Al Viro <[email protected]>
switch to ioremap()
---
drivers/net/lance.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-)
aadde842b4976445ac101c6ed04986382988d035
drivers/net/lance.c +7 -2
@@ -464,20 +464,25 @@ static int __init lance_probe1(struct nestatic int did_version;/* Already printed version info. */ unsigned long flags;int err = -ENOMEM ; +void __iomem *bios;/* First we look for special cases. Check for HP's on-board ethernet by looking for 'HP' in the BIOS. There are two HP versions, check the BIOS for the configuration port. This method provided by L. Julliard, [email protected]. */ -if (isa_readw (0x000f0102 ) ==0x5048 ) { + bios =ioremap (0xf00f0 ,0x14 ); +if (!bios) +return -ENOMEM ; +if (readw (bios +0x12 ) ==0x5048 ) {static const short ioaddr_table[] = {0x300 ,0x320 ,0x340 ,0x360 }; -int hp_port = (isa_readl (0x000f00f1 ) &1 ) ?0x499 :0x99 ; +int hp_port = (readl (bios +1 ) &1 ) ?0x499 :0x99 ;/* We can have boards other than the built-in! Verify this is on-board. */ if ((inb (hp_port) &0xc0 ) ==0x80 && ioaddr_table[inb (hp_port) &3 ] == ioaddr) hp_builtin = hp_port; } +iounmap (bios);/* We also recognize the HP Vectra on-board here, but check below. */ hpJ2405A = (inb (ioaddr) ==0x08 &&inb (ioaddr+1 ) ==0x00 &&inb (ioaddr+2 ) ==0x09 );
PATCH 8/10 remove ISA legacy functions: remove the helpers
In reply to Adrian BunkFrom: Al Viro <[email protected]>
unused isa_...() helpers removed.
Adrian Bunk:
The asm-sh part was rediffed due to unrelated changes.
---
include/asm-alpha/io.h | 84 ---------------------------------------- include/asm-arm/io.h | 36 ----------------- include/asm-i386/io.h | 12 ----- include/asm-mips/io.h | 13 ------ include/asm-parisc/io.h | 18 -------- include/asm-sh/io.h | 14 ------ include/asm-x86_64/io.h | 12 ----- 7 files changed, 189 deletions(-)
include/asm-alpha/io.h +0 -84
@@ -534,9 +534,6 @@ extern void outsl (unsigned long port, c#define eth_io_copy_and_sum (skb,src,len,unused) \ memcpy_fromio((skb)->data,src,len) -#define isa_eth_io_copy_and_sum (skb,src,len,unused) \ - isa_memcpy_fromio((skb)->data,src,len) -static inline int check_signature (const volatile void __iomem *io_addr,const unsigned char *signature,int length)
@@ -550,87 +547,6 @@ check_signature(const volatile void __ioreturn 1 ; } - -/* -* ISA space is mapped to some machine-specific location on Alpha. -* Call into the existing hooks to get the address translated. -*/ - -static inline u8 -isa_readb (unsigned long offset) -{ -void __iomem *addr =ioremap (offset,1 ); -u8 ret =readb (addr); -iounmap (addr); -return ret; -} - -static inline u16 -isa_readw (unsigned long offset) -{ -void __iomem *addr =ioremap (offset,2 ); -u16 ret =readw (addr); -iounmap (addr); -return ret; -} - -static inline u32 -isa_readl (unsigned long offset) -{ -void __iomem *addr =ioremap (offset,2 ); -u32 ret =readl (addr); -iounmap (addr); -return ret; -} - -static inline void -isa_writeb (u8 b,unsigned long offset) -{ -void __iomem *addr =ioremap (offset,2 ); -writeb (b, addr); -iounmap (addr); -} - -static inline void -isa_writew (u16 w,unsigned long offset) -{ -void __iomem *addr =ioremap (offset,2 ); -writew (w, addr); -iounmap (addr); -} - -static inline void -isa_writel (u32 l,unsigned long offset) -{ -void __iomem *addr =ioremap (offset,2 ); -writel (l, addr); -iounmap (addr); -} - -static inline void -isa_memset_io (unsigned long offset,u8 val,long n) -{ -void __iomem *addr =ioremap (offset, n); -memset_io (addr, val, n); -iounmap (addr); -} - -static inline void -isa_memcpy_fromio (void *dest,unsigned long offset,long n) -{ -void __iomem *addr =ioremap (offset, n); -memcpy_fromio (dest, addr, n); -iounmap (addr); -} - -static inline void -isa_memcpy_toio (unsigned long offset,const void *src,long n) -{ -void __iomem *addr =ioremap (offset, n); -memcpy_toio (addr, src, n); -iounmap (addr); -} -/* * The Alpha Jensen hardware for some rather strange reason puts * the RTC clock at 0x170 instead of 0x70. Probably due to some
include/asm-arm/io.h +0 -36
@@ -215,42 +215,6 @@ out:#endif /* __mem_pci */ /* -* If this architecture has ISA IO, then define the isa_read/isa_write -* macros. -*/ -#ifdef __mem_isa - -#define isa_readb (addr) __raw_readb(__mem_isa(addr)) -#define isa_readw (addr) __raw_readw(__mem_isa(addr)) -#define isa_readl (addr) __raw_readl(__mem_isa(addr)) -#define isa_writeb (val,addr) __raw_writeb(val,__mem_isa(addr)) -#define isa_writew (val,addr) __raw_writew(val,__mem_isa(addr)) -#define isa_writel (val,addr) __raw_writel(val,__mem_isa(addr)) -#define isa_memset_io (a,b,c) _memset_io(__mem_isa(a),(b),(c)) -#define isa_memcpy_fromio (a,b,c) _memcpy_fromio((a),__mem_isa(b),(c)) -#define isa_memcpy_toio (a,b,c) _memcpy_toio(__mem_isa((a)),(b),(c)) - -#define isa_eth_io_copy_and_sum (a,b,c,d) \ - eth_copy_and_sum((a),__mem_isa(b),(c),(d)) - -#else /* __mem_isa */ - -#define isa_readb (addr) (__readwrite_bug("isa_readb"),0) -#define isa_readw (addr) (__readwrite_bug("isa_readw"),0) -#define isa_readl (addr) (__readwrite_bug("isa_readl"),0) -#define isa_writeb (val,addr) __readwrite_bug("isa_writeb") -#define isa_writew (val,addr) __readwrite_bug("isa_writew") -#define isa_writel (val,addr) __readwrite_bug("isa_writel") -#define isa_memset_io (a,b,c) __readwrite_bug("isa_memset_io") -#define isa_memcpy_fromio (a,b,c) __readwrite_bug("isa_memcpy_fromio") -#define isa_memcpy_toio (a,b,c) __readwrite_bug("isa_memcpy_toio") - -#define isa_eth_io_copy_and_sum (a,b,c,d) \ - __readwrite_bug("isa_eth_io_copy_and_sum") - -#endif /* __mem_isa */ - -/* * ioremap and friends. * * ioremap takes a PCI memory address, as specified in
include/asm-i386/io.h +0 -12
@@ -214,23 +214,11 @@ static inline void memcpy_toio(volatile*/ #define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET)) -#define isa_readb (a) readb(__ISA_IO_base + (a)) -#define isa_readw (a) readw(__ISA_IO_base + (a)) -#define isa_readl (a) readl(__ISA_IO_base + (a)) -#define isa_writeb (b,a) writeb(b,__ISA_IO_base + (a)) -#define isa_writew (w,a) writew(w,__ISA_IO_base + (a)) -#define isa_writel (l,a) writel(l,__ISA_IO_base + (a)) -#define isa_memset_io (a,b,c) memset_io(__ISA_IO_base + (a),(b),(c)) -#define isa_memcpy_fromio (a,b,c) memcpy_fromio((a),__ISA_IO_base + (b),(c)) -#define isa_memcpy_toio (a,b,c) memcpy_toio(__ISA_IO_base + (a),(b),(c)) - -/* * Again, i386 does not require mem IO specific function. */ #define eth_io_copy_and_sum (a,b,c,d) eth_copy_and_sum((a),(void __force *)(b),(c),(d)) -#define isa_eth_io_copy_and_sum (a,b,c,d) eth_copy_and_sum((a),(void __force *)(__ISA_IO_base + (b)),(c),(d))/** * check_signature - find BIOS signatures
include/asm-mips/io.h +0 -13
@@ -572,24 +572,11 @@ extern void pci_iounmap(struct pci_dev **/ #define __ISA_IO_base ((char *)(isa_slot_offset)) -#define isa_readb (a) readb(__ISA_IO_base + (a)) -#define isa_readw (a) readw(__ISA_IO_base + (a)) -#define isa_readl (a) readl(__ISA_IO_base + (a)) -#define isa_readq (a) readq(__ISA_IO_base + (a)) -#define isa_writeb (b,a) writeb(b,__ISA_IO_base + (a)) -#define isa_writew (w,a) writew(w,__ISA_IO_base + (a)) -#define isa_writel (l,a) writel(l,__ISA_IO_base + (a)) -#define isa_writeq (q,a) writeq(q,__ISA_IO_base + (a)) -#define isa_memset_io (a,b,c) memset_io(__ISA_IO_base + (a),(b),(c)) -#define isa_memcpy_fromio (a,b,c) memcpy_fromio((a),__ISA_IO_base + (b),(c)) -#define isa_memcpy_toio (a,b,c) memcpy_toio(__ISA_IO_base + (a),(b),(c)) -/* * We don't have csum_partial_copy_fromio() yet, so we cheat here and * just copy it. The net code will then do the checksum later. */ #define eth_io_copy_and_sum (skb,src,len,unused) memcpy_fromio((skb)->data,(src),(len)) -#define isa_eth_io_copy_and_sum (a,b,c,d) eth_copy_and_sum((a),(b),(c),(d))/* * check_signature - find BIOS signatures
include/asm-parisc/io.h +0 -18
@@ -294,22 +294,6 @@ void memset_io(volatile void __iomem *advoid memcpy_fromio (void *dst,const volatile void __iomem *src,int count);void memcpy_toio (volatile void __iomem *dst,const void *src,int count); -/* Support old drivers which don't ioremap. -* NB this interface is scheduled to disappear in 2.5 -*/ - -#define __isa_addr (x) (void __iomem *)(F_EXTEND(0xfc000000) | (x)) -#define isa_readb (a) readb(__isa_addr(a)) -#define isa_readw (a) readw(__isa_addr(a)) -#define isa_readl (a) readl(__isa_addr(a)) -#define isa_writeb (b,a) writeb((b), __isa_addr(a)) -#define isa_writew (b,a) writew((b), __isa_addr(a)) -#define isa_writel (b,a) writel((b), __isa_addr(a)) -#define isa_memset_io (a,b,c) memset_io(__isa_addr(a), (b), (c)) -#define isa_memcpy_fromio (a,b,c) memcpy_fromio((a), __isa_addr(b), (c)) -#define isa_memcpy_toio (a,b,c) memcpy_toio(__isa_addr(a), (b), (c)) - -/* * XXX - We don't have csum_partial_copy_fromio() yet, so we cheat here and * just copy it. The net code will then do the checksum later. Presently
@@ -318,8 +302,6 @@ void memcpy_toio(volatile void __iomem *#define eth_io_copy_and_sum (skb,src,len,unused) \ memcpy_fromio((skb)->data,(src),(len)) -#define isa_eth_io_copy_and_sum (skb,src,len,unused) \ - isa_memcpy_fromio((skb)->data,(src),(len))/* Port-space IO */
include/asm-x86_64/io.h +0 -12
@@ -264,23 +264,11 @@ void memset_io(volatile void __iomem *a,*/ #define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET)) -#define isa_readb (a) readb(__ISA_IO_base + (a)) -#define isa_readw (a) readw(__ISA_IO_base + (a)) -#define isa_readl (a) readl(__ISA_IO_base + (a)) -#define isa_writeb (b,a) writeb(b,__ISA_IO_base + (a)) -#define isa_writew (w,a) writew(w,__ISA_IO_base + (a)) -#define isa_writel (l,a) writel(l,__ISA_IO_base + (a)) -#define isa_memset_io (a,b,c) memset_io(__ISA_IO_base + (a),(b),(c)) -#define isa_memcpy_fromio (a,b,c) memcpy_fromio((a),__ISA_IO_base + (b),(c)) -#define isa_memcpy_toio (a,b,c) memcpy_toio(__ISA_IO_base + (a),(b),(c)) - -/* * Again, x86-64 does not require mem IO specific function. */ #define eth_io_copy_and_sum (a,b,c,d) eth_copy_and_sum((a),(void *)(b),(c),(d)) -#define isa_eth_io_copy_and_sum (a,b,c,d) eth_copy_and_sum((a),(void *)(__ISA_IO_base + (b)),(c),(d))/** * check_signature - find BIOS signatures
include/asm-sh/io.h renamed from include/asm-sh/io.h.old +0 -14
@@ -174,20 +174,6 @@ generic_io_base = pbase; } -#define isa_readb (a) readb(ioport_map(a, 1)) -#define isa_readw (a) readw(ioport_map(a, 2)) -#define isa_readl (a) readl(ioport_map(a, 4)) -#define isa_writeb (b,a) writeb(b,ioport_map(a, 1)) -#define isa_writew (w,a) writew(w,ioport_map(a, 2)) -#define isa_writel (l,a) writel(l,ioport_map(a, 4)) - -#define isa_memset_io (a,b,c) \ - memset((void *)(ioport_map((unsigned long)(a), 1)),(b),(c)) -#define isa_memcpy_fromio (a,b,c) \ - memcpy((a),(void *)(ioport_map((unsigned long)(b), 1)),(c)) -#define isa_memcpy_toio (a,b,c) \ - memcpy((void *)(ioport_map((unsigned long)(a), 1)),(b),(c)) -/* We really want to try and get these to memcpy etc */ extern void memcpy_fromio (void *,volatile void __iomem *,unsigned long );extern void memcpy_toio (volatile void __iomem *,const void *,unsigned long );
PATCH 9/10 remove ISA legacy functions: remove documentation
In reply to Adrian BunkThis patch removes the documentation of the ISA legacy functions.
Documentation/DocBook/deviceiobook.tmpl renamed from Documentation/DocBook/deviceiobook.tmpl.old +0 -19
@@ -270,25 +270,6 @@ </para> </sect1> - <sect1> - <title>ISA legacy functions</title> - <para> - On older kernels (2.2 and earlier) the ISA bus could be read or - written with these functions and without ioremap being used. This is - no longer true in Linux 2.4. A set of equivalent functions exist for - easy legacy driver porting. The functions available are prefixed - with 'isa_' and are <function>isa_readb</function>, - <function>isa_writeb</function>, <function>isa_readw</function>, - <function>isa_writew</function>, <function>isa_readl</function>, - <function>isa_writel</function>, <function>isa_memcpy_fromio</function> - and <function>isa_memcpy_toio</function> - </para> - <para> - These functions should not be used in new drivers, and will - eventually be going away. - </para> - </sect1> - </chapter> <chapter>
PATCH 10/10 remove ISA legacy functions: only 9 patches
In reply to Adrian Bunk;-)
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed