Merge /spare/repo/linux-2.6/

+5489 -2809
+18 -6
Documentation/Changes
··· 44 44 45 45 Again, keep in mind that this list assumes you are already 46 46 functionally running a Linux 2.4 kernel. Also, not all tools are 47 - necessary on all systems; obviously, if you don't have any PCMCIA (PC 48 - Card) hardware, for example, you probably needn't concern yourself 49 - with pcmcia-cs. 47 + necessary on all systems; obviously, if you don't have any ISDN 48 + hardware, for example, you probably needn't concern yourself with 49 + isdn4k-utils. 50 50 51 51 o Gnu C 2.95.3 # gcc --version 52 52 o Gnu make 3.79.1 # make --version ··· 57 57 o jfsutils 1.1.3 # fsck.jfs -V 58 58 o reiserfsprogs 3.6.3 # reiserfsck -V 2>&1|grep reiserfsprogs 59 59 o xfsprogs 2.6.0 # xfs_db -V 60 + o pcmciautils 001 60 61 o pcmcia-cs 3.1.21 # cardmgr -V 61 62 o quota-tools 3.09 # quota -V 62 63 o PPP 2.4.0 # pppd --version ··· 187 186 work correctly with this version of the XFS kernel code (2.6.0 or 188 187 later is recommended, due to some significant improvements). 189 188 189 + PCMCIAutils 190 + ----------- 191 + 192 + PCMCIAutils replaces pcmcia-cs (see below). It properly sets up 193 + PCMCIA sockets at system startup and loads the appropriate modules 194 + for 16-bit PCMCIA devices if the kernel is modularized and the hotplug 195 + subsystem is used. 190 196 191 197 Pcmcia-cs 192 198 --------- 193 199 194 200 PCMCIA (PC Card) support is now partially implemented in the main 195 - kernel source. Pay attention when you recompile your kernel ;-). 196 - Also, be sure to upgrade to the latest pcmcia-cs release. 201 + kernel source. The "pcmciautils" package (see above) replaces pcmcia-cs 202 + for newest kernels. 197 203 198 204 Quota-tools 199 205 ----------- ··· 357 349 -------- 358 350 o <ftp://oss.sgi.com/projects/xfs/download/> 359 351 352 + Pcmciautils 353 + ----------- 354 + o <ftp://ftp.kernel.org/pub/linux/utils/kernel/pcmcia/> 355 + 360 356 Pcmcia-cs 361 357 --------- 362 - o <ftp://pcmcia-cs.sourceforge.net/pub/pcmcia-cs/pcmcia-cs-3.1.21.tar.gz> 358 + o <http://pcmcia-cs.sourceforge.net/> 363 359 364 360 Quota-tools 365 361 ----------
+64
Documentation/pcmcia/devicetable.txt
··· 1 + Matching of PCMCIA devices to drivers is done using one or more of the 2 + following criteria: 3 + 4 + - manufactor ID 5 + - card ID 6 + - product ID strings _and_ hashes of these strings 7 + - function ID 8 + - device function (actual and pseudo) 9 + 10 + You should use the helpers in include/pcmcia/device_id.h for generating the 11 + struct pcmcia_device_id[] entries which match devices to drivers. 12 + 13 + If you want to match product ID strings, you also need to pass the crc32 14 + hashes of the string to the macro, e.g. if you want to match the product ID 15 + string 1, you need to use 16 + 17 + PCMCIA_DEVICE_PROD_ID1("some_string", 0x(hash_of_some_string)), 18 + 19 + If the hash is incorrect, the kernel will inform you about this in "dmesg" 20 + upon module initialization, and tell you of the correct hash. 21 + 22 + You can determine the hash of the product ID strings by running 23 + "pcmcia-modalias %n.%m" [%n being replaced with the socket number and %m being 24 + replaced with the device function] from pcmciautils. It generates a string 25 + in the following form: 26 + pcmcia:m0149cC1ABf06pfn00fn00pa725B842DpbF1EFEE84pc0877B627pd00000000 27 + 28 + The hex value after "pa" is the hash of product ID string 1, after "pb" for 29 + string 2 and so on. 30 + 31 + Alternatively, you can use this small tool to determine the crc32 hash. 32 + simply pass the string you want to evaluate as argument to this program, 33 + e.g. 34 + $ ./crc32hash "Dual Speed" 35 + 36 + ------------------------------------------------------------------------- 37 + /* crc32hash.c - derived from linux/lib/crc32.c, GNU GPL v2 */ 38 + #include <string.h> 39 + #include <stdio.h> 40 + #include <ctype.h> 41 + #include <stdlib.h> 42 + 43 + unsigned int crc32(unsigned char const *p, unsigned int len) 44 + { 45 + int i; 46 + unsigned int crc = 0; 47 + while (len--) { 48 + crc ^= *p++; 49 + for (i = 0; i < 8; i++) 50 + crc = (crc >> 1) ^ ((crc & 1) ? 0xedb88320 : 0); 51 + } 52 + return crc; 53 + } 54 + 55 + int main(int argc, char **argv) { 56 + unsigned int result; 57 + if (argc != 2) { 58 + printf("no string passed as argument\n"); 59 + return -1; 60 + } 61 + result = crc32(argv[1], strlen(argv[1])); 62 + printf("0x%x\n", result); 63 + return 0; 64 + }
+51
Documentation/pcmcia/driver-changes.txt
··· 1 + This file details changes in 2.6 which affect PCMCIA card driver authors: 2 + 3 + * in-kernel device<->driver matching 4 + PCMCIA devices and their correct drivers can now be matched in 5 + kernelspace. See 'devicetable.txt' for details. 6 + 7 + * Device model integration (as of 2.6.11) 8 + A struct pcmcia_device is registered with the device model core, 9 + and can be used (e.g. for SET_NETDEV_DEV) by using 10 + handle_to_dev(client_handle_t * handle). 11 + 12 + * Convert internal I/O port addresses to unsigned long (as of 2.6.11) 13 + ioaddr_t should be replaced by kio_addr_t in PCMCIA card drivers. 14 + 15 + * irq_mask and irq_list parameters (as of 2.6.11) 16 + The irq_mask and irq_list parameters should no longer be used in 17 + PCMCIA card drivers. Instead, it is the job of the PCMCIA core to 18 + determine which IRQ should be used. Therefore, link->irq.IRQInfo2 19 + is ignored. 20 + 21 + * client->PendingEvents is gone (as of 2.6.11) 22 + client->PendingEvents is no longer available. 23 + 24 + * client->Attributes are gone (as of 2.6.11) 25 + client->Attributes is unused, therefore it is removed from all 26 + PCMCIA card drivers 27 + 28 + * core functions no longer available (as of 2.6.11) 29 + The following functions have been removed from the kernel source 30 + because they are unused by all in-kernel drivers, and no external 31 + driver was reported to rely on them: 32 + pcmcia_get_first_region() 33 + pcmcia_get_next_region() 34 + pcmcia_modify_window() 35 + pcmcia_set_event_mask() 36 + pcmcia_get_first_window() 37 + pcmcia_get_next_window() 38 + 39 + * device list iteration upon module removal (as of 2.6.10) 40 + It is no longer necessary to iterate on the driver's internal 41 + client list and call the ->detach() function upon module removal. 42 + 43 + * Resource management. (as of 2.6.8) 44 + Although the PCMCIA subsystem will allocate resources for cards, 45 + it no longer marks these resources busy. This means that driver 46 + authors are now responsible for claiming your resources as per 47 + other drivers in Linux. You should use request_region() to mark 48 + your IO regions in-use, and request_mem_region() to mark your 49 + memory regions in-use. The name argument should be a pointer to 50 + your driver name. Eg, for pcnet_cs, name should point to the 51 + string "pcnet_cs".
+1 -1
arch/sparc64/kernel/auxio.c
··· 16 16 #include <asm/ebus.h> 17 17 #include <asm/auxio.h> 18 18 19 - /* This cannot be static, as it is referenced in entry.S */ 19 + /* This cannot be static, as it is referenced in irq.c */ 20 20 void __iomem *auxio_register = NULL; 21 21 22 22 enum auxio_type {
+4 -112
arch/sparc64/kernel/entry.S
··· 271 271 fmuld %f0, %f2, %f26 272 272 faddd %f0, %f2, %f28 273 273 fmuld %f0, %f2, %f30 274 + membar #Sync 274 275 b,pt %xcc, fpdis_exit 275 - membar #Sync 276 + nop 276 277 2: andcc %g5, FPRS_DU, %g0 277 278 bne,pt %icc, 3f 278 279 fzero %f32 ··· 302 301 fmuld %f32, %f34, %f58 303 302 faddd %f32, %f34, %f60 304 303 fmuld %f32, %f34, %f62 304 + membar #Sync 305 305 ba,pt %xcc, fpdis_exit 306 - membar #Sync 306 + nop 307 307 3: mov SECONDARY_CONTEXT, %g3 308 308 add %g6, TI_FPREGS, %g1 309 309 ldxa [%g3] ASI_DMMU, %g5 ··· 700 698 add %sp, PTREGS_OFF, %o0 701 699 ba,pt %xcc, rtrap 702 700 clr %l6 703 - 704 - #ifdef CONFIG_BLK_DEV_FD 705 - .globl floppy_hardint 706 - floppy_hardint: 707 - wr %g0, (1 << 11), %clear_softint 708 - sethi %hi(doing_pdma), %g1 709 - ld [%g1 + %lo(doing_pdma)], %g2 710 - brz,pn %g2, floppy_dosoftint 711 - sethi %hi(fdc_status), %g3 712 - ldx [%g3 + %lo(fdc_status)], %g3 713 - sethi %hi(pdma_vaddr), %g5 714 - ldx [%g5 + %lo(pdma_vaddr)], %g4 715 - sethi %hi(pdma_size), %g5 716 - ldx [%g5 + %lo(pdma_size)], %g5 717 - 718 - next_byte: 719 - lduba [%g3] ASI_PHYS_BYPASS_EC_E, %g7 720 - andcc %g7, 0x80, %g0 721 - be,pn %icc, floppy_fifo_emptied 722 - andcc %g7, 0x20, %g0 723 - be,pn %icc, floppy_overrun 724 - andcc %g7, 0x40, %g0 725 - be,pn %icc, floppy_write 726 - sub %g5, 1, %g5 727 - 728 - inc %g3 729 - lduba [%g3] ASI_PHYS_BYPASS_EC_E, %g7 730 - dec %g3 731 - orcc %g0, %g5, %g0 732 - stb %g7, [%g4] 733 - bne,pn %xcc, next_byte 734 - add %g4, 1, %g4 735 - 736 - b,pt %xcc, floppy_tdone 737 - nop 738 - 739 - floppy_write: 740 - ldub [%g4], %g7 741 - orcc %g0, %g5, %g0 742 - inc %g3 743 - stba %g7, [%g3] ASI_PHYS_BYPASS_EC_E 744 - dec %g3 745 - bne,pn %xcc, next_byte 746 - add %g4, 1, %g4 747 - 748 - floppy_tdone: 749 - sethi %hi(pdma_vaddr), %g1 750 - stx %g4, [%g1 + %lo(pdma_vaddr)] 751 - sethi %hi(pdma_size), %g1 752 - stx %g5, [%g1 + %lo(pdma_size)] 753 - sethi %hi(auxio_register), %g1 754 - ldx [%g1 + %lo(auxio_register)], %g7 755 - lduba [%g7] ASI_PHYS_BYPASS_EC_E, %g5 756 - or %g5, AUXIO_AUX1_FTCNT, %g5 757 - /* andn %g5, AUXIO_AUX1_MASK, %g5 */ 758 - stba %g5, [%g7] ASI_PHYS_BYPASS_EC_E 759 - andn %g5, AUXIO_AUX1_FTCNT, %g5 760 - /* andn %g5, AUXIO_AUX1_MASK, %g5 */ 761 - 762 - nop; nop; nop; nop; nop; nop; 763 - nop; nop; nop; nop; nop; nop; 764 - 765 - stba %g5, [%g7] ASI_PHYS_BYPASS_EC_E 766 - sethi %hi(doing_pdma), %g1 767 - b,pt %xcc, floppy_dosoftint 768 - st %g0, [%g1 + %lo(doing_pdma)] 769 - 770 - floppy_fifo_emptied: 771 - sethi %hi(pdma_vaddr), %g1 772 - stx %g4, [%g1 + %lo(pdma_vaddr)] 773 - sethi %hi(pdma_size), %g1 774 - stx %g5, [%g1 + %lo(pdma_size)] 775 - sethi %hi(irq_action), %g1 776 - or %g1, %lo(irq_action), %g1 777 - ldx [%g1 + (11 << 3)], %g3 ! irqaction[floppy_irq] 778 - ldx [%g3 + 0x08], %g4 ! action->flags>>48==ino 779 - sethi %hi(ivector_table), %g3 780 - srlx %g4, 48, %g4 781 - or %g3, %lo(ivector_table), %g3 782 - sllx %g4, 5, %g4 783 - ldx [%g3 + %g4], %g4 ! &ivector_table[ino] 784 - ldx [%g4 + 0x10], %g4 ! bucket->iclr 785 - stwa %g0, [%g4] ASI_PHYS_BYPASS_EC_E ! ICLR_IDLE 786 - membar #Sync ! probably not needed... 787 - retry 788 - 789 - floppy_overrun: 790 - sethi %hi(pdma_vaddr), %g1 791 - stx %g4, [%g1 + %lo(pdma_vaddr)] 792 - sethi %hi(pdma_size), %g1 793 - stx %g5, [%g1 + %lo(pdma_size)] 794 - sethi %hi(doing_pdma), %g1 795 - st %g0, [%g1 + %lo(doing_pdma)] 796 - 797 - floppy_dosoftint: 798 - rdpr %pil, %g2 799 - wrpr %g0, 15, %pil 800 - sethi %hi(109f), %g7 801 - b,pt %xcc, etrap_irq 802 - 109: or %g7, %lo(109b), %g7 803 - 804 - mov 11, %o0 805 - mov 0, %o1 806 - call sparc_floppy_irq 807 - add %sp, PTREGS_OFF, %o2 808 - 809 - b,pt %xcc, rtrap_irq 810 - nop 811 - 812 - #endif /* CONFIG_BLK_DEV_FD */ 813 701 814 702 /* XXX Here is stuff we still need to write... -DaveM XXX */ 815 703 .globl netbsd_syscall
+50 -121
arch/sparc64/kernel/irq.c
··· 37 37 #include <asm/uaccess.h> 38 38 #include <asm/cache.h> 39 39 #include <asm/cpudata.h> 40 + #include <asm/auxio.h> 40 41 41 42 #ifdef CONFIG_SMP 42 43 static void distribute_irqs(void); ··· 835 834 } 836 835 837 836 #ifdef CONFIG_BLK_DEV_FD 838 - extern void floppy_interrupt(int irq, void *dev_cookie, struct pt_regs *regs); 837 + extern irqreturn_t floppy_interrupt(int, void *, struct pt_regs *);; 839 838 840 - void sparc_floppy_irq(int irq, void *dev_cookie, struct pt_regs *regs) 839 + /* XXX No easy way to include asm/floppy.h XXX */ 840 + extern unsigned char *pdma_vaddr; 841 + extern unsigned long pdma_size; 842 + extern volatile int doing_pdma; 843 + extern unsigned long fdc_status; 844 + 845 + irqreturn_t sparc_floppy_irq(int irq, void *dev_cookie, struct pt_regs *regs) 841 846 { 842 - struct irqaction *action = *(irq + irq_action); 843 - struct ino_bucket *bucket; 844 - int cpu = smp_processor_id(); 847 + if (likely(doing_pdma)) { 848 + void __iomem *stat = (void __iomem *) fdc_status; 849 + unsigned char *vaddr = pdma_vaddr; 850 + unsigned long size = pdma_size; 851 + u8 val; 845 852 846 - irq_enter(); 847 - kstat_this_cpu.irqs[irq]++; 853 + while (size) { 854 + val = readb(stat); 855 + if (unlikely(!(val & 0x80))) { 856 + pdma_vaddr = vaddr; 857 + pdma_size = size; 858 + return IRQ_HANDLED; 859 + } 860 + if (unlikely(!(val & 0x20))) { 861 + pdma_vaddr = vaddr; 862 + pdma_size = size; 863 + doing_pdma = 0; 864 + goto main_interrupt; 865 + } 866 + if (val & 0x40) { 867 + /* read */ 868 + *vaddr++ = readb(stat + 1); 869 + } else { 870 + unsigned char data = *vaddr++; 848 871 849 - *(irq_work(cpu, irq)) = 0; 850 - bucket = get_ino_in_irqaction(action) + ivector_table; 872 + /* write */ 873 + writeb(data, stat + 1); 874 + } 875 + size--; 876 + } 851 877 852 - bucket->flags |= IBF_INPROGRESS; 878 + pdma_vaddr = vaddr; 879 + pdma_size = size; 853 880 854 - floppy_interrupt(irq, dev_cookie, regs); 855 - upa_writel(ICLR_IDLE, bucket->iclr); 881 + /* Send Terminal Count pulse to floppy controller. */ 882 + val = readb(auxio_register); 883 + val |= AUXIO_AUX1_FTCNT; 884 + writeb(val, auxio_register); 885 + val &= AUXIO_AUX1_FTCNT; 886 + writeb(val, auxio_register); 856 887 857 - bucket->flags &= ~IBF_INPROGRESS; 888 + doing_pdma = 0; 889 + } 858 890 859 - irq_exit(); 891 + main_interrupt: 892 + return floppy_interrupt(irq, dev_cookie, regs); 860 893 } 894 + EXPORT_SYMBOL(sparc_floppy_irq); 861 895 #endif 862 - 863 - /* The following assumes that the branch lies before the place we 864 - * are branching to. This is the case for a trap vector... 865 - * You have been warned. 866 - */ 867 - #define SPARC_BRANCH(dest_addr, inst_addr) \ 868 - (0x10800000 | ((((dest_addr)-(inst_addr))>>2)&0x3fffff)) 869 - 870 - #define SPARC_NOP (0x01000000) 871 - 872 - static void install_fast_irq(unsigned int cpu_irq, 873 - irqreturn_t (*handler)(int, void *, struct pt_regs *)) 874 - { 875 - extern unsigned long sparc64_ttable_tl0; 876 - unsigned long ttent = (unsigned long) &sparc64_ttable_tl0; 877 - unsigned int *insns; 878 - 879 - ttent += 0x820; 880 - ttent += (cpu_irq - 1) << 5; 881 - insns = (unsigned int *) ttent; 882 - insns[0] = SPARC_BRANCH(((unsigned long) handler), 883 - ((unsigned long)&insns[0])); 884 - insns[1] = SPARC_NOP; 885 - __asm__ __volatile__("membar #StoreStore; flush %0" : : "r" (ttent)); 886 - } 887 - 888 - int request_fast_irq(unsigned int irq, 889 - irqreturn_t (*handler)(int, void *, struct pt_regs *), 890 - unsigned long irqflags, const char *name, void *dev_id) 891 - { 892 - struct irqaction *action; 893 - struct ino_bucket *bucket = __bucket(irq); 894 - unsigned long flags; 895 - 896 - /* No pil0 dummy buckets allowed here. */ 897 - if (bucket < &ivector_table[0] || 898 - bucket >= &ivector_table[NUM_IVECS]) { 899 - unsigned int *caller; 900 - 901 - __asm__ __volatile__("mov %%i7, %0" : "=r" (caller)); 902 - printk(KERN_CRIT "request_fast_irq: Old style IRQ registry attempt " 903 - "from %p, irq %08x.\n", caller, irq); 904 - return -EINVAL; 905 - } 906 - 907 - if (!handler) 908 - return -EINVAL; 909 - 910 - if ((bucket->pil == 0) || (bucket->pil == 14)) { 911 - printk("request_fast_irq: Trying to register shared IRQ 0 or 14.\n"); 912 - return -EBUSY; 913 - } 914 - 915 - spin_lock_irqsave(&irq_action_lock, flags); 916 - 917 - action = *(bucket->pil + irq_action); 918 - if (action) { 919 - if (action->flags & SA_SHIRQ) 920 - panic("Trying to register fast irq when already shared.\n"); 921 - if (irqflags & SA_SHIRQ) 922 - panic("Trying to register fast irq as shared.\n"); 923 - printk("request_fast_irq: Trying to register yet already owned.\n"); 924 - spin_unlock_irqrestore(&irq_action_lock, flags); 925 - return -EBUSY; 926 - } 927 - 928 - /* 929 - * We do not check for SA_SAMPLE_RANDOM in this path. Neither do we 930 - * support smp intr affinity in this path. 931 - */ 932 - if (irqflags & SA_STATIC_ALLOC) { 933 - if (static_irq_count < MAX_STATIC_ALLOC) 934 - action = &static_irqaction[static_irq_count++]; 935 - else 936 - printk("Request for IRQ%d (%s) SA_STATIC_ALLOC failed " 937 - "using kmalloc\n", bucket->pil, name); 938 - } 939 - if (action == NULL) 940 - action = (struct irqaction *)kmalloc(sizeof(struct irqaction), 941 - GFP_ATOMIC); 942 - if (!action) { 943 - spin_unlock_irqrestore(&irq_action_lock, flags); 944 - return -ENOMEM; 945 - } 946 - install_fast_irq(bucket->pil, handler); 947 - 948 - bucket->irq_info = action; 949 - bucket->flags |= IBF_ACTIVE; 950 - 951 - action->handler = handler; 952 - action->flags = irqflags; 953 - action->dev_id = NULL; 954 - action->name = name; 955 - action->next = NULL; 956 - put_ino_in_irqaction(action, irq); 957 - put_smpaff_in_irqaction(action, CPU_MASK_NONE); 958 - 959 - *(bucket->pil + irq_action) = action; 960 - enable_irq(irq); 961 - 962 - spin_unlock_irqrestore(&irq_action_lock, flags); 963 - 964 - #ifdef CONFIG_SMP 965 - distribute_irqs(); 966 - #endif 967 - return 0; 968 - } 969 896 970 897 /* We really don't need these at all on the Sparc. We only have 971 898 * stubs here because they are exported to modules.
+8 -4
arch/sparc64/kernel/semaphore.c
··· 32 32 " add %1, %4, %1\n" 33 33 " cas [%3], %0, %1\n" 34 34 " cmp %0, %1\n" 35 + " membar #StoreLoad | #StoreStore\n" 35 36 " bne,pn %%icc, 1b\n" 36 - " membar #StoreLoad | #StoreStore\n" 37 + " nop\n" 37 38 : "=&r" (old_count), "=&r" (tmp), "=m" (sem->count) 38 39 : "r" (&sem->count), "r" (incr), "m" (sem->count) 39 40 : "cc"); ··· 72 71 " cmp %%g1, %%g7\n" 73 72 " bne,pn %%icc, 1b\n" 74 73 " addcc %%g7, 1, %%g0\n" 74 + " membar #StoreLoad | #StoreStore\n" 75 75 " ble,pn %%icc, 3f\n" 76 - " membar #StoreLoad | #StoreStore\n" 76 + " nop\n" 77 77 "2:\n" 78 78 " .subsection 2\n" 79 79 "3: mov %0, %%g1\n" ··· 130 128 " cmp %%g1, %%g7\n" 131 129 " bne,pn %%icc, 1b\n" 132 130 " cmp %%g7, 1\n" 131 + " membar #StoreLoad | #StoreStore\n" 133 132 " bl,pn %%icc, 3f\n" 134 - " membar #StoreLoad | #StoreStore\n" 133 + " nop\n" 135 134 "2:\n" 136 135 " .subsection 2\n" 137 136 "3: mov %0, %%g1\n" ··· 236 233 " cmp %%g1, %%g7\n" 237 234 " bne,pn %%icc, 1b\n" 238 235 " cmp %%g7, 1\n" 236 + " membar #StoreLoad | #StoreStore\n" 239 237 " bl,pn %%icc, 3f\n" 240 - " membar #StoreLoad | #StoreStore\n" 238 + " nop\n" 241 239 "2:\n" 242 240 " .subsection 2\n" 243 241 "3: mov %2, %%g1\n"
-1
arch/sparc64/kernel/sparc64_ksyms.c
··· 227 227 228 228 EXPORT_SYMBOL(mostek_lock); 229 229 EXPORT_SYMBOL(mstk48t02_regs); 230 - EXPORT_SYMBOL(request_fast_irq); 231 230 #ifdef CONFIG_SUN_AUXIO 232 231 EXPORT_SYMBOL(auxio_set_led); 233 232 EXPORT_SYMBOL(auxio_set_lte);
+2 -1
arch/sparc64/kernel/trampoline.S
··· 98 98 99 99 sethi %hi(prom_entry_lock), %g2 100 100 1: ldstub [%g2 + %lo(prom_entry_lock)], %g1 101 + membar #StoreLoad | #StoreStore 101 102 brnz,pn %g1, 1b 102 - membar #StoreLoad | #StoreStore 103 + nop 103 104 104 105 sethi %hi(p1275buf), %g2 105 106 or %g2, %lo(p1275buf), %g2
+53 -50
arch/sparc64/lib/U1memcpy.S
··· 87 87 #define LOOP_CHUNK3(src, dest, len, branch_dest) \ 88 88 MAIN_LOOP_CHUNK(src, dest, f32, f48, len, branch_dest) 89 89 90 + #define DO_SYNC membar #Sync; 90 91 #define STORE_SYNC(dest, fsrc) \ 91 92 EX_ST(STORE_BLK(%fsrc, %dest)); \ 92 - add %dest, 0x40, %dest; 93 + add %dest, 0x40, %dest; \ 94 + DO_SYNC 93 95 94 96 #define STORE_JUMP(dest, fsrc, target) \ 95 97 EX_ST(STORE_BLK(%fsrc, %dest)); \ 96 98 add %dest, 0x40, %dest; \ 97 - ba,pt %xcc, target; 99 + ba,pt %xcc, target; \ 100 + nop; 98 101 99 102 #define FINISH_VISCHUNK(dest, f0, f1, left) \ 100 103 subcc %left, 8, %left;\ ··· 242 239 ba,pt %xcc, 1b+4 243 240 faligndata %f0, %f2, %f48 244 241 1: FREG_FROB(f16,f18,f20,f22,f24,f26,f28,f30,f32) 245 - STORE_SYNC(o0, f48) membar #Sync 242 + STORE_SYNC(o0, f48) 246 243 FREG_FROB(f32,f34,f36,f38,f40,f42,f44,f46,f0) 247 - STORE_JUMP(o0, f48, 40f) membar #Sync 244 + STORE_JUMP(o0, f48, 40f) 248 245 2: FREG_FROB(f32,f34,f36,f38,f40,f42,f44,f46,f0) 249 - STORE_SYNC(o0, f48) membar #Sync 246 + STORE_SYNC(o0, f48) 250 247 FREG_FROB(f0, f2, f4, f6, f8, f10,f12,f14,f16) 251 - STORE_JUMP(o0, f48, 48f) membar #Sync 248 + STORE_JUMP(o0, f48, 48f) 252 249 3: FREG_FROB(f0, f2, f4, f6, f8, f10,f12,f14,f16) 253 - STORE_SYNC(o0, f48) membar #Sync 250 + STORE_SYNC(o0, f48) 254 251 FREG_FROB(f16,f18,f20,f22,f24,f26,f28,f30,f32) 255 - STORE_JUMP(o0, f48, 56f) membar #Sync 252 + STORE_JUMP(o0, f48, 56f) 256 253 257 254 1: FREG_FROB(f2, f4, f6, f8, f10,f12,f14,f16,f18) 258 255 LOOP_CHUNK1(o1, o0, GLOBAL_SPARE, 1f) ··· 263 260 ba,pt %xcc, 1b+4 264 261 faligndata %f2, %f4, %f48 265 262 1: FREG_FROB(f18,f20,f22,f24,f26,f28,f30,f32,f34) 266 - STORE_SYNC(o0, f48) membar #Sync 263 + STORE_SYNC(o0, f48) 267 264 FREG_FROB(f34,f36,f38,f40,f42,f44,f46,f0, f2) 268 - STORE_JUMP(o0, f48, 41f) membar #Sync 265 + STORE_JUMP(o0, f48, 41f) 269 266 2: FREG_FROB(f34,f36,f38,f40,f42,f44,f46,f0, f2) 270 - STORE_SYNC(o0, f48) membar #Sync 267 + STORE_SYNC(o0, f48) 271 268 FREG_FROB(f2, f4, f6, f8, f10,f12,f14,f16,f18) 272 - STORE_JUMP(o0, f48, 49f) membar #Sync 269 + STORE_JUMP(o0, f48, 49f) 273 270 3: FREG_FROB(f2, f4, f6, f8, f10,f12,f14,f16,f18) 274 - STORE_SYNC(o0, f48) membar #Sync 271 + STORE_SYNC(o0, f48) 275 272 FREG_FROB(f18,f20,f22,f24,f26,f28,f30,f32,f34) 276 - STORE_JUMP(o0, f48, 57f) membar #Sync 273 + STORE_JUMP(o0, f48, 57f) 277 274 278 275 1: FREG_FROB(f4, f6, f8, f10,f12,f14,f16,f18,f20) 279 276 LOOP_CHUNK1(o1, o0, GLOBAL_SPARE, 1f) ··· 284 281 ba,pt %xcc, 1b+4 285 282 faligndata %f4, %f6, %f48 286 283 1: FREG_FROB(f20,f22,f24,f26,f28,f30,f32,f34,f36) 287 - STORE_SYNC(o0, f48) membar #Sync 284 + STORE_SYNC(o0, f48) 288 285 FREG_FROB(f36,f38,f40,f42,f44,f46,f0, f2, f4) 289 - STORE_JUMP(o0, f48, 42f) membar #Sync 286 + STORE_JUMP(o0, f48, 42f) 290 287 2: FREG_FROB(f36,f38,f40,f42,f44,f46,f0, f2, f4) 291 - STORE_SYNC(o0, f48) membar #Sync 288 + STORE_SYNC(o0, f48) 292 289 FREG_FROB(f4, f6, f8, f10,f12,f14,f16,f18,f20) 293 - STORE_JUMP(o0, f48, 50f) membar #Sync 290 + STORE_JUMP(o0, f48, 50f) 294 291 3: FREG_FROB(f4, f6, f8, f10,f12,f14,f16,f18,f20) 295 - STORE_SYNC(o0, f48) membar #Sync 292 + STORE_SYNC(o0, f48) 296 293 FREG_FROB(f20,f22,f24,f26,f28,f30,f32,f34,f36) 297 - STORE_JUMP(o0, f48, 58f) membar #Sync 294 + STORE_JUMP(o0, f48, 58f) 298 295 299 296 1: FREG_FROB(f6, f8, f10,f12,f14,f16,f18,f20,f22) 300 297 LOOP_CHUNK1(o1, o0, GLOBAL_SPARE, 1f) ··· 305 302 ba,pt %xcc, 1b+4 306 303 faligndata %f6, %f8, %f48 307 304 1: FREG_FROB(f22,f24,f26,f28,f30,f32,f34,f36,f38) 308 - STORE_SYNC(o0, f48) membar #Sync 305 + STORE_SYNC(o0, f48) 309 306 FREG_FROB(f38,f40,f42,f44,f46,f0, f2, f4, f6) 310 - STORE_JUMP(o0, f48, 43f) membar #Sync 307 + STORE_JUMP(o0, f48, 43f) 311 308 2: FREG_FROB(f38,f40,f42,f44,f46,f0, f2, f4, f6) 312 - STORE_SYNC(o0, f48) membar #Sync 309 + STORE_SYNC(o0, f48) 313 310 FREG_FROB(f6, f8, f10,f12,f14,f16,f18,f20,f22) 314 - STORE_JUMP(o0, f48, 51f) membar #Sync 311 + STORE_JUMP(o0, f48, 51f) 315 312 3: FREG_FROB(f6, f8, f10,f12,f14,f16,f18,f20,f22) 316 - STORE_SYNC(o0, f48) membar #Sync 313 + STORE_SYNC(o0, f48) 317 314 FREG_FROB(f22,f24,f26,f28,f30,f32,f34,f36,f38) 318 - STORE_JUMP(o0, f48, 59f) membar #Sync 315 + STORE_JUMP(o0, f48, 59f) 319 316 320 317 1: FREG_FROB(f8, f10,f12,f14,f16,f18,f20,f22,f24) 321 318 LOOP_CHUNK1(o1, o0, GLOBAL_SPARE, 1f) ··· 326 323 ba,pt %xcc, 1b+4 327 324 faligndata %f8, %f10, %f48 328 325 1: FREG_FROB(f24,f26,f28,f30,f32,f34,f36,f38,f40) 329 - STORE_SYNC(o0, f48) membar #Sync 326 + STORE_SYNC(o0, f48) 330 327 FREG_FROB(f40,f42,f44,f46,f0, f2, f4, f6, f8) 331 - STORE_JUMP(o0, f48, 44f) membar #Sync 328 + STORE_JUMP(o0, f48, 44f) 332 329 2: FREG_FROB(f40,f42,f44,f46,f0, f2, f4, f6, f8) 333 - STORE_SYNC(o0, f48) membar #Sync 330 + STORE_SYNC(o0, f48) 334 331 FREG_FROB(f8, f10,f12,f14,f16,f18,f20,f22,f24) 335 - STORE_JUMP(o0, f48, 52f) membar #Sync 332 + STORE_JUMP(o0, f48, 52f) 336 333 3: FREG_FROB(f8, f10,f12,f14,f16,f18,f20,f22,f24) 337 - STORE_SYNC(o0, f48) membar #Sync 334 + STORE_SYNC(o0, f48) 338 335 FREG_FROB(f24,f26,f28,f30,f32,f34,f36,f38,f40) 339 - STORE_JUMP(o0, f48, 60f) membar #Sync 336 + STORE_JUMP(o0, f48, 60f) 340 337 341 338 1: FREG_FROB(f10,f12,f14,f16,f18,f20,f22,f24,f26) 342 339 LOOP_CHUNK1(o1, o0, GLOBAL_SPARE, 1f) ··· 347 344 ba,pt %xcc, 1b+4 348 345 faligndata %f10, %f12, %f48 349 346 1: FREG_FROB(f26,f28,f30,f32,f34,f36,f38,f40,f42) 350 - STORE_SYNC(o0, f48) membar #Sync 347 + STORE_SYNC(o0, f48) 351 348 FREG_FROB(f42,f44,f46,f0, f2, f4, f6, f8, f10) 352 - STORE_JUMP(o0, f48, 45f) membar #Sync 349 + STORE_JUMP(o0, f48, 45f) 353 350 2: FREG_FROB(f42,f44,f46,f0, f2, f4, f6, f8, f10) 354 - STORE_SYNC(o0, f48) membar #Sync 351 + STORE_SYNC(o0, f48) 355 352 FREG_FROB(f10,f12,f14,f16,f18,f20,f22,f24,f26) 356 - STORE_JUMP(o0, f48, 53f) membar #Sync 353 + STORE_JUMP(o0, f48, 53f) 357 354 3: FREG_FROB(f10,f12,f14,f16,f18,f20,f22,f24,f26) 358 - STORE_SYNC(o0, f48) membar #Sync 355 + STORE_SYNC(o0, f48) 359 356 FREG_FROB(f26,f28,f30,f32,f34,f36,f38,f40,f42) 360 - STORE_JUMP(o0, f48, 61f) membar #Sync 357 + STORE_JUMP(o0, f48, 61f) 361 358 362 359 1: FREG_FROB(f12,f14,f16,f18,f20,f22,f24,f26,f28) 363 360 LOOP_CHUNK1(o1, o0, GLOBAL_SPARE, 1f) ··· 368 365 ba,pt %xcc, 1b+4 369 366 faligndata %f12, %f14, %f48 370 367 1: FREG_FROB(f28,f30,f32,f34,f36,f38,f40,f42,f44) 371 - STORE_SYNC(o0, f48) membar #Sync 368 + STORE_SYNC(o0, f48) 372 369 FREG_FROB(f44,f46,f0, f2, f4, f6, f8, f10,f12) 373 - STORE_JUMP(o0, f48, 46f) membar #Sync 370 + STORE_JUMP(o0, f48, 46f) 374 371 2: FREG_FROB(f44,f46,f0, f2, f4, f6, f8, f10,f12) 375 - STORE_SYNC(o0, f48) membar #Sync 372 + STORE_SYNC(o0, f48) 376 373 FREG_FROB(f12,f14,f16,f18,f20,f22,f24,f26,f28) 377 - STORE_JUMP(o0, f48, 54f) membar #Sync 374 + STORE_JUMP(o0, f48, 54f) 378 375 3: FREG_FROB(f12,f14,f16,f18,f20,f22,f24,f26,f28) 379 - STORE_SYNC(o0, f48) membar #Sync 376 + STORE_SYNC(o0, f48) 380 377 FREG_FROB(f28,f30,f32,f34,f36,f38,f40,f42,f44) 381 - STORE_JUMP(o0, f48, 62f) membar #Sync 378 + STORE_JUMP(o0, f48, 62f) 382 379 383 380 1: FREG_FROB(f14,f16,f18,f20,f22,f24,f26,f28,f30) 384 381 LOOP_CHUNK1(o1, o0, GLOBAL_SPARE, 1f) ··· 389 386 ba,pt %xcc, 1b+4 390 387 faligndata %f14, %f16, %f48 391 388 1: FREG_FROB(f30,f32,f34,f36,f38,f40,f42,f44,f46) 392 - STORE_SYNC(o0, f48) membar #Sync 389 + STORE_SYNC(o0, f48) 393 390 FREG_FROB(f46,f0, f2, f4, f6, f8, f10,f12,f14) 394 - STORE_JUMP(o0, f48, 47f) membar #Sync 391 + STORE_JUMP(o0, f48, 47f) 395 392 2: FREG_FROB(f46,f0, f2, f4, f6, f8, f10,f12,f14) 396 - STORE_SYNC(o0, f48) membar #Sync 393 + STORE_SYNC(o0, f48) 397 394 FREG_FROB(f14,f16,f18,f20,f22,f24,f26,f28,f30) 398 - STORE_JUMP(o0, f48, 55f) membar #Sync 395 + STORE_JUMP(o0, f48, 55f) 399 396 3: FREG_FROB(f14,f16,f18,f20,f22,f24,f26,f28,f30) 400 - STORE_SYNC(o0, f48) membar #Sync 397 + STORE_SYNC(o0, f48) 401 398 FREG_FROB(f30,f32,f34,f36,f38,f40,f42,f44,f46) 402 - STORE_JUMP(o0, f48, 63f) membar #Sync 399 + STORE_JUMP(o0, f48, 63f) 403 400 404 401 40: FINISH_VISCHUNK(o0, f0, f2, g3) 405 402 41: FINISH_VISCHUNK(o0, f2, f4, g3)
+13 -2
arch/sparc64/lib/VISsave.S
··· 72 72 73 73 stda %f48, [%g3 + %g1] ASI_BLK_P 74 74 5: membar #Sync 75 - jmpl %g7 + %g0, %g0 75 + ba,pt %xcc, 80f 76 + nop 77 + 78 + .align 32 79 + 80: jmpl %g7 + %g0, %g0 76 80 nop 77 81 78 82 6: ldub [%g3 + TI_FPSAVED], %o5 ··· 91 87 stda %f32, [%g2 + %g1] ASI_BLK_P 92 88 stda %f48, [%g3 + %g1] ASI_BLK_P 93 89 membar #Sync 94 - jmpl %g7 + %g0, %g0 90 + ba,pt %xcc, 80f 91 + nop 95 92 93 + .align 32 94 + 80: jmpl %g7 + %g0, %g0 96 95 nop 97 96 98 97 .align 32 ··· 133 126 stda %f0, [%g2 + %g1] ASI_BLK_P 134 127 stda %f16, [%g3 + %g1] ASI_BLK_P 135 128 membar #Sync 129 + ba,pt %xcc, 4f 130 + nop 131 + 132 + .align 32 136 133 4: and %o5, FPRS_DU, %o5 137 134 jmpl %g7 + %g0, %g0 138 135 wr %o5, FPRS_FEF, %fprs
+26 -16
arch/sparc64/lib/atomic.S
··· 7 7 #include <linux/config.h> 8 8 #include <asm/asi.h> 9 9 10 - /* On SMP we need to use memory barriers to ensure 11 - * correct memory operation ordering, nop these out 12 - * for uniprocessor. 13 - */ 14 - #ifdef CONFIG_SMP 15 - #define ATOMIC_PRE_BARRIER membar #StoreLoad | #LoadLoad 16 - #define ATOMIC_POST_BARRIER membar #StoreLoad | #StoreStore 17 - #else 18 - #define ATOMIC_PRE_BARRIER nop 19 - #define ATOMIC_POST_BARRIER nop 20 - #endif 21 - 22 10 .text 23 11 24 12 /* Two versions of the atomic routines, one that ··· 40 52 nop 41 53 .size atomic_sub, .-atomic_sub 42 54 55 + /* On SMP we need to use memory barriers to ensure 56 + * correct memory operation ordering, nop these out 57 + * for uniprocessor. 58 + */ 59 + #ifdef CONFIG_SMP 60 + 61 + #define ATOMIC_PRE_BARRIER membar #StoreLoad | #LoadLoad; 62 + #define ATOMIC_POST_BARRIER \ 63 + ba,pt %xcc, 80b; \ 64 + membar #StoreLoad | #StoreStore 65 + 66 + 80: retl 67 + nop 68 + #else 69 + #define ATOMIC_PRE_BARRIER 70 + #define ATOMIC_POST_BARRIER 71 + #endif 72 + 43 73 .globl atomic_add_ret 44 74 .type atomic_add_ret,#function 45 75 atomic_add_ret: /* %o0 = increment, %o1 = atomic_ptr */ ··· 68 62 cmp %g1, %g7 69 63 bne,pn %icc, 1b 70 64 add %g7, %o0, %g7 65 + sra %g7, 0, %o0 71 66 ATOMIC_POST_BARRIER 72 67 retl 73 - sra %g7, 0, %o0 68 + nop 74 69 .size atomic_add_ret, .-atomic_add_ret 75 70 76 71 .globl atomic_sub_ret ··· 84 77 cmp %g1, %g7 85 78 bne,pn %icc, 1b 86 79 sub %g7, %o0, %g7 80 + sra %g7, 0, %o0 87 81 ATOMIC_POST_BARRIER 88 82 retl 89 - sra %g7, 0, %o0 83 + nop 90 84 .size atomic_sub_ret, .-atomic_sub_ret 91 85 92 86 .globl atomic64_add ··· 126 118 cmp %g1, %g7 127 119 bne,pn %xcc, 1b 128 120 add %g7, %o0, %g7 121 + mov %g7, %o0 129 122 ATOMIC_POST_BARRIER 130 123 retl 131 - mov %g7, %o0 124 + nop 132 125 .size atomic64_add_ret, .-atomic64_add_ret 133 126 134 127 .globl atomic64_sub_ret ··· 142 133 cmp %g1, %g7 143 134 bne,pn %xcc, 1b 144 135 sub %g7, %o0, %g7 136 + mov %g7, %o0 145 137 ATOMIC_POST_BARRIER 146 138 retl 147 - mov %g7, %o0 139 + nop 148 140 .size atomic64_sub_ret, .-atomic64_sub_ret
+21 -12
arch/sparc64/lib/bitops.S
··· 7 7 #include <linux/config.h> 8 8 #include <asm/asi.h> 9 9 10 + .text 11 + 10 12 /* On SMP we need to use memory barriers to ensure 11 13 * correct memory operation ordering, nop these out 12 14 * for uniprocessor. 13 15 */ 16 + 14 17 #ifdef CONFIG_SMP 15 18 #define BITOP_PRE_BARRIER membar #StoreLoad | #LoadLoad 16 - #define BITOP_POST_BARRIER membar #StoreLoad | #StoreStore 17 - #else 18 - #define BITOP_PRE_BARRIER nop 19 - #define BITOP_POST_BARRIER nop 20 - #endif 19 + #define BITOP_POST_BARRIER \ 20 + ba,pt %xcc, 80b; \ 21 + membar #StoreLoad | #StoreStore 21 22 22 - .text 23 + 80: retl 24 + nop 25 + #else 26 + #define BITOP_PRE_BARRIER 27 + #define BITOP_POST_BARRIER 28 + #endif 23 29 24 30 .globl test_and_set_bit 25 31 .type test_and_set_bit,#function ··· 43 37 cmp %g7, %g1 44 38 bne,pn %xcc, 1b 45 39 and %g7, %o2, %g2 46 - BITOP_POST_BARRIER 47 40 clr %o0 41 + movrne %g2, 1, %o0 42 + BITOP_POST_BARRIER 48 43 retl 49 - movrne %g2, 1, %o0 44 + nop 50 45 .size test_and_set_bit, .-test_and_set_bit 51 46 52 47 .globl test_and_clear_bit ··· 66 59 cmp %g7, %g1 67 60 bne,pn %xcc, 1b 68 61 and %g7, %o2, %g2 69 - BITOP_POST_BARRIER 70 62 clr %o0 63 + movrne %g2, 1, %o0 64 + BITOP_POST_BARRIER 71 65 retl 72 - movrne %g2, 1, %o0 66 + nop 73 67 .size test_and_clear_bit, .-test_and_clear_bit 74 68 75 69 .globl test_and_change_bit ··· 89 81 cmp %g7, %g1 90 82 bne,pn %xcc, 1b 91 83 and %g7, %o2, %g2 92 - BITOP_POST_BARRIER 93 84 clr %o0 85 + movrne %g2, 1, %o0 86 + BITOP_POST_BARRIER 94 87 retl 95 - movrne %g2, 1, %o0 88 + nop 96 89 .size test_and_change_bit, .-test_and_change_bit 97 90 98 91 .globl set_bit
+4 -2
arch/sparc64/lib/debuglocks.c
··· 252 252 " andn %%g1, %%g3, %%g7\n" 253 253 " casx [%0], %%g1, %%g7\n" 254 254 " cmp %%g1, %%g7\n" 255 + " membar #StoreLoad | #StoreStore\n" 255 256 " bne,pn %%xcc, 1b\n" 256 - " membar #StoreLoad | #StoreStore" 257 + " nop" 257 258 : /* no outputs */ 258 259 : "r" (&(rw->lock)) 259 260 : "g3", "g1", "g7", "cc", "memory"); ··· 352 351 " andn %%g1, %%g3, %%g7\n" 353 352 " casx [%0], %%g1, %%g7\n" 354 353 " cmp %%g1, %%g7\n" 354 + " membar #StoreLoad | #StoreStore\n" 355 355 " bne,pn %%xcc, 1b\n" 356 - " membar #StoreLoad | #StoreStore" 356 + " nop" 357 357 : /* no outputs */ 358 358 : "r" (&(rw->lock)) 359 359 : "g3", "g1", "g7", "cc", "memory");
+4 -2
arch/sparc64/lib/dec_and_lock.S
··· 48 48 #endif 49 49 to_zero: 50 50 ldstub [%o1], %g3 51 + membar #StoreLoad | #StoreStore 51 52 brnz,pn %g3, spin_on_lock 52 - membar #StoreLoad | #StoreStore 53 + nop 53 54 loop2: cas [%o0], %g2, %g7 /* ASSERT(g7 == 0) */ 54 55 cmp %g2, %g7 55 56 ··· 72 71 nop 73 72 spin_on_lock: 74 73 ldub [%o1], %g3 74 + membar #LoadLoad 75 75 brnz,pt %g3, spin_on_lock 76 - membar #LoadLoad 76 + nop 77 77 ba,pt %xcc, to_zero 78 78 nop 79 79 nop
+10 -5
arch/sparc64/lib/rwsem.S
··· 17 17 bne,pn %icc, 1b 18 18 add %g7, 1, %g7 19 19 cmp %g7, 0 20 + membar #StoreLoad | #StoreStore 20 21 bl,pn %icc, 3f 21 - membar #StoreLoad | #StoreStore 22 + nop 22 23 2: 23 24 retl 24 25 nop ··· 58 57 cmp %g3, %g7 59 58 bne,pn %icc, 1b 60 59 cmp %g7, 0 60 + membar #StoreLoad | #StoreStore 61 61 bne,pn %icc, 3f 62 - membar #StoreLoad | #StoreStore 62 + nop 63 63 2: retl 64 64 nop 65 65 3: ··· 99 97 cmp %g1, %g7 100 98 bne,pn %icc, 1b 101 99 cmp %g7, 0 100 + membar #StoreLoad | #StoreStore 102 101 bl,pn %icc, 3f 103 - membar #StoreLoad | #StoreStore 102 + nop 104 103 2: retl 105 104 nop 106 105 3: sethi %hi(RWSEM_ACTIVE_MASK), %g1 ··· 129 126 bne,pn %icc, 1b 130 127 sub %g7, %g1, %g7 131 128 cmp %g7, 0 129 + membar #StoreLoad | #StoreStore 132 130 bl,pn %icc, 3f 133 - membar #StoreLoad | #StoreStore 131 + nop 134 132 2: 135 133 retl 136 134 nop ··· 155 151 bne,pn %icc, 1b 156 152 sub %g7, %g1, %g7 157 153 cmp %g7, 0 154 + membar #StoreLoad | #StoreStore 158 155 bl,pn %icc, 3f 159 - membar #StoreLoad | #StoreStore 156 + nop 160 157 2: 161 158 retl 162 159 nop
+4 -2
arch/sparc64/mm/init.c
··· 136 136 "or %%g1, %0, %%g1\n\t" 137 137 "casx [%2], %%g7, %%g1\n\t" 138 138 "cmp %%g7, %%g1\n\t" 139 + "membar #StoreLoad | #StoreStore\n\t" 139 140 "bne,pn %%xcc, 1b\n\t" 140 - " membar #StoreLoad | #StoreStore" 141 + " nop" 141 142 : /* no outputs */ 142 143 : "r" (mask), "r" (non_cpu_bits), "r" (&page->flags) 143 144 : "g1", "g7"); ··· 158 157 " andn %%g7, %1, %%g1\n\t" 159 158 "casx [%2], %%g7, %%g1\n\t" 160 159 "cmp %%g7, %%g1\n\t" 160 + "membar #StoreLoad | #StoreStore\n\t" 161 161 "bne,pn %%xcc, 1b\n\t" 162 - " membar #StoreLoad | #StoreStore\n" 162 + " nop\n" 163 163 "2:" 164 164 : /* no outputs */ 165 165 : "r" (cpu), "r" (mask), "r" (&page->flags),
+2 -1
arch/sparc64/mm/ultra.S
··· 266 266 andn %o3, 1, %o3 267 267 stxa %g0, [%o3] ASI_IMMU_DEMAP 268 268 2: stxa %g0, [%o3] ASI_DMMU_DEMAP 269 + membar #Sync 269 270 brnz,pt %o1, 1b 270 - membar #Sync 271 + nop 271 272 stxa %g2, [%o4] ASI_DMMU 272 273 flush %g6 273 274 wrpr %g0, 0, %tl
+24 -25
drivers/block/cfq-iosched.c
··· 300 300 static struct cfq_queue *cfq_find_cfq_hash(struct cfq_data *, unsigned int, unsigned short); 301 301 static void cfq_dispatch_sort(request_queue_t *, struct cfq_rq *); 302 302 static void cfq_put_cfqd(struct cfq_data *cfqd); 303 - static inline int cfq_pending_requests(struct cfq_data *cfqd); 304 303 305 304 #define process_sync(tsk) ((tsk)->flags & PF_SYNCWRITE) 306 305 ··· 345 346 } 346 347 347 348 return NULL; 349 + } 350 + 351 + static inline int cfq_pending_requests(struct cfq_data *cfqd) 352 + { 353 + return !list_empty(&cfqd->queue->queue_head) || cfqd->busy_queues; 354 + } 355 + 356 + /* 357 + * scheduler run of queue, if there are requests pending and no one in the 358 + * driver that will restart queueing 359 + */ 360 + static inline void cfq_schedule_dispatch(struct cfq_data *cfqd) 361 + { 362 + if (!cfqd->rq_in_driver && cfq_pending_requests(cfqd)) 363 + kblockd_schedule_work(&cfqd->unplug_work); 364 + } 365 + 366 + static int cfq_queue_empty(request_queue_t *q) 367 + { 368 + struct cfq_data *cfqd = q->elevator->elevator_data; 369 + 370 + return !cfq_pending_requests(cfqd); 348 371 } 349 372 350 373 /* ··· 1090 1069 WARN_ON(cfqq->ioprio >= IOPRIO_BE_NR); 1091 1070 1092 1071 return 2 * (base_rq + base_rq * (CFQ_PRIO_LISTS - 1 - cfqq->ioprio)); 1093 - } 1094 - 1095 - /* 1096 - * scheduler run of queue, if there are requests pending and no one in the 1097 - * driver that will restart queueing 1098 - */ 1099 - static inline void cfq_schedule_dispatch(struct cfq_data *cfqd) 1100 - { 1101 - if (!cfqd->rq_in_driver && cfq_pending_requests(cfqd)) 1102 - kblockd_schedule_work(&cfqd->unplug_work); 1103 1072 } 1104 1073 1105 1074 /* ··· 1857 1846 } 1858 1847 } 1859 1848 1860 - static inline int cfq_pending_requests(struct cfq_data *cfqd) 1861 - { 1862 - return !list_empty(&cfqd->queue->queue_head) || cfqd->busy_queues; 1863 - } 1864 - 1865 - static int cfq_queue_empty(request_queue_t *q) 1866 - { 1867 - struct cfq_data *cfqd = q->elevator->elevator_data; 1868 - 1869 - return !cfq_pending_requests(cfqd); 1870 - } 1871 - 1872 1849 static void cfq_completed_request(request_queue_t *q, struct request *rq) 1873 1850 { 1874 1851 struct cfq_rq *crq = RQ_DATA(rq); ··· 1951 1952 { 1952 1953 #if 1 1953 1954 if ((cfq_cfqq_wait_request(cfqq) || cfq_cfqq_must_alloc(cfqq)) && 1954 - !cfq_cfqq_must_alloc_slice) { 1955 + !cfq_cfqq_must_alloc_slice(cfqq)) { 1955 1956 cfq_mark_cfqq_must_alloc_slice(cfqq); 1956 1957 return ELV_MQUEUE_MUST; 1957 1958 } ··· 1968 1969 * only allow 1 ELV_MQUEUE_MUST per slice, otherwise we 1969 1970 * can quickly flood the queue with writes from a single task 1970 1971 */ 1971 - if (rw == READ || !cfq_cfqq_must_alloc_slice) { 1972 + if (rw == READ || !cfq_cfqq_must_alloc_slice(cfqq)) { 1972 1973 cfq_mark_cfqq_must_alloc_slice(cfqq); 1973 1974 return ELV_MQUEUE_MUST; 1974 1975 }
+9
drivers/bluetooth/bluecard_cs.c
··· 1089 1089 return 0; 1090 1090 } 1091 1091 1092 + static struct pcmcia_device_id bluecard_ids[] = { 1093 + PCMCIA_DEVICE_PROD_ID12("BlueCard", "LSE041", 0xbaf16fbf, 0x657cc15e), 1094 + PCMCIA_DEVICE_PROD_ID12("BTCFCARD", "LSE139", 0xe3987764, 0x2524b59c), 1095 + PCMCIA_DEVICE_PROD_ID12("WSS", "LSE039", 0x0a0736ec, 0x24e6dfab), 1096 + PCMCIA_DEVICE_NULL 1097 + }; 1098 + MODULE_DEVICE_TABLE(pcmcia, bluecard_ids); 1099 + 1092 1100 static struct pcmcia_driver bluecard_driver = { 1093 1101 .owner = THIS_MODULE, 1094 1102 .drv = { ··· 1104 1096 }, 1105 1097 .attach = bluecard_attach, 1106 1098 .detach = bluecard_detach, 1099 + .id_table = bluecard_ids, 1107 1100 }; 1108 1101 1109 1102 static int __init init_bluecard_cs(void)
+7
drivers/bluetooth/bt3c_cs.c
··· 935 935 return 0; 936 936 } 937 937 938 + static struct pcmcia_device_id bt3c_ids[] = { 939 + PCMCIA_DEVICE_PROD_ID13("3COM", "Bluetooth PC Card", 0xefce0a31, 0xd4ce9b02), 940 + PCMCIA_DEVICE_NULL 941 + }; 942 + MODULE_DEVICE_TABLE(pcmcia, bt3c_ids); 943 + 938 944 static struct pcmcia_driver bt3c_driver = { 939 945 .owner = THIS_MODULE, 940 946 .drv = { ··· 948 942 }, 949 943 .attach = bt3c_attach, 950 944 .detach = bt3c_detach, 945 + .id_table = bt3c_ids, 951 946 }; 952 947 953 948 static int __init init_bt3c_cs(void)
+7
drivers/bluetooth/btuart_cs.c
··· 855 855 return 0; 856 856 } 857 857 858 + static struct pcmcia_device_id btuart_ids[] = { 859 + /* don't use this driver. Use serial_cs + hci_uart instead */ 860 + PCMCIA_DEVICE_NULL 861 + }; 862 + MODULE_DEVICE_TABLE(pcmcia, btuart_ids); 863 + 858 864 static struct pcmcia_driver btuart_driver = { 859 865 .owner = THIS_MODULE, 860 866 .drv = { ··· 868 862 }, 869 863 .attach = btuart_attach, 870 864 .detach = btuart_detach, 865 + .id_table = btuart_ids, 871 866 }; 872 867 873 868 static int __init init_btuart_cs(void)
+8
drivers/bluetooth/dtl1_cs.c
··· 807 807 return 0; 808 808 } 809 809 810 + static struct pcmcia_device_id dtl1_ids[] = { 811 + PCMCIA_DEVICE_PROD_ID12("Nokia Mobile Phones", "DTL-1", 0xe1bfdd64, 0xe168480d), 812 + PCMCIA_DEVICE_PROD_ID12("Socket", "CF", 0xb38bcc2e, 0x44ebf863), 813 + PCMCIA_DEVICE_NULL 814 + }; 815 + MODULE_DEVICE_TABLE(pcmcia, dtl1_ids); 816 + 810 817 static struct pcmcia_driver dtl1_driver = { 811 818 .owner = THIS_MODULE, 812 819 .drv = { ··· 821 814 }, 822 815 .attach = dtl1_attach, 823 816 .detach = dtl1_detach, 817 + .id_table = dtl1_ids, 824 818 }; 825 819 826 820 static int __init init_dtl1_cs(void)
+6
drivers/ide/Kconfig
··· 606 606 <http://www.ite.com.tw/ia/brief_it8172bsp.htm>; picture of the 607 607 board at <http://www.mvista.com/partners/semiconductor/ite.html>. 608 608 609 + config BLK_DEV_IT821X 610 + tristate "IT821X IDE support" 611 + help 612 + This driver adds support for the ITE 8211 IDE controller and the 613 + IT 8212 IDE RAID controller in both RAID and pass-through mode. 614 + 609 615 config BLK_DEV_NS87415 610 616 tristate "NS87415 chipset support" 611 617 help
+4
drivers/ide/ide-disk.c
··· 119 119 { 120 120 unsigned long lba_sects, chs_sects, head, tail; 121 121 122 + /* No non-LBA info .. so valid! */ 123 + if (id->cyls == 0) 124 + return 1; 125 + 122 126 /* 123 127 * The ATA spec tells large drives to return 124 128 * C/H/S = 16383/16/63 independent of their size.
-1
drivers/ide/ide-dma.c
··· 132 132 { "SAMSUNG CD-ROM SC-148C", "ALL" }, 133 133 { "SAMSUNG CD-ROM SC", "ALL" }, 134 134 { "SanDisk SDP3B-64" , "ALL" }, 135 - { "SAMSUNG CD-ROM SN-124", "ALL" }, 136 135 { "ATAPI CD-ROM DRIVE 40X MAXIMUM", "ALL" }, 137 136 { "_NEC DV5800A", "ALL" }, 138 137 { NULL , NULL }
+2 -1
drivers/ide/ide-iops.c
··· 1181 1181 pre_reset(drive); 1182 1182 SELECT_DRIVE(drive); 1183 1183 udelay (20); 1184 - hwif->OUTB(WIN_SRST, IDE_COMMAND_REG); 1184 + hwif->OUTBSYNC(drive, WIN_SRST, IDE_COMMAND_REG); 1185 + ndelay(400); 1185 1186 hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; 1186 1187 hwgroup->polling = 1; 1187 1188 __ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20, NULL);
+35
drivers/ide/legacy/ide-cs.c
··· 457 457 return 0; 458 458 } /* ide_event */ 459 459 460 + static struct pcmcia_device_id ide_ids[] = { 461 + PCMCIA_DEVICE_FUNC_ID(4), 462 + PCMCIA_DEVICE_MANF_CARD(0x0032, 0x0704), 463 + PCMCIA_DEVICE_MANF_CARD(0x00a4, 0x002d), 464 + PCMCIA_DEVICE_MANF_CARD(0x2080, 0x0001), 465 + PCMCIA_DEVICE_MANF_CARD(0x0045, 0x0401), 466 + PCMCIA_DEVICE_PROD_ID123("Caravelle", "PSC-IDE ", "PSC000", 0x8c36137c, 0xd0693ab8, 0x2768a9f0), 467 + PCMCIA_DEVICE_PROD_ID123("CDROM", "IDE", "MCD-601p", 0x1b9179ca, 0xede88951, 0x0d902f74), 468 + PCMCIA_DEVICE_PROD_ID123("PCMCIA", "IDE CARD", "F1", 0x281f1c5d, 0x1907960c, 0xf7fde8b9), 469 + PCMCIA_DEVICE_PROD_ID12("ARGOSY", "CD-ROM", 0x78f308dc, 0x66536591), 470 + PCMCIA_DEVICE_PROD_ID12("ARGOSY", "PnPIDE", 0x78f308dc, 0x0c694728), 471 + PCMCIA_DEVICE_PROD_ID12("CNF CD-M", "CD-ROM", 0x7d93b852, 0x66536591), 472 + PCMCIA_DEVICE_PROD_ID12("Creative Technology Ltd.", "PCMCIA CD-ROM Interface Card", 0xff8c8a45, 0xfe8020c4), 473 + PCMCIA_DEVICE_PROD_ID12("Digital Equipment Corporation.", "Digital Mobile Media CD-ROM", 0x17692a66, 0xef1dcbde), 474 + PCMCIA_DEVICE_PROD_ID12("EXP", "CD", 0x6f58c983, 0xaae5994f), 475 + PCMCIA_DEVICE_PROD_ID12("EXP ", "CD-ROM", 0x0a5c52fd, 0x66536591), 476 + PCMCIA_DEVICE_PROD_ID12("EXP ", "PnPIDE", 0x0a5c52fd, 0x0c694728), 477 + PCMCIA_DEVICE_PROD_ID12("FREECOM", "PCCARD-IDE", 0x5714cbf7, 0x48e0ab8e), 478 + PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), 479 + PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), 480 + PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), 481 + PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDEII", 0x547e66dc, 0xb3662674), 482 + PCMCIA_DEVICE_PROD_ID12("LOOKMEET", "CBIDE2 ", 0xe37be2b5, 0x8671043b), 483 + PCMCIA_DEVICE_PROD_ID12(" ", "NinjaATA-", 0x3b6e20c8, 0xebe0bd79), 484 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "CD-ROM", 0x281f1c5d, 0x66536591), 485 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "PnPIDE", 0x281f1c5d, 0x0c694728), 486 + PCMCIA_DEVICE_PROD_ID12("SHUTTLE TECHNOLOGY LTD.", "PCCARD-IDE/ATAPI Adapter", 0x4a3f0ba0, 0x322560e1), 487 + PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003), 488 + PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), 489 + PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), 490 + PCMCIA_DEVICE_NULL, 491 + }; 492 + MODULE_DEVICE_TABLE(pcmcia, ide_ids); 493 + 460 494 static struct pcmcia_driver ide_cs_driver = { 461 495 .owner = THIS_MODULE, 462 496 .drv = { ··· 498 464 }, 499 465 .attach = ide_attach, 500 466 .detach = ide_detach, 467 + .id_table = ide_ids, 501 468 }; 502 469 503 470 static int __init init_ide_cs(void)
+1
drivers/ide/pci/Makefile
··· 12 12 obj-$(CONFIG_BLK_DEV_HPT366) += hpt366.o 13 13 #obj-$(CONFIG_BLK_DEV_HPT37X) += hpt37x.o 14 14 obj-$(CONFIG_BLK_DEV_IT8172) += it8172.o 15 + obj-$(CONFIG_BLK_DEV_IT821X) += it821x.o 15 16 obj-$(CONFIG_BLK_DEV_NS87415) += ns87415.o 16 17 obj-$(CONFIG_BLK_DEV_OPTI621) += opti621.o 17 18 obj-$(CONFIG_BLK_DEV_PDC202XX_OLD) += pdc202xx_old.o
+48 -25
drivers/ide/pci/generic.c
··· 39 39 40 40 #include <asm/io.h> 41 41 42 + static int ide_generic_all; /* Set to claim all devices */ 43 + 44 + static int __init ide_generic_all_on(char *unused) 45 + { 46 + ide_generic_all = 1; 47 + printk(KERN_INFO "IDE generic will claim all unknown PCI IDE storage controllers.\n"); 48 + return 1; 49 + } 50 + 51 + __setup("all-generic-ide", ide_generic_all_on); 52 + 42 53 static void __devinit init_hwif_generic (ide_hwif_t *hwif) 43 54 { 44 55 switch(hwif->pci_dev->device) { ··· 89 78 90 79 static ide_pci_device_t generic_chipsets[] __devinitdata = { 91 80 { /* 0 */ 81 + .name = "Unknown", 82 + .init_hwif = init_hwif_generic, 83 + .channels = 2, 84 + .autodma = AUTODMA, 85 + .bootable = ON_BOARD, 86 + },{ /* 1 */ 92 87 .name = "NS87410", 93 88 .init_hwif = init_hwif_generic, 94 89 .channels = 2, 95 90 .autodma = AUTODMA, 96 91 .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, 97 92 .bootable = ON_BOARD, 98 - },{ /* 1 */ 93 + },{ /* 2 */ 99 94 .name = "SAMURAI", 100 95 .init_hwif = init_hwif_generic, 101 96 .channels = 2, 102 97 .autodma = AUTODMA, 103 98 .bootable = ON_BOARD, 104 - },{ /* 2 */ 99 + },{ /* 3 */ 105 100 .name = "HT6565", 106 101 .init_hwif = init_hwif_generic, 107 102 .channels = 2, 108 103 .autodma = AUTODMA, 109 104 .bootable = ON_BOARD, 110 - },{ /* 3 */ 105 + },{ /* 4 */ 111 106 .name = "UM8673F", 112 107 .init_hwif = init_hwif_generic, 113 108 .channels = 2, 114 109 .autodma = NODMA, 115 110 .bootable = ON_BOARD, 116 - },{ /* 4 */ 111 + },{ /* 5 */ 117 112 .name = "UM8886A", 118 113 .init_hwif = init_hwif_generic, 119 114 .channels = 2, 120 115 .autodma = NODMA, 121 116 .bootable = ON_BOARD, 122 - },{ /* 5 */ 117 + },{ /* 6 */ 123 118 .name = "UM8886BF", 124 119 .init_hwif = init_hwif_generic, 125 120 .channels = 2, 126 121 .autodma = NODMA, 127 122 .bootable = ON_BOARD, 128 - },{ /* 6 */ 123 + },{ /* 7 */ 129 124 .name = "HINT_IDE", 130 125 .init_hwif = init_hwif_generic, 131 126 .channels = 2, 132 127 .autodma = AUTODMA, 133 128 .bootable = ON_BOARD, 134 - },{ /* 7 */ 129 + },{ /* 8 */ 135 130 .name = "VIA_IDE", 136 131 .init_hwif = init_hwif_generic, 137 132 .channels = 2, 138 133 .autodma = NOAUTODMA, 139 134 .bootable = ON_BOARD, 140 - },{ /* 8 */ 135 + },{ /* 9 */ 141 136 .name = "OPTI621V", 142 137 .init_hwif = init_hwif_generic, 143 138 .channels = 2, 144 139 .autodma = NOAUTODMA, 145 140 .bootable = ON_BOARD, 146 - },{ /* 9 */ 141 + },{ /* 10 */ 147 142 .name = "VIA8237SATA", 148 143 .init_hwif = init_hwif_generic, 149 144 .channels = 2, 150 145 .autodma = AUTODMA, 151 146 .bootable = OFF_BOARD, 152 - },{ /* 10 */ 147 + },{ /* 11 */ 153 148 .name = "Piccolo0102", 154 149 .init_hwif = init_hwif_generic, 155 150 .channels = 2, 156 151 .autodma = NOAUTODMA, 157 152 .bootable = ON_BOARD, 158 - },{ /* 11 */ 153 + },{ /* 12 */ 159 154 .name = "Piccolo0103", 160 155 .init_hwif = init_hwif_generic, 161 156 .channels = 2, 162 157 .autodma = NOAUTODMA, 163 158 .bootable = ON_BOARD, 164 - },{ /* 12 */ 159 + },{ /* 13 */ 165 160 .name = "Piccolo0105", 166 161 .init_hwif = init_hwif_generic, 167 162 .channels = 2, ··· 191 174 u16 command; 192 175 int ret = -ENODEV; 193 176 177 + /* Don't use the generic entry unless instructed to do so */ 178 + if (id->driver_data == 0 && ide_generic_all == 0) 179 + goto out; 180 + 194 181 if (dev->vendor == PCI_VENDOR_ID_UMC && 195 182 dev->device == PCI_DEVICE_ID_UMC_UM8886A && 196 183 (!(PCI_FUNC(dev->devfn) & 1))) ··· 216 195 } 217 196 218 197 static struct pci_device_id generic_pci_tbl[] = { 219 - { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 220 - { PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_SAMURAI_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, 221 - { PCI_VENDOR_ID_HOLTEK, PCI_DEVICE_ID_HOLTEK_6565, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2}, 222 - { PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8673F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3}, 223 - { PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4}, 224 - { PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5}, 225 - { PCI_VENDOR_ID_HINT, PCI_DEVICE_ID_HINT_VXPROII_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 6}, 226 - { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C561, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 7}, 227 - { PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C558, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8}, 198 + { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, 199 + { PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_SAMURAI_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2}, 200 + { PCI_VENDOR_ID_HOLTEK, PCI_DEVICE_ID_HOLTEK_6565, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3}, 201 + { PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8673F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4}, 202 + { PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5}, 203 + { PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 6}, 204 + { PCI_VENDOR_ID_HINT, PCI_DEVICE_ID_HINT_VXPROII_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 7}, 205 + { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C561, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8}, 206 + { PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C558, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 9}, 228 207 #ifdef CONFIG_BLK_DEV_IDE_SATA 229 - { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237_SATA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 9}, 208 + { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237_SATA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 10}, 230 209 #endif 231 - { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 10}, 232 - { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 11}, 233 - { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 12}, 210 + { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 11}, 211 + { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 12}, 212 + { PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 13}, 213 + /* Must come last. If you add entries adjust this table appropriately and the init_one code */ 214 + { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL, 0}, 234 215 { 0, }, 235 216 }; 236 217 MODULE_DEVICE_TABLE(pci, generic_pci_tbl);
+227 -241
drivers/ide/pci/hpt366.c
··· 10 10 * donation of an ABit BP6 mainboard, processor, and memory acellerated 11 11 * development and support. 12 12 * 13 + * 14 + * Highpoint have their own driver (source except for the raid part) 15 + * available from http://www.highpoint-tech.com/hpt3xx-opensource-v131.tgz 16 + * This may be useful to anyone wanting to work on the mainstream hpt IDE. 17 + * 13 18 * Note that final HPT370 support was done by force extraction of GPL. 14 19 * 15 20 * - add function for getting/setting power status of drive ··· 451 446 #define F_LOW_PCI_50 0x2d 452 447 #define F_LOW_PCI_66 0x42 453 448 454 - /* FIXME: compare with driver's code before removing */ 455 - #if 0 456 - if (hpt_minimum_revision(dev, 3)) { 457 - u8 cbl; 458 - cbl = inb(iobase + 0x7b); 459 - outb(cbl | 1, iobase + 0x7b); 460 - outb(cbl & ~1, iobase + 0x7b); 461 - cbl = inb(iobase + 0x7a); 462 - p += sprintf(p, "Cable: ATA-%d" 463 - " ATA-%d\n", 464 - (cbl & 0x02) ? 33 : 66, 465 - (cbl & 0x01) ? 33 : 66); 466 - p += sprintf(p, "\n"); 467 - } 468 - { 469 - u8 c2, c3; 470 - /* older revs don't have these registers mapped 471 - * into io space */ 472 - pci_read_config_byte(dev, 0x43, &c0); 473 - pci_read_config_byte(dev, 0x47, &c1); 474 - pci_read_config_byte(dev, 0x4b, &c2); 475 - pci_read_config_byte(dev, 0x4f, &c3); 449 + /* 450 + * Hold all the highpoint quirks and revision information in one 451 + * place. 452 + */ 476 453 477 - p += sprintf(p, "Mode: %s %s" 478 - " %s %s\n", 479 - (c0 & 0x10) ? "UDMA" : (c0 & 0x20) ? "DMA " : 480 - (c0 & 0x80) ? "PIO " : "off ", 481 - (c1 & 0x10) ? "UDMA" : (c1 & 0x20) ? "DMA " : 482 - (c1 & 0x80) ? "PIO " : "off ", 483 - (c2 & 0x10) ? "UDMA" : (c2 & 0x20) ? "DMA " : 484 - (c2 & 0x80) ? "PIO " : "off ", 485 - (c3 & 0x10) ? "UDMA" : (c3 & 0x20) ? "DMA " : 486 - (c3 & 0x80) ? "PIO " : "off "); 487 - } 488 - } 489 - #endif 454 + struct hpt_info 455 + { 456 + u8 max_mode; /* Speeds allowed */ 457 + int revision; /* Chipset revision */ 458 + int flags; /* Chipset properties */ 459 + #define PLL_MODE 1 460 + #define IS_372N 2 461 + /* Speed table */ 462 + struct chipset_bus_clock_list_entry *speed; 463 + }; 490 464 491 - static u32 hpt_revision (struct pci_dev *dev) 465 + /* 466 + * This wants fixing so that we do everything not by classrev 467 + * (which breaks on the newest chips) but by creating an 468 + * enumeration of chip variants and using that 469 + */ 470 + 471 + static __devinit u32 hpt_revision (struct pci_dev *dev) 492 472 { 493 473 u32 class_rev; 494 474 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); ··· 497 507 return class_rev; 498 508 } 499 509 500 - static u32 hpt_minimum_revision (struct pci_dev *dev, int revision) 501 - { 502 - unsigned int class_rev = hpt_revision(dev); 503 - revision--; 504 - return ((int) (class_rev > revision) ? 1 : 0); 505 - } 506 - 507 510 static int check_in_drive_lists(ide_drive_t *drive, const char **list); 508 511 509 512 static u8 hpt3xx_ratemask (ide_drive_t *drive) 510 513 { 511 - struct pci_dev *dev = HWIF(drive)->pci_dev; 514 + ide_hwif_t *hwif = drive->hwif; 515 + struct hpt_info *info = ide_get_hwifdata(hwif); 512 516 u8 mode = 0; 513 517 514 - if (hpt_minimum_revision(dev, 8)) { /* HPT374 */ 518 + /* FIXME: TODO - move this to set info->mode once at boot */ 519 + 520 + if (info->revision >= 8) { /* HPT374 */ 515 521 mode = (HPT374_ALLOW_ATA133_6) ? 4 : 3; 516 - } else if (hpt_minimum_revision(dev, 7)) { /* HPT371 */ 522 + } else if (info->revision >= 7) { /* HPT371 */ 517 523 mode = (HPT371_ALLOW_ATA133_6) ? 4 : 3; 518 - } else if (hpt_minimum_revision(dev, 6)) { /* HPT302 */ 524 + } else if (info->revision >= 6) { /* HPT302 */ 519 525 mode = (HPT302_ALLOW_ATA133_6) ? 4 : 3; 520 - } else if (hpt_minimum_revision(dev, 5)) { /* HPT372 */ 526 + } else if (info->revision >= 5) { /* HPT372 */ 521 527 mode = (HPT372_ALLOW_ATA133_6) ? 4 : 3; 522 - } else if (hpt_minimum_revision(dev, 4)) { /* HPT370A */ 528 + } else if (info->revision >= 4) { /* HPT370A */ 523 529 mode = (HPT370_ALLOW_ATA100_5) ? 3 : 2; 524 - } else if (hpt_minimum_revision(dev, 3)) { /* HPT370 */ 530 + } else if (info->revision >= 3) { /* HPT370 */ 525 531 mode = (HPT370_ALLOW_ATA100_5) ? 3 : 2; 526 532 mode = (check_in_drive_lists(drive, bad_ata33)) ? 0 : mode; 527 533 } else { /* HPT366 and HPT368 */ 528 534 mode = (check_in_drive_lists(drive, bad_ata33)) ? 0 : 2; 529 535 } 530 - if (!eighty_ninty_three(drive) && (mode)) 536 + if (!eighty_ninty_three(drive) && mode) 531 537 mode = min(mode, (u8)1); 532 538 return mode; 533 539 } ··· 535 549 536 550 static u8 hpt3xx_ratefilter (ide_drive_t *drive, u8 speed) 537 551 { 538 - struct pci_dev *dev = HWIF(drive)->pci_dev; 552 + ide_hwif_t *hwif = drive->hwif; 553 + struct hpt_info *info = ide_get_hwifdata(hwif); 539 554 u8 mode = hpt3xx_ratemask(drive); 540 555 541 556 if (drive->media != ide_disk) ··· 548 561 break; 549 562 case 0x03: 550 563 speed = min(speed, (u8)XFER_UDMA_5); 551 - if (hpt_minimum_revision(dev, 5)) 564 + if (info->revision >= 5) 552 565 break; 553 566 if (check_in_drive_lists(drive, bad_ata100_5)) 554 567 speed = min(speed, (u8)XFER_UDMA_4); ··· 558 571 /* 559 572 * CHECK ME, Does this need to be set to 5 ?? 560 573 */ 561 - if (hpt_minimum_revision(dev, 3)) 574 + if (info->revision >= 3) 562 575 break; 563 576 if ((check_in_drive_lists(drive, bad_ata66_4)) || 564 577 (!(HPT366_ALLOW_ATA66_4))) ··· 572 585 /* 573 586 * CHECK ME, Does this need to be set to 5 ?? 574 587 */ 575 - if (hpt_minimum_revision(dev, 3)) 588 + if (info->revision >= 3) 576 589 break; 577 590 if (check_in_drive_lists(drive, bad_ata33)) 578 591 speed = min(speed, (u8)XFER_MW_DMA_2); ··· 611 624 612 625 static int hpt36x_tune_chipset(ide_drive_t *drive, u8 xferspeed) 613 626 { 614 - struct pci_dev *dev = HWIF(drive)->pci_dev; 627 + ide_hwif_t *hwif = drive->hwif; 628 + struct pci_dev *dev = hwif->pci_dev; 629 + struct hpt_info *info = ide_get_hwifdata(hwif); 615 630 u8 speed = hpt3xx_ratefilter(drive, xferspeed); 616 - // u8 speed = ide_rate_filter(hpt3xx_ratemask(drive), xferspeed); 617 631 u8 regtime = (drive->select.b.unit & 0x01) ? 0x44 : 0x40; 618 - u8 regfast = (HWIF(drive)->channel) ? 0x55 : 0x51; 632 + u8 regfast = (hwif->channel) ? 0x55 : 0x51; 619 633 u8 drive_fast = 0; 620 634 u32 reg1 = 0, reg2 = 0; 621 635 ··· 624 636 * Disable the "fast interrupt" prediction. 625 637 */ 626 638 pci_read_config_byte(dev, regfast, &drive_fast); 627 - #if 0 628 - if (drive_fast & 0x02) 629 - pci_write_config_byte(dev, regfast, drive_fast & ~0x20); 630 - #else 631 639 if (drive_fast & 0x80) 632 640 pci_write_config_byte(dev, regfast, drive_fast & ~0x80); 633 - #endif 634 641 635 - reg2 = pci_bus_clock_list(speed, 636 - (struct chipset_bus_clock_list_entry *) pci_get_drvdata(dev)); 642 + reg2 = pci_bus_clock_list(speed, info->speed); 643 + 637 644 /* 638 645 * Disable on-chip PIO FIFO/buffer 639 646 * (to avoid problems handling I/O errors later) ··· 648 665 649 666 static int hpt370_tune_chipset(ide_drive_t *drive, u8 xferspeed) 650 667 { 651 - struct pci_dev *dev = HWIF(drive)->pci_dev; 668 + ide_hwif_t *hwif = drive->hwif; 669 + struct pci_dev *dev = hwif->pci_dev; 670 + struct hpt_info *info = ide_get_hwifdata(hwif); 652 671 u8 speed = hpt3xx_ratefilter(drive, xferspeed); 653 - // u8 speed = ide_rate_filter(hpt3xx_ratemask(drive), xferspeed); 654 - u8 regfast = (HWIF(drive)->channel) ? 0x55 : 0x51; 672 + u8 regfast = (drive->hwif->channel) ? 0x55 : 0x51; 655 673 u8 drive_pci = 0x40 + (drive->dn * 4); 656 674 u8 new_fast = 0, drive_fast = 0; 657 675 u32 list_conf = 0, drive_conf = 0; ··· 677 693 if (new_fast != drive_fast) 678 694 pci_write_config_byte(dev, regfast, new_fast); 679 695 680 - list_conf = pci_bus_clock_list(speed, 681 - (struct chipset_bus_clock_list_entry *) 682 - pci_get_drvdata(dev)); 696 + list_conf = pci_bus_clock_list(speed, info->speed); 683 697 684 698 pci_read_config_dword(dev, drive_pci, &drive_conf); 685 699 list_conf = (list_conf & ~conf_mask) | (drive_conf & conf_mask); 686 700 687 - if (speed < XFER_MW_DMA_0) { 701 + if (speed < XFER_MW_DMA_0) 688 702 list_conf &= ~0x80000000; /* Disable on-chip PIO FIFO/buffer */ 689 - } 690 - 691 703 pci_write_config_dword(dev, drive_pci, list_conf); 692 704 693 705 return ide_config_drive_speed(drive, speed); ··· 691 711 692 712 static int hpt372_tune_chipset(ide_drive_t *drive, u8 xferspeed) 693 713 { 694 - struct pci_dev *dev = HWIF(drive)->pci_dev; 714 + ide_hwif_t *hwif = drive->hwif; 715 + struct pci_dev *dev = hwif->pci_dev; 716 + struct hpt_info *info = ide_get_hwifdata(hwif); 695 717 u8 speed = hpt3xx_ratefilter(drive, xferspeed); 696 - // u8 speed = ide_rate_filter(hpt3xx_ratemask(drive), xferspeed); 697 - u8 regfast = (HWIF(drive)->channel) ? 0x55 : 0x51; 718 + u8 regfast = (drive->hwif->channel) ? 0x55 : 0x51; 698 719 u8 drive_fast = 0, drive_pci = 0x40 + (drive->dn * 4); 699 720 u32 list_conf = 0, drive_conf = 0; 700 721 u32 conf_mask = (speed >= XFER_MW_DMA_0) ? 0xc0000000 : 0x30070000; ··· 707 726 pci_read_config_byte(dev, regfast, &drive_fast); 708 727 drive_fast &= ~0x07; 709 728 pci_write_config_byte(dev, regfast, drive_fast); 710 - 711 - list_conf = pci_bus_clock_list(speed, 712 - (struct chipset_bus_clock_list_entry *) 713 - pci_get_drvdata(dev)); 729 + 730 + list_conf = pci_bus_clock_list(speed, info->speed); 714 731 pci_read_config_dword(dev, drive_pci, &drive_conf); 715 732 list_conf = (list_conf & ~conf_mask) | (drive_conf & conf_mask); 716 733 if (speed < XFER_MW_DMA_0) ··· 720 741 721 742 static int hpt3xx_tune_chipset (ide_drive_t *drive, u8 speed) 722 743 { 723 - struct pci_dev *dev = HWIF(drive)->pci_dev; 744 + ide_hwif_t *hwif = drive->hwif; 745 + struct hpt_info *info = ide_get_hwifdata(hwif); 724 746 725 - if (hpt_minimum_revision(dev, 8)) 747 + if (info->revision >= 8) 726 748 return hpt372_tune_chipset(drive, speed); /* not a typo */ 727 - #if 0 728 - else if (hpt_minimum_revision(dev, 7)) 729 - hpt371_tune_chipset(drive, speed); 730 - else if (hpt_minimum_revision(dev, 6)) 731 - hpt302_tune_chipset(drive, speed); 732 - #endif 733 - else if (hpt_minimum_revision(dev, 5)) 749 + else if (info->revision >= 5) 734 750 return hpt372_tune_chipset(drive, speed); 735 - else if (hpt_minimum_revision(dev, 3)) 751 + else if (info->revision >= 3) 736 752 return hpt370_tune_chipset(drive, speed); 737 753 else /* hpt368: hpt_minimum_revision(dev, 2) */ 738 754 return hpt36x_tune_chipset(drive, speed); ··· 753 779 static int config_chipset_for_dma (ide_drive_t *drive) 754 780 { 755 781 u8 speed = ide_dma_speed(drive, hpt3xx_ratemask(drive)); 782 + ide_hwif_t *hwif = drive->hwif; 783 + struct hpt_info *info = ide_get_hwifdata(hwif); 756 784 757 - if (!(speed)) 785 + if (!speed) 786 + return 0; 787 + 788 + /* If we don't have any timings we can't do a lot */ 789 + if (info->speed == NULL) 758 790 return 0; 759 791 760 792 (void) hpt3xx_tune_chipset(drive, speed); ··· 774 794 775 795 static void hpt3xx_intrproc (ide_drive_t *drive) 776 796 { 777 - ide_hwif_t *hwif = HWIF(drive); 797 + ide_hwif_t *hwif = drive->hwif; 778 798 779 799 if (drive->quirk_list) 780 800 return; ··· 784 804 785 805 static void hpt3xx_maskproc (ide_drive_t *drive, int mask) 786 806 { 787 - struct pci_dev *dev = HWIF(drive)->pci_dev; 807 + ide_hwif_t *hwif = drive->hwif; 808 + struct hpt_info *info = ide_get_hwifdata(hwif); 809 + struct pci_dev *dev = hwif->pci_dev; 788 810 789 811 if (drive->quirk_list) { 790 - if (hpt_minimum_revision(dev,3)) { 812 + if (info->revision >= 3) { 791 813 u8 reg5a = 0; 792 814 pci_read_config_byte(dev, 0x5a, &reg5a); 793 815 if (((reg5a & 0x10) >> 4) != mask) 794 816 pci_write_config_byte(dev, 0x5a, mask ? (reg5a | 0x10) : (reg5a & ~0x10)); 795 817 } else { 796 818 if (mask) { 797 - disable_irq(HWIF(drive)->irq); 819 + disable_irq(hwif->irq); 798 820 } else { 799 - enable_irq(HWIF(drive)->irq); 821 + enable_irq(hwif->irq); 800 822 } 801 823 } 802 824 } else { 803 825 if (IDE_CONTROL_REG) 804 - HWIF(drive)->OUTB(mask ? (drive->ctl | 2) : 826 + hwif->OUTB(mask ? (drive->ctl | 2) : 805 827 (drive->ctl & ~2), 806 828 IDE_CONTROL_REG); 807 829 } ··· 811 829 812 830 static int hpt366_config_drive_xfer_rate (ide_drive_t *drive) 813 831 { 814 - ide_hwif_t *hwif = HWIF(drive); 832 + ide_hwif_t *hwif = drive->hwif; 815 833 struct hd_driveid *id = drive->id; 816 834 817 835 drive->init_speed = 0; 818 836 819 - if (id && (id->capability & 1) && drive->autodma) { 837 + if ((id->capability & 1) && drive->autodma) { 820 838 821 839 if (ide_use_dma(drive)) { 822 840 if (config_chipset_for_dma(drive)) ··· 850 868 drive->name, __FUNCTION__, reg50h, reg52h, reg5ah); 851 869 if (reg5ah & 0x10) 852 870 pci_write_config_byte(dev, 0x5a, reg5ah & ~0x10); 853 - #if 0 854 - /* how about we flush and reset, mmmkay? */ 855 - pci_write_config_byte(dev, 0x51, 0x1F); 856 - /* fall through to a reset */ 857 - case dma_start: 858 - case ide_dma_end: 859 - /* reset the chips state over and over.. */ 860 - pci_write_config_byte(dev, 0x51, 0x13); 861 - #endif 862 871 return __ide_dma_lostirq(drive); 863 872 } 864 873 ··· 892 919 u8 dma_stat = 0, dma_cmd = 0; 893 920 894 921 pci_read_config_byte(HWIF(drive)->pci_dev, reginfo, &bfifo); 895 - printk("%s: %d bytes in FIFO\n", drive->name, bfifo); 922 + printk(KERN_DEBUG "%s: %d bytes in FIFO\n", drive->name, bfifo); 896 923 hpt370_clear_engine(drive); 897 924 /* get dma command mode */ 898 925 dma_cmd = hwif->INB(hwif->dma_command); ··· 1020 1047 1021 1048 static void hpt3xx_reset (ide_drive_t *drive) 1022 1049 { 1023 - #if 0 1024 - unsigned long high_16 = pci_resource_start(HWIF(drive)->pci_dev, 4); 1025 - u8 reset = (HWIF(drive)->channel) ? 0x80 : 0x40; 1026 - u8 reg59h = 0; 1027 - 1028 - pci_read_config_byte(HWIF(drive)->pci_dev, 0x59, &reg59h); 1029 - pci_write_config_byte(HWIF(drive)->pci_dev, 0x59, reg59h|reset); 1030 - pci_write_config_byte(HWIF(drive)->pci_dev, 0x59, reg59h); 1031 - #endif 1032 1050 } 1033 1051 1034 1052 static int hpt3xx_tristate (ide_drive_t * drive, int state) ··· 1028 1064 struct pci_dev *dev = hwif->pci_dev; 1029 1065 u8 reg59h = 0, reset = (hwif->channel) ? 0x80 : 0x40; 1030 1066 u8 regXXh = 0, state_reg= (hwif->channel) ? 0x57 : 0x53; 1031 - 1032 - // hwif->bus_state = state; 1033 1067 1034 1068 pci_read_config_byte(dev, 0x59, &reg59h); 1035 1069 pci_read_config_byte(dev, state_reg, &regXXh); ··· 1055 1093 #define TRISTATE_BIT 0x8000 1056 1094 static int hpt370_busproc(ide_drive_t * drive, int state) 1057 1095 { 1058 - ide_hwif_t *hwif = HWIF(drive); 1096 + ide_hwif_t *hwif = drive->hwif; 1059 1097 struct pci_dev *dev = hwif->pci_dev; 1060 1098 u8 tristate = 0, resetmask = 0, bus_reg = 0; 1061 1099 u16 tri_reg; ··· 1110 1148 return 0; 1111 1149 } 1112 1150 1113 - static int __devinit init_hpt37x(struct pci_dev *dev) 1151 + static void __devinit hpt366_clocking(ide_hwif_t *hwif) 1114 1152 { 1153 + u32 reg1 = 0; 1154 + struct hpt_info *info = ide_get_hwifdata(hwif); 1155 + 1156 + pci_read_config_dword(hwif->pci_dev, 0x40, &reg1); 1157 + 1158 + /* detect bus speed by looking at control reg timing: */ 1159 + switch((reg1 >> 8) & 7) { 1160 + case 5: 1161 + info->speed = forty_base_hpt366; 1162 + break; 1163 + case 9: 1164 + info->speed = twenty_five_base_hpt366; 1165 + break; 1166 + case 7: 1167 + default: 1168 + info->speed = thirty_three_base_hpt366; 1169 + break; 1170 + } 1171 + } 1172 + 1173 + static void __devinit hpt37x_clocking(ide_hwif_t *hwif) 1174 + { 1175 + struct hpt_info *info = ide_get_hwifdata(hwif); 1176 + struct pci_dev *dev = hwif->pci_dev; 1115 1177 int adjust, i; 1116 1178 u16 freq; 1117 1179 u32 pll; 1118 1180 u8 reg5bh; 1119 - u8 reg5ah = 0; 1120 - unsigned long dmabase = pci_resource_start(dev, 4); 1121 - u8 did, rid; 1122 - int is_372n = 0; 1123 1181 1124 - pci_read_config_byte(dev, 0x5a, &reg5ah); 1125 - /* interrupt force enable */ 1126 - pci_write_config_byte(dev, 0x5a, (reg5ah & ~0x10)); 1127 - 1128 - if(dmabase) 1129 - { 1130 - did = inb(dmabase + 0x22); 1131 - rid = inb(dmabase + 0x28); 1132 - 1133 - if((did == 4 && rid == 6) || (did == 5 && rid > 1)) 1134 - is_372n = 1; 1135 - } 1136 - 1137 1182 /* 1138 1183 * default to pci clock. make sure MA15/16 are set to output 1139 - * to prevent drives having problems with 40-pin cables. 1184 + * to prevent drives having problems with 40-pin cables. Needed 1185 + * for some drives such as IBM-DTLA which will not enter ready 1186 + * state on reset when PDIAG is a input. 1187 + * 1188 + * ToDo: should we set 0x21 when using PLL mode ? 1140 1189 */ 1141 1190 pci_write_config_byte(dev, 0x5b, 0x23); 1142 1191 ··· 1170 1197 * Currently we always set up the PLL for the 372N 1171 1198 */ 1172 1199 1173 - pci_set_drvdata(dev, NULL); 1174 - 1175 - if(is_372n) 1200 + if(info->flags & IS_372N) 1176 1201 { 1177 1202 printk(KERN_INFO "hpt: HPT372N detected, using 372N timing.\n"); 1178 1203 if(freq < 0x55) ··· 1198 1227 pll = F_LOW_PCI_66; 1199 1228 1200 1229 if (pll == F_LOW_PCI_33) { 1201 - if (hpt_minimum_revision(dev,8)) 1202 - pci_set_drvdata(dev, (void *) thirty_three_base_hpt374); 1203 - else if (hpt_minimum_revision(dev,5)) 1204 - pci_set_drvdata(dev, (void *) thirty_three_base_hpt372); 1205 - else if (hpt_minimum_revision(dev,4)) 1206 - pci_set_drvdata(dev, (void *) thirty_three_base_hpt370a); 1230 + if (info->revision >= 8) 1231 + info->speed = thirty_three_base_hpt374; 1232 + else if (info->revision >= 5) 1233 + info->speed = thirty_three_base_hpt372; 1234 + else if (info->revision >= 4) 1235 + info->speed = thirty_three_base_hpt370a; 1207 1236 else 1208 - pci_set_drvdata(dev, (void *) thirty_three_base_hpt370); 1209 - printk("HPT37X: using 33MHz PCI clock\n"); 1237 + info->speed = thirty_three_base_hpt370; 1238 + printk(KERN_DEBUG "HPT37X: using 33MHz PCI clock\n"); 1210 1239 } else if (pll == F_LOW_PCI_40) { 1211 1240 /* Unsupported */ 1212 1241 } else if (pll == F_LOW_PCI_50) { 1213 - if (hpt_minimum_revision(dev,8)) 1214 - pci_set_drvdata(dev, (void *) fifty_base_hpt370a); 1215 - else if (hpt_minimum_revision(dev,5)) 1216 - pci_set_drvdata(dev, (void *) fifty_base_hpt372); 1217 - else if (hpt_minimum_revision(dev,4)) 1218 - pci_set_drvdata(dev, (void *) fifty_base_hpt370a); 1242 + if (info->revision >= 8) 1243 + info->speed = fifty_base_hpt370a; 1244 + else if (info->revision >= 5) 1245 + info->speed = fifty_base_hpt372; 1246 + else if (info->revision >= 4) 1247 + info->speed = fifty_base_hpt370a; 1219 1248 else 1220 - pci_set_drvdata(dev, (void *) fifty_base_hpt370a); 1221 - printk("HPT37X: using 50MHz PCI clock\n"); 1249 + info->speed = fifty_base_hpt370a; 1250 + printk(KERN_DEBUG "HPT37X: using 50MHz PCI clock\n"); 1222 1251 } else { 1223 - if (hpt_minimum_revision(dev,8)) 1224 - { 1252 + if (info->revision >= 8) { 1225 1253 printk(KERN_ERR "HPT37x: 66MHz timings are not supported.\n"); 1226 1254 } 1227 - else if (hpt_minimum_revision(dev,5)) 1228 - pci_set_drvdata(dev, (void *) sixty_six_base_hpt372); 1229 - else if (hpt_minimum_revision(dev,4)) 1230 - pci_set_drvdata(dev, (void *) sixty_six_base_hpt370a); 1255 + else if (info->revision >= 5) 1256 + info->speed = sixty_six_base_hpt372; 1257 + else if (info->revision >= 4) 1258 + info->speed = sixty_six_base_hpt370a; 1231 1259 else 1232 - pci_set_drvdata(dev, (void *) sixty_six_base_hpt370); 1233 - printk("HPT37X: using 66MHz PCI clock\n"); 1260 + info->speed = sixty_six_base_hpt370; 1261 + printk(KERN_DEBUG "HPT37X: using 66MHz PCI clock\n"); 1234 1262 } 1235 1263 } 1236 1264 ··· 1239 1269 * result in slow reads when using a 33MHz PCI clock. we also 1240 1270 * don't like to use the PLL because it will cause glitches 1241 1271 * on PRST/SRST when the HPT state engine gets reset. 1272 + * 1273 + * ToDo: Use 66MHz PLL when ATA133 devices are present on a 1274 + * 372 device so we can get ATA133 support 1242 1275 */ 1243 - if (pci_get_drvdata(dev)) 1276 + if (info->speed) 1244 1277 goto init_hpt37X_done; 1278 + 1279 + info->flags |= PLL_MODE; 1245 1280 1246 1281 /* 1282 + * FIXME: make this work correctly, esp with 372N as per 1283 + * reference driver code. 1284 + * 1247 1285 * adjust PLL based upon PCI clock, enable it, and wait for 1248 1286 * stabilization. 1249 1287 */ ··· 1276 1298 pci_write_config_dword(dev, 0x5c, 1277 1299 pll & ~0x100); 1278 1300 pci_write_config_byte(dev, 0x5b, 0x21); 1279 - if (hpt_minimum_revision(dev,8)) 1280 - pci_set_drvdata(dev, (void *) fifty_base_hpt370a); 1281 - else if (hpt_minimum_revision(dev,5)) 1282 - pci_set_drvdata(dev, (void *) fifty_base_hpt372); 1283 - else if (hpt_minimum_revision(dev,4)) 1284 - pci_set_drvdata(dev, (void *) fifty_base_hpt370a); 1301 + if (info->revision >= 8) 1302 + info->speed = fifty_base_hpt370a; 1303 + else if (info->revision >= 5) 1304 + info->speed = fifty_base_hpt372; 1305 + else if (info->revision >= 4) 1306 + info->speed = fifty_base_hpt370a; 1285 1307 else 1286 - pci_set_drvdata(dev, (void *) fifty_base_hpt370a); 1308 + info->speed = fifty_base_hpt370a; 1287 1309 printk("HPT37X: using 50MHz internal PLL\n"); 1288 1310 goto init_hpt37X_done; 1289 1311 } ··· 1296 1318 } 1297 1319 1298 1320 init_hpt37X_done: 1321 + if (!info->speed) 1322 + printk(KERN_ERR "HPT37X%s: unknown bus timing [%d %d].\n", 1323 + (info->flags & IS_372N)?"N":"", pll, freq); 1299 1324 /* reset state engine */ 1300 1325 pci_write_config_byte(dev, 0x50, 0x37); 1301 1326 pci_write_config_byte(dev, 0x54, 0x37); 1302 1327 udelay(100); 1328 + } 1329 + 1330 + static int __devinit init_hpt37x(struct pci_dev *dev) 1331 + { 1332 + u8 reg5ah; 1333 + 1334 + pci_read_config_byte(dev, 0x5a, &reg5ah); 1335 + /* interrupt force enable */ 1336 + pci_write_config_byte(dev, 0x5a, (reg5ah & ~0x10)); 1303 1337 return 0; 1304 1338 } 1305 1339 ··· 1328 1338 pci_write_config_byte(dev, 0x51, drive_fast & ~0x80); 1329 1339 pci_read_config_dword(dev, 0x40, &reg1); 1330 1340 1331 - /* detect bus speed by looking at control reg timing: */ 1332 - switch((reg1 >> 8) & 7) { 1333 - case 5: 1334 - pci_set_drvdata(dev, (void *) forty_base_hpt366); 1335 - break; 1336 - case 9: 1337 - pci_set_drvdata(dev, (void *) twenty_five_base_hpt366); 1338 - break; 1339 - case 7: 1340 - default: 1341 - pci_set_drvdata(dev, (void *) thirty_three_base_hpt366); 1342 - break; 1343 - } 1344 - 1345 - if (!pci_get_drvdata(dev)) 1346 - { 1347 - printk(KERN_ERR "hpt366: unknown bus timing.\n"); 1348 - pci_set_drvdata(dev, NULL); 1349 - } 1350 1341 return 0; 1351 1342 } 1352 1343 1353 1344 static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const char *name) 1354 1345 { 1355 1346 int ret = 0; 1356 - u8 test = 0; 1357 - 1347 + /* FIXME: Not portable */ 1358 1348 if (dev->resource[PCI_ROM_RESOURCE].start) 1359 1349 pci_write_config_byte(dev, PCI_ROM_ADDRESS, 1360 1350 dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); 1361 1351 1362 - pci_read_config_byte(dev, PCI_CACHE_LINE_SIZE, &test); 1363 - if (test != (L1_CACHE_BYTES / 4)) 1364 - pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 1365 - (L1_CACHE_BYTES / 4)); 1352 + pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (L1_CACHE_BYTES / 4)); 1353 + pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x78); 1354 + pci_write_config_byte(dev, PCI_MIN_GNT, 0x08); 1355 + pci_write_config_byte(dev, PCI_MAX_LAT, 0x08); 1366 1356 1367 - pci_read_config_byte(dev, PCI_LATENCY_TIMER, &test); 1368 - if (test != 0x78) 1369 - pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x78); 1370 - 1371 - pci_read_config_byte(dev, PCI_MIN_GNT, &test); 1372 - if (test != 0x08) 1373 - pci_write_config_byte(dev, PCI_MIN_GNT, 0x08); 1374 - 1375 - pci_read_config_byte(dev, PCI_MAX_LAT, &test); 1376 - if (test != 0x08) 1377 - pci_write_config_byte(dev, PCI_MAX_LAT, 0x08); 1378 - 1379 - if (hpt_minimum_revision(dev, 3)) { 1357 + if (hpt_revision(dev) >= 3) 1380 1358 ret = init_hpt37x(dev); 1381 - } else { 1382 - ret =init_hpt366(dev); 1383 - } 1359 + else 1360 + ret = init_hpt366(dev); 1361 + 1384 1362 if (ret) 1385 1363 return ret; 1386 1364 ··· 1358 1400 static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) 1359 1401 { 1360 1402 struct pci_dev *dev = hwif->pci_dev; 1403 + struct hpt_info *info = ide_get_hwifdata(hwif); 1361 1404 u8 ata66 = 0, regmask = (hwif->channel) ? 0x01 : 0x02; 1362 - u8 did, rid; 1363 - unsigned long dmabase = hwif->dma_base; 1364 - int is_372n = 0; 1365 1405 1366 - if(dmabase) 1367 - { 1368 - did = inb(dmabase + 0x22); 1369 - rid = inb(dmabase + 0x28); 1370 - 1371 - if((did == 4 && rid == 6) || (did == 5 && rid > 1)) 1372 - is_372n = 1; 1373 - } 1374 - 1375 1406 hwif->tuneproc = &hpt3xx_tune_drive; 1376 1407 hwif->speedproc = &hpt3xx_tune_chipset; 1377 1408 hwif->quirkproc = &hpt3xx_quirkproc; 1378 1409 hwif->intrproc = &hpt3xx_intrproc; 1379 1410 hwif->maskproc = &hpt3xx_maskproc; 1380 1411 1381 - if(is_372n) 1412 + if(info->flags & IS_372N) 1382 1413 hwif->rw_disk = &hpt372n_rw_disk; 1383 1414 1384 1415 /* ··· 1375 1428 * address lines to access an external eeprom. To read valid 1376 1429 * cable detect state the pins must be enabled as inputs. 1377 1430 */ 1378 - if (hpt_minimum_revision(dev, 8) && PCI_FUNC(dev->devfn) & 1) { 1431 + if (info->revision >= 8 && (PCI_FUNC(dev->devfn) & 1)) { 1379 1432 /* 1380 1433 * HPT374 PCI function 1 1381 1434 * - set bit 15 of reg 0x52 to enable TCBLID as input ··· 1390 1443 pci_read_config_byte(dev, 0x5a, &ata66); 1391 1444 pci_write_config_word(dev, 0x52, mcr3); 1392 1445 pci_write_config_word(dev, 0x56, mcr6); 1393 - } else if (hpt_minimum_revision(dev, 3)) { 1446 + } else if (info->revision >= 3) { 1394 1447 /* 1395 1448 * HPT370/372 and 374 pcifn 0 1396 1449 * - clear bit 0 of 0x5b to enable P/SCBLID as inputs ··· 1417 1470 hwif->serialized = hwif->mate->serialized = 1; 1418 1471 #endif 1419 1472 1420 - if (hpt_minimum_revision(dev,3)) { 1473 + if (info->revision >= 3) { 1421 1474 u8 reg5ah = 0; 1422 1475 pci_write_config_byte(dev, 0x5a, reg5ah & ~0x10); 1423 1476 /* ··· 1427 1480 */ 1428 1481 hwif->resetproc = &hpt3xx_reset; 1429 1482 hwif->busproc = &hpt370_busproc; 1430 - // hwif->drives[0].autotune = hwif->drives[1].autotune = 1; 1431 - } else if (hpt_minimum_revision(dev,2)) { 1483 + } else if (info->revision >= 2) { 1432 1484 hwif->resetproc = &hpt3xx_reset; 1433 1485 hwif->busproc = &hpt3xx_tristate; 1434 1486 } else { ··· 1448 1502 hwif->udma_four = ((ata66 & regmask) ? 0 : 1); 1449 1503 hwif->ide_dma_check = &hpt366_config_drive_xfer_rate; 1450 1504 1451 - if (hpt_minimum_revision(dev,8)) { 1505 + if (info->revision >= 8) { 1452 1506 hwif->ide_dma_test_irq = &hpt374_ide_dma_test_irq; 1453 1507 hwif->ide_dma_end = &hpt374_ide_dma_end; 1454 - } else if (hpt_minimum_revision(dev,5)) { 1508 + } else if (info->revision >= 5) { 1455 1509 hwif->ide_dma_test_irq = &hpt374_ide_dma_test_irq; 1456 1510 hwif->ide_dma_end = &hpt374_ide_dma_end; 1457 - } else if (hpt_minimum_revision(dev,3)) { 1511 + } else if (info->revision >= 3) { 1458 1512 hwif->dma_start = &hpt370_ide_dma_start; 1459 1513 hwif->ide_dma_end = &hpt370_ide_dma_end; 1460 1514 hwif->ide_dma_timeout = &hpt370_ide_dma_timeout; 1461 1515 hwif->ide_dma_lostirq = &hpt370_ide_dma_lostirq; 1462 - } else if (hpt_minimum_revision(dev,2)) 1516 + } else if (info->revision >= 2) 1463 1517 hwif->ide_dma_lostirq = &hpt366_ide_dma_lostirq; 1464 1518 else 1465 1519 hwif->ide_dma_lostirq = &hpt366_ide_dma_lostirq; ··· 1472 1526 1473 1527 static void __devinit init_dma_hpt366(ide_hwif_t *hwif, unsigned long dmabase) 1474 1528 { 1529 + struct hpt_info *info = ide_get_hwifdata(hwif); 1475 1530 u8 masterdma = 0, slavedma = 0; 1476 1531 u8 dma_new = 0, dma_old = 0; 1477 1532 u8 primary = hwif->channel ? 0x4b : 0x43; ··· 1482 1535 if (!dmabase) 1483 1536 return; 1484 1537 1485 - if(pci_get_drvdata(hwif->pci_dev) == NULL) 1486 - { 1538 + if(info->speed == NULL) { 1487 1539 printk(KERN_WARNING "hpt: no known IDE timings, disabling DMA.\n"); 1488 1540 return; 1489 1541 } ··· 1503 1557 local_irq_restore(flags); 1504 1558 1505 1559 ide_setup_dma(hwif, dmabase, 8); 1560 + } 1561 + 1562 + /* 1563 + * We "borrow" this hook in order to set the data structures 1564 + * up early enough before dma or init_hwif calls are made. 1565 + */ 1566 + 1567 + static void __devinit init_iops_hpt366(ide_hwif_t *hwif) 1568 + { 1569 + struct hpt_info *info = kmalloc(sizeof(struct hpt_info), GFP_KERNEL); 1570 + unsigned long dmabase = pci_resource_start(hwif->pci_dev, 4); 1571 + u8 did, rid; 1572 + 1573 + if(info == NULL) { 1574 + printk(KERN_WARNING "hpt366: out of memory.\n"); 1575 + return; 1576 + } 1577 + memset(info, 0, sizeof(struct hpt_info)); 1578 + ide_set_hwifdata(hwif, info); 1579 + 1580 + if(dmabase) { 1581 + did = inb(dmabase + 0x22); 1582 + rid = inb(dmabase + 0x28); 1583 + 1584 + if((did == 4 && rid == 6) || (did == 5 && rid > 1)) 1585 + info->flags |= IS_372N; 1586 + } 1587 + 1588 + info->revision = hpt_revision(hwif->pci_dev); 1589 + 1590 + if (info->revision >= 3) 1591 + hpt37x_clocking(hwif); 1592 + else 1593 + hpt366_clocking(hwif); 1506 1594 } 1507 1595 1508 1596 static int __devinit init_setup_hpt374(struct pci_dev *dev, ide_pci_device_t *d) ··· 1626 1646 .name = "HPT366", 1627 1647 .init_setup = init_setup_hpt366, 1628 1648 .init_chipset = init_chipset_hpt366, 1649 + .init_iops = init_iops_hpt366, 1629 1650 .init_hwif = init_hwif_hpt366, 1630 1651 .init_dma = init_dma_hpt366, 1631 1652 .channels = 2, ··· 1637 1656 .name = "HPT372A", 1638 1657 .init_setup = init_setup_hpt37x, 1639 1658 .init_chipset = init_chipset_hpt366, 1659 + .init_iops = init_iops_hpt366, 1640 1660 .init_hwif = init_hwif_hpt366, 1641 1661 .init_dma = init_dma_hpt366, 1642 1662 .channels = 2, ··· 1647 1665 .name = "HPT302", 1648 1666 .init_setup = init_setup_hpt37x, 1649 1667 .init_chipset = init_chipset_hpt366, 1668 + .init_iops = init_iops_hpt366, 1650 1669 .init_hwif = init_hwif_hpt366, 1651 1670 .init_dma = init_dma_hpt366, 1652 1671 .channels = 2, ··· 1657 1674 .name = "HPT371", 1658 1675 .init_setup = init_setup_hpt37x, 1659 1676 .init_chipset = init_chipset_hpt366, 1677 + .init_iops = init_iops_hpt366, 1660 1678 .init_hwif = init_hwif_hpt366, 1661 1679 .init_dma = init_dma_hpt366, 1662 1680 .channels = 2, ··· 1667 1683 .name = "HPT374", 1668 1684 .init_setup = init_setup_hpt374, 1669 1685 .init_chipset = init_chipset_hpt366, 1686 + .init_iops = init_iops_hpt366, 1670 1687 .init_hwif = init_hwif_hpt366, 1671 1688 .init_dma = init_dma_hpt366, 1672 1689 .channels = 2, /* 4 */ ··· 1677 1692 .name = "HPT372N", 1678 1693 .init_setup = init_setup_hpt37x, 1679 1694 .init_chipset = init_chipset_hpt366, 1695 + .init_iops = init_iops_hpt366, 1680 1696 .init_hwif = init_hwif_hpt366, 1681 1697 .init_dma = init_dma_hpt366, 1682 1698 .channels = 2, /* 4 */
+812
drivers/ide/pci/it821x.c
··· 1 + 2 + /* 3 + * linux/drivers/ide/pci/it821x.c Version 0.09 December 2004 4 + * 5 + * Copyright (C) 2004 Red Hat <alan@redhat.com> 6 + * 7 + * May be copied or modified under the terms of the GNU General Public License 8 + * Based in part on the ITE vendor provided SCSI driver. 9 + * 10 + * Documentation available from 11 + * http://www.ite.com.tw/pc/IT8212F_V04.pdf 12 + * Some other documents are NDA. 13 + * 14 + * The ITE8212 isn't exactly a standard IDE controller. It has two 15 + * modes. In pass through mode then it is an IDE controller. In its smart 16 + * mode its actually quite a capable hardware raid controller disguised 17 + * as an IDE controller. Smart mode only understands DMA read/write and 18 + * identify, none of the fancier commands apply. The IT8211 is identical 19 + * in other respects but lacks the raid mode. 20 + * 21 + * Errata: 22 + * o Rev 0x10 also requires master/slave hold the same DMA timings and 23 + * cannot do ATAPI MWDMA. 24 + * o The identify data for raid volumes lacks CHS info (technically ok) 25 + * but also fails to set the LBA28 and other bits. We fix these in 26 + * the IDE probe quirk code. 27 + * o If you write LBA48 sized I/O's (ie > 256 sector) in smart mode 28 + * raid then the controller firmware dies 29 + * o Smart mode without RAID doesn't clear all the necessary identify 30 + * bits to reduce the command set to the one used 31 + * 32 + * This has a few impacts on the driver 33 + * - In pass through mode we do all the work you would expect 34 + * - In smart mode the clocking set up is done by the controller generally 35 + * but we must watch the other limits and filter. 36 + * - There are a few extra vendor commands that actually talk to the 37 + * controller but only work PIO with no IRQ. 38 + * 39 + * Vendor areas of the identify block in smart mode are used for the 40 + * timing and policy set up. Each HDD in raid mode also has a serial 41 + * block on the disk. The hardware extra commands are get/set chip status, 42 + * rebuild, get rebuild status. 43 + * 44 + * In Linux the driver supports pass through mode as if the device was 45 + * just another IDE controller. If the smart mode is running then 46 + * volumes are managed by the controller firmware and each IDE "disk" 47 + * is a raid volume. Even more cute - the controller can do automated 48 + * hotplug and rebuild. 49 + * 50 + * The pass through controller itself is a little demented. It has a 51 + * flaw that it has a single set of PIO/MWDMA timings per channel so 52 + * non UDMA devices restrict each others performance. It also has a 53 + * single clock source per channel so mixed UDMA100/133 performance 54 + * isn't perfect and we have to pick a clock. Thankfully none of this 55 + * matters in smart mode. ATAPI DMA is not currently supported. 56 + * 57 + * It seems the smart mode is a win for RAID1/RAID10 but otherwise not. 58 + * 59 + * TODO 60 + * - ATAPI UDMA is ok but not MWDMA it seems 61 + * - RAID configuration ioctls 62 + * - Move to libata once it grows up 63 + */ 64 + 65 + #include <linux/config.h> 66 + #include <linux/types.h> 67 + #include <linux/module.h> 68 + #include <linux/pci.h> 69 + #include <linux/delay.h> 70 + #include <linux/hdreg.h> 71 + #include <linux/ide.h> 72 + #include <linux/init.h> 73 + 74 + #include <asm/io.h> 75 + 76 + struct it821x_dev 77 + { 78 + unsigned int smart:1, /* Are we in smart raid mode */ 79 + timing10:1; /* Rev 0x10 */ 80 + u8 clock_mode; /* 0, ATA_50 or ATA_66 */ 81 + u8 want[2][2]; /* Mode/Pri log for master slave */ 82 + /* We need these for switching the clock when DMA goes on/off 83 + The high byte is the 66Mhz timing */ 84 + u16 pio[2]; /* Cached PIO values */ 85 + u16 mwdma[2]; /* Cached MWDMA values */ 86 + u16 udma[2]; /* Cached UDMA values (per drive) */ 87 + }; 88 + 89 + #define ATA_66 0 90 + #define ATA_50 1 91 + #define ATA_ANY 2 92 + 93 + #define UDMA_OFF 0 94 + #define MWDMA_OFF 0 95 + 96 + /* 97 + * We allow users to force the card into non raid mode without 98 + * flashing the alternative BIOS. This is also neccessary right now 99 + * for embedded platforms that cannot run a PC BIOS but are using this 100 + * device. 101 + */ 102 + 103 + static int it8212_noraid; 104 + 105 + /** 106 + * it821x_program - program the PIO/MWDMA registers 107 + * @drive: drive to tune 108 + * 109 + * Program the PIO/MWDMA timing for this channel according to the 110 + * current clock. 111 + */ 112 + 113 + static void it821x_program(ide_drive_t *drive, u16 timing) 114 + { 115 + ide_hwif_t *hwif = drive->hwif; 116 + struct it821x_dev *itdev = ide_get_hwifdata(hwif); 117 + int channel = hwif->channel; 118 + u8 conf; 119 + 120 + /* Program PIO/MWDMA timing bits */ 121 + if(itdev->clock_mode == ATA_66) 122 + conf = timing >> 8; 123 + else 124 + conf = timing & 0xFF; 125 + pci_write_config_byte(hwif->pci_dev, 0x54 + 4 * channel, conf); 126 + } 127 + 128 + /** 129 + * it821x_program_udma - program the UDMA registers 130 + * @drive: drive to tune 131 + * 132 + * Program the UDMA timing for this drive according to the 133 + * current clock. 134 + */ 135 + 136 + static void it821x_program_udma(ide_drive_t *drive, u16 timing) 137 + { 138 + ide_hwif_t *hwif = drive->hwif; 139 + struct it821x_dev *itdev = ide_get_hwifdata(hwif); 140 + int channel = hwif->channel; 141 + int unit = drive->select.b.unit; 142 + u8 conf; 143 + 144 + /* Program UDMA timing bits */ 145 + if(itdev->clock_mode == ATA_66) 146 + conf = timing >> 8; 147 + else 148 + conf = timing & 0xFF; 149 + if(itdev->timing10 == 0) 150 + pci_write_config_byte(hwif->pci_dev, 0x56 + 4 * channel + unit, conf); 151 + else { 152 + pci_write_config_byte(hwif->pci_dev, 0x56 + 4 * channel, conf); 153 + pci_write_config_byte(hwif->pci_dev, 0x56 + 4 * channel + 1, conf); 154 + } 155 + } 156 + 157 + 158 + /** 159 + * it821x_clock_strategy 160 + * @hwif: hardware interface 161 + * 162 + * Select between the 50 and 66Mhz base clocks to get the best 163 + * results for this interface. 164 + */ 165 + 166 + static void it821x_clock_strategy(ide_drive_t *drive) 167 + { 168 + ide_hwif_t *hwif = drive->hwif; 169 + struct it821x_dev *itdev = ide_get_hwifdata(hwif); 170 + 171 + u8 unit = drive->select.b.unit; 172 + ide_drive_t *pair = &hwif->drives[1-unit]; 173 + 174 + int clock, altclock; 175 + u8 v; 176 + int sel = 0; 177 + 178 + if(itdev->want[0][0] > itdev->want[1][0]) { 179 + clock = itdev->want[0][1]; 180 + altclock = itdev->want[1][1]; 181 + } else { 182 + clock = itdev->want[1][1]; 183 + altclock = itdev->want[0][1]; 184 + } 185 + 186 + /* Master doesn't care does the slave ? */ 187 + if(clock == ATA_ANY) 188 + clock = altclock; 189 + 190 + /* Nobody cares - keep the same clock */ 191 + if(clock == ATA_ANY) 192 + return; 193 + /* No change */ 194 + if(clock == itdev->clock_mode) 195 + return; 196 + 197 + /* Load this into the controller ? */ 198 + if(clock == ATA_66) 199 + itdev->clock_mode = ATA_66; 200 + else { 201 + itdev->clock_mode = ATA_50; 202 + sel = 1; 203 + } 204 + pci_read_config_byte(hwif->pci_dev, 0x50, &v); 205 + v &= ~(1 << (1 + hwif->channel)); 206 + v |= sel << (1 + hwif->channel); 207 + pci_write_config_byte(hwif->pci_dev, 0x50, v); 208 + 209 + /* 210 + * Reprogram the UDMA/PIO of the pair drive for the switch 211 + * MWDMA will be dealt with by the dma switcher 212 + */ 213 + if(pair && itdev->udma[1-unit] != UDMA_OFF) { 214 + it821x_program_udma(pair, itdev->udma[1-unit]); 215 + it821x_program(pair, itdev->pio[1-unit]); 216 + } 217 + /* 218 + * Reprogram the UDMA/PIO of our drive for the switch. 219 + * MWDMA will be dealt with by the dma switcher 220 + */ 221 + if(itdev->udma[unit] != UDMA_OFF) { 222 + it821x_program_udma(drive, itdev->udma[unit]); 223 + it821x_program(drive, itdev->pio[unit]); 224 + } 225 + } 226 + 227 + /** 228 + * it821x_ratemask - Compute available modes 229 + * @drive: IDE drive 230 + * 231 + * Compute the available speeds for the devices on the interface. This 232 + * is all modes to ATA133 clipped by drive cable setup. 233 + */ 234 + 235 + static u8 it821x_ratemask (ide_drive_t *drive) 236 + { 237 + u8 mode = 4; 238 + if (!eighty_ninty_three(drive)) 239 + mode = min(mode, (u8)1); 240 + return mode; 241 + } 242 + 243 + /** 244 + * it821x_tuneproc - tune a drive 245 + * @drive: drive to tune 246 + * @mode_wanted: the target operating mode 247 + * 248 + * Load the timing settings for this device mode into the 249 + * controller. By the time we are called the mode has been 250 + * modified as neccessary to handle the absence of seperate 251 + * master/slave timers for MWDMA/PIO. 252 + * 253 + * This code is only used in pass through mode. 254 + */ 255 + 256 + static void it821x_tuneproc (ide_drive_t *drive, byte mode_wanted) 257 + { 258 + ide_hwif_t *hwif = drive->hwif; 259 + struct it821x_dev *itdev = ide_get_hwifdata(hwif); 260 + int unit = drive->select.b.unit; 261 + 262 + /* Spec says 89 ref driver uses 88 */ 263 + static u16 pio[] = { 0xAA88, 0xA382, 0xA181, 0x3332, 0x3121 }; 264 + static u8 pio_want[] = { ATA_66, ATA_66, ATA_66, ATA_66, ATA_ANY }; 265 + 266 + if(itdev->smart) 267 + return; 268 + 269 + /* We prefer 66Mhz clock for PIO 0-3, don't care for PIO4 */ 270 + itdev->want[unit][1] = pio_want[mode_wanted]; 271 + itdev->want[unit][0] = 1; /* PIO is lowest priority */ 272 + itdev->pio[unit] = pio[mode_wanted]; 273 + it821x_clock_strategy(drive); 274 + it821x_program(drive, itdev->pio[unit]); 275 + } 276 + 277 + /** 278 + * it821x_tune_mwdma - tune a channel for MWDMA 279 + * @drive: drive to set up 280 + * @mode_wanted: the target operating mode 281 + * 282 + * Load the timing settings for this device mode into the 283 + * controller when doing MWDMA in pass through mode. The caller 284 + * must manage the whole lack of per device MWDMA/PIO timings and 285 + * the shared MWDMA/PIO timing register. 286 + */ 287 + 288 + static void it821x_tune_mwdma (ide_drive_t *drive, byte mode_wanted) 289 + { 290 + ide_hwif_t *hwif = drive->hwif; 291 + struct it821x_dev *itdev = (void *)ide_get_hwifdata(hwif); 292 + int unit = drive->select.b.unit; 293 + int channel = hwif->channel; 294 + u8 conf; 295 + 296 + static u16 dma[] = { 0x8866, 0x3222, 0x3121 }; 297 + static u8 mwdma_want[] = { ATA_ANY, ATA_66, ATA_ANY }; 298 + 299 + itdev->want[unit][1] = mwdma_want[mode_wanted]; 300 + itdev->want[unit][0] = 2; /* MWDMA is low priority */ 301 + itdev->mwdma[unit] = dma[mode_wanted]; 302 + itdev->udma[unit] = UDMA_OFF; 303 + 304 + /* UDMA bits off - Revision 0x10 do them in pairs */ 305 + pci_read_config_byte(hwif->pci_dev, 0x50, &conf); 306 + if(itdev->timing10) 307 + conf |= channel ? 0x60: 0x18; 308 + else 309 + conf |= 1 << (3 + 2 * channel + unit); 310 + pci_write_config_byte(hwif->pci_dev, 0x50, conf); 311 + 312 + it821x_clock_strategy(drive); 313 + /* FIXME: do we need to program this ? */ 314 + /* it821x_program(drive, itdev->mwdma[unit]); */ 315 + } 316 + 317 + /** 318 + * it821x_tune_udma - tune a channel for UDMA 319 + * @drive: drive to set up 320 + * @mode_wanted: the target operating mode 321 + * 322 + * Load the timing settings for this device mode into the 323 + * controller when doing UDMA modes in pass through. 324 + */ 325 + 326 + static void it821x_tune_udma (ide_drive_t *drive, byte mode_wanted) 327 + { 328 + ide_hwif_t *hwif = drive->hwif; 329 + struct it821x_dev *itdev = ide_get_hwifdata(hwif); 330 + int unit = drive->select.b.unit; 331 + int channel = hwif->channel; 332 + u8 conf; 333 + 334 + static u16 udma[] = { 0x4433, 0x4231, 0x3121, 0x2121, 0x1111, 0x2211, 0x1111 }; 335 + static u8 udma_want[] = { ATA_ANY, ATA_50, ATA_ANY, ATA_66, ATA_66, ATA_50, ATA_66 }; 336 + 337 + itdev->want[unit][1] = udma_want[mode_wanted]; 338 + itdev->want[unit][0] = 3; /* UDMA is high priority */ 339 + itdev->mwdma[unit] = MWDMA_OFF; 340 + itdev->udma[unit] = udma[mode_wanted]; 341 + if(mode_wanted >= 5) 342 + itdev->udma[unit] |= 0x8080; /* UDMA 5/6 select on */ 343 + 344 + /* UDMA on. Again revision 0x10 must do the pair */ 345 + pci_read_config_byte(hwif->pci_dev, 0x50, &conf); 346 + if(itdev->timing10) 347 + conf &= channel ? 0x9F: 0xE7; 348 + else 349 + conf &= ~ (1 << (3 + 2 * channel + unit)); 350 + pci_write_config_byte(hwif->pci_dev, 0x50, conf); 351 + 352 + it821x_clock_strategy(drive); 353 + it821x_program_udma(drive, itdev->udma[unit]); 354 + 355 + } 356 + 357 + /** 358 + * config_it821x_chipset_for_pio - set drive timings 359 + * @drive: drive to tune 360 + * @speed we want 361 + * 362 + * Compute the best pio mode we can for a given device. We must 363 + * pick a speed that does not cause problems with the other device 364 + * on the cable. 365 + */ 366 + 367 + static void config_it821x_chipset_for_pio (ide_drive_t *drive, byte set_speed) 368 + { 369 + u8 unit = drive->select.b.unit; 370 + ide_hwif_t *hwif = drive->hwif; 371 + ide_drive_t *pair = &hwif->drives[1-unit]; 372 + u8 speed = 0, set_pio = ide_get_best_pio_mode(drive, 255, 5, NULL); 373 + u8 pair_pio; 374 + 375 + /* We have to deal with this mess in pairs */ 376 + if(pair != NULL) { 377 + pair_pio = ide_get_best_pio_mode(pair, 255, 5, NULL); 378 + /* Trim PIO to the slowest of the master/slave */ 379 + if(pair_pio < set_pio) 380 + set_pio = pair_pio; 381 + } 382 + it821x_tuneproc(drive, set_pio); 383 + speed = XFER_PIO_0 + set_pio; 384 + /* XXX - We trim to the lowest of the pair so the other drive 385 + will always be fine at this point until we do hotplug passthru */ 386 + 387 + if (set_speed) 388 + (void) ide_config_drive_speed(drive, speed); 389 + } 390 + 391 + /** 392 + * it821x_dma_read - DMA hook 393 + * @drive: drive for DMA 394 + * 395 + * The IT821x has a single timing register for MWDMA and for PIO 396 + * operations. As we flip back and forth we have to reload the 397 + * clock. In addition the rev 0x10 device only works if the same 398 + * timing value is loaded into the master and slave UDMA clock 399 + * so we must also reload that. 400 + * 401 + * FIXME: we could figure out in advance if we need to do reloads 402 + */ 403 + 404 + static void it821x_dma_start(ide_drive_t *drive) 405 + { 406 + ide_hwif_t *hwif = drive->hwif; 407 + struct it821x_dev *itdev = ide_get_hwifdata(hwif); 408 + int unit = drive->select.b.unit; 409 + if(itdev->mwdma[unit] != MWDMA_OFF) 410 + it821x_program(drive, itdev->mwdma[unit]); 411 + else if(itdev->udma[unit] != UDMA_OFF && itdev->timing10) 412 + it821x_program_udma(drive, itdev->udma[unit]); 413 + ide_dma_start(drive); 414 + } 415 + 416 + /** 417 + * it821x_dma_write - DMA hook 418 + * @drive: drive for DMA stop 419 + * 420 + * The IT821x has a single timing register for MWDMA and for PIO 421 + * operations. As we flip back and forth we have to reload the 422 + * clock. 423 + */ 424 + 425 + static int it821x_dma_end(ide_drive_t *drive) 426 + { 427 + ide_hwif_t *hwif = drive->hwif; 428 + int unit = drive->select.b.unit; 429 + struct it821x_dev *itdev = ide_get_hwifdata(hwif); 430 + int ret = __ide_dma_end(drive); 431 + if(itdev->mwdma[unit] != MWDMA_OFF) 432 + it821x_program(drive, itdev->pio[unit]); 433 + return ret; 434 + } 435 + 436 + 437 + /** 438 + * it821x_tune_chipset - set controller timings 439 + * @drive: Drive to set up 440 + * @xferspeed: speed we want to achieve 441 + * 442 + * Tune the ITE chipset for the desired mode. If we can't achieve 443 + * the desired mode then tune for a lower one, but ultimately 444 + * make the thing work. 445 + */ 446 + 447 + static int it821x_tune_chipset (ide_drive_t *drive, byte xferspeed) 448 + { 449 + 450 + ide_hwif_t *hwif = drive->hwif; 451 + struct it821x_dev *itdev = ide_get_hwifdata(hwif); 452 + u8 speed = ide_rate_filter(it821x_ratemask(drive), xferspeed); 453 + 454 + if(!itdev->smart) { 455 + switch(speed) { 456 + case XFER_PIO_4: 457 + case XFER_PIO_3: 458 + case XFER_PIO_2: 459 + case XFER_PIO_1: 460 + case XFER_PIO_0: 461 + it821x_tuneproc(drive, (speed - XFER_PIO_0)); 462 + break; 463 + /* MWDMA tuning is really hard because our MWDMA and PIO 464 + timings are kept in the same place. We can switch in the 465 + host dma on/off callbacks */ 466 + case XFER_MW_DMA_2: 467 + case XFER_MW_DMA_1: 468 + case XFER_MW_DMA_0: 469 + it821x_tune_mwdma(drive, (speed - XFER_MW_DMA_0)); 470 + break; 471 + case XFER_UDMA_6: 472 + case XFER_UDMA_5: 473 + case XFER_UDMA_4: 474 + case XFER_UDMA_3: 475 + case XFER_UDMA_2: 476 + case XFER_UDMA_1: 477 + case XFER_UDMA_0: 478 + it821x_tune_udma(drive, (speed - XFER_UDMA_0)); 479 + break; 480 + default: 481 + return 1; 482 + } 483 + } 484 + /* 485 + * In smart mode the clocking is done by the host controller 486 + * snooping the mode we picked. The rest of it is not our problem 487 + */ 488 + return ide_config_drive_speed(drive, speed); 489 + } 490 + 491 + /** 492 + * config_chipset_for_dma - configure for DMA 493 + * @drive: drive to configure 494 + * 495 + * Called by the IDE layer when it wants the timings set up. 496 + */ 497 + 498 + static int config_chipset_for_dma (ide_drive_t *drive) 499 + { 500 + u8 speed = ide_dma_speed(drive, it821x_ratemask(drive)); 501 + 502 + config_it821x_chipset_for_pio(drive, !speed); 503 + it821x_tune_chipset(drive, speed); 504 + return ide_dma_enable(drive); 505 + } 506 + 507 + /** 508 + * it821x_configure_drive_for_dma - set up for DMA transfers 509 + * @drive: drive we are going to set up 510 + * 511 + * Set up the drive for DMA, tune the controller and drive as 512 + * required. If the drive isn't suitable for DMA or we hit 513 + * other problems then we will drop down to PIO and set up 514 + * PIO appropriately 515 + */ 516 + 517 + static int it821x_config_drive_for_dma (ide_drive_t *drive) 518 + { 519 + ide_hwif_t *hwif = drive->hwif; 520 + 521 + if (ide_use_dma(drive)) { 522 + if (config_chipset_for_dma(drive)) 523 + return hwif->ide_dma_on(drive); 524 + } 525 + config_it821x_chipset_for_pio(drive, 1); 526 + return hwif->ide_dma_off_quietly(drive); 527 + } 528 + 529 + /** 530 + * ata66_it821x - check for 80 pin cable 531 + * @hwif: interface to check 532 + * 533 + * Check for the presence of an ATA66 capable cable on the 534 + * interface. Problematic as it seems some cards don't have 535 + * the needed logic onboard. 536 + */ 537 + 538 + static unsigned int __devinit ata66_it821x(ide_hwif_t *hwif) 539 + { 540 + /* The reference driver also only does disk side */ 541 + return 1; 542 + } 543 + 544 + /** 545 + * it821x_fixup - post init callback 546 + * @hwif: interface 547 + * 548 + * This callback is run after the drives have been probed but 549 + * before anything gets attached. It allows drivers to do any 550 + * final tuning that is needed, or fixups to work around bugs. 551 + */ 552 + 553 + static void __devinit it821x_fixups(ide_hwif_t *hwif) 554 + { 555 + struct it821x_dev *itdev = ide_get_hwifdata(hwif); 556 + int i; 557 + 558 + if(!itdev->smart) { 559 + /* 560 + * If we are in pass through mode then not much 561 + * needs to be done, but we do bother to clear the 562 + * IRQ mask as we may well be in PIO (eg rev 0x10) 563 + * for now and we know unmasking is safe on this chipset. 564 + */ 565 + for (i = 0; i < 2; i++) { 566 + ide_drive_t *drive = &hwif->drives[i]; 567 + if(drive->present) 568 + drive->unmask = 1; 569 + } 570 + return; 571 + } 572 + /* 573 + * Perform fixups on smart mode. We need to "lose" some 574 + * capabilities the firmware lacks but does not filter, and 575 + * also patch up some capability bits that it forgets to set 576 + * in RAID mode. 577 + */ 578 + 579 + for(i = 0; i < 2; i++) { 580 + ide_drive_t *drive = &hwif->drives[i]; 581 + struct hd_driveid *id; 582 + u16 *idbits; 583 + 584 + if(!drive->present) 585 + continue; 586 + id = drive->id; 587 + idbits = (u16 *)drive->id; 588 + 589 + /* Check for RAID v native */ 590 + if(strstr(id->model, "Integrated Technology Express")) { 591 + /* In raid mode the ident block is slightly buggy 592 + We need to set the bits so that the IDE layer knows 593 + LBA28. LBA48 and DMA ar valid */ 594 + id->capability |= 3; /* LBA28, DMA */ 595 + id->command_set_2 |= 0x0400; /* LBA48 valid */ 596 + id->cfs_enable_2 |= 0x0400; /* LBA48 on */ 597 + /* Reporting logic */ 598 + printk(KERN_INFO "%s: IT8212 %sRAID %d volume", 599 + drive->name, 600 + idbits[147] ? "Bootable ":"", 601 + idbits[129]); 602 + if(idbits[129] != 1) 603 + printk("(%dK stripe)", idbits[146]); 604 + printk(".\n"); 605 + /* Now the core code will have wrongly decided no DMA 606 + so we need to fix this */ 607 + hwif->ide_dma_off_quietly(drive); 608 + #ifdef CONFIG_IDEDMA_ONLYDISK 609 + if (drive->media == ide_disk) 610 + #endif 611 + hwif->ide_dma_check(drive); 612 + } else { 613 + /* Non RAID volume. Fixups to stop the core code 614 + doing unsupported things */ 615 + id->field_valid &= 1; 616 + id->queue_depth = 0; 617 + id->command_set_1 = 0; 618 + id->command_set_2 &= 0xC400; 619 + id->cfsse &= 0xC000; 620 + id->cfs_enable_1 = 0; 621 + id->cfs_enable_2 &= 0xC400; 622 + id->csf_default &= 0xC000; 623 + id->word127 = 0; 624 + id->dlf = 0; 625 + id->csfo = 0; 626 + id->cfa_power = 0; 627 + printk(KERN_INFO "%s: Performing identify fixups.\n", 628 + drive->name); 629 + } 630 + } 631 + 632 + } 633 + 634 + /** 635 + * init_hwif_it821x - set up hwif structs 636 + * @hwif: interface to set up 637 + * 638 + * We do the basic set up of the interface structure. The IT8212 639 + * requires several custom handlers so we override the default 640 + * ide DMA handlers appropriately 641 + */ 642 + 643 + static void __devinit init_hwif_it821x(ide_hwif_t *hwif) 644 + { 645 + struct it821x_dev *idev = kmalloc(sizeof(struct it821x_dev), GFP_KERNEL); 646 + u8 conf; 647 + 648 + if(idev == NULL) { 649 + printk(KERN_ERR "it821x: out of memory, falling back to legacy behaviour.\n"); 650 + goto fallback; 651 + } 652 + memset(idev, 0, sizeof(struct it821x_dev)); 653 + ide_set_hwifdata(hwif, idev); 654 + 655 + pci_read_config_byte(hwif->pci_dev, 0x50, &conf); 656 + if(conf & 1) { 657 + idev->smart = 1; 658 + hwif->atapi_dma = 0; 659 + /* Long I/O's although allowed in LBA48 space cause the 660 + onboard firmware to enter the twighlight zone */ 661 + hwif->rqsize = 256; 662 + } 663 + 664 + /* Pull the current clocks from 0x50 also */ 665 + if (conf & (1 << (1 + hwif->channel))) 666 + idev->clock_mode = ATA_50; 667 + else 668 + idev->clock_mode = ATA_66; 669 + 670 + idev->want[0][1] = ATA_ANY; 671 + idev->want[1][1] = ATA_ANY; 672 + 673 + /* 674 + * Not in the docs but according to the reference driver 675 + * this is neccessary. 676 + */ 677 + 678 + pci_read_config_byte(hwif->pci_dev, 0x08, &conf); 679 + if(conf == 0x10) { 680 + idev->timing10 = 1; 681 + hwif->atapi_dma = 0; 682 + if(!idev->smart) 683 + printk(KERN_WARNING "it821x: Revision 0x10, workarounds activated.\n"); 684 + } 685 + 686 + hwif->speedproc = &it821x_tune_chipset; 687 + hwif->tuneproc = &it821x_tuneproc; 688 + 689 + /* MWDMA/PIO clock switching for pass through mode */ 690 + if(!idev->smart) { 691 + hwif->dma_start = &it821x_dma_start; 692 + hwif->ide_dma_end = &it821x_dma_end; 693 + } 694 + 695 + hwif->drives[0].autotune = 1; 696 + hwif->drives[1].autotune = 1; 697 + 698 + if (!hwif->dma_base) 699 + goto fallback; 700 + 701 + hwif->ultra_mask = 0x7f; 702 + hwif->mwdma_mask = 0x07; 703 + hwif->swdma_mask = 0x07; 704 + 705 + hwif->ide_dma_check = &it821x_config_drive_for_dma; 706 + if (!(hwif->udma_four)) 707 + hwif->udma_four = ata66_it821x(hwif); 708 + 709 + /* 710 + * The BIOS often doesn't set up DMA on this controller 711 + * so we always do it. 712 + */ 713 + 714 + hwif->autodma = 1; 715 + hwif->drives[0].autodma = hwif->autodma; 716 + hwif->drives[1].autodma = hwif->autodma; 717 + return; 718 + fallback: 719 + hwif->autodma = 0; 720 + return; 721 + } 722 + 723 + static void __devinit it8212_disable_raid(struct pci_dev *dev) 724 + { 725 + /* Reset local CPU, and set BIOS not ready */ 726 + pci_write_config_byte(dev, 0x5E, 0x01); 727 + 728 + /* Set to bypass mode, and reset PCI bus */ 729 + pci_write_config_byte(dev, 0x50, 0x00); 730 + pci_write_config_word(dev, PCI_COMMAND, 731 + PCI_COMMAND_PARITY | PCI_COMMAND_IO | 732 + PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); 733 + pci_write_config_word(dev, 0x40, 0xA0F3); 734 + 735 + pci_write_config_dword(dev,0x4C, 0x02040204); 736 + pci_write_config_byte(dev, 0x42, 0x36); 737 + pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0); 738 + } 739 + 740 + static unsigned int __devinit init_chipset_it821x(struct pci_dev *dev, const char *name) 741 + { 742 + u8 conf; 743 + static char *mode[2] = { "pass through", "smart" }; 744 + 745 + /* Force the card into bypass mode if so requested */ 746 + if (it8212_noraid) { 747 + printk(KERN_INFO "it8212: forcing bypass mode.\n"); 748 + it8212_disable_raid(dev); 749 + } 750 + pci_read_config_byte(dev, 0x50, &conf); 751 + printk(KERN_INFO "it821x: controller in %s mode.\n", mode[conf & 1]); 752 + return 0; 753 + } 754 + 755 + 756 + #define DECLARE_ITE_DEV(name_str) \ 757 + { \ 758 + .name = name_str, \ 759 + .init_chipset = init_chipset_it821x, \ 760 + .init_hwif = init_hwif_it821x, \ 761 + .channels = 2, \ 762 + .autodma = AUTODMA, \ 763 + .bootable = ON_BOARD, \ 764 + .fixup = it821x_fixups \ 765 + } 766 + 767 + static ide_pci_device_t it821x_chipsets[] __devinitdata = { 768 + /* 0 */ DECLARE_ITE_DEV("IT8212"), 769 + }; 770 + 771 + /** 772 + * it821x_init_one - pci layer discovery entry 773 + * @dev: PCI device 774 + * @id: ident table entry 775 + * 776 + * Called by the PCI code when it finds an ITE821x controller. 777 + * We then use the IDE PCI generic helper to do most of the work. 778 + */ 779 + 780 + static int __devinit it821x_init_one(struct pci_dev *dev, const struct pci_device_id *id) 781 + { 782 + ide_setup_pci_device(dev, &it821x_chipsets[id->driver_data]); 783 + return 0; 784 + } 785 + 786 + static struct pci_device_id it821x_pci_tbl[] = { 787 + { PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 788 + { PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8212, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 789 + { 0, }, 790 + }; 791 + 792 + MODULE_DEVICE_TABLE(pci, it821x_pci_tbl); 793 + 794 + static struct pci_driver driver = { 795 + .name = "ITE821x IDE", 796 + .id_table = it821x_pci_tbl, 797 + .probe = it821x_init_one, 798 + }; 799 + 800 + static int __init it821x_ide_init(void) 801 + { 802 + return ide_pci_register_driver(&driver); 803 + } 804 + 805 + module_init(it821x_ide_init); 806 + 807 + module_param_named(noraid, it8212_noraid, int, S_IRUGO); 808 + MODULE_PARM_DESC(it8212_noraid, "Force card into bypass mode"); 809 + 810 + MODULE_AUTHOR("Alan Cox"); 811 + MODULE_DESCRIPTION("PCI driver module for the ITE 821x"); 812 + MODULE_LICENSE("GPL");
+5 -5
drivers/ide/pci/serverworks.c
··· 442 442 return (dev->irq) ? dev->irq : 0; 443 443 } 444 444 445 - static unsigned int __init ata66_svwks_svwks (ide_hwif_t *hwif) 445 + static unsigned int __devinit ata66_svwks_svwks (ide_hwif_t *hwif) 446 446 { 447 447 return 1; 448 448 } ··· 454 454 * Bit 14 clear = primary IDE channel does not have 80-pin cable. 455 455 * Bit 14 set = primary IDE channel has 80-pin cable. 456 456 */ 457 - static unsigned int __init ata66_svwks_dell (ide_hwif_t *hwif) 457 + static unsigned int __devinit ata66_svwks_dell (ide_hwif_t *hwif) 458 458 { 459 459 struct pci_dev *dev = hwif->pci_dev; 460 460 if (dev->subsystem_vendor == PCI_VENDOR_ID_DELL && ··· 472 472 * 473 473 * WARNING: this only works on Alpine hardware! 474 474 */ 475 - static unsigned int __init ata66_svwks_cobalt (ide_hwif_t *hwif) 475 + static unsigned int __devinit ata66_svwks_cobalt (ide_hwif_t *hwif) 476 476 { 477 477 struct pci_dev *dev = hwif->pci_dev; 478 478 if (dev->subsystem_vendor == PCI_VENDOR_ID_SUN && ··· 483 483 return 0; 484 484 } 485 485 486 - static unsigned int __init ata66_svwks (ide_hwif_t *hwif) 486 + static unsigned int __devinit ata66_svwks (ide_hwif_t *hwif) 487 487 { 488 488 struct pci_dev *dev = hwif->pci_dev; 489 489 ··· 573 573 return ide_setup_pci_device(dev, d); 574 574 } 575 575 576 - static int __init init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d) 576 + static int __devinit init_setup_csb6 (struct pci_dev *dev, ide_pci_device_t *d) 577 577 { 578 578 if (!(PCI_FUNC(dev->devfn) & 1)) { 579 579 d->bootable = NEVER_BOARD;
+12 -19
drivers/input/gameport/gameport.c
··· 17 17 #include <linux/init.h> 18 18 #include <linux/gameport.h> 19 19 #include <linux/wait.h> 20 - #include <linux/completion.h> 21 20 #include <linux/sched.h> 22 - #include <linux/smp_lock.h> 23 21 #include <linux/slab.h> 24 22 #include <linux/delay.h> 23 + #include <linux/kthread.h> 25 24 26 25 /*#include <asm/io.h>*/ 27 26 ··· 237 238 static DEFINE_SPINLOCK(gameport_event_lock); /* protects gameport_event_list */ 238 239 static LIST_HEAD(gameport_event_list); 239 240 static DECLARE_WAIT_QUEUE_HEAD(gameport_wait); 240 - static DECLARE_COMPLETION(gameport_exited); 241 - static int gameport_pid; 241 + static struct task_struct *gameport_task; 242 242 243 243 static void gameport_queue_event(void *object, struct module *owner, 244 244 enum gameport_event_type event_type) ··· 248 250 spin_lock_irqsave(&gameport_event_lock, flags); 249 251 250 252 /* 251 - * Scan event list for the other events for the same gameport port, 253 + * Scan event list for the other events for the same gameport port, 252 254 * starting with the most recent one. If event is the same we 253 255 * do not need add new one. If event is of different type we 254 256 * need to add this event and should not look further because 255 257 * we need to preseve sequence of distinct events. 256 - */ 258 + */ 257 259 list_for_each_entry_reverse(event, &gameport_event_list, node) { 258 260 if (event->object == object) { 259 261 if (event->type == event_type) ··· 430 432 431 433 static int gameport_thread(void *nothing) 432 434 { 433 - lock_kernel(); 434 - daemonize("kgameportd"); 435 - allow_signal(SIGTERM); 436 - 437 435 do { 438 436 gameport_handle_events(); 439 - wait_event_interruptible(gameport_wait, !list_empty(&gameport_event_list)); 437 + wait_event_interruptible(gameport_wait, 438 + kthread_should_stop() || !list_empty(&gameport_event_list)); 440 439 try_to_freeze(); 441 - } while (!signal_pending(current)); 440 + } while (!kthread_should_stop()); 442 441 443 442 printk(KERN_DEBUG "gameport: kgameportd exiting\n"); 444 - 445 - unlock_kernel(); 446 - complete_and_exit(&gameport_exited, 0); 443 + return 0; 447 444 } 448 445 449 446 ··· 766 773 767 774 static int __init gameport_init(void) 768 775 { 769 - if (!(gameport_pid = kernel_thread(gameport_thread, NULL, CLONE_KERNEL))) { 776 + gameport_task = kthread_run(gameport_thread, NULL, "kgameportd"); 777 + if (IS_ERR(gameport_task)) { 770 778 printk(KERN_ERR "gameport: Failed to start kgameportd\n"); 771 - return -1; 779 + return PTR_ERR(gameport_task); 772 780 } 773 781 774 782 gameport_bus.dev_attrs = gameport_device_attrs; ··· 783 789 static void __exit gameport_exit(void) 784 790 { 785 791 bus_unregister(&gameport_bus); 786 - kill_proc(gameport_pid, SIGTERM, 1); 787 - wait_for_completion(&gameport_exited); 792 + kthread_stop(gameport_task); 788 793 } 789 794 790 795 module_init(gameport_init);
+62 -27
drivers/input/serio/serio.c
··· 31 31 #include <linux/serio.h> 32 32 #include <linux/errno.h> 33 33 #include <linux/wait.h> 34 - #include <linux/completion.h> 35 34 #include <linux/sched.h> 36 - #include <linux/smp_lock.h> 37 35 #include <linux/slab.h> 36 + #include <linux/kthread.h> 38 37 39 38 MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); 40 39 MODULE_DESCRIPTION("Serio abstraction core"); ··· 42 43 EXPORT_SYMBOL(serio_interrupt); 43 44 EXPORT_SYMBOL(__serio_register_port); 44 45 EXPORT_SYMBOL(serio_unregister_port); 46 + EXPORT_SYMBOL(serio_unregister_child_port); 45 47 EXPORT_SYMBOL(__serio_unregister_port_delayed); 46 48 EXPORT_SYMBOL(__serio_register_driver); 47 49 EXPORT_SYMBOL(serio_unregister_driver); ··· 68 68 static void serio_reconnect_port(struct serio *serio); 69 69 static void serio_disconnect_port(struct serio *serio); 70 70 71 + static int serio_connect_driver(struct serio *serio, struct serio_driver *drv) 72 + { 73 + int retval; 74 + 75 + down(&serio->drv_sem); 76 + retval = drv->connect(serio, drv); 77 + up(&serio->drv_sem); 78 + 79 + return retval; 80 + } 81 + 82 + static int serio_reconnect_driver(struct serio *serio) 83 + { 84 + int retval = -1; 85 + 86 + down(&serio->drv_sem); 87 + if (serio->drv && serio->drv->reconnect) 88 + retval = serio->drv->reconnect(serio); 89 + up(&serio->drv_sem); 90 + 91 + return retval; 92 + } 93 + 94 + static void serio_disconnect_driver(struct serio *serio) 95 + { 96 + down(&serio->drv_sem); 97 + if (serio->drv) 98 + serio->drv->disconnect(serio); 99 + up(&serio->drv_sem); 100 + } 101 + 71 102 static int serio_match_port(const struct serio_device_id *ids, struct serio *serio) 72 103 { 73 104 while (ids->type || ids->proto) { ··· 122 91 123 92 if (serio_match_port(drv->id_table, serio)) { 124 93 serio->dev.driver = &drv->driver; 125 - if (drv->connect(serio, drv)) { 94 + if (serio_connect_driver(serio, drv)) { 126 95 serio->dev.driver = NULL; 127 96 goto out; 128 97 } ··· 169 138 static DEFINE_SPINLOCK(serio_event_lock); /* protects serio_event_list */ 170 139 static LIST_HEAD(serio_event_list); 171 140 static DECLARE_WAIT_QUEUE_HEAD(serio_wait); 172 - static DECLARE_COMPLETION(serio_exited); 173 - static int serio_pid; 141 + static struct task_struct *serio_task; 174 142 175 143 static void serio_queue_event(void *object, struct module *owner, 176 144 enum serio_event_type event_type) ··· 180 150 spin_lock_irqsave(&serio_event_lock, flags); 181 151 182 152 /* 183 - * Scan event list for the other events for the same serio port, 153 + * Scan event list for the other events for the same serio port, 184 154 * starting with the most recent one. If event is the same we 185 155 * do not need add new one. If event is of different type we 186 156 * need to add this event and should not look further because 187 157 * we need to preseve sequence of distinct events. 188 - */ 158 + */ 189 159 list_for_each_entry_reverse(event, &serio_event_list, node) { 190 160 if (event->object == object) { 191 161 if (event->type == event_type) ··· 367 337 368 338 static int serio_thread(void *nothing) 369 339 { 370 - lock_kernel(); 371 - daemonize("kseriod"); 372 - allow_signal(SIGTERM); 373 - 374 340 do { 375 341 serio_handle_events(); 376 - wait_event_interruptible(serio_wait, !list_empty(&serio_event_list)); 342 + wait_event_interruptible(serio_wait, 343 + kthread_should_stop() || !list_empty(&serio_event_list)); 377 344 try_to_freeze(); 378 - } while (!signal_pending(current)); 345 + } while (!kthread_should_stop()); 379 346 380 347 printk(KERN_DEBUG "serio: kseriod exiting\n"); 381 - 382 - unlock_kernel(); 383 - complete_and_exit(&serio_exited, 0); 348 + return 0; 384 349 } 385 350 386 351 ··· 582 557 static void serio_reconnect_port(struct serio *serio) 583 558 { 584 559 do { 585 - if (!serio->drv || !serio->drv->reconnect || serio->drv->reconnect(serio)) { 560 + if (serio_reconnect_driver(serio)) { 586 561 serio_disconnect_port(serio); 587 562 serio_find_driver(serio); 588 563 /* Ok, old children are now gone, we are done */ ··· 655 630 } 656 631 657 632 /* 633 + * Safely unregisters child port if one is present. 634 + */ 635 + void serio_unregister_child_port(struct serio *serio) 636 + { 637 + down(&serio_sem); 638 + if (serio->child) { 639 + serio_disconnect_port(serio->child); 640 + serio_destroy_port(serio->child); 641 + } 642 + up(&serio_sem); 643 + } 644 + 645 + /* 658 646 * Submits register request to kseriod for subsequent execution. 659 647 * Can be used when it is not obvious whether the serio_sem is 660 648 * taken or not and when delayed execution is feasible. ··· 724 686 struct serio *serio = to_serio_port(dev); 725 687 struct serio_driver *drv = to_serio_driver(dev->driver); 726 688 727 - return drv->connect(serio, drv); 689 + return serio_connect_driver(serio, drv); 728 690 } 729 691 730 692 static int serio_driver_remove(struct device *dev) 731 693 { 732 694 struct serio *serio = to_serio_port(dev); 733 - struct serio_driver *drv = to_serio_driver(dev->driver); 734 695 735 - drv->disconnect(serio); 696 + serio_disconnect_driver(serio); 736 697 return 0; 737 698 } 738 699 ··· 767 730 768 731 static void serio_set_drv(struct serio *serio, struct serio_driver *drv) 769 732 { 770 - down(&serio->drv_sem); 771 733 serio_pause_rx(serio); 772 734 serio->drv = drv; 773 735 serio_continue_rx(serio); 774 - up(&serio->drv_sem); 775 736 } 776 737 777 738 static int serio_bus_match(struct device *dev, struct device_driver *drv) ··· 829 794 { 830 795 struct serio *serio = to_serio_port(dev); 831 796 832 - if (!serio->drv || !serio->drv->reconnect || serio->drv->reconnect(serio)) { 797 + if (serio_reconnect_driver(serio)) { 833 798 /* 834 799 * Driver re-probing can take a while, so better let kseriod 835 800 * deal with it. ··· 883 848 884 849 static int __init serio_init(void) 885 850 { 886 - if (!(serio_pid = kernel_thread(serio_thread, NULL, CLONE_KERNEL))) { 851 + serio_task = kthread_run(serio_thread, NULL, "kseriod"); 852 + if (IS_ERR(serio_task)) { 887 853 printk(KERN_ERR "serio: Failed to start kseriod\n"); 888 - return -1; 854 + return PTR_ERR(serio_task); 889 855 } 890 856 891 857 serio_bus.dev_attrs = serio_device_attrs; ··· 902 866 static void __exit serio_exit(void) 903 867 { 904 868 bus_unregister(&serio_bus); 905 - kill_proc(serio_pid, SIGTERM, 1); 906 - wait_for_completion(&serio_exited); 869 + kthread_stop(serio_task); 907 870 } 908 871 909 872 module_init(serio_init);
+9
drivers/isdn/hardware/avm/avm_cs.c
··· 486 486 return 0; 487 487 } /* avmcs_event */ 488 488 489 + static struct pcmcia_device_id avmcs_ids[] = { 490 + PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN-Controller B1", 0x95d42008, 0x845dc335), 491 + PCMCIA_DEVICE_PROD_ID12("AVM", "Mobile ISDN-Controller M1", 0x95d42008, 0x81e10430), 492 + PCMCIA_DEVICE_PROD_ID12("AVM", "Mobile ISDN-Controller M2", 0x95d42008, 0x18e8558a), 493 + PCMCIA_DEVICE_NULL 494 + }; 495 + MODULE_DEVICE_TABLE(pcmcia, avmcs_ids); 496 + 489 497 static struct pcmcia_driver avmcs_driver = { 490 498 .owner = THIS_MODULE, 491 499 .drv = { ··· 501 493 }, 502 494 .attach = avmcs_attach, 503 495 .detach = avmcs_detach, 496 + .id_table = avmcs_ids, 504 497 }; 505 498 506 499 static int __init avmcs_init(void)
+8
drivers/isdn/hisax/avma1_cs.c
··· 501 501 return 0; 502 502 } /* avma1cs_event */ 503 503 504 + static struct pcmcia_device_id avma1cs_ids[] = { 505 + PCMCIA_DEVICE_PROD_ID12("AVM", "ISDN A", 0x95d42008, 0xadc9d4bb), 506 + PCMCIA_DEVICE_PROD_ID12("ISDN", "CARD", 0x8d9761c8, 0x01c5aa7b), 507 + PCMCIA_DEVICE_NULL 508 + }; 509 + MODULE_DEVICE_TABLE(pcmcia, avma1cs_ids); 510 + 504 511 static struct pcmcia_driver avma1cs_driver = { 505 512 .owner = THIS_MODULE, 506 513 .drv = { ··· 515 508 }, 516 509 .attach = avma1cs_attach, 517 510 .detach = avma1cs_detach, 511 + .id_table = avma1cs_ids, 518 512 }; 519 513 520 514 /*====================================================================*/
+8
drivers/isdn/hisax/elsa_cs.c
··· 508 508 return 0; 509 509 } /* elsa_cs_event */ 510 510 511 + static struct pcmcia_device_id elsa_ids[] = { 512 + PCMCIA_DEVICE_PROD_ID12("ELSA AG (Aachen, Germany)", "MicroLink ISDN/MC ", 0x983de2c4, 0x333ba257), 513 + PCMCIA_DEVICE_PROD_ID12("ELSA GmbH, Aachen", "MicroLink ISDN/MC ", 0x639e5718, 0x333ba257), 514 + PCMCIA_DEVICE_NULL 515 + }; 516 + MODULE_DEVICE_TABLE(pcmcia, elsa_ids); 517 + 511 518 static struct pcmcia_driver elsa_cs_driver = { 512 519 .owner = THIS_MODULE, 513 520 .drv = { ··· 522 515 }, 523 516 .attach = elsa_cs_attach, 524 517 .detach = elsa_cs_detach, 518 + .id_table = elsa_ids, 525 519 }; 526 520 527 521 static int __init init_elsa_cs(void)
+13
drivers/isdn/hisax/sedlbauer_cs.c
··· 616 616 return 0; 617 617 } /* sedlbauer_event */ 618 618 619 + static struct pcmcia_device_id sedlbauer_ids[] = { 620 + PCMCIA_DEVICE_PROD_ID1234("SEDLBAUER", "speed star II", "V 3.1", "(c) 93 - 98 cb ", 0x81fb79f5, 0xf3612e1d, 0x6b95c78a, 0x50d4149c), 621 + PCMCIA_DEVICE_PROD_ID123("SEDLBAUER", "ISDN-Adapter", "4D67", 0x81fb79f5, 0xe4e9bc12, 0x397b7e90), 622 + PCMCIA_DEVICE_PROD_ID123("SEDLBAUER", "ISDN-Adapter", "4D98", 0x81fb79f5, 0xe4e9bc12, 0x2e5c7fce), 623 + PCMCIA_DEVICE_PROD_ID123("SEDLBAUER", "ISDN-Adapter", " (C) 93-94 VK", 0x81fb79f5, 0xe4e9bc12, 0x8db143fe), 624 + PCMCIA_DEVICE_PROD_ID123("SEDLBAUER", "ISDN-Adapter", " (c) 93-95 VK", 0x81fb79f5, 0xe4e9bc12, 0xb391ab4c), 625 + PCMCIA_DEVICE_PROD_ID12("HST High Soft Tech GmbH", "Saphir II B", 0xd79e0b84, 0x21d083ae), 626 + /* PCMCIA_DEVICE_PROD_ID1234("SEDLBAUER", 0x81fb79f5), */ /* too generic*/ 627 + PCMCIA_DEVICE_NULL 628 + }; 629 + MODULE_DEVICE_TABLE(pcmcia, sedlbauer_ids); 630 + 619 631 static struct pcmcia_driver sedlbauer_driver = { 620 632 .owner = THIS_MODULE, 621 633 .drv = { ··· 635 623 }, 636 624 .attach = sedlbauer_attach, 637 625 .detach = sedlbauer_detach, 626 + .id_table = sedlbauer_ids, 638 627 }; 639 628 640 629 static int __init init_sedlbauer_cs(void)
+7
drivers/isdn/hisax/teles_cs.c
··· 489 489 return 0; 490 490 } /* teles_cs_event */ 491 491 492 + static struct pcmcia_device_id teles_ids[] = { 493 + PCMCIA_DEVICE_PROD_ID12("TELES", "S0/PC", 0x67b50eae, 0xe9e70119), 494 + PCMCIA_DEVICE_NULL, 495 + }; 496 + MODULE_DEVICE_TABLE(pcmcia, teles_ids); 497 + 492 498 static struct pcmcia_driver teles_cs_driver = { 493 499 .owner = THIS_MODULE, 494 500 .drv = { ··· 502 496 }, 503 497 .attach = teles_attach, 504 498 .detach = teles_detach, 499 + .id_table = teles_ids, 505 500 }; 506 501 507 502 static int __init init_teles_cs(void)
+10
drivers/mtd/maps/Kconfig
··· 607 607 cards are usually around 4-16MiB in size. This does not include 608 608 Compact Flash cards which are treated as IDE devices. 609 609 610 + config MTD_PCMCIA_ANONYMOUS 611 + bool "Use PCMCIA MTD drivers for anonymous PCMCIA cards" 612 + depends on MTD_PCMCIA 613 + default N 614 + help 615 + If this option is enabled, PCMCIA cards which do not report 616 + anything about themselves are assumed to be MTD cards. 617 + 618 + If unsure, say N. 619 + 610 620 config MTD_UCLINUX 611 621 tristate "Generic uClinux RAM/ROM filesystem support" 612 622 depends on MTD_PARTITIONS && !MMU
+28 -1
drivers/mtd/maps/pcmciamtd.c
··· 818 818 return link; 819 819 } 820 820 821 + static struct pcmcia_device_id pcmciamtd_ids[] = { 822 + PCMCIA_DEVICE_FUNC_ID(1), 823 + PCMCIA_DEVICE_PROD_ID123("IO DATA", "PCS-2M", "2MB SRAM", 0x547e66dc, 0x1fed36cd, 0x36eadd21), 824 + PCMCIA_DEVICE_PROD_ID12("IBM", "2MB SRAM", 0xb569a6e5, 0x36eadd21), 825 + PCMCIA_DEVICE_PROD_ID12("IBM", "4MB FLASH", 0xb569a6e5, 0x8bc54d2a), 826 + PCMCIA_DEVICE_PROD_ID12("IBM", "8MB FLASH", 0xb569a6e5, 0x6df1be3e), 827 + PCMCIA_DEVICE_PROD_ID12("Intel", "S2E20SW", 0x816cc815, 0xd14c9dcf), 828 + PCMCIA_DEVICE_PROD_ID12("Intel", "S2E8 SW", 0x816cc815, 0xa2d7dedb), 829 + PCMCIA_DEVICE_PROD_ID12("intel", "SERIES2-02 ", 0x40ade711, 0x145cea5c), 830 + PCMCIA_DEVICE_PROD_ID12("intel", "SERIES2-04 ", 0x40ade711, 0x42064dda), 831 + PCMCIA_DEVICE_PROD_ID12("intel", "SERIES2-20 ", 0x40ade711, 0x25ee5cb0), 832 + PCMCIA_DEVICE_PROD_ID12("intel", "VALUE SERIES 100 ", 0x40ade711, 0xdf8506d8), 833 + PCMCIA_DEVICE_PROD_ID12("KINGMAX TECHNOLOGY INC.", "SRAM 256K Bytes", 0x54d0c69c, 0xad12c29c), 834 + PCMCIA_DEVICE_PROD_ID12("Maxtor", "MAXFL MobileMax Flash Memory Card", 0xb68968c8, 0x2dfb47b0), 835 + PCMCIA_DEVICE_PROD_ID12("SEIKO EPSON", "WWB101EN20", 0xf9876baf, 0xad0b207b), 836 + PCMCIA_DEVICE_PROD_ID12("SEIKO EPSON", "WWB513EN20", 0xf9876baf, 0xe8d884ad), 837 + PCMCIA_DEVICE_PROD_ID12("Starfish, Inc.", "REX-3000", 0x05ddca47, 0xe7d67bca), 838 + PCMCIA_DEVICE_PROD_ID12("Starfish, Inc.", "REX-4100", 0x05ddca47, 0x7bc32944), 839 + /* the following was commented out in pcmcia-cs-3.2.7 */ 840 + /* PCMCIA_DEVICE_PROD_ID12("RATOC Systems,Inc.", "SmartMedia ADAPTER PC Card", 0xf4a2fefe, 0x5885b2ae), */ 841 + #ifdef CONFIG_MTD_PCMCIA_ANONYMOUS 842 + { .match_flags = PCMCIA_DEV_ID_MATCH_ANONYMOUS, }, 843 + #endif 844 + PCMCIA_DEVICE_NULL 845 + }; 846 + MODULE_DEVICE_TABLE(pcmcia, pcmciamtd_ids); 821 847 822 848 static struct pcmcia_driver pcmciamtd_driver = { 823 849 .drv = { ··· 851 825 }, 852 826 .attach = pcmciamtd_attach, 853 827 .detach = pcmciamtd_detach, 854 - .owner = THIS_MODULE 828 + .owner = THIS_MODULE, 829 + .id_table = pcmciamtd_ids, 855 830 }; 856 831 857 832
+8
drivers/net/pcmcia/3c574_cs.c
··· 1286 1286 return 0; 1287 1287 } 1288 1288 1289 + static struct pcmcia_device_id tc574_ids[] = { 1290 + PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0574), 1291 + PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0101, 0x0556, "3CCFEM556.cis"), 1292 + PCMCIA_DEVICE_NULL, 1293 + }; 1294 + MODULE_DEVICE_TABLE(pcmcia, tc574_ids); 1295 + 1289 1296 static struct pcmcia_driver tc574_driver = { 1290 1297 .owner = THIS_MODULE, 1291 1298 .drv = { ··· 1300 1293 }, 1301 1294 .attach = tc574_attach, 1302 1295 .detach = tc574_detach, 1296 + .id_table = tc574_ids, 1303 1297 }; 1304 1298 1305 1299 static int __init init_tc574(void)
+12
drivers/net/pcmcia/3c589_cs.c
··· 1057 1057 return 0; 1058 1058 } 1059 1059 1060 + static struct pcmcia_device_id tc589_ids[] = { 1061 + PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0101, 0x0562), 1062 + PCMCIA_MFC_DEVICE_PROD_ID1(0, "Motorola MARQUIS", 0xf03e4e77), 1063 + PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0589), 1064 + PCMCIA_DEVICE_PROD_ID12("Farallon", "ENet", 0x58d93fc4, 0x992c2202), 1065 + PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0101, 0x0035, "3CXEM556.cis"), 1066 + PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0101, 0x003d, "3CXEM556.cis"), 1067 + PCMCIA_DEVICE_NULL, 1068 + }; 1069 + MODULE_DEVICE_TABLE(pcmcia, tc589_ids); 1070 + 1060 1071 static struct pcmcia_driver tc589_driver = { 1061 1072 .owner = THIS_MODULE, 1062 1073 .drv = { ··· 1075 1064 }, 1076 1065 .attach = tc589_attach, 1077 1066 .detach = tc589_detach, 1067 + .id_table = tc589_ids, 1078 1068 }; 1079 1069 1080 1070 static int __init init_tc589(void)
+29
drivers/net/pcmcia/axnet_cs.c
··· 850 850 outsw(nic_base + AXNET_DATAPORT, buf, count>>1); 851 851 } 852 852 853 + static struct pcmcia_device_id axnet_ids[] = { 854 + PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x016c, 0x0081), 855 + PCMCIA_DEVICE_MANF_CARD(0x018a, 0x0301), 856 + PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0301), 857 + PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0303), 858 + PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0309), 859 + PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1106), 860 + PCMCIA_DEVICE_MANF_CARD(0x8a01, 0xc1ab), 861 + PCMCIA_DEVICE_PROD_ID124("Fast Ethernet", "16-bit PC Card", "AX88190", 0xb4be14e3, 0x9a12eb6a, 0xab9be5ef), 862 + PCMCIA_DEVICE_PROD_ID12("ASIX", "AX88190", 0x0959823b, 0xab9be5ef), 863 + PCMCIA_DEVICE_PROD_ID12("Billionton", "LNA-100B", 0x552ab682, 0xbc3b87e1), 864 + PCMCIA_DEVICE_PROD_ID12("CHEETAH ETHERCARD", "EN2228", 0x00fa7bc8, 0x00e990cc), 865 + PCMCIA_DEVICE_PROD_ID12("CNet", "CNF301", 0xbc477dde, 0x78c5f40b), 866 + PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FEther PCC-TXD", 0x5261440f, 0x436768c5), 867 + PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FEtherII PCC-TXD", 0x5261440f, 0x730df72e), 868 + PCMCIA_DEVICE_PROD_ID12("Dynalink", "L100C16", 0x55632fd5, 0x66bc2a90), 869 + PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V3)", 0x0733cc81, 0x232019a8), 870 + PCMCIA_DEVICE_PROD_ID12("MELCO", "LPC3-TX", 0x481e0094, 0xf91af609), 871 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "100BASE", 0x281f1c5d, 0x7c2add04), 872 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "FastEtherCard", 0x281f1c5d, 0x7ef26116), 873 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "FEP501", 0x281f1c5d, 0x2e272058), 874 + PCMCIA_DEVICE_PROD_ID14("Network Everywhere", "AX88190", 0x820a67b6, 0xab9be5ef), 875 + /* this is not specific enough */ 876 + /* PCMCIA_DEVICE_MANF_CARD(0x021b, 0x0202), */ 877 + PCMCIA_DEVICE_NULL, 878 + }; 879 + MODULE_DEVICE_TABLE(pcmcia, axnet_ids); 880 + 853 881 static struct pcmcia_driver axnet_cs_driver = { 854 882 .owner = THIS_MODULE, 855 883 .drv = { ··· 885 857 }, 886 858 .attach = axnet_attach, 887 859 .detach = axnet_detach, 860 + .id_table = axnet_ids, 888 861 }; 889 862 890 863 static int __init init_axnet_cs(void)
+6 -1
drivers/net/pcmcia/com20020_cs.c
··· 483 483 return 0; 484 484 } /* com20020_event */ 485 485 486 - 486 + static struct pcmcia_device_id com20020_ids[] = { 487 + PCMCIA_DEVICE_PROD_ID12("Contemporary Control Systems, Inc.", "PCM20 Arcnet Adapter", 0x59991666, 0x95dfffaf), 488 + PCMCIA_DEVICE_NULL 489 + }; 490 + MODULE_DEVICE_TABLE(pcmcia, com20020_ids); 487 491 488 492 static struct pcmcia_driver com20020_cs_driver = { 489 493 .owner = THIS_MODULE, ··· 496 492 }, 497 493 .attach = com20020_attach, 498 494 .detach = com20020_detach, 495 + .id_table = com20020_ids, 499 496 }; 500 497 501 498 static int __init init_com20020_cs(void)
+29 -1
drivers/net/pcmcia/fmvj18x_cs.c
··· 435 435 pcmcia_get_status(handle, &status); 436 436 if (status.CardState & CS_EVENT_3VCARD) 437 437 link->conf.Vcc = 33; /* inserted in 3.3V slot */ 438 - } else if (le16_to_cpu(buf[1]) == PRODID_TDK_GN3410) { 438 + } else if (le16_to_cpu(buf[1]) == PRODID_TDK_GN3410 439 + || le16_to_cpu(buf[1]) == PRODID_TDK_NP9610 440 + || le16_to_cpu(buf[1]) == PRODID_TDK_MN3200) { 439 441 /* MultiFunction Card */ 440 442 link->conf.ConfigBase = 0x800; 441 443 link->conf.ConfigIndex = 0x47; ··· 766 764 return 0; 767 765 } /* fmvj18x_event */ 768 766 767 + static struct pcmcia_device_id fmvj18x_ids[] = { 768 + PCMCIA_DEVICE_MANF_CARD(0x0004, 0x0004), 769 + PCMCIA_DEVICE_PROD_ID12("EAGLE Technology", "NE200 ETHERNET LAN MBH10302 04", 0x528c88c4, 0x74f91e59), 770 + PCMCIA_DEVICE_PROD_ID12("Eiger Labs,Inc", "EPX-10BT PC Card Ethernet 10BT", 0x53af556e, 0x877f9922), 771 + PCMCIA_DEVICE_PROD_ID12("Eiger labs,Inc.", "EPX-10BT PC Card Ethernet 10BT", 0xf47e6c66, 0x877f9922), 772 + PCMCIA_DEVICE_PROD_ID12("FUJITSU", "LAN Card(FMV-J182)", 0x6ee5a3d8, 0x5baf31db), 773 + PCMCIA_DEVICE_PROD_ID12("FUJITSU", "MBH10308", 0x6ee5a3d8, 0x3f04875e), 774 + PCMCIA_DEVICE_PROD_ID12("FUJITSU TOWA", "LA501", 0xb8451188, 0x12939ba2), 775 + PCMCIA_DEVICE_PROD_ID12("HITACHI", "HT-4840-11", 0xf4f43949, 0x773910f4), 776 + PCMCIA_DEVICE_PROD_ID12("NextComK.K.", "NC5310B Ver1.0 ", 0x8cef4d3a, 0x075fc7b6), 777 + PCMCIA_DEVICE_PROD_ID12("NextComK.K.", "NC5310 Ver1.0 ", 0x8cef4d3a, 0xbccf43e6), 778 + PCMCIA_DEVICE_PROD_ID12("RATOC System Inc.", "10BASE_T CARD R280", 0x85c10e17, 0xd9413666), 779 + PCMCIA_DEVICE_PROD_ID12("TDK", "LAC-CD02x", 0x1eae9475, 0x8fa0ee70), 780 + PCMCIA_DEVICE_PROD_ID12("TDK", "LAC-CF010", 0x1eae9475, 0x7683bc9a), 781 + PCMCIA_DEVICE_PROD_ID1("CONTEC Co.,Ltd.", 0x58d8fee2), 782 + PCMCIA_DEVICE_PROD_ID1("PCMCIA LAN MBH10304 ES", 0x2599f454), 783 + PCMCIA_DEVICE_PROD_ID1("PCMCIA MBH10302", 0x8f4005da), 784 + PCMCIA_DEVICE_PROD_ID1("UBKK,V2.0", 0x90888080), 785 + PCMCIA_PFC_DEVICE_PROD_ID12(0, "TDK", "GlobalNetworker 3410/3412", 0x1eae9475, 0xd9a93bed), 786 + PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0x0d0a), 787 + PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0x0e0a), 788 + PCMCIA_DEVICE_NULL, 789 + }; 790 + MODULE_DEVICE_TABLE(pcmcia, fmvj18x_ids); 791 + 769 792 static struct pcmcia_driver fmvj18x_cs_driver = { 770 793 .owner = THIS_MODULE, 771 794 .drv = { ··· 798 771 }, 799 772 .attach = fmvj18x_attach, 800 773 .detach = fmvj18x_detach, 774 + .id_table = fmvj18x_ids, 801 775 }; 802 776 803 777 static int __init init_fmvj18x_cs(void)
+8
drivers/net/pcmcia/ibmtr_cs.c
··· 508 508 return; 509 509 } 510 510 511 + static struct pcmcia_device_id ibmtr_ids[] = { 512 + PCMCIA_DEVICE_PROD_ID12("3Com", "TokenLink Velocity PC Card", 0x41240e5b, 0x82c3734e), 513 + PCMCIA_DEVICE_PROD_ID12("IBM", "TOKEN RING", 0xb569a6e5, 0xbf8eed47), 514 + PCMCIA_DEVICE_NULL, 515 + }; 516 + MODULE_DEVICE_TABLE(pcmcia, ibmtr_ids); 517 + 511 518 static struct pcmcia_driver ibmtr_cs_driver = { 512 519 .owner = THIS_MODULE, 513 520 .drv = { ··· 522 515 }, 523 516 .attach = ibmtr_attach, 524 517 .detach = ibmtr_detach, 518 + .id_table = ibmtr_ids, 525 519 }; 526 520 527 521 static int __init init_ibmtr_cs(void)
+8
drivers/net/pcmcia/nmclan_cs.c
··· 1675 1675 1676 1676 } /* set_multicast_list */ 1677 1677 1678 + static struct pcmcia_device_id nmclan_ids[] = { 1679 + PCMCIA_DEVICE_PROD_ID12("New Media Corporation", "Ethernet", 0x085a850b, 0x00b2e941), 1680 + PCMCIA_DEVICE_PROD_ID12("Portable Add-ons", "Ethernet", 0x0ebf1d60, 0x00b2e941), 1681 + PCMCIA_DEVICE_NULL, 1682 + }; 1683 + MODULE_DEVICE_TABLE(pcmcia, nmclan_ids); 1684 + 1678 1685 static struct pcmcia_driver nmclan_cs_driver = { 1679 1686 .owner = THIS_MODULE, 1680 1687 .drv = { ··· 1689 1682 }, 1690 1683 .attach = nmclan_attach, 1691 1684 .detach = nmclan_detach, 1685 + .id_table = nmclan_ids, 1692 1686 }; 1693 1687 1694 1688 static int __init init_nmclan_cs(void)
+203
drivers/net/pcmcia/pcnet_cs.c
··· 1637 1637 1638 1638 /*====================================================================*/ 1639 1639 1640 + static struct pcmcia_device_id pcnet_ids[] = { 1641 + PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0057, 0x0021), 1642 + PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0104, 0x000a), 1643 + PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0xea15), 1644 + PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0143, 0x3341), 1645 + PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0143, 0xc0ab), 1646 + PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x021b, 0x0101), 1647 + PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x08a1, 0xc0ab), 1648 + PCMCIA_PFC_DEVICE_PROD_ID12(0, "AnyCom", "Fast Ethernet ", 0x578ba6e7, 0x02d92d1e), 1649 + PCMCIA_PFC_DEVICE_PROD_ID12(0, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff), 1650 + PCMCIA_PFC_DEVICE_PROD_ID12(0, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae), 1651 + PCMCIA_PFC_DEVICE_PROD_ID12(0, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033), 1652 + PCMCIA_PFC_DEVICE_PROD_ID12(0, "LINKSYS", "PCMLM336", 0xf7cb0b07, 0x7a821b58), 1653 + PCMCIA_PFC_DEVICE_PROD_ID12(0, "PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc), 1654 + PCMCIA_PFC_DEVICE_PROD_ID12(0, "PCMCIAs", "LanModem", 0xdcfe12d3, 0xc67c648f), 1655 + PCMCIA_MFC_DEVICE_PROD_ID12(0, "IBM", "Home and Away 28.8 PC Card ", 0xb569a6e5, 0x5bd4ff2c), 1656 + PCMCIA_MFC_DEVICE_PROD_ID12(0, "IBM", "Home and Away Credit Card Adapter", 0xb569a6e5, 0x4bdf15c3), 1657 + PCMCIA_MFC_DEVICE_PROD_ID12(0, "IBM", "w95 Home and Away Credit Card ", 0xb569a6e5, 0xae911c15), 1658 + PCMCIA_MFC_DEVICE_PROD_ID123(0, "APEX DATA", "MULTICARD", "ETHERNET-MODEM", 0x11c2da09, 0x7289dc5d, 0xaad95e1f), 1659 + PCMCIA_MFC_DEVICE_PROD_ID2(0, "FAX/Modem/Ethernet Combo Card ", 0x1ed59302), 1660 + PCMCIA_DEVICE_MANF_CARD(0x0057, 0x1004), 1661 + PCMCIA_DEVICE_MANF_CARD(0x0104, 0x000d), 1662 + PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0075), 1663 + PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0145), 1664 + PCMCIA_DEVICE_MANF_CARD(0x0149, 0x0230), 1665 + PCMCIA_DEVICE_MANF_CARD(0x0149, 0x4530), 1666 + /* PCMCIA_DEVICE_MANF_CARD(0x0149, 0xc1ab), conflict with axnet_cs */ 1667 + PCMCIA_DEVICE_MANF_CARD(0x0186, 0x0110), 1668 + PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x2328), 1669 + PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x8041), 1670 + PCMCIA_DEVICE_MANF_CARD(0x0213, 0x2452), 1671 + /* PCMCIA_DEVICE_MANF_CARD(0x021b, 0x0202), conflict with axnet_cs */ 1672 + PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0300), 1673 + PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0307), 1674 + PCMCIA_DEVICE_MANF_CARD(0x026f, 0x030a), 1675 + PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1103), 1676 + PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1121), 1677 + PCMCIA_DEVICE_PROD_ID12("2408LAN", "Ethernet", 0x352fff7f, 0x00b2e941), 1678 + PCMCIA_DEVICE_PROD_ID123("Cardwell", "PCMCIA", "ETHERNET", 0x9533672e, 0x281f1c5d, 0x3ff7175b), 1679 + PCMCIA_DEVICE_PROD_ID123("CNet ", "CN30BC", "ETHERNET", 0x9fe55d3d, 0x85601198, 0x3ff7175b), 1680 + PCMCIA_DEVICE_PROD_ID123("Digital", "Ethernet", "Adapter", 0x9999ab35, 0x00b2e941, 0x4b0d829e), 1681 + PCMCIA_DEVICE_PROD_ID123("Edimax Technology Inc.", "PCMCIA", "Ethernet Card", 0x738a0019, 0x281f1c5d, 0x5e9d92c0), 1682 + PCMCIA_DEVICE_PROD_ID123("EFA ", "EFA207", "ETHERNET", 0x3d294be4, 0xeb9aab6c, 0x3ff7175b), 1683 + PCMCIA_DEVICE_PROD_ID123("I-O DATA", "PCLA", "ETHERNET", 0x1d55d7ec, 0xe4c64d34, 0x3ff7175b), 1684 + PCMCIA_DEVICE_PROD_ID123("IO DATA", "PCLATE", "ETHERNET", 0x547e66dc, 0x6b260753, 0x3ff7175b), 1685 + PCMCIA_DEVICE_PROD_ID123("KingMax Technology Inc.", "EN10-T2", "PCMCIA Ethernet Card", 0x932b7189, 0x699e4436, 0x6f6652e0), 1686 + PCMCIA_DEVICE_PROD_ID123("PCMCIA", "PCMCIA-ETHERNET-CARD", "UE2216", 0x281f1c5d, 0xd4cd2f20, 0xb87add82), 1687 + PCMCIA_DEVICE_PROD_ID123("PCMCIA", "PCMCIA-ETHERNET-CARD", "UE2620", 0x281f1c5d, 0xd4cd2f20, 0x7d3d83a8), 1688 + PCMCIA_DEVICE_PROD_ID1("2412LAN", 0x67f236ab), 1689 + PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2212", 0xdfc6b5b2, 0xcb112a11), 1690 + PCMCIA_DEVICE_PROD_ID12("ACCTON", "EN2216-PCMCIA-ETHERNET", 0xdfc6b5b2, 0x5542bfff), 1691 + PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA100-PCM-T V2 100/10M LAN PC Card", 0xbb7fbdd7, 0xcd91cc68), 1692 + PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA-PCM", 0xbb7fbdd7, 0x5ba10d49), 1693 + PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA100-PCM V2", 0x36634a66, 0xc6d05997), 1694 + PCMCIA_DEVICE_PROD_ID12("Allied Telesis, K.K.", "CentreCOM LA-PCM_V2", 0xbb7fBdd7, 0x28e299f8), 1695 + PCMCIA_DEVICE_PROD_ID12("Allied Telesis K.K.", "LA-PCM V3", 0x36634a66, 0x62241d96), 1696 + PCMCIA_DEVICE_PROD_ID12("AmbiCom", "AMB8010", 0x5070a7f9, 0x82f96e96), 1697 + PCMCIA_DEVICE_PROD_ID12("AmbiCom", "AMB8610", 0x5070a7f9, 0x86741224), 1698 + PCMCIA_DEVICE_PROD_ID12("AmbiCom Inc", "AMB8002", 0x93b15570, 0x75ec3efb), 1699 + PCMCIA_DEVICE_PROD_ID12("AmbiCom Inc", "AMB8002T", 0x93b15570, 0x461c5247), 1700 + PCMCIA_DEVICE_PROD_ID12("AmbiCom Inc", "AMB8010", 0x93b15570, 0x82f96e96), 1701 + PCMCIA_DEVICE_PROD_ID12("AnyCom", "ECO Ethernet", 0x578ba6e7, 0x0a9888c1), 1702 + PCMCIA_DEVICE_PROD_ID12("AnyCom", "ECO Ethernet 10/100", 0x578ba6e7, 0x939fedbd), 1703 + PCMCIA_DEVICE_PROD_ID12("AROWANA", "PCMCIA Ethernet LAN Card", 0x313adbc8, 0x08d9f190), 1704 + PCMCIA_DEVICE_PROD_ID12("ASANTE", "FriendlyNet PC Card", 0x3a7ade0f, 0x41c64504), 1705 + PCMCIA_DEVICE_PROD_ID12("Billionton", "LNT-10TB", 0x552ab682, 0xeeb1ba6a), 1706 + PCMCIA_DEVICE_PROD_ID12("CF", "10Base-Ethernet", 0x44ebf863, 0x93ae4d79), 1707 + PCMCIA_DEVICE_PROD_ID12("CNet", "CN40BC Ethernet", 0xbc477dde, 0xfba775a7), 1708 + PCMCIA_DEVICE_PROD_ID12("COMPU-SHACK", "BASEline PCMCIA 10 MBit Ethernetadapter", 0xfa2e424d, 0xe9190d8a), 1709 + PCMCIA_DEVICE_PROD_ID12("COMPU-SHACK", "FASTline PCMCIA 10/100 Fast-Ethernet", 0xfa2e424d, 0x3953d9b9), 1710 + PCMCIA_DEVICE_PROD_ID12("CONTEC", "C-NET(PC)C-10L", 0x21cab552, 0xf6f90722), 1711 + PCMCIA_DEVICE_PROD_ID12("corega", "FEther PCC-TXF", 0x0a21501a, 0xa51564a2), 1712 + PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-T", 0x5261440f, 0xfa9d85bd), 1713 + PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d), 1714 + PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega Ether PCC-T", 0x5261440f, 0x6705fcaa), 1715 + PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega FastEther PCC-TX", 0x5261440f, 0x485e85d9), 1716 + PCMCIA_DEVICE_PROD_ID12("Corega,K.K.", "Ethernet LAN Card", 0x110d26d9, 0x9fd2f0a2), 1717 + PCMCIA_DEVICE_PROD_ID12("corega,K.K.", "Ethernet LAN Card", 0x9791a90e, 0x9fd2f0a2), 1718 + PCMCIA_DEVICE_PROD_ID12("CouplerlessPCMCIA", "100BASE", 0xee5af0ad, 0x7c2add04), 1719 + PCMCIA_DEVICE_PROD_ID12("CyQ've", "ELA-010", 0x77008979, 0x9d8d445d), 1720 + PCMCIA_DEVICE_PROD_ID12("CyQ've", "ELA-110E 10/100M LAN Card", 0x77008979, 0xfd184814), 1721 + PCMCIA_DEVICE_PROD_ID12("DataTrek.", "NetCard ", 0x5cd66d9d, 0x84697ce0), 1722 + PCMCIA_DEVICE_PROD_ID12("Dayna Communications, Inc.", "CommuniCard E", 0x0c629325, 0xb4e7dbaf), 1723 + PCMCIA_DEVICE_PROD_ID12("Digicom", "Palladio LAN 10/100", 0x697403d8, 0xe160b995), 1724 + PCMCIA_DEVICE_PROD_ID12("Digicom", "Palladio LAN 10/100 Dongless", 0x697403d8, 0xa6d3b233), 1725 + PCMCIA_DEVICE_PROD_ID12("DIGITAL", "DEPCM-XX", 0x69616cb3, 0xe600e76e), 1726 + PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-650", 0x1a424a1c, 0xf28c8398), 1727 + PCMCIA_DEVICE_PROD_ID12("D-Link", "DE-660", 0x1a424a1c, 0xd9a1d05b), 1728 + PCMCIA_DEVICE_PROD_ID12("D-Link", "DFE-650", 0x1a424a1c, 0x0f0073f9), 1729 + PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 PC Card", 0x725b842d, 0xf1efee84), 1730 + PCMCIA_DEVICE_PROD_ID12("Dual Speed", "10/100 Port Attached PC Card", 0x725b842d, 0x2db1f8e9), 1731 + PCMCIA_DEVICE_PROD_ID12("Dynalink", "L10BC", 0x55632fd5, 0xdc65f2b1), 1732 + PCMCIA_DEVICE_PROD_ID12("DYNALINK", "L10BC", 0x6a26d1cf, 0xdc65f2b1), 1733 + PCMCIA_DEVICE_PROD_ID12("DYNALINK", "L10C", 0x6a26d1cf, 0xc4f84efb), 1734 + PCMCIA_DEVICE_PROD_ID12("E-CARD", "E-CARD", 0x6701da11, 0x6701da11), 1735 + PCMCIA_DEVICE_PROD_ID12("EIGER Labs Inc.", "Ethernet 10BaseT card", 0x53c864c6, 0xedd059f6), 1736 + PCMCIA_DEVICE_PROD_ID12("EIGER Labs Inc.", "Ethernet Combo card", 0x53c864c6, 0x929c486c), 1737 + PCMCIA_DEVICE_PROD_ID12("Ethernet", "Adapter", 0x00b2e941, 0x4b0d829e), 1738 + PCMCIA_DEVICE_PROD_ID12("Ethernet Adapter", "E2000 PCMCIA Ethernet", 0x96767301, 0x71fbbc61), 1739 + PCMCIA_DEVICE_PROD_ID12("Ethernet PCMCIA adapter", "EP-210", 0x8dd86181, 0xf2b52517), 1740 + PCMCIA_DEVICE_PROD_ID12("Fast Ethernet", "Adapter", 0xb4be14e3, 0x4b0d829e), 1741 + PCMCIA_DEVICE_PROD_ID12("Grey Cell", "GCS2000", 0x2a151fac, 0xf00555cb), 1742 + PCMCIA_DEVICE_PROD_ID12("Grey Cell", "GCS2220", 0x2a151fac, 0xc1b7e327), 1743 + PCMCIA_DEVICE_PROD_ID12("GVC", "NIC-2000p", 0x76e171bd, 0x6eb1c947), 1744 + PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "Ethernet", 0xe3736c88, 0x00b2e941), 1745 + PCMCIA_DEVICE_PROD_ID12("IC-CARD", "IC-CARD", 0x60cb09a6, 0x60cb09a6), 1746 + PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b), 1747 + PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0), 1748 + PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956), 1749 + PCMCIA_DEVICE_PROD_ID12("KCI", "PE520 PCMCIA Ethernet Adapter", 0xa89b87d3, 0x1eb88e64), 1750 + PCMCIA_DEVICE_PROD_ID12("KINGMAX", "EN10T2T", 0x7bcb459a, 0xa5c81fa5), 1751 + PCMCIA_DEVICE_PROD_ID12("Kingston", "KNE-PC2", 0x1128e633, 0xce2a89b3), 1752 + PCMCIA_DEVICE_PROD_ID12("Kingston Technology Corp.", "EtheRx PC Card Ethernet Adapter", 0x313c7be3, 0x0afb54a2), 1753 + PCMCIA_DEVICE_PROD_ID12("Laneed", "LD-10/100CD", 0x1b7827b2, 0xcda71d1c), 1754 + PCMCIA_DEVICE_PROD_ID12("Laneed", "LD-CDF", 0x1b7827b2, 0xfec71e40), 1755 + PCMCIA_DEVICE_PROD_ID12("Laneed", "LD-CDL/T", 0x1b7827b2, 0x79fba4f7), 1756 + PCMCIA_DEVICE_PROD_ID12("Laneed", "LD-CDS", 0x1b7827b2, 0x931afaab), 1757 + PCMCIA_DEVICE_PROD_ID12("Linksys", "Combo PCMCIA EthernetCard (EC2T)", 0x0733cc81, 0x32ee8c78), 1758 + PCMCIA_DEVICE_PROD_ID12("LINKSYS", "E-CARD", 0xf7cb0b07, 0x6701da11), 1759 + PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 Integrated PC Card (PCM100)", 0x0733cc81, 0x453c3f9d), 1760 + PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100)", 0x0733cc81, 0x66c5a389), 1761 + PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V2)", 0x0733cc81, 0x3a3b28e9), 1762 + PCMCIA_DEVICE_PROD_ID12("Linksys", "HomeLink Phoneline ", 0x0733cc81, 0x5e07cfa0), 1763 + PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN100TX", 0x88fcdeda, 0x6d772737), 1764 + PCMCIA_DEVICE_PROD_ID12("Logitec", "LPM-LN20T", 0x88fcdeda, 0x81090922), 1765 + PCMCIA_DEVICE_PROD_ID12("LONGSHINE", "PCMCIA Ethernet Card", 0xf866b0b0, 0x6f6652e0), 1766 + PCMCIA_DEVICE_PROD_ID12("MACNICA", "ME1-JEIDA", 0x20841b68, 0xaf8a3578), 1767 + PCMCIA_DEVICE_PROD_ID12("Macsense", "MPC-10", 0xd830297f, 0xd265c307), 1768 + PCMCIA_DEVICE_PROD_ID12("Matsushita Electric Industrial Co.,LTD.", "CF-VEL211", 0x44445376, 0x8ded41d4), 1769 + PCMCIA_DEVICE_PROD_ID12("MAXTECH", "PCN2000", 0x78d64bc0, 0xca0ca4b8), 1770 + PCMCIA_DEVICE_PROD_ID12("MELCO", "LPC2-T", 0x481e0094, 0xa2eb0cf3), 1771 + PCMCIA_DEVICE_PROD_ID12("MELCO", "LPC2-TX", 0x481e0094, 0x41a6916c), 1772 + PCMCIA_DEVICE_PROD_ID12("Microcom C.E.", "Travel Card LAN 10/100", 0x4b91cec7, 0xe70220d6), 1773 + PCMCIA_DEVICE_PROD_ID12("Microdyne", "NE4200", 0x2e6da59b, 0x0478e472), 1774 + PCMCIA_DEVICE_PROD_ID12("MIDORI ELEC.", "LT-PCMT", 0x648d55c1, 0xbde526c7), 1775 + PCMCIA_DEVICE_PROD_ID12("National Semiconductor", "InfoMover 4100", 0x36e1191f, 0x60c229b9), 1776 + PCMCIA_DEVICE_PROD_ID12("National Semiconductor", "InfoMover NE4100", 0x36e1191f, 0xa6617ec8), 1777 + PCMCIA_DEVICE_PROD_ID12("NEC", "PC-9801N-J12", 0x18df0ba0, 0xbc912d76), 1778 + PCMCIA_DEVICE_PROD_ID12("NETGEAR", "FA410TX", 0x9aa79dc3, 0x60e5bc0e), 1779 + PCMCIA_DEVICE_PROD_ID12("NETGEAR", "FA411", 0x9aa79dc3, 0x40fad875), 1780 + PCMCIA_DEVICE_PROD_ID12("Network Everywhere", "Fast Ethernet 10/100 PC Card", 0x820a67b6, 0x31ed1a5f), 1781 + PCMCIA_DEVICE_PROD_ID12("NextCom K.K.", "Next Hawk", 0xaedaec74, 0xad050ef1), 1782 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "10/100Mbps Ethernet Card", 0x281f1c5d, 0x6e41773b), 1783 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Ethernet", 0x281f1c5d, 0x00b2e941), 1784 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "ETHERNET", 0x281f1c5d, 0x3ff7175b), 1785 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Ethernet 10BaseT Card", 0x281f1c5d, 0x4de2f6c8), 1786 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Ethernet Card", 0x281f1c5d, 0x5e9d92c0), 1787 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Ethernet Combo card", 0x281f1c5d, 0x929c486c), 1788 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "ETHERNET V1.0", 0x281f1c5d, 0x4d8817c8), 1789 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "FastEthernet", 0x281f1c5d, 0xfe871eeb), 1790 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Fast-Ethernet", 0x281f1c5d, 0x45f1f3b4), 1791 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "FAST ETHERNET CARD", 0x281f1c5d, 0xec5dbca7), 1792 + PCMCIA_DEVICE_PROD_ID12("PCMCIA LAN", "Ethernet", 0x7500e246, 0x00b2e941), 1793 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "LNT-10TN", 0x281f1c5d, 0xe707f641), 1794 + PCMCIA_DEVICE_PROD_ID12("PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc), 1795 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "UE2212", 0x281f1c5d, 0xbf17199b), 1796 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", " Ethernet NE2000 Compatible", 0x281f1c5d, 0x42d5d7e1), 1797 + PCMCIA_DEVICE_PROD_ID12("PRETEC", "Ethernet CompactLAN 10baseT 3.3V", 0xebf91155, 0x30074c80), 1798 + PCMCIA_DEVICE_PROD_ID12("PRETEC", "Ethernet CompactLAN 10BaseT 3.3V", 0xebf91155, 0x7f5a4f50), 1799 + PCMCIA_DEVICE_PROD_ID12("Psion Dacom", "Gold Card Ethernet", 0xf5f025c2, 0x3a30e110), 1800 + PCMCIA_DEVICE_PROD_ID12("=RELIA==", "Ethernet", 0xcdd0644a, 0x00b2e941), 1801 + PCMCIA_DEVICE_PROD_ID12("RP", "1625B Ethernet NE2000 Compatible", 0xe3e66e22, 0xb96150df), 1802 + PCMCIA_DEVICE_PROD_ID12("RPTI", "EP400 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4a7e2ae0), 1803 + PCMCIA_DEVICE_PROD_ID12("RPTI", "EP401 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4bcbd7fd), 1804 + PCMCIA_DEVICE_PROD_ID12("RPTI LTD.", "EP400", 0xc53ac515, 0x81e39388), 1805 + PCMCIA_DEVICE_PROD_ID12("SCM", "Ethernet Combo card", 0xbdc3b102, 0x929c486c), 1806 + PCMCIA_DEVICE_PROD_ID12("Seiko Epson Corp.", "Ethernet", 0x09928730, 0x00b2e941), 1807 + PCMCIA_DEVICE_PROD_ID12("SMC", "EZCard-10-PCMCIA", 0xc4f8b18b, 0xfb21d265), 1808 + PCMCIA_DEVICE_PROD_ID12("Socket Communications Inc", "Socket EA PCMCIA LAN Adapter Revision D", 0xc70a4760, 0x2ade483e), 1809 + PCMCIA_DEVICE_PROD_ID12("Socket Communications Inc", "Socket EA PCMCIA LAN Adapter Revision E", 0xc70a4760, 0x5dd978a8), 1810 + PCMCIA_DEVICE_PROD_ID12("TDK", "LAK-CD031 for PCMCIA", 0x1eae9475, 0x0ed386fa), 1811 + PCMCIA_DEVICE_PROD_ID12("Telecom Device K.K.", "SuperSocket RE450T", 0x466b05f0, 0x8b74bc4f), 1812 + PCMCIA_DEVICE_PROD_ID12("Telecom Device K.K.", "SuperSocket RE550T", 0x466b05f0, 0x33c8db2a), 1813 + PCMCIA_DEVICE_PROD_ID13("Hypertec", "EP401", 0x8787bec7, 0xf6e4a31e), 1814 + PCMCIA_DEVICE_PROD_ID13("KingMax Technology Inc.", "Ethernet Card", 0x932b7189, 0x5e9d92c0), 1815 + PCMCIA_DEVICE_PROD_ID13("LONGSHINE", "EP401", 0xf866b0b0, 0xf6e4a31e), 1816 + PCMCIA_DEVICE_PROD_ID13("Xircom", "CFE-10", 0x2e3ee845, 0x22a49f89), 1817 + PCMCIA_DEVICE_PROD_ID1("CyQ've 10 Base-T LAN CARD", 0x94faf360), 1818 + PCMCIA_DEVICE_PROD_ID1("EP-210 PCMCIA LAN CARD.", 0x8850b4de), 1819 + PCMCIA_DEVICE_PROD_ID1("ETHER-C16", 0x06a8514f), 1820 + PCMCIA_DEVICE_PROD_ID1("IC-CARD", 0x60cb09a6), 1821 + PCMCIA_DEVICE_PROD_ID1("NE2000 Compatible", 0x75b8ad5a), 1822 + PCMCIA_DEVICE_PROD_ID2("EN-6200P2", 0xa996d078), 1823 + /* too generic! */ 1824 + /* PCMCIA_DEVICE_PROD_ID12("PCMCIA", "10/100 Ethernet Card", 0x281f1c5d, 0x11b0ffc0), */ 1825 + PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "PCMCIA", "EN2218-LAN/MODEM", 0x281f1c5d, 0x570f348e, "PCMLM28.cis"), 1826 + PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "PCMCIA", "UE2218-LAN/MODEM", 0x281f1c5d, 0x6fdcacee, "PCMLM28.cis"), 1827 + PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "Psion Dacom", "Gold Card V34 Ethernet", 0xf5f025c2, 0x338e8155, "PCMLM28.cis"), 1828 + PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "Psion Dacom", "Gold Card V34 Ethernet GSM", 0xf5f025c2, 0x4ae85d35, "PCMLM28.cis"), 1829 + PCMCIA_PFC_DEVICE_CIS_PROD_ID12(0, "LINKSYS", "PCMLM28", 0xf7cb0b07, 0x66881874, "PCMLM28.cis"), 1830 + PCMCIA_MFC_DEVICE_CIS_PROD_ID12(0, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "DP83903.cis"), 1831 + PCMCIA_MFC_DEVICE_CIS_PROD_ID4(0, "NSC MF LAN/Modem", 0x58fc6056, "DP83903.cis"), 1832 + PCMCIA_MFC_DEVICE_CIS_MANF_CARD(0, 0x0175, 0x0000, "DP83903.cis"), 1833 + PCMCIA_DEVICE_CIS_MANF_CARD(0xc00f, 0x0002, "LA-PCM.cis"), 1834 + PCMCIA_DEVICE_CIS_PROD_ID12("KTI", "PE520 PLUS", 0xad180345, 0x9d58d392, "PE520.cis"), 1835 + PCMCIA_DEVICE_CIS_PROD_ID12("NDC", "Ethernet", 0x01c43ae1, 0x00b2e941, "NE2K.cis"), 1836 + PCMCIA_DEVICE_CIS_PROD_ID12("PMX ", "PE-200", 0x34f3f1c8, 0x10b59f8c, "PE-200.cis"), 1837 + PCMCIA_DEVICE_CIS_PROD_ID12("TAMARACK", "Ethernet", 0xcf434fba, 0x00b2e941, "tamarack.cis"), 1838 + PCMCIA_DEVICE_NULL 1839 + }; 1840 + MODULE_DEVICE_TABLE(pcmcia, pcnet_ids); 1841 + 1640 1842 static struct pcmcia_driver pcnet_driver = { 1641 1843 .drv = { 1642 1844 .name = "pcnet_cs", ··· 1846 1644 .attach = pcnet_attach, 1847 1645 .detach = pcnet_detach, 1848 1646 .owner = THIS_MODULE, 1647 + .id_table = pcnet_ids, 1849 1648 }; 1850 1649 1851 1650 static int __init init_pcnet_cs(void)
+33
drivers/net/pcmcia/smc91c92_cs.c
··· 2327 2327 return rc; 2328 2328 } 2329 2329 2330 + static struct pcmcia_device_id smc91c92_ids[] = { 2331 + PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0109, 0x0501), 2332 + PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0140, 0x000a), 2333 + PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "CC/XJEM3288", "DATA/FAX/CELL ETHERNET MODEM", 0xf510db04, 0x04cd2988, 0x46a52d63), 2334 + PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "CC/XJEM3336", "DATA/FAX/CELL ETHERNET MODEM", 0xf510db04, 0x0143b773, 0x46a52d63), 2335 + PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "EM1144T", "PCMCIA MODEM", 0xf510db04, 0x856d66c8, 0xbd6c43ef), 2336 + PCMCIA_PFC_DEVICE_PROD_ID123(0, "MEGAHERTZ", "XJEM1144/CCEM1144", "PCMCIA MODEM", 0xf510db04, 0x52d21e1e, 0xbd6c43ef), 2337 + PCMCIA_PFC_DEVICE_PROD_ID12(0, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c), 2338 + PCMCIA_PFC_DEVICE_PROD_ID12(0, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e), 2339 + PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 2340 + PCMCIA_PFC_DEVICE_PROD_ID12(0, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 2341 + PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x016c, 0x0020), 2342 + PCMCIA_DEVICE_MANF_CARD(0x016c, 0x0023), 2343 + PCMCIA_DEVICE_PROD_ID123("BASICS by New Media Corporation", "Ethernet", "SMC91C94", 0x23c78a9d, 0x00b2e941, 0xcef397fb), 2344 + PCMCIA_DEVICE_PROD_ID12("ARGOSY", "Fast Ethernet PCCard", 0x78f308dc, 0xdcea68bc), 2345 + PCMCIA_DEVICE_PROD_ID12("dit Co., Ltd.", "PC Card-10/100BTX", 0xe59365c8, 0x6a2161d1), 2346 + PCMCIA_DEVICE_PROD_ID12("DYNALINK", "L100C", 0x6a26d1cf, 0xc16ce9c5), 2347 + PCMCIA_DEVICE_PROD_ID12("Farallon", "Farallon Enet", 0x58d93fc4, 0x244734e9), 2348 + PCMCIA_DEVICE_PROD_ID12("Megahertz", "CC10BT/2", 0x33234748, 0x3c95b953), 2349 + PCMCIA_DEVICE_PROD_ID12("MELCO/SMC", "LPC-TX", 0xa2cd8e6d, 0x42da662a), 2350 + PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 2351 + PCMCIA_DEVICE_PROD_ID12("Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 2352 + PCMCIA_DEVICE_PROD_ID12("PCMCIA", "Fast Ethernet PCCard", 0x281f1c5d, 0xdcea68bc), 2353 + PCMCIA_DEVICE_PROD_ID12("Psion", "10Mb Ethernet", 0x4ef00b21, 0x844be9e9), 2354 + PCMCIA_DEVICE_PROD_ID12("SMC", "EtherEZ Ethernet 8020", 0xc4f8b18b, 0x4a0eeb2d), 2355 + /* These conflict with other cards! */ 2356 + /* PCMCIA_DEVICE_MANF_CARD(0x0186, 0x0100), */ 2357 + /* PCMCIA_DEVICE_MANF_CARD(0x8a01, 0xc1ab), */ 2358 + PCMCIA_DEVICE_NULL, 2359 + }; 2360 + MODULE_DEVICE_TABLE(pcmcia, smc91c92_ids); 2361 + 2330 2362 static struct pcmcia_driver smc91c92_cs_driver = { 2331 2363 .owner = THIS_MODULE, 2332 2364 .drv = { ··· 2366 2334 }, 2367 2335 .attach = smc91c92_attach, 2368 2336 .detach = smc91c92_detach, 2337 + .id_table = smc91c92_ids, 2369 2338 }; 2370 2339 2371 2340 static int __init init_smc91c92_cs(void)
+28
drivers/net/pcmcia/xirc2ps_cs.c
··· 1983 1983 return 0; 1984 1984 } 1985 1985 1986 + static struct pcmcia_device_id xirc2ps_ids[] = { 1987 + PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0089, 0x110a), 1988 + PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0138, 0x110a), 1989 + PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "CEM28", 0x2e3ee845, 0x0ea978ea), 1990 + PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "CEM33", 0x2e3ee845, 0x80609023), 1991 + PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a), 1992 + PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29), 1993 + PCMCIA_PFC_DEVICE_PROD_ID13(0, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719), 1994 + PCMCIA_PFC_DEVICE_PROD_ID12(0, "Xircom", "CreditCard Ethernet", 0x2e3ee845, 0xc0e778c2), 1995 + PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x010a), 1996 + PCMCIA_DEVICE_PROD_ID13("Toshiba Information Systems", "TPCENET", 0x1b3b94fe, 0xf381c1a2), 1997 + PCMCIA_DEVICE_PROD_ID13("Xircom", "CE3-10/100", 0x2e3ee845, 0x0ec0ac37), 1998 + PCMCIA_DEVICE_PROD_ID13("Xircom", "PS-CE2-10", 0x2e3ee845, 0x947d9073), 1999 + PCMCIA_DEVICE_PROD_ID13("Xircom", "R2E-100BTX", 0x2e3ee845, 0x2464a6e3), 2000 + PCMCIA_DEVICE_PROD_ID13("Xircom", "RE-10", 0x2e3ee845, 0x3e08d609), 2001 + PCMCIA_DEVICE_PROD_ID13("Xircom", "XE2000", 0x2e3ee845, 0xf7188e46), 2002 + PCMCIA_DEVICE_PROD_ID12("Compaq", "Ethernet LAN Card", 0x54f7c49c, 0x9fd2f0a2), 2003 + PCMCIA_DEVICE_PROD_ID12("Compaq", "Netelligent 10/100 PC Card", 0x54f7c49c, 0xefe96769), 2004 + PCMCIA_DEVICE_PROD_ID12("Intel", "EtherExpress(TM) PRO/100 PC Card Mobile Adapter16", 0x816cc815, 0x174397db), 2005 + PCMCIA_DEVICE_PROD_ID12("Toshiba", "10/100 Ethernet PC Card", 0x44a09d9c, 0xb44deecf), 2006 + /* also matches CFE-10 cards! */ 2007 + /* PCMCIA_DEVICE_MANF_CARD(0x0105, 0x010a), */ 2008 + PCMCIA_DEVICE_NULL, 2009 + }; 2010 + MODULE_DEVICE_TABLE(pcmcia, xirc2ps_ids); 2011 + 2012 + 1986 2013 static struct pcmcia_driver xirc2ps_cs_driver = { 1987 2014 .owner = THIS_MODULE, 1988 2015 .drv = { ··· 2017 1990 }, 2018 1991 .attach = xirc2ps_attach, 2019 1992 .detach = xirc2ps_detach, 1993 + .id_table = xirc2ps_ids, 2020 1994 }; 2021 1995 2022 1996 static int __init
+10
drivers/net/wireless/airo_cs.c
··· 559 559 return 0; 560 560 } /* airo_event */ 561 561 562 + static struct pcmcia_device_id airo_ids[] = { 563 + PCMCIA_DEVICE_MANF_CARD(0x015f, 0x000a), 564 + PCMCIA_DEVICE_MANF_CARD(0x015f, 0x0005), 565 + PCMCIA_DEVICE_MANF_CARD(0x015f, 0x0007), 566 + PCMCIA_DEVICE_MANF_CARD(0x0105, 0x0007), 567 + PCMCIA_DEVICE_NULL, 568 + }; 569 + MODULE_DEVICE_TABLE(pcmcia, airo_ids); 570 + 562 571 static struct pcmcia_driver airo_driver = { 563 572 .owner = THIS_MODULE, 564 573 .drv = { ··· 575 566 }, 576 567 .attach = airo_attach, 577 568 .detach = airo_detach, 569 + .id_table = airo_ids, 578 570 }; 579 571 580 572 static int airo_cs_init(void)
+22
drivers/net/wireless/atmel_cs.c
··· 646 646 } /* atmel_event */ 647 647 648 648 /*====================================================================*/ 649 + static struct pcmcia_device_id atmel_ids[] = { 650 + PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0620), 651 + PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0696), 652 + PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x3302), 653 + PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0007), 654 + PCMCIA_DEVICE_PROD_ID12("11WAVE", "11WP611AL-E", 0x9eb2da1f, 0xc9a0d3f9), 655 + PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C502AR", 0xabda4164, 0x41b37e1f), 656 + PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C504", 0xabda4164, 0x5040670a), 657 + PCMCIA_DEVICE_PROD_ID12("ATMEL", "AT76C504A", 0xabda4164, 0xe15ed87f), 658 + PCMCIA_DEVICE_PROD_ID12("BT", "Voyager 1020 Laptop Adapter", 0xae49b86a, 0x1e957cd5), 659 + PCMCIA_DEVICE_PROD_ID12("CNet", "CNWLC 11Mbps Wireless PC Card V-5", 0xbc477dde, 0x502fae6b), 660 + PCMCIA_DEVICE_PROD_ID12("IEEE 802.11b", "Wireless LAN PC Card", 0x5b878724, 0x122f1df6), 661 + PCMCIA_DEVICE_PROD_ID12("OEM", "11Mbps Wireless LAN PC Card V-3", 0xfea54c90, 0x1c5b0f68), 662 + PCMCIA_DEVICE_PROD_ID12("SMC", "2632W", 0xc4f8b18b, 0x30f38774), 663 + PCMCIA_DEVICE_PROD_ID12("SMC", "2632W-V2", 0xc4f8b18b, 0x172d1377), 664 + PCMCIA_DEVICE_PROD_ID12("Wireless", "PC", 0xa407ecdd, 0x556e4d7e), 665 + PCMCIA_DEVICE_PROD_ID12("WLAN", "802.11b PC CARD", 0x575c516c, 0xb1f6dbc4), 666 + PCMCIA_DEVICE_NULL 667 + }; 668 + MODULE_DEVICE_TABLE(pcmcia, atmel_ids); 669 + 649 670 static struct pcmcia_driver atmel_driver = { 650 671 .owner = THIS_MODULE, 651 672 .drv = { ··· 674 653 }, 675 654 .attach = atmel_attach, 676 655 .detach = atmel_detach, 656 + .id_table = atmel_ids, 677 657 }; 678 658 679 659 static int atmel_cs_init(void)
+7
drivers/net/wireless/netwave_cs.c
··· 1668 1668 return 0; 1669 1669 } 1670 1670 1671 + static struct pcmcia_device_id netwave_ids[] = { 1672 + PCMCIA_DEVICE_PROD_ID12("Xircom", "CreditCard Netwave", 0x2e3ee845, 0x54e28a28), 1673 + PCMCIA_DEVICE_NULL, 1674 + }; 1675 + MODULE_DEVICE_TABLE(pcmcia, netwave_ids); 1676 + 1671 1677 static struct pcmcia_driver netwave_driver = { 1672 1678 .owner = THIS_MODULE, 1673 1679 .drv = { ··· 1681 1675 }, 1682 1676 .attach = netwave_attach, 1683 1677 .detach = netwave_detach, 1678 + .id_table = netwave_ids, 1684 1679 }; 1685 1680 1686 1681 static int __init init_netwave_cs(void)
+51
drivers/net/wireless/orinoco_cs.c
··· 608 608 " (David Gibson <hermes@gibson.dropbear.id.au>, " 609 609 "Pavel Roskin <proski@gnu.org>, et al)"; 610 610 611 + static struct pcmcia_device_id orinoco_cs_ids[] = { 612 + PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), 613 + PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0001), 614 + PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002), 615 + PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), 616 + PCMCIA_DEVICE_MANF_CARD(0x01eb, 0x080a), 617 + PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002), 618 + PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001), 619 + PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305), 620 + PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613), 621 + PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002), 622 + PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673), 623 + PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002), 624 + PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002), 625 + PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001), 626 + PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300), 627 + PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021), 628 + PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002), 629 + PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), 630 + PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), 631 + PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), 632 + PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), 633 + PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3), 634 + PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0), 635 + PCMCIA_DEVICE_PROD_ID12("ACTIONTEC", "PRISM Wireless LAN PC Card", 0x393089da, 0xa71e69d5), 636 + PCMCIA_DEVICE_PROD_ID12("Avaya Communication", "Avaya Wireless PC Card", 0xd8a43b78, 0x0d341169), 637 + PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-PCM-L11G", 0x2decece3, 0xf57ca4b3), 638 + PCMCIA_DEVICE_PROD_ID12("Cabletron", "RoamAbout 802.11 DS", 0x32d445f5, 0xedeffd90), 639 + PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCC-11", 0x5261440f, 0xa6405584), 640 + PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCCA-11", 0x5261440f, 0xdf6115f9), 641 + PCMCIA_DEVICE_PROD_ID12("D", "Link DRC-650 11Mbps WLAN Card", 0x71b18589, 0xf144e3ac), 642 + PCMCIA_DEVICE_PROD_ID12("D", "Link DWL-650 11Mbps WLAN Card", 0x71b18589, 0xb6f1b0ab), 643 + PCMCIA_DEVICE_PROD_ID12("ELSA", "AirLancer MC-11", 0x4507a33a, 0xef54f0e3), 644 + PCMCIA_DEVICE_PROD_ID12("HyperLink", "Wireless PC Card 11Mbps", 0x56cc3f1a, 0x0bcf220c), 645 + PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18), 646 + PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/IEEE", 0x23eb9949, 0xc562e72a), 647 + PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11", 0x481e0094, 0x7360e410), 648 + PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11G", 0x481e0094, 0xf57ca4b3), 649 + PCMCIA_DEVICE_PROD_ID12("Microsoft", "Wireless Notebook Adapter MN-520", 0x5961bf85, 0x6eec8c01), 650 + PCMCIA_DEVICE_PROD_ID12("NCR", "WaveLAN/IEEE", 0x24358cd4, 0xc562e72a), 651 + PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401RA Wireless PC", "Card", 0x0306467f, 0x9762e8f1), 652 + PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-CF110", 0x209f40ab, 0xd9715264), 653 + PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PC CARD HARMONY 80211B", 0xc6536a5e, 0x090c3cd9), 654 + PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PCI CARD HARMONY 80211B", 0xc6536a5e, 0x9f494e26), 655 + PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b), 656 + PCMCIA_DEVICE_PROD_ID1("Symbol Technologies", 0x3f02b4d6), 657 + PCMCIA_DEVICE_NULL, 658 + }; 659 + MODULE_DEVICE_TABLE(pcmcia, orinoco_cs_ids); 660 + 611 661 static struct pcmcia_driver orinoco_driver = { 612 662 .owner = THIS_MODULE, 613 663 .drv = { ··· 665 615 }, 666 616 .attach = orinoco_cs_attach, 667 617 .detach = orinoco_cs_detach, 618 + .id_table = orinoco_cs_ids, 668 619 }; 669 620 670 621 static int __init
+7
drivers/net/wireless/ray_cs.c
··· 2904 2904 } 2905 2905 #endif 2906 2906 2907 + static struct pcmcia_device_id ray_ids[] = { 2908 + PCMCIA_DEVICE_MANF_CARD(0x01a6, 0x0000), 2909 + PCMCIA_DEVICE_NULL, 2910 + }; 2911 + MODULE_DEVICE_TABLE(pcmcia, ray_ids); 2912 + 2907 2913 static struct pcmcia_driver ray_driver = { 2908 2914 .owner = THIS_MODULE, 2909 2915 .drv = { ··· 2917 2911 }, 2918 2912 .attach = ray_attach, 2919 2913 .detach = ray_detach, 2914 + .id_table = ray_ids, 2920 2915 }; 2921 2916 2922 2917 static int __init init_ray_cs(void)
+10
drivers/net/wireless/wavelan_cs.c
··· 4889 4889 return 0; 4890 4890 } 4891 4891 4892 + static struct pcmcia_device_id wavelan_ids[] = { 4893 + PCMCIA_DEVICE_PROD_ID12("AT&T","WaveLAN/PCMCIA", 0xe7c5affd, 0x1bc50975), 4894 + PCMCIA_DEVICE_PROD_ID12("Digital", "RoamAbout/DS", 0x9999ab35, 0x00d05e06), 4895 + PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/PCMCIA", 0x23eb9949, 0x1bc50975), 4896 + PCMCIA_DEVICE_PROD_ID12("NCR", "WaveLAN/PCMCIA", 0x24358cd4, 0x1bc50975), 4897 + PCMCIA_DEVICE_NULL, 4898 + }; 4899 + MODULE_DEVICE_TABLE(pcmcia, wavelan_ids); 4900 + 4892 4901 static struct pcmcia_driver wavelan_driver = { 4893 4902 .owner = THIS_MODULE, 4894 4903 .drv = { ··· 4905 4896 }, 4906 4897 .attach = wavelan_attach, 4907 4898 .detach = wavelan_detach, 4899 + .id_table = wavelan_ids, 4908 4900 }; 4909 4901 4910 4902 static int __init
+7
drivers/net/wireless/wl3501_cs.c
··· 2239 2239 return 0; 2240 2240 } 2241 2241 2242 + static struct pcmcia_device_id wl3501_ids[] = { 2243 + PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0001), 2244 + PCMCIA_DEVICE_NULL 2245 + }; 2246 + MODULE_DEVICE_TABLE(pcmcia, wl3501_ids); 2247 + 2242 2248 static struct pcmcia_driver wl3501_driver = { 2243 2249 .owner = THIS_MODULE, 2244 2250 .drv = { ··· 2252 2246 }, 2253 2247 .attach = wl3501_attach, 2254 2248 .detach = wl3501_detach, 2249 + .id_table = wl3501_ids, 2255 2250 }; 2256 2251 2257 2252 static int __init wl3501_init_module(void)
+9
drivers/parport/parport_cs.c
··· 373 373 return 0; 374 374 } /* parport_event */ 375 375 376 + static struct pcmcia_device_id parport_ids[] = { 377 + PCMCIA_DEVICE_FUNC_ID(3), 378 + PCMCIA_DEVICE_MANF_CARD(0x0137, 0x0003), 379 + PCMCIA_DEVICE_NULL 380 + }; 381 + MODULE_DEVICE_TABLE(pcmcia, parport_ids); 382 + 376 383 static struct pcmcia_driver parport_cs_driver = { 377 384 .owner = THIS_MODULE, 378 385 .drv = { ··· 387 380 }, 388 381 .attach = parport_attach, 389 382 .detach = parport_detach, 383 + .id_table = parport_ids, 384 + 390 385 }; 391 386 392 387 static int __init init_parport_cs(void)
+35 -8
drivers/pcmcia/Kconfig
··· 14 14 Say Y here if you want to attach PCMCIA- or PC-cards to your Linux 15 15 computer. These are credit-card size devices such as network cards, 16 16 modems or hard drives often used with laptops computers. There are 17 - actually two varieties of these cards: the older 16 bit PCMCIA cards 18 - and the newer 32 bit CardBus cards. 17 + actually two varieties of these cards: 16 bit PCMCIA and 32 bit 18 + CardBus cards. 19 19 20 20 To compile this driver as modules, choose M here: the 21 21 module will be called pcmcia_core. ··· 42 42 43 43 config PCMCIA 44 44 tristate "16-bit PCMCIA support" 45 + select CRC32 45 46 default y 46 47 ---help--- 47 48 This option enables support for 16-bit PCMCIA cards. Most older 48 49 PC-cards are such 16-bit PCMCIA cards, so unless you know you're 49 50 only using 32-bit CardBus cards, say Y or M here. 50 51 51 - To use 16-bit PCMCIA cards, you will need supporting software from 52 - David Hinds' pcmcia-cs package (see the file <file:Documentation/Changes> 53 - for location). Please also read the PCMCIA-HOWTO, available from 54 - <http://www.tldp.org/docs.html#howto>. 52 + To use 16-bit PCMCIA cards, you will need supporting software in 53 + most cases. (see the file <file:Documentation/Changes> for 54 + location and details). 55 55 56 56 To compile this driver as modules, choose M here: the 57 57 module will be called pcmcia. 58 58 59 59 If unsure, say Y. 60 + 61 + config PCMCIA_LOAD_CIS 62 + bool "Load CIS updates from userspace (EXPERIMENTAL)" 63 + depends on PCMCIA && EXPERIMENTAL 64 + select FW_LOADER 65 + default y 66 + help 67 + Some PCMCIA cards require an updated Card Information Structure (CIS) 68 + to be loaded from userspace to work correctly. If you say Y here, 69 + and your userspace is arranged correctly, this will be loaded 70 + automatically using the in-kernel firmware loader and the hotplug 71 + subsystem, instead of relying on cardmgr from pcmcia-cs to do so. 72 + 73 + If unsure, say Y. 74 + 75 + config PCMCIA_IOCTL 76 + bool 77 + depends on PCMCIA 78 + default y 79 + help 80 + If you say Y here, the deprecated ioctl interface to the PCMCIA 81 + subsystem will be built. It is needed by cardmgr and cardctl 82 + (pcmcia-cs) to function properly. 83 + 84 + If you do not use the new pcmciautils package, and have a 85 + yenta, Cirrus PD6729, i82092, i82365 or tcic compatible bridge, 86 + you need to say Y here to be able to use 16-bit PCMCIA cards. 87 + 88 + If unsure, say Y. 60 89 61 90 config CARDBUS 62 91 bool "32-bit CardBus support" ··· 106 77 107 78 config YENTA 108 79 tristate "CardBus yenta-compatible bridge support" 109 - depends on PCI 110 - #fixme: remove dependendcy on CARDBUS 111 80 depends on CARDBUS 112 81 select PCCARD_NONSTATIC 113 82 ---help---
+2 -1
drivers/pcmcia/Makefile
··· 10 10 pcmcia_core-$(CONFIG_CARDBUS) += cardbus.o 11 11 obj-$(CONFIG_PCCARD) += pcmcia_core.o 12 12 13 - pcmcia-y += ds.o pcmcia_compat.o 13 + pcmcia-y += ds.o pcmcia_compat.o pcmcia_resource.o 14 + pcmcia-$(CONFIG_PCMCIA_IOCTL) += pcmcia_ioctl.o 14 15 obj-$(CONFIG_PCMCIA) += pcmcia.o 15 16 16 17 obj-$(CONFIG_PCCARD_NONSTATIC) += rsrc_nonstatic.o
+20 -8
drivers/pcmcia/cistpl.c
··· 89 89 set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags) 90 90 { 91 91 pccard_mem_map *mem = &s->cis_mem; 92 + int ret; 93 + 92 94 if (!(s->features & SS_CAP_STATIC_MAP) && mem->res == NULL) { 93 - mem->res = find_mem_region(0, s->map_size, s->map_size, 0, s); 95 + mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s); 94 96 if (mem->res == NULL) { 95 97 printk(KERN_NOTICE "cs: unable to map card memory!\n"); 96 98 return NULL; ··· 101 99 } 102 100 mem->card_start = card_offset; 103 101 mem->flags = flags; 104 - s->ops->set_mem_map(s, mem); 102 + ret = s->ops->set_mem_map(s, mem); 103 + if (ret) { 104 + iounmap(s->cis_virt); 105 + return NULL; 106 + } 107 + 105 108 if (s->features & SS_CAP_STATIC_MAP) { 106 109 if (s->cis_virt) 107 110 iounmap(s->cis_virt); ··· 126 119 #define IS_ATTR 1 127 120 #define IS_INDIRECT 8 128 121 129 - int read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, 122 + int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, 130 123 u_int len, void *ptr) 131 124 { 132 125 void __iomem *sys, *end; 133 126 unsigned char *buf = ptr; 134 127 135 - cs_dbg(s, 3, "read_cis_mem(%d, %#x, %u)\n", attr, addr, len); 128 + cs_dbg(s, 3, "pcmcia_read_cis_mem(%d, %#x, %u)\n", attr, addr, len); 136 129 137 130 if (attr & IS_INDIRECT) { 138 131 /* Indirect accesses use a bunch of special registers at fixed ··· 189 182 *(u_char *)(ptr+2), *(u_char *)(ptr+3)); 190 183 return 0; 191 184 } 185 + EXPORT_SYMBOL(pcmcia_read_cis_mem); 192 186 193 - void write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, 187 + 188 + void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, 194 189 u_int len, void *ptr) 195 190 { 196 191 void __iomem *sys, *end; 197 192 unsigned char *buf = ptr; 198 193 199 - cs_dbg(s, 3, "write_cis_mem(%d, %#x, %u)\n", attr, addr, len); 194 + cs_dbg(s, 3, "pcmcia_write_cis_mem(%d, %#x, %u)\n", attr, addr, len); 200 195 201 196 if (attr & IS_INDIRECT) { 202 197 /* Indirect accesses use a bunch of special registers at fixed ··· 248 239 } 249 240 } 250 241 } 242 + EXPORT_SYMBOL(pcmcia_write_cis_mem); 243 + 251 244 252 245 /*====================================================================== 253 246 ··· 285 274 ret = read_cb_mem(s, attr, addr, len, ptr); 286 275 else 287 276 #endif 288 - ret = read_cis_mem(s, attr, addr, len, ptr); 277 + ret = pcmcia_read_cis_mem(s, attr, addr, len, ptr); 289 278 290 279 if (ret == 0) { 291 280 /* Copy data into the cache */ ··· 359 348 read_cb_mem(s, cis->attr, cis->addr, len, buf); 360 349 else 361 350 #endif 362 - read_cis_mem(s, cis->attr, cis->addr, len, buf); 351 + pcmcia_read_cis_mem(s, cis->attr, cis->addr, len, buf); 363 352 364 353 if (memcmp(buf, cis->cache, len) != 0) { 365 354 kfree(buf); ··· 392 381 memcpy(s->fake_cis, cis->Data, cis->Length); 393 382 return CS_SUCCESS; 394 383 } 384 + EXPORT_SYMBOL(pcmcia_replace_cis); 395 385 396 386 /*====================================================================== 397 387
+91 -1073
drivers/pcmcia/cs.c
··· 43 43 #include <pcmcia/ds.h> 44 44 #include "cs_internal.h" 45 45 46 - #ifdef CONFIG_PCI 47 - #define PCI_OPT " [pci]" 48 - #else 49 - #define PCI_OPT "" 50 - #endif 51 - #ifdef CONFIG_CARDBUS 52 - #define CB_OPT " [cardbus]" 53 - #else 54 - #define CB_OPT "" 55 - #endif 56 - #ifdef CONFIG_PM 57 - #define PM_OPT " [pm]" 58 - #else 59 - #define PM_OPT "" 60 - #endif 61 - #if !defined(CONFIG_CARDBUS) && !defined(CONFIG_PCI) && !defined(CONFIG_PM) 62 - #define OPTIONS " none" 63 - #else 64 - #define OPTIONS PCI_OPT CB_OPT PM_OPT 65 - #endif 66 - 67 - static const char *release = "Linux Kernel Card Services"; 68 - static const char *options = "options: " OPTIONS; 69 - 70 - /*====================================================================*/ 71 46 72 47 /* Module parameters */ 73 48 74 49 MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>"); 75 - MODULE_DESCRIPTION("Linux Kernel Card Services\noptions:" OPTIONS); 50 + MODULE_DESCRIPTION("Linux Kernel Card Services"); 76 51 MODULE_LICENSE("GPL"); 77 52 78 53 #define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0444) ··· 64 89 /* Access speed for attribute memory windows */ 65 90 INT_MODULE_PARM(cis_speed, 300); /* ns */ 66 91 67 - /* Access speed for IO windows */ 68 - INT_MODULE_PARM(io_speed, 0); /* ns */ 69 - 70 92 #ifdef DEBUG 71 93 static int pc_debug; 72 94 ··· 75 103 } 76 104 #endif 77 105 78 - /*====================================================================*/ 79 106 80 107 socket_state_t dead_socket = { 81 108 .csc_mask = SS_DETECT, 82 109 }; 110 + EXPORT_SYMBOL(dead_socket); 83 111 84 112 85 113 /* List of all sockets, protected by a rwsem */ 86 114 LIST_HEAD(pcmcia_socket_list); 87 - DECLARE_RWSEM(pcmcia_socket_list_rwsem); 88 115 EXPORT_SYMBOL(pcmcia_socket_list); 116 + 117 + DECLARE_RWSEM(pcmcia_socket_list_rwsem); 89 118 EXPORT_SYMBOL(pcmcia_socket_list_rwsem); 90 119 91 120 92 - #ifdef CONFIG_PCMCIA_PROBE 93 - /* mask ofIRQs already reserved by other cards, we should avoid using them */ 94 - static u8 pcmcia_used_irq[NR_IRQS]; 95 - #endif 96 - 97 - /*==================================================================== 98 - 99 - Low-level PC Card interface drivers need to register with Card 100 - Services using these calls. 101 - 102 - ======================================================================*/ 103 - 104 121 /** 105 - * socket drivers are expected to use the following callbacks in their 122 + * Low-level PCMCIA socket drivers need to register with the PCCard 123 + * core using pcmcia_register_socket. 124 + * 125 + * socket drivers are expected to use the following callbacks in their 106 126 * .drv struct: 107 127 * - pcmcia_socket_dev_suspend 108 128 * - pcmcia_socket_dev_resume ··· 194 230 } 195 231 196 232 /* try to obtain a socket number [yes, it gets ugly if we 197 - * register more than 2^sizeof(unsigned int) pcmcia 198 - * sockets... but the socket number is deprecated 233 + * register more than 2^sizeof(unsigned int) pcmcia 234 + * sockets... but the socket number is deprecated 199 235 * anyways, so I don't care] */ 200 236 down_write(&pcmcia_socket_list_rwsem); 201 237 if (list_empty(&pcmcia_socket_list)) ··· 304 340 EXPORT_SYMBOL(pcmcia_get_socket_by_nr); 305 341 306 342 307 - /*====================================================================== 308 - 309 - socket_setup() and shutdown_socket() are called by the main event 310 - handler when card insertion and removal events are received. 311 - socket_setup() turns on socket power and resets the socket, in two stages. 312 - shutdown_socket() unconfigures a socket and turns off socket power. 313 - 314 - ======================================================================*/ 315 - 343 + /** 344 + * socket_setup() and shutdown_socket() are called by the main event 345 + * handler when card insertion and removal events are received. 346 + * socket_setup() turns on socket power and resets the socket, in two stages. 347 + * shutdown_socket() unconfigures a socket and turns off socket power. 348 + */ 316 349 static void shutdown_socket(struct pcmcia_socket *s) 317 350 { 318 - cs_dbg(s, 1, "shutdown_socket\n"); 351 + cs_dbg(s, 1, "shutdown_socket\n"); 319 352 320 - /* Blank out the socket state */ 321 - s->socket = dead_socket; 322 - s->ops->init(s); 323 - s->ops->set_socket(s, &s->socket); 324 - s->irq.AssignedIRQ = s->irq.Config = 0; 325 - s->lock_count = 0; 326 - destroy_cis_cache(s); 353 + /* Blank out the socket state */ 354 + s->socket = dead_socket; 355 + s->ops->init(s); 356 + s->ops->set_socket(s, &s->socket); 357 + s->irq.AssignedIRQ = s->irq.Config = 0; 358 + s->lock_count = 0; 359 + destroy_cis_cache(s); 327 360 #ifdef CONFIG_CARDBUS 328 - cb_free(s); 361 + cb_free(s); 329 362 #endif 330 - s->functions = 0; 331 - if (s->config) { 332 - kfree(s->config); 333 - s->config = NULL; 334 - } 335 - 336 - { 337 - int status; 338 - s->ops->get_status(s, &status); 339 - if (status & SS_POWERON) { 340 - printk(KERN_ERR "PCMCIA: socket %p: *** DANGER *** unable to remove socket power\n", s); 363 + s->functions = 0; 364 + if (s->config) { 365 + kfree(s->config); 366 + s->config = NULL; 341 367 } 342 - } 368 + 369 + { 370 + int status; 371 + s->ops->get_status(s, &status); 372 + if (status & SS_POWERON) { 373 + printk(KERN_ERR "PCMCIA: socket %p: *** DANGER *** unable to remove socket power\n", s); 374 + } 375 + } 343 376 } /* shutdown_socket */ 344 377 345 - /*====================================================================== 346 378 347 - The central event handler. Send_event() sends an event to the 348 - 16-bit subsystem, which then calls the relevant device drivers. 349 - Parse_events() interprets the event bits from 350 - a card status change report. Do_shutdown() handles the high 351 - priority stuff associated with a card removal. 352 - 353 - ======================================================================*/ 354 - 379 + /** 380 + * The central event handler. Send_event() sends an event to the 381 + * 16-bit subsystem, which then calls the relevant device drivers. 382 + * Parse_events() interprets the event bits from 383 + * a card status change report. Do_shutdown() handles the high 384 + * priority stuff associated with a card removal. 385 + */ 355 386 356 387 /* NOTE: send_event needs to be called with skt->sem held. */ 357 388 ··· 705 746 wake_up(&s->thread_wait); 706 747 } 707 748 } /* pcmcia_parse_events */ 749 + EXPORT_SYMBOL(pcmcia_parse_events); 708 750 709 - 710 - /*====================================================================== 711 - 712 - Special stuff for managing IO windows, because they are scarce. 713 - 714 - ======================================================================*/ 715 - 716 - static int alloc_io_space(struct pcmcia_socket *s, u_int attr, ioaddr_t *base, 717 - ioaddr_t num, u_int lines) 718 - { 719 - int i; 720 - kio_addr_t try, align; 721 - 722 - align = (*base) ? (lines ? 1<<lines : 0) : 1; 723 - if (align && (align < num)) { 724 - if (*base) { 725 - cs_dbg(s, 0, "odd IO request: num %#x align %#lx\n", 726 - num, align); 727 - align = 0; 728 - } else 729 - while (align && (align < num)) align <<= 1; 730 - } 731 - if (*base & ~(align-1)) { 732 - cs_dbg(s, 0, "odd IO request: base %#x align %#lx\n", 733 - *base, align); 734 - align = 0; 735 - } 736 - if ((s->features & SS_CAP_STATIC_MAP) && s->io_offset) { 737 - *base = s->io_offset | (*base & 0x0fff); 738 - return 0; 739 - } 740 - /* Check for an already-allocated window that must conflict with 741 - what was asked for. It is a hack because it does not catch all 742 - potential conflicts, just the most obvious ones. */ 743 - for (i = 0; i < MAX_IO_WIN; i++) 744 - if ((s->io[i].NumPorts != 0) && 745 - ((s->io[i].BasePort & (align-1)) == *base)) 746 - return 1; 747 - for (i = 0; i < MAX_IO_WIN; i++) { 748 - if (s->io[i].NumPorts == 0) { 749 - s->io[i].res = find_io_region(*base, num, align, s); 750 - if (s->io[i].res) { 751 - s->io[i].Attributes = attr; 752 - s->io[i].BasePort = *base = s->io[i].res->start; 753 - s->io[i].NumPorts = s->io[i].InUse = num; 754 - break; 755 - } else 756 - return 1; 757 - } else if (s->io[i].Attributes != attr) 758 - continue; 759 - /* Try to extend top of window */ 760 - try = s->io[i].BasePort + s->io[i].NumPorts; 761 - if ((*base == 0) || (*base == try)) 762 - if (adjust_io_region(s->io[i].res, s->io[i].res->start, 763 - s->io[i].res->end + num, s) == 0) { 764 - *base = try; 765 - s->io[i].NumPorts += num; 766 - s->io[i].InUse += num; 767 - break; 768 - } 769 - /* Try to extend bottom of window */ 770 - try = s->io[i].BasePort - num; 771 - if ((*base == 0) || (*base == try)) 772 - if (adjust_io_region(s->io[i].res, s->io[i].res->start - num, 773 - s->io[i].res->end, s) == 0) { 774 - s->io[i].BasePort = *base = try; 775 - s->io[i].NumPorts += num; 776 - s->io[i].InUse += num; 777 - break; 778 - } 779 - } 780 - return (i == MAX_IO_WIN); 781 - } /* alloc_io_space */ 782 - 783 - static void release_io_space(struct pcmcia_socket *s, ioaddr_t base, 784 - ioaddr_t num) 785 - { 786 - int i; 787 - 788 - for (i = 0; i < MAX_IO_WIN; i++) { 789 - if ((s->io[i].BasePort <= base) && 790 - (s->io[i].BasePort+s->io[i].NumPorts >= base+num)) { 791 - s->io[i].InUse -= num; 792 - /* Free the window if no one else is using it */ 793 - if (s->io[i].InUse == 0) { 794 - s->io[i].NumPorts = 0; 795 - release_resource(s->io[i].res); 796 - kfree(s->io[i].res); 797 - s->io[i].res = NULL; 798 - } 799 - } 800 - } 801 - } 802 - 803 - /*====================================================================== 804 - 805 - Access_configuration_register() reads and writes configuration 806 - registers in attribute memory. Memory window 0 is reserved for 807 - this and the tuple reading services. 808 - 809 - ======================================================================*/ 810 - 811 - int pccard_access_configuration_register(struct pcmcia_socket *s, 812 - unsigned int function, 813 - conf_reg_t *reg) 814 - { 815 - config_t *c; 816 - int addr; 817 - u_char val; 818 - 819 - if (!s || !s->config) 820 - return CS_NO_CARD; 821 - 822 - c = &s->config[function]; 823 - 824 - if (c == NULL) 825 - return CS_NO_CARD; 826 - 827 - if (!(c->state & CONFIG_LOCKED)) 828 - return CS_CONFIGURATION_LOCKED; 829 - 830 - addr = (c->ConfigBase + reg->Offset) >> 1; 831 - 832 - switch (reg->Action) { 833 - case CS_READ: 834 - read_cis_mem(s, 1, addr, 1, &val); 835 - reg->Value = val; 836 - break; 837 - case CS_WRITE: 838 - val = reg->Value; 839 - write_cis_mem(s, 1, addr, 1, &val); 840 - break; 841 - default: 842 - return CS_BAD_ARGS; 843 - break; 844 - } 845 - return CS_SUCCESS; 846 - } /* access_configuration_register */ 847 - EXPORT_SYMBOL(pccard_access_configuration_register); 848 - 849 - 850 - /*====================================================================*/ 851 - 852 - int pccard_get_configuration_info(struct pcmcia_socket *s, 853 - unsigned int function, 854 - config_info_t *config) 855 - { 856 - config_t *c; 857 - 858 - if (!(s->state & SOCKET_PRESENT)) 859 - return CS_NO_CARD; 860 - 861 - config->Function = function; 862 - 863 - #ifdef CONFIG_CARDBUS 864 - if (s->state & SOCKET_CARDBUS) { 865 - memset(config, 0, sizeof(config_info_t)); 866 - config->Vcc = s->socket.Vcc; 867 - config->Vpp1 = config->Vpp2 = s->socket.Vpp; 868 - config->Option = s->cb_dev->subordinate->number; 869 - if (s->state & SOCKET_CARDBUS_CONFIG) { 870 - config->Attributes = CONF_VALID_CLIENT; 871 - config->IntType = INT_CARDBUS; 872 - config->AssignedIRQ = s->irq.AssignedIRQ; 873 - if (config->AssignedIRQ) 874 - config->Attributes |= CONF_ENABLE_IRQ; 875 - config->BasePort1 = s->io[0].BasePort; 876 - config->NumPorts1 = s->io[0].NumPorts; 877 - } 878 - return CS_SUCCESS; 879 - } 880 - #endif 881 - 882 - c = (s->config != NULL) ? &s->config[function] : NULL; 883 - 884 - if ((c == NULL) || !(c->state & CONFIG_LOCKED)) { 885 - config->Attributes = 0; 886 - config->Vcc = s->socket.Vcc; 887 - config->Vpp1 = config->Vpp2 = s->socket.Vpp; 888 - return CS_SUCCESS; 889 - } 890 - 891 - /* !!! This is a hack !!! */ 892 - memcpy(&config->Attributes, &c->Attributes, sizeof(config_t)); 893 - config->Attributes |= CONF_VALID_CLIENT; 894 - config->CardValues = c->CardValues; 895 - config->IRQAttributes = c->irq.Attributes; 896 - config->AssignedIRQ = s->irq.AssignedIRQ; 897 - config->BasePort1 = c->io.BasePort1; 898 - config->NumPorts1 = c->io.NumPorts1; 899 - config->Attributes1 = c->io.Attributes1; 900 - config->BasePort2 = c->io.BasePort2; 901 - config->NumPorts2 = c->io.NumPorts2; 902 - config->Attributes2 = c->io.Attributes2; 903 - config->IOAddrLines = c->io.IOAddrLines; 904 - 905 - return CS_SUCCESS; 906 - } /* get_configuration_info */ 907 - EXPORT_SYMBOL(pccard_get_configuration_info); 908 - 909 - /*====================================================================== 910 - 911 - Return information about this version of Card Services. 912 - 913 - ======================================================================*/ 914 - 915 - int pcmcia_get_card_services_info(servinfo_t *info) 916 - { 917 - unsigned int socket_count = 0; 918 - struct list_head *tmp; 919 - info->Signature[0] = 'C'; 920 - info->Signature[1] = 'S'; 921 - down_read(&pcmcia_socket_list_rwsem); 922 - list_for_each(tmp, &pcmcia_socket_list) 923 - socket_count++; 924 - up_read(&pcmcia_socket_list_rwsem); 925 - info->Count = socket_count; 926 - info->Revision = CS_RELEASE_CODE; 927 - info->CSLevel = 0x0210; 928 - info->VendorString = (char *)release; 929 - return CS_SUCCESS; 930 - } /* get_card_services_info */ 931 - 932 - 933 - /*====================================================================*/ 934 - 935 - int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req) 936 - { 937 - window_t *win; 938 - int w; 939 - 940 - if (!s || !(s->state & SOCKET_PRESENT)) 941 - return CS_NO_CARD; 942 - for (w = idx; w < MAX_WIN; w++) 943 - if (s->state & SOCKET_WIN_REQ(w)) break; 944 - if (w == MAX_WIN) 945 - return CS_NO_MORE_ITEMS; 946 - win = &s->win[w]; 947 - req->Base = win->ctl.res->start; 948 - req->Size = win->ctl.res->end - win->ctl.res->start + 1; 949 - req->AccessSpeed = win->ctl.speed; 950 - req->Attributes = 0; 951 - if (win->ctl.flags & MAP_ATTRIB) 952 - req->Attributes |= WIN_MEMORY_TYPE_AM; 953 - if (win->ctl.flags & MAP_ACTIVE) 954 - req->Attributes |= WIN_ENABLE; 955 - if (win->ctl.flags & MAP_16BIT) 956 - req->Attributes |= WIN_DATA_WIDTH_16; 957 - if (win->ctl.flags & MAP_USE_WAIT) 958 - req->Attributes |= WIN_USE_WAIT; 959 - *handle = win; 960 - return CS_SUCCESS; 961 - } /* get_window */ 962 - EXPORT_SYMBOL(pcmcia_get_window); 963 - 964 - /*===================================================================== 965 - 966 - Return the PCI device associated with a card.. 967 - 968 - ======================================================================*/ 969 - 970 - #ifdef CONFIG_CARDBUS 971 - 972 - struct pci_bus *pcmcia_lookup_bus(struct pcmcia_socket *s) 973 - { 974 - if (!s || !(s->state & SOCKET_CARDBUS)) 975 - return NULL; 976 - 977 - return s->cb_dev->subordinate; 978 - } 979 - 980 - EXPORT_SYMBOL(pcmcia_lookup_bus); 981 - 982 - #endif 983 - 984 - /*====================================================================== 985 - 986 - Get the current socket state bits. We don't support the latched 987 - SocketState yet: I haven't seen any point for it. 988 - 989 - ======================================================================*/ 990 - 991 - int pccard_get_status(struct pcmcia_socket *s, unsigned int function, cs_status_t *status) 992 - { 993 - config_t *c; 994 - int val; 995 - 996 - s->ops->get_status(s, &val); 997 - status->CardState = status->SocketState = 0; 998 - status->CardState |= (val & SS_DETECT) ? CS_EVENT_CARD_DETECT : 0; 999 - status->CardState |= (val & SS_CARDBUS) ? CS_EVENT_CB_DETECT : 0; 1000 - status->CardState |= (val & SS_3VCARD) ? CS_EVENT_3VCARD : 0; 1001 - status->CardState |= (val & SS_XVCARD) ? CS_EVENT_XVCARD : 0; 1002 - if (s->state & SOCKET_SUSPEND) 1003 - status->CardState |= CS_EVENT_PM_SUSPEND; 1004 - if (!(s->state & SOCKET_PRESENT)) 1005 - return CS_NO_CARD; 1006 - 1007 - c = (s->config != NULL) ? &s->config[function] : NULL; 1008 - if ((c != NULL) && (c->state & CONFIG_LOCKED) && 1009 - (c->IntType & (INT_MEMORY_AND_IO | INT_ZOOMED_VIDEO))) { 1010 - u_char reg; 1011 - if (c->Present & PRESENT_PIN_REPLACE) { 1012 - read_cis_mem(s, 1, (c->ConfigBase+CISREG_PRR)>>1, 1, &reg); 1013 - status->CardState |= 1014 - (reg & PRR_WP_STATUS) ? CS_EVENT_WRITE_PROTECT : 0; 1015 - status->CardState |= 1016 - (reg & PRR_READY_STATUS) ? CS_EVENT_READY_CHANGE : 0; 1017 - status->CardState |= 1018 - (reg & PRR_BVD2_STATUS) ? CS_EVENT_BATTERY_LOW : 0; 1019 - status->CardState |= 1020 - (reg & PRR_BVD1_STATUS) ? CS_EVENT_BATTERY_DEAD : 0; 1021 - } else { 1022 - /* No PRR? Then assume we're always ready */ 1023 - status->CardState |= CS_EVENT_READY_CHANGE; 1024 - } 1025 - if (c->Present & PRESENT_EXT_STATUS) { 1026 - read_cis_mem(s, 1, (c->ConfigBase+CISREG_ESR)>>1, 1, &reg); 1027 - status->CardState |= 1028 - (reg & ESR_REQ_ATTN) ? CS_EVENT_REQUEST_ATTENTION : 0; 1029 - } 1030 - return CS_SUCCESS; 1031 - } 1032 - status->CardState |= 1033 - (val & SS_WRPROT) ? CS_EVENT_WRITE_PROTECT : 0; 1034 - status->CardState |= 1035 - (val & SS_BATDEAD) ? CS_EVENT_BATTERY_DEAD : 0; 1036 - status->CardState |= 1037 - (val & SS_BATWARN) ? CS_EVENT_BATTERY_LOW : 0; 1038 - status->CardState |= 1039 - (val & SS_READY) ? CS_EVENT_READY_CHANGE : 0; 1040 - return CS_SUCCESS; 1041 - } /* get_status */ 1042 - EXPORT_SYMBOL(pccard_get_status); 1043 - 1044 - /*====================================================================== 1045 - 1046 - Change the card address of an already open memory window. 1047 - 1048 - ======================================================================*/ 1049 - 1050 - int pcmcia_get_mem_page(window_handle_t win, memreq_t *req) 1051 - { 1052 - if ((win == NULL) || (win->magic != WINDOW_MAGIC)) 1053 - return CS_BAD_HANDLE; 1054 - req->Page = 0; 1055 - req->CardOffset = win->ctl.card_start; 1056 - return CS_SUCCESS; 1057 - } /* get_mem_page */ 1058 - 1059 - int pcmcia_map_mem_page(window_handle_t win, memreq_t *req) 1060 - { 1061 - struct pcmcia_socket *s; 1062 - if ((win == NULL) || (win->magic != WINDOW_MAGIC)) 1063 - return CS_BAD_HANDLE; 1064 - if (req->Page != 0) 1065 - return CS_BAD_PAGE; 1066 - s = win->sock; 1067 - win->ctl.card_start = req->CardOffset; 1068 - if (s->ops->set_mem_map(s, &win->ctl) != 0) 1069 - return CS_BAD_OFFSET; 1070 - return CS_SUCCESS; 1071 - } /* map_mem_page */ 1072 - 1073 - /*====================================================================== 1074 - 1075 - Modify a locked socket configuration 1076 - 1077 - ======================================================================*/ 1078 - 1079 - int pcmcia_modify_configuration(client_handle_t handle, 1080 - modconf_t *mod) 1081 - { 1082 - struct pcmcia_socket *s; 1083 - config_t *c; 1084 - 1085 - if (CHECK_HANDLE(handle)) 1086 - return CS_BAD_HANDLE; 1087 - s = SOCKET(handle); c = CONFIG(handle); 1088 - if (!(s->state & SOCKET_PRESENT)) 1089 - return CS_NO_CARD; 1090 - if (!(c->state & CONFIG_LOCKED)) 1091 - return CS_CONFIGURATION_LOCKED; 1092 - 1093 - if (mod->Attributes & CONF_IRQ_CHANGE_VALID) { 1094 - if (mod->Attributes & CONF_ENABLE_IRQ) { 1095 - c->Attributes |= CONF_ENABLE_IRQ; 1096 - s->socket.io_irq = s->irq.AssignedIRQ; 1097 - } else { 1098 - c->Attributes &= ~CONF_ENABLE_IRQ; 1099 - s->socket.io_irq = 0; 1100 - } 1101 - s->ops->set_socket(s, &s->socket); 1102 - } 1103 - 1104 - if (mod->Attributes & CONF_VCC_CHANGE_VALID) 1105 - return CS_BAD_VCC; 1106 - 1107 - /* We only allow changing Vpp1 and Vpp2 to the same value */ 1108 - if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) && 1109 - (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { 1110 - if (mod->Vpp1 != mod->Vpp2) 1111 - return CS_BAD_VPP; 1112 - c->Vpp1 = c->Vpp2 = s->socket.Vpp = mod->Vpp1; 1113 - if (s->ops->set_socket(s, &s->socket)) 1114 - return CS_BAD_VPP; 1115 - } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) || 1116 - (mod->Attributes & CONF_VPP2_CHANGE_VALID)) 1117 - return CS_BAD_VPP; 1118 - 1119 - return CS_SUCCESS; 1120 - } /* modify_configuration */ 1121 751 1122 752 /* register pcmcia_callback */ 1123 753 int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c) ··· 736 1188 } 737 1189 EXPORT_SYMBOL(pccard_register_pcmcia); 738 1190 739 - /*====================================================================*/ 740 1191 741 - int pcmcia_release_configuration(client_handle_t handle) 742 - { 743 - pccard_io_map io = { 0, 0, 0, 0, 1 }; 744 - struct pcmcia_socket *s; 745 - int i; 746 - 747 - if (CHECK_HANDLE(handle) || 748 - !(handle->state & CLIENT_CONFIG_LOCKED)) 749 - return CS_BAD_HANDLE; 750 - handle->state &= ~CLIENT_CONFIG_LOCKED; 751 - s = SOCKET(handle); 752 - 753 - #ifdef CONFIG_CARDBUS 754 - if (handle->state & CLIENT_CARDBUS) 755 - return CS_SUCCESS; 756 - #endif 757 - 758 - if (!(handle->state & CLIENT_STALE)) { 759 - config_t *c = CONFIG(handle); 760 - if (--(s->lock_count) == 0) { 761 - s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ 762 - s->socket.Vpp = 0; 763 - s->socket.io_irq = 0; 764 - s->ops->set_socket(s, &s->socket); 765 - } 766 - if (c->state & CONFIG_IO_REQ) 767 - for (i = 0; i < MAX_IO_WIN; i++) { 768 - if (s->io[i].NumPorts == 0) 769 - continue; 770 - s->io[i].Config--; 771 - if (s->io[i].Config != 0) 772 - continue; 773 - io.map = i; 774 - s->ops->set_io_map(s, &io); 775 - } 776 - c->state &= ~CONFIG_LOCKED; 777 - } 778 - 779 - return CS_SUCCESS; 780 - } /* release_configuration */ 781 - 782 - /*====================================================================== 783 - 784 - Release_io() releases the I/O ranges allocated by a client. This 785 - may be invoked some time after a card ejection has already dumped 786 - the actual socket configuration, so if the client is "stale", we 787 - don't bother checking the port ranges against the current socket 788 - values. 789 - 790 - ======================================================================*/ 791 - 792 - int pcmcia_release_io(client_handle_t handle, io_req_t *req) 793 - { 794 - struct pcmcia_socket *s; 795 - 796 - if (CHECK_HANDLE(handle) || !(handle->state & CLIENT_IO_REQ)) 797 - return CS_BAD_HANDLE; 798 - handle->state &= ~CLIENT_IO_REQ; 799 - s = SOCKET(handle); 800 - 801 - #ifdef CONFIG_CARDBUS 802 - if (handle->state & CLIENT_CARDBUS) 803 - return CS_SUCCESS; 804 - #endif 805 - 806 - if (!(handle->state & CLIENT_STALE)) { 807 - config_t *c = CONFIG(handle); 808 - if (c->state & CONFIG_LOCKED) 809 - return CS_CONFIGURATION_LOCKED; 810 - if ((c->io.BasePort1 != req->BasePort1) || 811 - (c->io.NumPorts1 != req->NumPorts1) || 812 - (c->io.BasePort2 != req->BasePort2) || 813 - (c->io.NumPorts2 != req->NumPorts2)) 814 - return CS_BAD_ARGS; 815 - c->state &= ~CONFIG_IO_REQ; 816 - } 817 - 818 - release_io_space(s, req->BasePort1, req->NumPorts1); 819 - if (req->NumPorts2) 820 - release_io_space(s, req->BasePort2, req->NumPorts2); 821 - 822 - return CS_SUCCESS; 823 - } /* release_io */ 824 - 825 - /*====================================================================*/ 826 - 827 - int pcmcia_release_irq(client_handle_t handle, irq_req_t *req) 828 - { 829 - struct pcmcia_socket *s; 830 - if (CHECK_HANDLE(handle) || !(handle->state & CLIENT_IRQ_REQ)) 831 - return CS_BAD_HANDLE; 832 - handle->state &= ~CLIENT_IRQ_REQ; 833 - s = SOCKET(handle); 834 - 835 - if (!(handle->state & CLIENT_STALE)) { 836 - config_t *c = CONFIG(handle); 837 - if (c->state & CONFIG_LOCKED) 838 - return CS_CONFIGURATION_LOCKED; 839 - if (c->irq.Attributes != req->Attributes) 840 - return CS_BAD_ATTRIBUTE; 841 - if (s->irq.AssignedIRQ != req->AssignedIRQ) 842 - return CS_BAD_IRQ; 843 - if (--s->irq.Config == 0) { 844 - c->state &= ~CONFIG_IRQ_REQ; 845 - s->irq.AssignedIRQ = 0; 846 - } 847 - } 848 - 849 - if (req->Attributes & IRQ_HANDLE_PRESENT) { 850 - free_irq(req->AssignedIRQ, req->Instance); 851 - } 852 - 853 - #ifdef CONFIG_PCMCIA_PROBE 854 - pcmcia_used_irq[req->AssignedIRQ]--; 855 - #endif 856 - 857 - return CS_SUCCESS; 858 - } /* cs_release_irq */ 859 - 860 - /*====================================================================*/ 861 - 862 - int pcmcia_release_window(window_handle_t win) 863 - { 864 - struct pcmcia_socket *s; 865 - 866 - if ((win == NULL) || (win->magic != WINDOW_MAGIC)) 867 - return CS_BAD_HANDLE; 868 - s = win->sock; 869 - if (!(win->handle->state & CLIENT_WIN_REQ(win->index))) 870 - return CS_BAD_HANDLE; 871 - 872 - /* Shut down memory window */ 873 - win->ctl.flags &= ~MAP_ACTIVE; 874 - s->ops->set_mem_map(s, &win->ctl); 875 - s->state &= ~SOCKET_WIN_REQ(win->index); 876 - 877 - /* Release system memory */ 878 - if (win->ctl.res) { 879 - release_resource(win->ctl.res); 880 - kfree(win->ctl.res); 881 - win->ctl.res = NULL; 882 - } 883 - win->handle->state &= ~CLIENT_WIN_REQ(win->index); 884 - 885 - win->magic = 0; 886 - 887 - return CS_SUCCESS; 888 - } /* release_window */ 889 - 890 - /*====================================================================*/ 891 - 892 - int pcmcia_request_configuration(client_handle_t handle, 893 - config_req_t *req) 894 - { 895 - int i; 896 - u_int base; 897 - struct pcmcia_socket *s; 898 - config_t *c; 899 - pccard_io_map iomap; 900 - 901 - if (CHECK_HANDLE(handle)) 902 - return CS_BAD_HANDLE; 903 - s = SOCKET(handle); 904 - if (!(s->state & SOCKET_PRESENT)) 905 - return CS_NO_CARD; 906 - 907 - #ifdef CONFIG_CARDBUS 908 - if (handle->state & CLIENT_CARDBUS) 909 - return CS_UNSUPPORTED_MODE; 910 - #endif 911 - 912 - if (req->IntType & INT_CARDBUS) 913 - return CS_UNSUPPORTED_MODE; 914 - c = CONFIG(handle); 915 - if (c->state & CONFIG_LOCKED) 916 - return CS_CONFIGURATION_LOCKED; 917 - 918 - /* Do power control. We don't allow changes in Vcc. */ 919 - if (s->socket.Vcc != req->Vcc) 920 - return CS_BAD_VCC; 921 - if (req->Vpp1 != req->Vpp2) 922 - return CS_BAD_VPP; 923 - s->socket.Vpp = req->Vpp1; 924 - if (s->ops->set_socket(s, &s->socket)) 925 - return CS_BAD_VPP; 926 - 927 - c->Vcc = req->Vcc; c->Vpp1 = c->Vpp2 = req->Vpp1; 928 - 929 - /* Pick memory or I/O card, DMA mode, interrupt */ 930 - c->IntType = req->IntType; 931 - c->Attributes = req->Attributes; 932 - if (req->IntType & INT_MEMORY_AND_IO) 933 - s->socket.flags |= SS_IOCARD; 934 - if (req->IntType & INT_ZOOMED_VIDEO) 935 - s->socket.flags |= SS_ZVCARD | SS_IOCARD; 936 - if (req->Attributes & CONF_ENABLE_DMA) 937 - s->socket.flags |= SS_DMA_MODE; 938 - if (req->Attributes & CONF_ENABLE_SPKR) 939 - s->socket.flags |= SS_SPKR_ENA; 940 - if (req->Attributes & CONF_ENABLE_IRQ) 941 - s->socket.io_irq = s->irq.AssignedIRQ; 942 - else 943 - s->socket.io_irq = 0; 944 - s->ops->set_socket(s, &s->socket); 945 - s->lock_count++; 946 - 947 - /* Set up CIS configuration registers */ 948 - base = c->ConfigBase = req->ConfigBase; 949 - c->Present = c->CardValues = req->Present; 950 - if (req->Present & PRESENT_COPY) { 951 - c->Copy = req->Copy; 952 - write_cis_mem(s, 1, (base + CISREG_SCR)>>1, 1, &c->Copy); 953 - } 954 - if (req->Present & PRESENT_OPTION) { 955 - if (s->functions == 1) { 956 - c->Option = req->ConfigIndex & COR_CONFIG_MASK; 957 - } else { 958 - c->Option = req->ConfigIndex & COR_MFC_CONFIG_MASK; 959 - c->Option |= COR_FUNC_ENA|COR_IREQ_ENA; 960 - if (req->Present & PRESENT_IOBASE_0) 961 - c->Option |= COR_ADDR_DECODE; 962 - } 963 - if (c->state & CONFIG_IRQ_REQ) 964 - if (!(c->irq.Attributes & IRQ_FORCED_PULSE)) 965 - c->Option |= COR_LEVEL_REQ; 966 - write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &c->Option); 967 - mdelay(40); 968 - } 969 - if (req->Present & PRESENT_STATUS) { 970 - c->Status = req->Status; 971 - write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &c->Status); 972 - } 973 - if (req->Present & PRESENT_PIN_REPLACE) { 974 - c->Pin = req->Pin; 975 - write_cis_mem(s, 1, (base + CISREG_PRR)>>1, 1, &c->Pin); 976 - } 977 - if (req->Present & PRESENT_EXT_STATUS) { 978 - c->ExtStatus = req->ExtStatus; 979 - write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, &c->ExtStatus); 980 - } 981 - if (req->Present & PRESENT_IOBASE_0) { 982 - u_char b = c->io.BasePort1 & 0xff; 983 - write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b); 984 - b = (c->io.BasePort1 >> 8) & 0xff; 985 - write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b); 986 - } 987 - if (req->Present & PRESENT_IOSIZE) { 988 - u_char b = c->io.NumPorts1 + c->io.NumPorts2 - 1; 989 - write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b); 990 - } 991 - 992 - /* Configure I/O windows */ 993 - if (c->state & CONFIG_IO_REQ) { 994 - iomap.speed = io_speed; 995 - for (i = 0; i < MAX_IO_WIN; i++) 996 - if (s->io[i].NumPorts != 0) { 997 - iomap.map = i; 998 - iomap.flags = MAP_ACTIVE; 999 - switch (s->io[i].Attributes & IO_DATA_PATH_WIDTH) { 1000 - case IO_DATA_PATH_WIDTH_16: 1001 - iomap.flags |= MAP_16BIT; break; 1002 - case IO_DATA_PATH_WIDTH_AUTO: 1003 - iomap.flags |= MAP_AUTOSZ; break; 1004 - default: 1005 - break; 1006 - } 1007 - iomap.start = s->io[i].BasePort; 1008 - iomap.stop = iomap.start + s->io[i].NumPorts - 1; 1009 - s->ops->set_io_map(s, &iomap); 1010 - s->io[i].Config++; 1011 - } 1012 - } 1013 - 1014 - c->state |= CONFIG_LOCKED; 1015 - handle->state |= CLIENT_CONFIG_LOCKED; 1016 - return CS_SUCCESS; 1017 - } /* request_configuration */ 1018 - 1019 - /*====================================================================== 1020 - 1021 - Request_io() reserves ranges of port addresses for a socket. 1022 - I have not implemented range sharing or alias addressing. 1023 - 1024 - ======================================================================*/ 1025 - 1026 - int pcmcia_request_io(client_handle_t handle, io_req_t *req) 1027 - { 1028 - struct pcmcia_socket *s; 1029 - config_t *c; 1030 - 1031 - if (CHECK_HANDLE(handle)) 1032 - return CS_BAD_HANDLE; 1033 - s = SOCKET(handle); 1034 - if (!(s->state & SOCKET_PRESENT)) 1035 - return CS_NO_CARD; 1036 - 1037 - if (handle->state & CLIENT_CARDBUS) { 1038 - #ifdef CONFIG_CARDBUS 1039 - handle->state |= CLIENT_IO_REQ; 1040 - return CS_SUCCESS; 1041 - #else 1042 - return CS_UNSUPPORTED_FUNCTION; 1043 - #endif 1044 - } 1045 - 1046 - if (!req) 1047 - return CS_UNSUPPORTED_MODE; 1048 - c = CONFIG(handle); 1049 - if (c->state & CONFIG_LOCKED) 1050 - return CS_CONFIGURATION_LOCKED; 1051 - if (c->state & CONFIG_IO_REQ) 1052 - return CS_IN_USE; 1053 - if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) 1054 - return CS_BAD_ATTRIBUTE; 1055 - if ((req->NumPorts2 > 0) && 1056 - (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) 1057 - return CS_BAD_ATTRIBUTE; 1058 - 1059 - if (alloc_io_space(s, req->Attributes1, &req->BasePort1, 1060 - req->NumPorts1, req->IOAddrLines)) 1061 - return CS_IN_USE; 1062 - 1063 - if (req->NumPorts2) { 1064 - if (alloc_io_space(s, req->Attributes2, &req->BasePort2, 1065 - req->NumPorts2, req->IOAddrLines)) { 1066 - release_io_space(s, req->BasePort1, req->NumPorts1); 1067 - return CS_IN_USE; 1068 - } 1069 - } 1070 - 1071 - c->io = *req; 1072 - c->state |= CONFIG_IO_REQ; 1073 - handle->state |= CLIENT_IO_REQ; 1074 - return CS_SUCCESS; 1075 - } /* request_io */ 1076 - 1077 - /*====================================================================== 1078 - 1079 - Request_irq() reserves an irq for this client. 1080 - 1081 - Also, since Linux only reserves irq's when they are actually 1082 - hooked, we don't guarantee that an irq will still be available 1083 - when the configuration is locked. Now that I think about it, 1084 - there might be a way to fix this using a dummy handler. 1085 - 1086 - ======================================================================*/ 1087 - 1088 - #ifdef CONFIG_PCMCIA_PROBE 1089 - static irqreturn_t test_action(int cpl, void *dev_id, struct pt_regs *regs) 1090 - { 1091 - return IRQ_NONE; 1092 - } 1093 - #endif 1094 - 1095 - int pcmcia_request_irq(client_handle_t handle, irq_req_t *req) 1096 - { 1097 - struct pcmcia_socket *s; 1098 - config_t *c; 1099 - int ret = CS_IN_USE, irq = 0; 1100 - struct pcmcia_device *p_dev = handle_to_pdev(handle); 1101 - 1102 - if (CHECK_HANDLE(handle)) 1103 - return CS_BAD_HANDLE; 1104 - s = SOCKET(handle); 1105 - if (!(s->state & SOCKET_PRESENT)) 1106 - return CS_NO_CARD; 1107 - c = CONFIG(handle); 1108 - if (c->state & CONFIG_LOCKED) 1109 - return CS_CONFIGURATION_LOCKED; 1110 - if (c->state & CONFIG_IRQ_REQ) 1111 - return CS_IN_USE; 1112 - 1113 - #ifdef CONFIG_PCMCIA_PROBE 1114 - if (s->irq.AssignedIRQ != 0) { 1115 - /* If the interrupt is already assigned, it must be the same */ 1116 - irq = s->irq.AssignedIRQ; 1117 - } else { 1118 - int try; 1119 - u32 mask = s->irq_mask; 1120 - void *data = NULL; 1121 - 1122 - for (try = 0; try < 64; try++) { 1123 - irq = try % 32; 1124 - 1125 - /* marked as available by driver, and not blocked by userspace? */ 1126 - if (!((mask >> irq) & 1)) 1127 - continue; 1128 - 1129 - /* avoid an IRQ which is already used by a PCMCIA card */ 1130 - if ((try < 32) && pcmcia_used_irq[irq]) 1131 - continue; 1132 - 1133 - /* register the correct driver, if possible, of check whether 1134 - * registering a dummy handle works, i.e. if the IRQ isn't 1135 - * marked as used by the kernel resource management core */ 1136 - ret = request_irq(irq, 1137 - (req->Attributes & IRQ_HANDLE_PRESENT) ? req->Handler : test_action, 1138 - ((req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) || 1139 - (s->functions > 1) || 1140 - (irq == s->pci_irq)) ? SA_SHIRQ : 0, 1141 - p_dev->dev.bus_id, 1142 - (req->Attributes & IRQ_HANDLE_PRESENT) ? req->Instance : data); 1143 - if (!ret) { 1144 - if (!(req->Attributes & IRQ_HANDLE_PRESENT)) 1145 - free_irq(irq, data); 1146 - break; 1147 - } 1148 - } 1149 - } 1150 - #endif 1151 - if (ret) { 1152 - if (!s->pci_irq) 1153 - return ret; 1154 - irq = s->pci_irq; 1155 - } 1156 - 1157 - if (ret && req->Attributes & IRQ_HANDLE_PRESENT) { 1158 - if (request_irq(irq, req->Handler, 1159 - ((req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) || 1160 - (s->functions > 1) || 1161 - (irq == s->pci_irq)) ? SA_SHIRQ : 0, 1162 - p_dev->dev.bus_id, req->Instance)) 1163 - return CS_IN_USE; 1164 - } 1165 - 1166 - c->irq.Attributes = req->Attributes; 1167 - s->irq.AssignedIRQ = req->AssignedIRQ = irq; 1168 - s->irq.Config++; 1169 - 1170 - c->state |= CONFIG_IRQ_REQ; 1171 - handle->state |= CLIENT_IRQ_REQ; 1172 - 1173 - #ifdef CONFIG_PCMCIA_PROBE 1174 - pcmcia_used_irq[irq]++; 1175 - #endif 1176 - 1177 - return CS_SUCCESS; 1178 - } /* pcmcia_request_irq */ 1179 - 1180 - /*====================================================================== 1181 - 1182 - Request_window() establishes a mapping between card memory space 1183 - and system memory space. 1184 - 1185 - ======================================================================*/ 1186 - 1187 - int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle_t *wh) 1188 - { 1189 - struct pcmcia_socket *s; 1190 - window_t *win; 1191 - u_long align; 1192 - int w; 1193 - 1194 - if (CHECK_HANDLE(*handle)) 1195 - return CS_BAD_HANDLE; 1196 - s = (*handle)->Socket; 1197 - if (!(s->state & SOCKET_PRESENT)) 1198 - return CS_NO_CARD; 1199 - if (req->Attributes & (WIN_PAGED | WIN_SHARED)) 1200 - return CS_BAD_ATTRIBUTE; 1201 - 1202 - /* Window size defaults to smallest available */ 1203 - if (req->Size == 0) 1204 - req->Size = s->map_size; 1205 - align = (((s->features & SS_CAP_MEM_ALIGN) || 1206 - (req->Attributes & WIN_STRICT_ALIGN)) ? 1207 - req->Size : s->map_size); 1208 - if (req->Size & (s->map_size-1)) 1209 - return CS_BAD_SIZE; 1210 - if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || 1211 - (req->Base & (align-1))) 1212 - return CS_BAD_BASE; 1213 - if (req->Base) 1214 - align = 0; 1215 - 1216 - /* Allocate system memory window */ 1217 - for (w = 0; w < MAX_WIN; w++) 1218 - if (!(s->state & SOCKET_WIN_REQ(w))) break; 1219 - if (w == MAX_WIN) 1220 - return CS_OUT_OF_RESOURCE; 1221 - 1222 - win = &s->win[w]; 1223 - win->magic = WINDOW_MAGIC; 1224 - win->index = w; 1225 - win->handle = *handle; 1226 - win->sock = s; 1227 - 1228 - if (!(s->features & SS_CAP_STATIC_MAP)) { 1229 - win->ctl.res = find_mem_region(req->Base, req->Size, align, 1230 - (req->Attributes & WIN_MAP_BELOW_1MB), s); 1231 - if (!win->ctl.res) 1232 - return CS_IN_USE; 1233 - } 1234 - (*handle)->state |= CLIENT_WIN_REQ(w); 1235 - 1236 - /* Configure the socket controller */ 1237 - win->ctl.map = w+1; 1238 - win->ctl.flags = 0; 1239 - win->ctl.speed = req->AccessSpeed; 1240 - if (req->Attributes & WIN_MEMORY_TYPE) 1241 - win->ctl.flags |= MAP_ATTRIB; 1242 - if (req->Attributes & WIN_ENABLE) 1243 - win->ctl.flags |= MAP_ACTIVE; 1244 - if (req->Attributes & WIN_DATA_WIDTH_16) 1245 - win->ctl.flags |= MAP_16BIT; 1246 - if (req->Attributes & WIN_USE_WAIT) 1247 - win->ctl.flags |= MAP_USE_WAIT; 1248 - win->ctl.card_start = 0; 1249 - if (s->ops->set_mem_map(s, &win->ctl) != 0) 1250 - return CS_BAD_ARGS; 1251 - s->state |= SOCKET_WIN_REQ(w); 1252 - 1253 - /* Return window handle */ 1254 - if (s->features & SS_CAP_STATIC_MAP) { 1255 - req->Base = win->ctl.static_start; 1256 - } else { 1257 - req->Base = win->ctl.res->start; 1258 - } 1259 - *wh = win; 1260 - 1261 - return CS_SUCCESS; 1262 - } /* request_window */ 1263 - 1264 - /*====================================================================== 1265 - 1266 - I'm not sure which "reset" function this is supposed to use, 1267 - but for now, it uses the low-level interface's reset, not the 1268 - CIS register. 1269 - 1270 - ======================================================================*/ 1192 + /* I'm not sure which "reset" function this is supposed to use, 1193 + * but for now, it uses the low-level interface's reset, not the 1194 + * CIS register. 1195 + */ 1271 1196 1272 1197 int pccard_reset_card(struct pcmcia_socket *skt) 1273 1198 { 1274 1199 int ret; 1275 - 1200 + 1276 1201 cs_dbg(skt, 1, "resetting socket\n"); 1277 1202 1278 1203 down(&skt->skt_sem); ··· 778 1757 } /* reset_card */ 779 1758 EXPORT_SYMBOL(pccard_reset_card); 780 1759 781 - /*====================================================================== 782 1760 783 - These shut down or wake up a socket. They are sort of user 784 - initiated versions of the APM suspend and resume actions. 785 - 786 - ======================================================================*/ 787 - 1761 + /* These shut down or wake up a socket. They are sort of user 1762 + * initiated versions of the APM suspend and resume actions. 1763 + */ 788 1764 int pcmcia_suspend_card(struct pcmcia_socket *skt) 789 1765 { 790 1766 int ret; 791 - 1767 + 792 1768 cs_dbg(skt, 1, "suspending socket\n"); 793 1769 794 1770 down(&skt->skt_sem); ··· 804 1786 805 1787 return ret; 806 1788 } /* suspend_card */ 1789 + EXPORT_SYMBOL(pcmcia_suspend_card); 1790 + 807 1791 808 1792 int pcmcia_resume_card(struct pcmcia_socket *skt) 809 1793 { ··· 829 1809 830 1810 return ret; 831 1811 } /* resume_card */ 1812 + EXPORT_SYMBOL(pcmcia_resume_card); 832 1813 833 - /*====================================================================== 834 1814 835 - These handle user requests to eject or insert a card. 836 - 837 - ======================================================================*/ 838 - 1815 + /* These handle user requests to eject or insert a card. */ 839 1816 int pcmcia_eject_card(struct pcmcia_socket *skt) 840 1817 { 841 1818 int ret; ··· 859 1842 860 1843 return ret; 861 1844 } /* eject_card */ 1845 + EXPORT_SYMBOL(pcmcia_eject_card); 1846 + 862 1847 863 1848 int pcmcia_insert_card(struct pcmcia_socket *skt) 864 1849 { ··· 884 1865 885 1866 return ret; 886 1867 } /* insert_card */ 887 - 888 - /*====================================================================== 889 - 890 - OS-specific module glue goes here 891 - 892 - ======================================================================*/ 893 - /* in alpha order */ 894 - EXPORT_SYMBOL(pcmcia_eject_card); 895 - EXPORT_SYMBOL(pcmcia_get_card_services_info); 896 - EXPORT_SYMBOL(pcmcia_get_mem_page); 897 1868 EXPORT_SYMBOL(pcmcia_insert_card); 898 - EXPORT_SYMBOL(pcmcia_map_mem_page); 899 - EXPORT_SYMBOL(pcmcia_modify_configuration); 900 - EXPORT_SYMBOL(pcmcia_release_configuration); 901 - EXPORT_SYMBOL(pcmcia_release_io); 902 - EXPORT_SYMBOL(pcmcia_release_irq); 903 - EXPORT_SYMBOL(pcmcia_release_window); 904 - EXPORT_SYMBOL(pcmcia_replace_cis); 905 - EXPORT_SYMBOL(pcmcia_request_configuration); 906 - EXPORT_SYMBOL(pcmcia_request_io); 907 - EXPORT_SYMBOL(pcmcia_request_irq); 908 - EXPORT_SYMBOL(pcmcia_request_window); 909 - EXPORT_SYMBOL(pcmcia_resume_card); 910 - EXPORT_SYMBOL(pcmcia_suspend_card); 911 1869 912 - EXPORT_SYMBOL(dead_socket); 913 - EXPORT_SYMBOL(pcmcia_parse_events); 1870 + 1871 + static int pcmcia_socket_hotplug(struct class_device *dev, char **envp, 1872 + int num_envp, char *buffer, int buffer_size) 1873 + { 1874 + struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev); 1875 + int i = 0, length = 0; 1876 + 1877 + if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, 1878 + &length, "SOCKET_NO=%u", s->sock)) 1879 + return -ENOMEM; 1880 + 1881 + envp[i] = NULL; 1882 + 1883 + return 0; 1884 + } 1885 + 1886 + 1887 + static struct completion pcmcia_unload; 1888 + 1889 + static void pcmcia_release_socket_class(struct class *data) 1890 + { 1891 + complete(&pcmcia_unload); 1892 + } 1893 + 914 1894 915 1895 struct class pcmcia_socket_class = { 916 1896 .name = "pcmcia_socket", 1897 + .hotplug = pcmcia_socket_hotplug, 917 1898 .release = pcmcia_release_socket, 1899 + .class_release = pcmcia_release_socket_class, 918 1900 }; 919 1901 EXPORT_SYMBOL(pcmcia_socket_class); 920 1902 ··· 923 1903 static int __init init_pcmcia_cs(void) 924 1904 { 925 1905 int ret; 926 - printk(KERN_INFO "%s\n", release); 927 - printk(KERN_INFO " %s\n", options); 928 1906 1907 + init_completion(&pcmcia_unload); 929 1908 ret = class_register(&pcmcia_socket_class); 930 1909 if (ret) 931 1910 return (ret); ··· 933 1914 934 1915 static void __exit exit_pcmcia_cs(void) 935 1916 { 936 - printk(KERN_INFO "unloading Kernel Card Services\n"); 937 - class_interface_unregister(&pccard_sysfs_interface); 938 - class_unregister(&pcmcia_socket_class); 1917 + class_interface_unregister(&pccard_sysfs_interface); 1918 + class_unregister(&pcmcia_socket_class); 1919 + 1920 + wait_for_completion(&pcmcia_unload); 939 1921 } 940 1922 941 1923 subsys_initcall(init_pcmcia_cs); 942 1924 module_exit(exit_pcmcia_cs); 943 - 944 - /*====================================================================*/ 945 1925
+6 -7
drivers/pcmcia/cs_internal.h
··· 123 123 int read_cb_mem(struct pcmcia_socket *s, int space, u_int addr, u_int len, void *ptr); 124 124 125 125 /* In cistpl.c */ 126 - int read_cis_mem(struct pcmcia_socket *s, int attr, 126 + int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, 127 127 u_int addr, u_int len, void *ptr); 128 - void write_cis_mem(struct pcmcia_socket *s, int attr, 128 + void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, 129 129 u_int addr, u_int len, void *ptr); 130 130 void release_cis_mem(struct pcmcia_socket *s); 131 131 void destroy_cis_cache(struct pcmcia_socket *s); ··· 134 134 135 135 /* In rsrc_mgr */ 136 136 void pcmcia_validate_mem(struct pcmcia_socket *s); 137 - struct resource *find_io_region(unsigned long base, int num, unsigned long align, 137 + struct resource *pcmcia_find_io_region(unsigned long base, int num, unsigned long align, 138 138 struct pcmcia_socket *s); 139 - int adjust_io_region(struct resource *res, unsigned long r_start, 139 + int pcmcia_adjust_io_region(struct resource *res, unsigned long r_start, 140 140 unsigned long r_end, struct pcmcia_socket *s); 141 - struct resource *find_mem_region(u_long base, u_long num, u_long align, 141 + struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align, 142 142 int low, struct pcmcia_socket *s); 143 - int adjust_resource_info(client_handle_t handle, adjust_t *adj); 144 143 void release_resource_db(struct pcmcia_socket *s); 145 144 146 145 /* In socket_sysfs.c */ ··· 158 159 struct pcmcia_callback{ 159 160 struct module *owner; 160 161 int (*event) (struct pcmcia_socket *s, event_t event, int priority); 161 - int (*resources_done) (struct pcmcia_socket *s); 162 + void (*requery) (struct pcmcia_socket *s); 162 163 }; 163 164 164 165 int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c);
+428 -843
drivers/pcmcia/ds.c
··· 10 10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 11 11 * 12 12 * (C) 1999 David A. Hinds 13 - * (C) 2003 - 2004 Dominik Brodowski 13 + * (C) 2003 - 2005 Dominik Brodowski 14 14 */ 15 15 16 16 #include <linux/config.h> 17 - #include <linux/module.h> 18 - #include <linux/moduleparam.h> 19 - #include <linux/init.h> 20 17 #include <linux/kernel.h> 21 - #include <linux/major.h> 22 - #include <linux/string.h> 18 + #include <linux/module.h> 19 + #include <linux/init.h> 23 20 #include <linux/errno.h> 24 - #include <linux/slab.h> 25 - #include <linux/mm.h> 26 - #include <linux/fcntl.h> 27 - #include <linux/sched.h> 28 - #include <linux/smp_lock.h> 29 - #include <linux/timer.h> 30 - #include <linux/ioctl.h> 31 - #include <linux/proc_fs.h> 32 - #include <linux/poll.h> 33 - #include <linux/pci.h> 34 21 #include <linux/list.h> 35 22 #include <linux/delay.h> 36 - #include <linux/kref.h> 37 23 #include <linux/workqueue.h> 38 - 39 - #include <asm/atomic.h> 24 + #include <linux/crc32.h> 25 + #include <linux/firmware.h> 40 26 41 27 #define IN_CARD_SERVICES 42 - #include <pcmcia/version.h> 43 28 #include <pcmcia/cs_types.h> 44 29 #include <pcmcia/cs.h> 45 - #include <pcmcia/bulkmem.h> 46 30 #include <pcmcia/cistpl.h> 47 31 #include <pcmcia/ds.h> 48 32 #include <pcmcia/ss.h> 49 33 50 34 #include "cs_internal.h" 35 + #include "ds_internal.h" 51 36 52 37 /*====================================================================*/ 53 38 ··· 55 70 #define ds_dbg(lvl, fmt, arg...) do { } while (0) 56 71 #endif 57 72 58 - /*====================================================================*/ 73 + spinlock_t pcmcia_dev_list_lock; 59 74 60 - /* Device user information */ 61 - #define MAX_EVENTS 32 62 - #define USER_MAGIC 0x7ea4 63 - #define CHECK_USER(u) \ 64 - (((u) == NULL) || ((u)->user_magic != USER_MAGIC)) 65 - typedef struct user_info_t { 66 - u_int user_magic; 67 - int event_head, event_tail; 68 - event_t event[MAX_EVENTS]; 69 - struct user_info_t *next; 70 - struct pcmcia_bus_socket *socket; 71 - } user_info_t; 72 - 73 - /* Socket state information */ 74 - struct pcmcia_bus_socket { 75 - struct kref refcount; 76 - struct pcmcia_callback callback; 77 - int state; 78 - user_info_t *user; 79 - wait_queue_head_t queue; 80 - struct pcmcia_socket *parent; 81 - 82 - /* the PCMCIA devices connected to this socket (normally one, more 83 - * for multifunction devices: */ 84 - struct list_head devices_list; 85 - u8 device_count; /* the number of devices, used 86 - * only internally and subject 87 - * to incorrectness and change */ 88 - }; 89 - static spinlock_t pcmcia_dev_list_lock; 90 - 91 - #define DS_SOCKET_PRESENT 0x01 92 - #define DS_SOCKET_BUSY 0x02 93 - #define DS_SOCKET_REMOVAL_PENDING 0x10 94 - #define DS_SOCKET_DEAD 0x80 95 - 96 - /*====================================================================*/ 97 - 98 - static int major_dev = -1; 99 - 100 - static int unbind_request(struct pcmcia_bus_socket *s); 75 + static int unbind_request(struct pcmcia_socket *s); 101 76 102 77 /*====================================================================*/ 103 78 ··· 158 213 }; 159 214 160 215 161 - int pcmcia_report_error(client_handle_t handle, error_info_t *err) 216 + static int pcmcia_report_error(client_handle_t handle, error_info_t *err) 162 217 { 163 218 int i; 164 219 char *serv; ··· 188 243 189 244 return CS_SUCCESS; 190 245 } /* report_error */ 191 - EXPORT_SYMBOL(pcmcia_report_error); 192 246 193 247 /* end of code which was in cs.c before */ 194 248 ··· 200 256 } 201 257 EXPORT_SYMBOL(cs_error); 202 258 259 + 260 + static void pcmcia_check_driver(struct pcmcia_driver *p_drv) 261 + { 262 + struct pcmcia_device_id *did = p_drv->id_table; 263 + unsigned int i; 264 + u32 hash; 265 + 266 + while (did && did->match_flags) { 267 + for (i=0; i<4; i++) { 268 + if (!did->prod_id[i]) 269 + continue; 270 + 271 + hash = crc32(0, did->prod_id[i], strlen(did->prod_id[i])); 272 + if (hash == did->prod_id_hash[i]) 273 + continue; 274 + 275 + printk(KERN_DEBUG "pcmcia: %s: invalid hash for " 276 + "product string \"%s\": is 0x%x, should " 277 + "be 0x%x\n", p_drv->drv.name, did->prod_id[i], 278 + did->prod_id_hash[i], hash); 279 + printk(KERN_DEBUG "pcmcia: see " 280 + "Documentation/pcmcia/devicetable.txt for " 281 + "details\n"); 282 + } 283 + did++; 284 + } 285 + 286 + return; 287 + } 288 + 289 + 290 + #ifdef CONFIG_PCMCIA_LOAD_CIS 291 + 292 + /** 293 + * pcmcia_load_firmware - load CIS from userspace if device-provided is broken 294 + * @dev - the pcmcia device which needs a CIS override 295 + * @filename - requested filename in /lib/firmware/cis/ 296 + * 297 + * This uses the in-kernel firmware loading mechanism to use a "fake CIS" if 298 + * the one provided by the card is broken. The firmware files reside in 299 + * /lib/firmware/cis/ in userspace. 300 + */ 301 + static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) 302 + { 303 + struct pcmcia_socket *s = dev->socket; 304 + const struct firmware *fw; 305 + char path[20]; 306 + int ret=-ENOMEM; 307 + cisdump_t *cis; 308 + 309 + if (!filename) 310 + return -EINVAL; 311 + 312 + ds_dbg(1, "trying to load firmware %s\n", filename); 313 + 314 + if (strlen(filename) > 14) 315 + return -EINVAL; 316 + 317 + snprintf(path, 20, "%s", filename); 318 + 319 + if (request_firmware(&fw, path, &dev->dev) == 0) { 320 + if (fw->size >= CISTPL_MAX_CIS_SIZE) 321 + goto release; 322 + 323 + cis = kmalloc(sizeof(cisdump_t), GFP_KERNEL); 324 + if (!cis) 325 + goto release; 326 + 327 + memset(cis, 0, sizeof(cisdump_t)); 328 + 329 + cis->Length = fw->size + 1; 330 + memcpy(cis->Data, fw->data, fw->size); 331 + 332 + if (!pcmcia_replace_cis(s, cis)) 333 + ret = 0; 334 + } 335 + release: 336 + release_firmware(fw); 337 + 338 + return (ret); 339 + } 340 + 341 + #else /* !CONFIG_PCMCIA_LOAD_CIS */ 342 + 343 + static inline int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) 344 + { 345 + return -ENODEV; 346 + } 347 + 348 + #endif 349 + 350 + 203 351 /*======================================================================*/ 204 352 205 - static struct pcmcia_driver * get_pcmcia_driver (dev_info_t *dev_info); 206 - static struct pcmcia_bus_socket * get_socket_info_by_nr(unsigned int nr); 207 - 208 - static void pcmcia_release_bus_socket(struct kref *refcount) 209 - { 210 - struct pcmcia_bus_socket *s = container_of(refcount, struct pcmcia_bus_socket, refcount); 211 - pcmcia_put_socket(s->parent); 212 - kfree(s); 213 - } 214 - 215 - static void pcmcia_put_bus_socket(struct pcmcia_bus_socket *s) 216 - { 217 - kref_put(&s->refcount, pcmcia_release_bus_socket); 218 - } 219 - 220 - static struct pcmcia_bus_socket *pcmcia_get_bus_socket(struct pcmcia_bus_socket *s) 221 - { 222 - kref_get(&s->refcount); 223 - return (s); 224 - } 225 353 226 354 /** 227 355 * pcmcia_register_driver - register a PCMCIA driver with the bus core ··· 307 291 { 308 292 if (!driver) 309 293 return -EINVAL; 294 + 295 + pcmcia_check_driver(driver); 310 296 311 297 /* initialize common fields */ 312 298 driver->drv.bus = &pcmcia_bus_type; ··· 329 311 } 330 312 EXPORT_SYMBOL(pcmcia_unregister_driver); 331 313 332 - #ifdef CONFIG_PROC_FS 333 - static struct proc_dir_entry *proc_pccard = NULL; 334 - 335 - static int proc_read_drivers_callback(struct device_driver *driver, void *d) 336 - { 337 - char **p = d; 338 - struct pcmcia_driver *p_drv = container_of(driver, 339 - struct pcmcia_driver, drv); 340 - 341 - *p += sprintf(*p, "%-24.24s 1 %d\n", p_drv->drv.name, 342 - #ifdef CONFIG_MODULE_UNLOAD 343 - (p_drv->owner) ? module_refcount(p_drv->owner) : 1 344 - #else 345 - 1 346 - #endif 347 - ); 348 - d = (void *) p; 349 - 350 - return 0; 351 - } 352 - 353 - static int proc_read_drivers(char *buf, char **start, off_t pos, 354 - int count, int *eof, void *data) 355 - { 356 - char *p = buf; 357 - 358 - bus_for_each_drv(&pcmcia_bus_type, NULL, 359 - (void *) &p, proc_read_drivers_callback); 360 - 361 - return (p - buf); 362 - } 363 - #endif 364 314 365 315 /* pcmcia_device handling */ 366 316 367 - static struct pcmcia_device * pcmcia_get_dev(struct pcmcia_device *p_dev) 317 + struct pcmcia_device * pcmcia_get_dev(struct pcmcia_device *p_dev) 368 318 { 369 319 struct device *tmp_dev; 370 320 tmp_dev = get_device(&p_dev->dev); ··· 341 355 return to_pcmcia_dev(tmp_dev); 342 356 } 343 357 344 - static void pcmcia_put_dev(struct pcmcia_device *p_dev) 358 + void pcmcia_put_dev(struct pcmcia_device *p_dev) 345 359 { 346 360 if (p_dev) 347 361 put_device(&p_dev->dev); ··· 351 365 { 352 366 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 353 367 ds_dbg(1, "releasing dev %p\n", p_dev); 354 - pcmcia_put_bus_socket(p_dev->socket->pcmcia); 368 + pcmcia_put_socket(p_dev->socket); 355 369 kfree(p_dev); 356 370 } 357 371 ··· 486 500 */ 487 501 static DECLARE_MUTEX(device_add_lock); 488 502 489 - static struct pcmcia_device * pcmcia_device_add(struct pcmcia_bus_socket *s, unsigned int function) 503 + struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int function) 490 504 { 491 505 struct pcmcia_device *p_dev; 492 506 unsigned long flags; 493 507 494 - s = pcmcia_get_bus_socket(s); 508 + s = pcmcia_get_socket(s); 495 509 if (!s) 496 510 return NULL; 497 511 498 512 down(&device_add_lock); 513 + 514 + /* max of 2 devices per card */ 515 + if (s->device_count == 2) 516 + goto err_put; 499 517 500 518 p_dev = kmalloc(sizeof(struct pcmcia_device), GFP_KERNEL); 501 519 if (!p_dev) 502 520 goto err_put; 503 521 memset(p_dev, 0, sizeof(struct pcmcia_device)); 504 522 505 - p_dev->socket = s->parent; 523 + p_dev->socket = s; 506 524 p_dev->device_no = (s->device_count++); 507 525 p_dev->func = function; 508 526 509 527 p_dev->dev.bus = &pcmcia_bus_type; 510 - p_dev->dev.parent = s->parent->dev.dev; 528 + p_dev->dev.parent = s->dev.dev; 511 529 p_dev->dev.release = pcmcia_release_dev; 512 530 sprintf (p_dev->dev.bus_id, "%d.%d", p_dev->socket->sock, p_dev->device_no); 513 531 514 532 /* compat */ 515 533 p_dev->client.client_magic = CLIENT_MAGIC; 516 - p_dev->client.Socket = s->parent; 534 + p_dev->client.Socket = s; 517 535 p_dev->client.Function = function; 518 536 p_dev->client.state = CLIENT_UNBOUND; 519 537 ··· 525 535 spin_lock_irqsave(&pcmcia_dev_list_lock, flags); 526 536 list_add_tail(&p_dev->socket_device_list, &s->devices_list); 527 537 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 538 + 539 + pcmcia_device_query(p_dev); 528 540 529 541 if (device_register(&p_dev->dev)) { 530 542 spin_lock_irqsave(&pcmcia_dev_list_lock, flags); ··· 545 553 s->device_count--; 546 554 err_put: 547 555 up(&device_add_lock); 548 - pcmcia_put_bus_socket(s); 556 + pcmcia_put_socket(s); 549 557 550 558 return NULL; 551 559 } ··· 576 584 /* this doesn't handle multifunction devices on one pcmcia function 577 585 * yet. */ 578 586 for (i=0; i < no_funcs; i++) 579 - pcmcia_device_add(s->pcmcia, i); 587 + pcmcia_device_add(s, i); 580 588 581 589 return (ret); 590 + } 591 + 592 + 593 + static void pcmcia_delayed_add_pseudo_device(void *data) 594 + { 595 + struct pcmcia_socket *s = data; 596 + pcmcia_device_add(s, 0); 597 + s->pcmcia_state.device_add_pending = 0; 598 + } 599 + 600 + static inline void pcmcia_add_pseudo_device(struct pcmcia_socket *s) 601 + { 602 + if (!s->pcmcia_state.device_add_pending) { 603 + schedule_work(&s->device_add); 604 + s->pcmcia_state.device_add_pending = 1; 605 + } 606 + return; 607 + } 608 + 609 + static int pcmcia_requery(struct device *dev, void * _data) 610 + { 611 + struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 612 + if (!p_dev->dev.driver) 613 + pcmcia_device_query(p_dev); 614 + 615 + return 0; 616 + } 617 + 618 + static void pcmcia_bus_rescan(struct pcmcia_socket *skt) 619 + { 620 + int no_devices=0; 621 + unsigned long flags; 622 + 623 + /* must be called with skt_sem held */ 624 + spin_lock_irqsave(&pcmcia_dev_list_lock, flags); 625 + if (list_empty(&skt->devices_list)) 626 + no_devices=1; 627 + spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 628 + 629 + /* if no devices were added for this socket yet because of 630 + * missing resource information or other trouble, we need to 631 + * do this now. */ 632 + if (no_devices) { 633 + int ret = pcmcia_card_add(skt); 634 + if (ret) 635 + return; 636 + } 637 + 638 + /* some device information might have changed because of a CIS 639 + * update or because we can finally read it correctly... so 640 + * determine it again, overwriting old values if necessary. */ 641 + bus_for_each_dev(&pcmcia_bus_type, NULL, NULL, pcmcia_requery); 642 + 643 + /* we re-scan all devices, not just the ones connected to this 644 + * socket. This does not matter, though. */ 645 + bus_rescan_devices(&pcmcia_bus_type); 646 + } 647 + 648 + static inline int pcmcia_devmatch(struct pcmcia_device *dev, 649 + struct pcmcia_device_id *did) 650 + { 651 + if (did->match_flags & PCMCIA_DEV_ID_MATCH_MANF_ID) { 652 + if ((!dev->has_manf_id) || (dev->manf_id != did->manf_id)) 653 + return 0; 654 + } 655 + 656 + if (did->match_flags & PCMCIA_DEV_ID_MATCH_CARD_ID) { 657 + if ((!dev->has_card_id) || (dev->card_id != did->card_id)) 658 + return 0; 659 + } 660 + 661 + if (did->match_flags & PCMCIA_DEV_ID_MATCH_FUNCTION) { 662 + if (dev->func != did->function) 663 + return 0; 664 + } 665 + 666 + if (did->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID1) { 667 + if (!dev->prod_id[0]) 668 + return 0; 669 + if (strcmp(did->prod_id[0], dev->prod_id[0])) 670 + return 0; 671 + } 672 + 673 + if (did->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID2) { 674 + if (!dev->prod_id[1]) 675 + return 0; 676 + if (strcmp(did->prod_id[1], dev->prod_id[1])) 677 + return 0; 678 + } 679 + 680 + if (did->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID3) { 681 + if (!dev->prod_id[2]) 682 + return 0; 683 + if (strcmp(did->prod_id[2], dev->prod_id[2])) 684 + return 0; 685 + } 686 + 687 + if (did->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID4) { 688 + if (!dev->prod_id[3]) 689 + return 0; 690 + if (strcmp(did->prod_id[3], dev->prod_id[3])) 691 + return 0; 692 + } 693 + 694 + if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) { 695 + /* handle pseudo multifunction devices: 696 + * there are at most two pseudo multifunction devices. 697 + * if we're matching against the first, schedule a 698 + * call which will then check whether there are two 699 + * pseudo devices, and if not, add the second one. 700 + */ 701 + if (dev->device_no == 0) 702 + pcmcia_add_pseudo_device(dev->socket); 703 + 704 + if (dev->device_no != did->device_no) 705 + return 0; 706 + } 707 + 708 + if (did->match_flags & PCMCIA_DEV_ID_MATCH_FUNC_ID) { 709 + if ((!dev->has_func_id) || (dev->func_id != did->func_id)) 710 + return 0; 711 + 712 + /* if this is a pseudo-multi-function device, 713 + * we need explicit matches */ 714 + if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) 715 + return 0; 716 + if (dev->device_no) 717 + return 0; 718 + 719 + /* also, FUNC_ID matching needs to be activated by userspace 720 + * after it has re-checked that there is no possible module 721 + * with a prod_id/manf_id/card_id match. 722 + */ 723 + if (!dev->allow_func_id_match) 724 + return 0; 725 + } 726 + 727 + if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) { 728 + if (!dev->socket->fake_cis) 729 + pcmcia_load_firmware(dev, did->cisfile); 730 + 731 + if (!dev->socket->fake_cis) 732 + return 0; 733 + } 734 + 735 + if (did->match_flags & PCMCIA_DEV_ID_MATCH_ANONYMOUS) { 736 + int i; 737 + for (i=0; i<4; i++) 738 + if (dev->prod_id[i]) 739 + return 0; 740 + if (dev->has_manf_id || dev->has_card_id || dev->has_func_id) 741 + return 0; 742 + } 743 + 744 + dev->dev.driver_data = (void *) did; 745 + 746 + return 1; 582 747 } 583 748 584 749 585 750 static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) { 586 751 struct pcmcia_device * p_dev = to_pcmcia_dev(dev); 587 752 struct pcmcia_driver * p_drv = to_pcmcia_drv(drv); 753 + struct pcmcia_device_id *did = p_drv->id_table; 588 754 589 755 /* matching by cardmgr */ 590 756 if (p_dev->cardmgr == p_drv) 591 757 return 1; 592 758 759 + while (did && did->match_flags) { 760 + if (pcmcia_devmatch(p_dev, did)) 761 + return 1; 762 + did++; 763 + } 764 + 593 765 return 0; 594 766 } 767 + 768 + #ifdef CONFIG_HOTPLUG 769 + 770 + static int pcmcia_bus_hotplug(struct device *dev, char **envp, int num_envp, 771 + char *buffer, int buffer_size) 772 + { 773 + struct pcmcia_device *p_dev; 774 + int i, length = 0; 775 + u32 hash[4] = { 0, 0, 0, 0}; 776 + 777 + if (!dev) 778 + return -ENODEV; 779 + 780 + p_dev = to_pcmcia_dev(dev); 781 + 782 + /* calculate hashes */ 783 + for (i=0; i<4; i++) { 784 + if (!p_dev->prod_id[i]) 785 + continue; 786 + hash[i] = crc32(0, p_dev->prod_id[i], strlen(p_dev->prod_id[i])); 787 + } 788 + 789 + i = 0; 790 + 791 + if (add_hotplug_env_var(envp, num_envp, &i, 792 + buffer, buffer_size, &length, 793 + "SOCKET_NO=%u", 794 + p_dev->socket->sock)) 795 + return -ENOMEM; 796 + 797 + if (add_hotplug_env_var(envp, num_envp, &i, 798 + buffer, buffer_size, &length, 799 + "DEVICE_NO=%02X", 800 + p_dev->device_no)) 801 + return -ENOMEM; 802 + 803 + if (add_hotplug_env_var(envp, num_envp, &i, 804 + buffer, buffer_size, &length, 805 + "MODALIAS=pcmcia:m%04Xc%04Xf%02Xfn%02Xpfn%02X" 806 + "pa%08Xpb%08Xpc%08Xpd%08X", 807 + p_dev->has_manf_id ? p_dev->manf_id : 0, 808 + p_dev->has_card_id ? p_dev->card_id : 0, 809 + p_dev->has_func_id ? p_dev->func_id : 0, 810 + p_dev->func, 811 + p_dev->device_no, 812 + hash[0], 813 + hash[1], 814 + hash[2], 815 + hash[3])) 816 + return -ENOMEM; 817 + 818 + envp[i] = NULL; 819 + 820 + return 0; 821 + } 822 + 823 + #else 824 + 825 + static int pcmcia_bus_hotplug(struct device *dev, char **envp, int num_envp, 826 + char *buffer, int buffer_size) 827 + { 828 + return -ENODEV; 829 + } 830 + 831 + #endif 595 832 596 833 /************************ per-device sysfs output ***************************/ 597 834 ··· 847 626 pcmcia_device_stringattr(prod_id3, prod_id[2]); 848 627 pcmcia_device_stringattr(prod_id4, prod_id[3]); 849 628 629 + static ssize_t modalias_show(struct device *dev, char *buf) 630 + { 631 + struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 632 + int i; 633 + u32 hash[4] = { 0, 0, 0, 0}; 634 + 635 + /* calculate hashes */ 636 + for (i=0; i<4; i++) { 637 + if (!p_dev->prod_id[i]) 638 + continue; 639 + hash[i] = crc32(0,p_dev->prod_id[i],strlen(p_dev->prod_id[i])); 640 + } 641 + return sprintf(buf, "pcmcia:m%04Xc%04Xf%02Xfn%02Xpfn%02X" 642 + "pa%08Xpb%08Xpc%08Xpd%08X\n", 643 + p_dev->has_manf_id ? p_dev->manf_id : 0, 644 + p_dev->has_card_id ? p_dev->card_id : 0, 645 + p_dev->has_func_id ? p_dev->func_id : 0, 646 + p_dev->func, p_dev->device_no, 647 + hash[0], hash[1], hash[2], hash[3]); 648 + } 649 + 650 + static ssize_t pcmcia_store_allow_func_id_match(struct device *dev, 651 + struct device_attribute *attr, const char *buf, size_t count) 652 + { 653 + struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 654 + if (!count) 655 + return -EINVAL; 656 + 657 + down(&p_dev->socket->skt_sem); 658 + p_dev->allow_func_id_match = 1; 659 + up(&p_dev->socket->skt_sem); 660 + 661 + bus_rescan_devices(&pcmcia_bus_type); 662 + 663 + return count; 664 + } 665 + 850 666 static struct device_attribute pcmcia_dev_attrs[] = { 851 667 __ATTR(function, 0444, func_show, NULL), 852 668 __ATTR_RO(func_id), ··· 893 635 __ATTR_RO(prod_id2), 894 636 __ATTR_RO(prod_id3), 895 637 __ATTR_RO(prod_id4), 638 + __ATTR_RO(modalias), 639 + __ATTR(allow_func_id_match, 0200, NULL, pcmcia_store_allow_func_id_match), 896 640 __ATTR_NULL, 897 641 }; 898 - 899 - 900 - /*====================================================================== 901 - 902 - These manage a ring buffer of events pending for one user process 903 - 904 - ======================================================================*/ 905 - 906 - static int queue_empty(user_info_t *user) 907 - { 908 - return (user->event_head == user->event_tail); 909 - } 910 - 911 - static event_t get_queued_event(user_info_t *user) 912 - { 913 - user->event_tail = (user->event_tail+1) % MAX_EVENTS; 914 - return user->event[user->event_tail]; 915 - } 916 - 917 - static void queue_event(user_info_t *user, event_t event) 918 - { 919 - user->event_head = (user->event_head+1) % MAX_EVENTS; 920 - if (user->event_head == user->event_tail) 921 - user->event_tail = (user->event_tail+1) % MAX_EVENTS; 922 - user->event[user->event_head] = event; 923 - } 924 - 925 - static void handle_event(struct pcmcia_bus_socket *s, event_t event) 926 - { 927 - user_info_t *user; 928 - for (user = s->user; user; user = user->next) 929 - queue_event(user, event); 930 - wake_up_interruptible(&s->queue); 931 - } 932 642 933 643 934 644 /*====================================================================== ··· 932 706 933 707 static int send_event(struct pcmcia_socket *s, event_t event, int priority) 934 708 { 935 - int ret = 0; 936 709 struct send_event_data private; 937 - struct pcmcia_bus_socket *skt = pcmcia_get_bus_socket(s->pcmcia); 938 - 939 - if (!skt) 940 - return 0; 941 710 942 711 private.skt = s; 943 712 private.event = event; 944 713 private.priority = priority; 945 714 946 - ret = bus_for_each_dev(&pcmcia_bus_type, NULL, &private, send_event_callback); 947 - 948 - pcmcia_put_bus_socket(skt); 949 - return ret; 715 + return bus_for_each_dev(&pcmcia_bus_type, NULL, &private, send_event_callback); 950 716 } /* send_event */ 951 717 952 718 ··· 949 731 950 732 static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) 951 733 { 952 - struct pcmcia_bus_socket *s = skt->pcmcia; 734 + struct pcmcia_socket *s = pcmcia_get_socket(skt); 953 735 int ret = 0; 954 736 955 737 ds_dbg(1, "ds_event(0x%06x, %d, 0x%p)\n", 956 - event, priority, s); 738 + event, priority, skt); 957 739 958 740 switch (event) { 959 741 960 742 case CS_EVENT_CARD_REMOVAL: 961 - s->state &= ~DS_SOCKET_PRESENT; 743 + s->pcmcia_state.present = 0; 962 744 send_event(skt, event, priority); 963 - unbind_request(s); 964 - handle_event(s, event); 745 + unbind_request(skt); 746 + handle_event(skt, event); 965 747 break; 966 748 967 749 case CS_EVENT_CARD_INSERTION: 968 - s->state |= DS_SOCKET_PRESENT; 750 + s->pcmcia_state.present = 1; 969 751 pcmcia_card_add(skt); 970 - handle_event(s, event); 752 + handle_event(skt, event); 971 753 break; 972 754 973 755 case CS_EVENT_EJECTION_REQUEST: ··· 975 757 break; 976 758 977 759 default: 978 - handle_event(s, event); 760 + handle_event(skt, event); 979 761 send_event(skt, event, priority); 980 762 break; 981 763 } 764 + 765 + pcmcia_put_socket(s); 982 766 983 767 return 0; 984 768 } /* ds_event */ 985 769 986 770 987 - /*====================================================================== 988 - 989 - bind_request() and bind_device() are merged by now. Register_client() 990 - is called right at the end of bind_request(), during the driver's 991 - ->attach() call. Individual descriptions: 992 - 993 - bind_request() connects a socket to a particular client driver. 994 - It looks up the specified device ID in the list of registered 995 - drivers, binds it to the socket, and tries to create an instance 996 - of the device. unbind_request() deletes a driver instance. 997 - 998 - Bind_device() associates a device driver with a particular socket. 999 - It is normally called by Driver Services after it has identified 1000 - a newly inserted card. An instance of that driver will then be 1001 - eligible to register as a client of this socket. 1002 - 1003 - Register_client() uses the dev_info_t handle to match the 1004 - caller with a socket. The driver must have already been bound 1005 - to a socket with bind_device() -- in fact, bind_device() 1006 - allocates the client structure that will be used. 1007 - 1008 - ======================================================================*/ 1009 - 1010 - static int bind_request(struct pcmcia_bus_socket *s, bind_info_t *bind_info) 1011 - { 1012 - struct pcmcia_driver *p_drv; 1013 - struct pcmcia_device *p_dev; 1014 - int ret = 0; 1015 - unsigned long flags; 1016 - 1017 - s = pcmcia_get_bus_socket(s); 1018 - if (!s) 1019 - return -EINVAL; 1020 - 1021 - ds_dbg(2, "bind_request(%d, '%s')\n", s->parent->sock, 1022 - (char *)bind_info->dev_info); 1023 - 1024 - p_drv = get_pcmcia_driver(&bind_info->dev_info); 1025 - if (!p_drv) { 1026 - ret = -EINVAL; 1027 - goto err_put; 1028 - } 1029 - 1030 - if (!try_module_get(p_drv->owner)) { 1031 - ret = -EINVAL; 1032 - goto err_put_driver; 1033 - } 1034 - 1035 - spin_lock_irqsave(&pcmcia_dev_list_lock, flags); 1036 - list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { 1037 - if (p_dev->func == bind_info->function) { 1038 - if ((p_dev->dev.driver == &p_drv->drv)) { 1039 - if (p_dev->cardmgr) { 1040 - /* if there's already a device 1041 - * registered, and it was registered 1042 - * by userspace before, we need to 1043 - * return the "instance". */ 1044 - spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 1045 - bind_info->instance = p_dev->instance; 1046 - ret = -EBUSY; 1047 - goto err_put_module; 1048 - } else { 1049 - /* the correct driver managed to bind 1050 - * itself magically to the correct 1051 - * device. */ 1052 - spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 1053 - p_dev->cardmgr = p_drv; 1054 - ret = 0; 1055 - goto err_put_module; 1056 - } 1057 - } else if (!p_dev->dev.driver) { 1058 - /* there's already a device available where 1059 - * no device has been bound to yet. So we don't 1060 - * need to register a device! */ 1061 - spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 1062 - goto rescan; 1063 - } 1064 - } 1065 - } 1066 - spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 1067 - 1068 - p_dev = pcmcia_device_add(s, bind_info->function); 1069 - if (!p_dev) { 1070 - ret = -EIO; 1071 - goto err_put_module; 1072 - } 1073 - 1074 - rescan: 1075 - p_dev->cardmgr = p_drv; 1076 - 1077 - pcmcia_device_query(p_dev); 1078 - 1079 - /* 1080 - * Prevent this racing with a card insertion. 1081 - */ 1082 - down(&s->parent->skt_sem); 1083 - bus_rescan_devices(&pcmcia_bus_type); 1084 - up(&s->parent->skt_sem); 1085 - 1086 - /* check whether the driver indeed matched. I don't care if this 1087 - * is racy or not, because it can only happen on cardmgr access 1088 - * paths... 1089 - */ 1090 - if (!(p_dev->dev.driver == &p_drv->drv)) 1091 - p_dev->cardmgr = NULL; 1092 - 1093 - err_put_module: 1094 - module_put(p_drv->owner); 1095 - err_put_driver: 1096 - put_driver(&p_drv->drv); 1097 - err_put: 1098 - pcmcia_put_bus_socket(s); 1099 - 1100 - return (ret); 1101 - } /* bind_request */ 1102 - 1103 771 1104 772 int pcmcia_register_client(client_handle_t *handle, client_reg_t *req) 1105 773 { 1106 774 client_t *client = NULL; 1107 - struct pcmcia_socket *s; 1108 - struct pcmcia_bus_socket *skt = NULL; 775 + struct pcmcia_socket *s = NULL; 1109 776 struct pcmcia_device *p_dev = NULL; 1110 777 1111 778 /* Look for unbound client with matching dev_info */ ··· 1001 898 if (s->state & SOCKET_CARDBUS) 1002 899 continue; 1003 900 1004 - skt = s->pcmcia; 1005 - if (!skt) 1006 - continue; 1007 - skt = pcmcia_get_bus_socket(skt); 1008 - if (!skt) 901 + s = pcmcia_get_socket(s); 902 + if (!s) 1009 903 continue; 1010 904 spin_lock_irqsave(&pcmcia_dev_list_lock, flags); 1011 - list_for_each_entry(p_dev, &skt->devices_list, socket_device_list) { 905 + list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { 1012 906 struct pcmcia_driver *p_drv; 1013 907 p_dev = pcmcia_get_dev(p_dev); 1014 908 if (!p_dev) ··· 1024 924 pcmcia_put_dev(p_dev); 1025 925 } 1026 926 spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 1027 - pcmcia_put_bus_socket(skt); 927 + pcmcia_put_socket(s); 1028 928 } 1029 929 found: 1030 930 up_read(&pcmcia_socket_list_rwsem); 1031 931 if (!p_dev || !client) 1032 932 return -ENODEV; 1033 933 1034 - pcmcia_put_bus_socket(skt); /* safe, as we already hold a reference from bind_device */ 934 + pcmcia_put_socket(s); /* safe, as we already hold a reference from bind_device */ 1035 935 1036 936 *handle = client; 1037 937 client->state &= ~CLIENT_UNBOUND; ··· 1078 978 EXPORT_SYMBOL(pcmcia_register_client); 1079 979 1080 980 1081 - /*====================================================================*/ 1082 - 1083 - extern struct pci_bus *pcmcia_lookup_bus(struct pcmcia_socket *s); 1084 - 1085 - static int get_device_info(struct pcmcia_bus_socket *s, bind_info_t *bind_info, int first) 1086 - { 1087 - dev_node_t *node; 1088 - struct pcmcia_device *p_dev; 1089 - unsigned long flags; 1090 - int ret = 0; 1091 - 1092 - #ifdef CONFIG_CARDBUS 1093 - /* 1094 - * Some unbelievably ugly code to associate the PCI cardbus 1095 - * device and its driver with the PCMCIA "bind" information. 1096 - */ 1097 - { 1098 - struct pci_bus *bus; 1099 - 1100 - bus = pcmcia_lookup_bus(s->parent); 1101 - if (bus) { 1102 - struct list_head *list; 1103 - struct pci_dev *dev = NULL; 1104 - 1105 - list = bus->devices.next; 1106 - while (list != &bus->devices) { 1107 - struct pci_dev *pdev = pci_dev_b(list); 1108 - list = list->next; 1109 - 1110 - if (first) { 1111 - dev = pdev; 1112 - break; 1113 - } 1114 - 1115 - /* Try to handle "next" here some way? */ 1116 - } 1117 - if (dev && dev->driver) { 1118 - strlcpy(bind_info->name, dev->driver->name, DEV_NAME_LEN); 1119 - bind_info->major = 0; 1120 - bind_info->minor = 0; 1121 - bind_info->next = NULL; 1122 - return 0; 1123 - } 1124 - } 1125 - } 1126 - #endif 1127 - 1128 - spin_lock_irqsave(&pcmcia_dev_list_lock, flags); 1129 - list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { 1130 - if (p_dev->func == bind_info->function) { 1131 - p_dev = pcmcia_get_dev(p_dev); 1132 - if (!p_dev) 1133 - continue; 1134 - goto found; 1135 - } 1136 - } 1137 - spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 1138 - return -ENODEV; 1139 - 1140 - found: 1141 - spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 1142 - 1143 - if ((!p_dev->instance) || 1144 - (p_dev->instance->state & DEV_CONFIG_PENDING)) { 1145 - ret = -EAGAIN; 1146 - goto err_put; 1147 - } 1148 - 1149 - if (first) 1150 - node = p_dev->instance->dev; 1151 - else 1152 - for (node = p_dev->instance->dev; node; node = node->next) 1153 - if (node == bind_info->next) 1154 - break; 1155 - if (!node) { 1156 - ret = -ENODEV; 1157 - goto err_put; 1158 - } 1159 - 1160 - strlcpy(bind_info->name, node->dev_name, DEV_NAME_LEN); 1161 - bind_info->major = node->major; 1162 - bind_info->minor = node->minor; 1163 - bind_info->next = node->next; 1164 - 1165 - err_put: 1166 - pcmcia_put_dev(p_dev); 1167 - return (ret); 1168 - } /* get_device_info */ 1169 - 1170 - /*====================================================================*/ 1171 - 1172 981 /* unbind _all_ devices attached to a given pcmcia_bus_socket. The 1173 982 * drivers have been called with EVENT_CARD_REMOVAL before. 1174 983 */ 1175 - static int unbind_request(struct pcmcia_bus_socket *s) 984 + static int unbind_request(struct pcmcia_socket *s) 1176 985 { 1177 986 struct pcmcia_device *p_dev; 1178 987 unsigned long flags; 1179 988 1180 - ds_dbg(2, "unbind_request(%d)\n", s->parent->sock); 989 + ds_dbg(2, "unbind_request(%d)\n", s->sock); 1181 990 1182 991 s->device_count = 0; 1183 992 ··· 1142 1133 } /* deregister_client */ 1143 1134 EXPORT_SYMBOL(pcmcia_deregister_client); 1144 1135 1145 - 1146 - /*====================================================================== 1147 - 1148 - The user-mode PC Card device interface 1149 - 1150 - ======================================================================*/ 1151 - 1152 - static int ds_open(struct inode *inode, struct file *file) 1153 - { 1154 - socket_t i = iminor(inode); 1155 - struct pcmcia_bus_socket *s; 1156 - user_info_t *user; 1157 - 1158 - ds_dbg(0, "ds_open(socket %d)\n", i); 1159 - 1160 - s = get_socket_info_by_nr(i); 1161 - if (!s) 1162 - return -ENODEV; 1163 - s = pcmcia_get_bus_socket(s); 1164 - if (!s) 1165 - return -ENODEV; 1166 - 1167 - if ((file->f_flags & O_ACCMODE) != O_RDONLY) { 1168 - if (s->state & DS_SOCKET_BUSY) { 1169 - pcmcia_put_bus_socket(s); 1170 - return -EBUSY; 1171 - } 1172 - else 1173 - s->state |= DS_SOCKET_BUSY; 1174 - } 1175 - 1176 - user = kmalloc(sizeof(user_info_t), GFP_KERNEL); 1177 - if (!user) { 1178 - pcmcia_put_bus_socket(s); 1179 - return -ENOMEM; 1180 - } 1181 - user->event_tail = user->event_head = 0; 1182 - user->next = s->user; 1183 - user->user_magic = USER_MAGIC; 1184 - user->socket = s; 1185 - s->user = user; 1186 - file->private_data = user; 1187 - 1188 - if (s->state & DS_SOCKET_PRESENT) 1189 - queue_event(user, CS_EVENT_CARD_INSERTION); 1190 - return 0; 1191 - } /* ds_open */ 1192 - 1193 - /*====================================================================*/ 1194 - 1195 - static int ds_release(struct inode *inode, struct file *file) 1196 - { 1197 - struct pcmcia_bus_socket *s; 1198 - user_info_t *user, **link; 1199 - 1200 - ds_dbg(0, "ds_release(socket %d)\n", iminor(inode)); 1201 - 1202 - user = file->private_data; 1203 - if (CHECK_USER(user)) 1204 - goto out; 1205 - 1206 - s = user->socket; 1207 - 1208 - /* Unlink user data structure */ 1209 - if ((file->f_flags & O_ACCMODE) != O_RDONLY) { 1210 - s->state &= ~DS_SOCKET_BUSY; 1211 - } 1212 - file->private_data = NULL; 1213 - for (link = &s->user; *link; link = &(*link)->next) 1214 - if (*link == user) break; 1215 - if (link == NULL) 1216 - goto out; 1217 - *link = user->next; 1218 - user->user_magic = 0; 1219 - kfree(user); 1220 - pcmcia_put_bus_socket(s); 1221 - out: 1222 - return 0; 1223 - } /* ds_release */ 1224 - 1225 - /*====================================================================*/ 1226 - 1227 - static ssize_t ds_read(struct file *file, char __user *buf, 1228 - size_t count, loff_t *ppos) 1229 - { 1230 - struct pcmcia_bus_socket *s; 1231 - user_info_t *user; 1232 - int ret; 1233 - 1234 - ds_dbg(2, "ds_read(socket %d)\n", iminor(file->f_dentry->d_inode)); 1235 - 1236 - if (count < 4) 1237 - return -EINVAL; 1238 - 1239 - user = file->private_data; 1240 - if (CHECK_USER(user)) 1241 - return -EIO; 1242 - 1243 - s = user->socket; 1244 - if (s->state & DS_SOCKET_DEAD) 1245 - return -EIO; 1246 - 1247 - ret = wait_event_interruptible(s->queue, !queue_empty(user)); 1248 - if (ret == 0) 1249 - ret = put_user(get_queued_event(user), (int __user *)buf) ? -EFAULT : 4; 1250 - 1251 - return ret; 1252 - } /* ds_read */ 1253 - 1254 - /*====================================================================*/ 1255 - 1256 - static ssize_t ds_write(struct file *file, const char __user *buf, 1257 - size_t count, loff_t *ppos) 1258 - { 1259 - ds_dbg(2, "ds_write(socket %d)\n", iminor(file->f_dentry->d_inode)); 1260 - 1261 - if (count != 4) 1262 - return -EINVAL; 1263 - if ((file->f_flags & O_ACCMODE) == O_RDONLY) 1264 - return -EBADF; 1265 - 1266 - return -EIO; 1267 - } /* ds_write */ 1268 - 1269 - /*====================================================================*/ 1270 - 1271 - /* No kernel lock - fine */ 1272 - static u_int ds_poll(struct file *file, poll_table *wait) 1273 - { 1274 - struct pcmcia_bus_socket *s; 1275 - user_info_t *user; 1276 - 1277 - ds_dbg(2, "ds_poll(socket %d)\n", iminor(file->f_dentry->d_inode)); 1278 - 1279 - user = file->private_data; 1280 - if (CHECK_USER(user)) 1281 - return POLLERR; 1282 - s = user->socket; 1283 - /* 1284 - * We don't check for a dead socket here since that 1285 - * will send cardmgr into an endless spin. 1286 - */ 1287 - poll_wait(file, &s->queue, wait); 1288 - if (!queue_empty(user)) 1289 - return POLLIN | POLLRDNORM; 1290 - return 0; 1291 - } /* ds_poll */ 1292 - 1293 - /*====================================================================*/ 1294 - 1295 - extern int pcmcia_adjust_resource_info(adjust_t *adj); 1296 - 1297 - static int ds_ioctl(struct inode * inode, struct file * file, 1298 - u_int cmd, u_long arg) 1299 - { 1300 - struct pcmcia_bus_socket *s; 1301 - void __user *uarg = (char __user *)arg; 1302 - u_int size; 1303 - int ret, err; 1304 - ds_ioctl_arg_t *buf; 1305 - user_info_t *user; 1306 - 1307 - ds_dbg(2, "ds_ioctl(socket %d, %#x, %#lx)\n", iminor(inode), cmd, arg); 1308 - 1309 - user = file->private_data; 1310 - if (CHECK_USER(user)) 1311 - return -EIO; 1312 - 1313 - s = user->socket; 1314 - if (s->state & DS_SOCKET_DEAD) 1315 - return -EIO; 1316 - 1317 - size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT; 1318 - if (size > sizeof(ds_ioctl_arg_t)) return -EINVAL; 1319 - 1320 - /* Permission check */ 1321 - if (!(cmd & IOC_OUT) && !capable(CAP_SYS_ADMIN)) 1322 - return -EPERM; 1323 - 1324 - if (cmd & IOC_IN) { 1325 - if (!access_ok(VERIFY_READ, uarg, size)) { 1326 - ds_dbg(3, "ds_ioctl(): verify_read = %d\n", -EFAULT); 1327 - return -EFAULT; 1328 - } 1329 - } 1330 - if (cmd & IOC_OUT) { 1331 - if (!access_ok(VERIFY_WRITE, uarg, size)) { 1332 - ds_dbg(3, "ds_ioctl(): verify_write = %d\n", -EFAULT); 1333 - return -EFAULT; 1334 - } 1335 - } 1336 - buf = kmalloc(sizeof(ds_ioctl_arg_t), GFP_KERNEL); 1337 - if (!buf) 1338 - return -ENOMEM; 1339 - 1340 - err = ret = 0; 1341 - 1342 - if (cmd & IOC_IN) __copy_from_user((char *)buf, uarg, size); 1343 - 1344 - switch (cmd) { 1345 - case DS_ADJUST_RESOURCE_INFO: 1346 - ret = pcmcia_adjust_resource_info(&buf->adjust); 1347 - break; 1348 - case DS_GET_CARD_SERVICES_INFO: 1349 - ret = pcmcia_get_card_services_info(&buf->servinfo); 1350 - break; 1351 - case DS_GET_CONFIGURATION_INFO: 1352 - if (buf->config.Function && 1353 - (buf->config.Function >= s->parent->functions)) 1354 - ret = CS_BAD_ARGS; 1355 - else 1356 - ret = pccard_get_configuration_info(s->parent, 1357 - buf->config.Function, &buf->config); 1358 - break; 1359 - case DS_GET_FIRST_TUPLE: 1360 - down(&s->parent->skt_sem); 1361 - pcmcia_validate_mem(s->parent); 1362 - up(&s->parent->skt_sem); 1363 - ret = pccard_get_first_tuple(s->parent, BIND_FN_ALL, &buf->tuple); 1364 - break; 1365 - case DS_GET_NEXT_TUPLE: 1366 - ret = pccard_get_next_tuple(s->parent, BIND_FN_ALL, &buf->tuple); 1367 - break; 1368 - case DS_GET_TUPLE_DATA: 1369 - buf->tuple.TupleData = buf->tuple_parse.data; 1370 - buf->tuple.TupleDataMax = sizeof(buf->tuple_parse.data); 1371 - ret = pccard_get_tuple_data(s->parent, &buf->tuple); 1372 - break; 1373 - case DS_PARSE_TUPLE: 1374 - buf->tuple.TupleData = buf->tuple_parse.data; 1375 - ret = pccard_parse_tuple(&buf->tuple, &buf->tuple_parse.parse); 1376 - break; 1377 - case DS_RESET_CARD: 1378 - ret = pccard_reset_card(s->parent); 1379 - break; 1380 - case DS_GET_STATUS: 1381 - if (buf->status.Function && 1382 - (buf->status.Function >= s->parent->functions)) 1383 - ret = CS_BAD_ARGS; 1384 - else 1385 - ret = pccard_get_status(s->parent, buf->status.Function, &buf->status); 1386 - break; 1387 - case DS_VALIDATE_CIS: 1388 - down(&s->parent->skt_sem); 1389 - pcmcia_validate_mem(s->parent); 1390 - up(&s->parent->skt_sem); 1391 - ret = pccard_validate_cis(s->parent, BIND_FN_ALL, &buf->cisinfo); 1392 - break; 1393 - case DS_SUSPEND_CARD: 1394 - ret = pcmcia_suspend_card(s->parent); 1395 - break; 1396 - case DS_RESUME_CARD: 1397 - ret = pcmcia_resume_card(s->parent); 1398 - break; 1399 - case DS_EJECT_CARD: 1400 - err = pcmcia_eject_card(s->parent); 1401 - break; 1402 - case DS_INSERT_CARD: 1403 - err = pcmcia_insert_card(s->parent); 1404 - break; 1405 - case DS_ACCESS_CONFIGURATION_REGISTER: 1406 - if ((buf->conf_reg.Action == CS_WRITE) && !capable(CAP_SYS_ADMIN)) { 1407 - err = -EPERM; 1408 - goto free_out; 1409 - } 1410 - if (buf->conf_reg.Function && 1411 - (buf->conf_reg.Function >= s->parent->functions)) 1412 - ret = CS_BAD_ARGS; 1413 - else 1414 - ret = pccard_access_configuration_register(s->parent, 1415 - buf->conf_reg.Function, &buf->conf_reg); 1416 - break; 1417 - case DS_GET_FIRST_REGION: 1418 - case DS_GET_NEXT_REGION: 1419 - case DS_BIND_MTD: 1420 - if (!capable(CAP_SYS_ADMIN)) { 1421 - err = -EPERM; 1422 - goto free_out; 1423 - } else { 1424 - static int printed = 0; 1425 - if (!printed) { 1426 - printk(KERN_WARNING "2.6. kernels use pcmciamtd instead of memory_cs.c and do not require special\n"); 1427 - printk(KERN_WARNING "MTD handling any more.\n"); 1428 - printed++; 1429 - } 1430 - } 1431 - err = -EINVAL; 1432 - goto free_out; 1433 - break; 1434 - case DS_GET_FIRST_WINDOW: 1435 - ret = pcmcia_get_window(s->parent, &buf->win_info.handle, 0, 1436 - &buf->win_info.window); 1437 - break; 1438 - case DS_GET_NEXT_WINDOW: 1439 - ret = pcmcia_get_window(s->parent, &buf->win_info.handle, 1440 - buf->win_info.handle->index + 1, &buf->win_info.window); 1441 - break; 1442 - case DS_GET_MEM_PAGE: 1443 - ret = pcmcia_get_mem_page(buf->win_info.handle, 1444 - &buf->win_info.map); 1445 - break; 1446 - case DS_REPLACE_CIS: 1447 - ret = pcmcia_replace_cis(s->parent, &buf->cisdump); 1448 - break; 1449 - case DS_BIND_REQUEST: 1450 - if (!capable(CAP_SYS_ADMIN)) { 1451 - err = -EPERM; 1452 - goto free_out; 1453 - } 1454 - err = bind_request(s, &buf->bind_info); 1455 - break; 1456 - case DS_GET_DEVICE_INFO: 1457 - err = get_device_info(s, &buf->bind_info, 1); 1458 - break; 1459 - case DS_GET_NEXT_DEVICE: 1460 - err = get_device_info(s, &buf->bind_info, 0); 1461 - break; 1462 - case DS_UNBIND_REQUEST: 1463 - err = 0; 1464 - break; 1465 - default: 1466 - err = -EINVAL; 1467 - } 1468 - 1469 - if ((err == 0) && (ret != CS_SUCCESS)) { 1470 - ds_dbg(2, "ds_ioctl: ret = %d\n", ret); 1471 - switch (ret) { 1472 - case CS_BAD_SOCKET: case CS_NO_CARD: 1473 - err = -ENODEV; break; 1474 - case CS_BAD_ARGS: case CS_BAD_ATTRIBUTE: case CS_BAD_IRQ: 1475 - case CS_BAD_TUPLE: 1476 - err = -EINVAL; break; 1477 - case CS_IN_USE: 1478 - err = -EBUSY; break; 1479 - case CS_OUT_OF_RESOURCE: 1480 - err = -ENOSPC; break; 1481 - case CS_NO_MORE_ITEMS: 1482 - err = -ENODATA; break; 1483 - case CS_UNSUPPORTED_FUNCTION: 1484 - err = -ENOSYS; break; 1485 - default: 1486 - err = -EIO; break; 1487 - } 1488 - } 1489 - 1490 - if (cmd & IOC_OUT) { 1491 - if (__copy_to_user(uarg, (char *)buf, size)) 1492 - err = -EFAULT; 1493 - } 1494 - 1495 - free_out: 1496 - kfree(buf); 1497 - return err; 1498 - } /* ds_ioctl */ 1499 - 1500 - /*====================================================================*/ 1501 - 1502 - static struct file_operations ds_fops = { 1503 - .owner = THIS_MODULE, 1504 - .open = ds_open, 1505 - .release = ds_release, 1506 - .ioctl = ds_ioctl, 1507 - .read = ds_read, 1508 - .write = ds_write, 1509 - .poll = ds_poll, 1136 + static struct pcmcia_callback pcmcia_bus_callback = { 1137 + .owner = THIS_MODULE, 1138 + .event = ds_event, 1139 + .requery = pcmcia_bus_rescan, 1510 1140 }; 1511 1141 1512 1142 static int __devinit pcmcia_bus_add_socket(struct class_device *class_dev) 1513 1143 { 1514 1144 struct pcmcia_socket *socket = class_get_devdata(class_dev); 1515 - struct pcmcia_bus_socket *s; 1516 1145 int ret; 1517 1146 1518 - s = kmalloc(sizeof(struct pcmcia_bus_socket), GFP_KERNEL); 1519 - if(!s) 1520 - return -ENOMEM; 1521 - memset(s, 0, sizeof(struct pcmcia_bus_socket)); 1522 - 1523 - /* get reference to parent socket */ 1524 - s->parent = pcmcia_get_socket(socket); 1525 - if (!s->parent) { 1147 + socket = pcmcia_get_socket(socket); 1148 + if (!socket) { 1526 1149 printk(KERN_ERR "PCMCIA obtaining reference to socket %p failed\n", socket); 1527 - kfree (s); 1528 1150 return -ENODEV; 1529 1151 } 1530 1152 1531 - kref_init(&s->refcount); 1532 - 1533 1153 /* 1534 1154 * Ugly. But we want to wait for the socket threads to have started up. 1535 1155 * We really should let the drivers themselves drive some of this.. 1536 1156 */ 1537 1157 msleep(250); 1538 1158 1539 - init_waitqueue_head(&s->queue); 1540 - INIT_LIST_HEAD(&s->devices_list); 1159 + #ifdef CONFIG_PCMCIA_IOCTL 1160 + init_waitqueue_head(&socket->queue); 1161 + #endif 1162 + INIT_LIST_HEAD(&socket->devices_list); 1163 + INIT_WORK(&socket->device_add, pcmcia_delayed_add_pseudo_device, socket); 1164 + memset(&socket->pcmcia_state, 0, sizeof(u8)); 1165 + socket->device_count = 0; 1541 1166 1542 - /* Set up hotline to Card Services */ 1543 - s->callback.owner = THIS_MODULE; 1544 - s->callback.event = &ds_event; 1545 - s->callback.resources_done = &pcmcia_card_add; 1546 - socket->pcmcia = s; 1547 - 1548 - ret = pccard_register_pcmcia(socket, &s->callback); 1167 + ret = pccard_register_pcmcia(socket, &pcmcia_bus_callback); 1549 1168 if (ret) { 1550 1169 printk(KERN_ERR "PCMCIA registration PCCard core failed for socket %p\n", socket); 1551 - pcmcia_put_bus_socket(s); 1552 - socket->pcmcia = NULL; 1170 + pcmcia_put_socket(socket); 1553 1171 return (ret); 1554 1172 } 1555 1173 1556 1174 return 0; 1557 1175 } 1558 1176 1559 - 1560 1177 static void pcmcia_bus_remove_socket(struct class_device *class_dev) 1561 1178 { 1562 1179 struct pcmcia_socket *socket = class_get_devdata(class_dev); 1563 1180 1564 - if (!socket || !socket->pcmcia) 1181 + if (!socket) 1565 1182 return; 1566 1183 1184 + socket->pcmcia_state.dead = 1; 1567 1185 pccard_register_pcmcia(socket, NULL); 1568 1186 1569 - socket->pcmcia->state |= DS_SOCKET_DEAD; 1570 - pcmcia_put_bus_socket(socket->pcmcia); 1571 - socket->pcmcia = NULL; 1187 + pcmcia_put_socket(socket); 1572 1188 1573 1189 return; 1574 1190 } ··· 1209 1575 1210 1576 struct bus_type pcmcia_bus_type = { 1211 1577 .name = "pcmcia", 1578 + .hotplug = pcmcia_bus_hotplug, 1212 1579 .match = pcmcia_bus_match, 1213 1580 .dev_attrs = pcmcia_dev_attrs, 1214 1581 }; 1215 - EXPORT_SYMBOL(pcmcia_bus_type); 1216 1582 1217 1583 1218 1584 static int __init init_pcmcia_bus(void) 1219 1585 { 1220 - int i; 1221 - 1222 1586 spin_lock_init(&pcmcia_dev_list_lock); 1223 1587 1224 1588 bus_register(&pcmcia_bus_type); 1225 1589 class_interface_register(&pcmcia_bus_interface); 1226 1590 1227 - /* Set up character device for user mode clients */ 1228 - i = register_chrdev(0, "pcmcia", &ds_fops); 1229 - if (i < 0) 1230 - printk(KERN_NOTICE "unable to find a free device # for " 1231 - "Driver Services (error=%d)\n", i); 1232 - else 1233 - major_dev = i; 1234 - 1235 - #ifdef CONFIG_PROC_FS 1236 - proc_pccard = proc_mkdir("pccard", proc_bus); 1237 - if (proc_pccard) 1238 - create_proc_read_entry("drivers",0,proc_pccard,proc_read_drivers,NULL); 1239 - #endif 1591 + pcmcia_setup_ioctl(); 1240 1592 1241 1593 return 0; 1242 1594 } ··· 1232 1612 1233 1613 static void __exit exit_pcmcia_bus(void) 1234 1614 { 1235 - class_interface_unregister(&pcmcia_bus_interface); 1615 + pcmcia_cleanup_ioctl(); 1236 1616 1237 - #ifdef CONFIG_PROC_FS 1238 - if (proc_pccard) { 1239 - remove_proc_entry("drivers", proc_pccard); 1240 - remove_proc_entry("pccard", proc_bus); 1241 - } 1242 - #endif 1243 - if (major_dev != -1) 1244 - unregister_chrdev(major_dev, "pcmcia"); 1617 + class_interface_unregister(&pcmcia_bus_interface); 1245 1618 1246 1619 bus_unregister(&pcmcia_bus_type); 1247 1620 } 1248 1621 module_exit(exit_pcmcia_bus); 1249 1622 1250 - 1251 - 1252 - /* helpers for backwards-compatible functions */ 1253 - 1254 - static struct pcmcia_bus_socket * get_socket_info_by_nr(unsigned int nr) 1255 - { 1256 - struct pcmcia_socket * s = pcmcia_get_socket_by_nr(nr); 1257 - if (s && s->pcmcia) 1258 - return s->pcmcia; 1259 - else 1260 - return NULL; 1261 - } 1262 - 1263 - /* backwards-compatible accessing of driver --- by name! */ 1264 - 1265 - static struct pcmcia_driver * get_pcmcia_driver (dev_info_t *dev_info) 1266 - { 1267 - struct device_driver *drv; 1268 - struct pcmcia_driver *p_drv; 1269 - 1270 - drv = driver_find((char *) dev_info, &pcmcia_bus_type); 1271 - if (!drv) 1272 - return NULL; 1273 - 1274 - p_drv = container_of(drv, struct pcmcia_driver, drv); 1275 - 1276 - return (p_drv); 1277 - } 1278 1623 1279 1624 MODULE_ALIAS("ds");
+21
drivers/pcmcia/ds_internal.h
··· 1 + /* ds_internal.h - internal header for 16-bit PCMCIA devices management */ 2 + 3 + extern spinlock_t pcmcia_dev_list_lock; 4 + extern struct bus_type pcmcia_bus_type; 5 + 6 + extern struct pcmcia_device * pcmcia_get_dev(struct pcmcia_device *p_dev); 7 + extern void pcmcia_put_dev(struct pcmcia_device *p_dev); 8 + 9 + struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int function); 10 + 11 + #ifdef CONFIG_PCMCIA_IOCTL 12 + extern void __init pcmcia_setup_ioctl(void); 13 + extern void __exit pcmcia_cleanup_ioctl(void); 14 + extern void handle_event(struct pcmcia_socket *s, event_t event); 15 + extern int handle_request(struct pcmcia_socket *s, event_t event); 16 + #else 17 + static inline void __init pcmcia_setup_ioctl(void) { return; } 18 + static inline void __init pcmcia_cleanup_ioctl(void) { return; } 19 + static inline void handle_event(struct pcmcia_socket *s, event_t event) { return; } 20 + static inline int handle_request(struct pcmcia_socket *s, event_t event) { return CS_SUCCESS; } 21 + #endif
+16 -7
drivers/pcmcia/i82365.c
··· 669 669 if ((stat & I365_CS_DETECT) && (stat & I365_CS_POWERON) && 670 670 (i365_get(sock, I365_INTCTL) & I365_PC_IOCARD) && 671 671 (i365_get(sock, I365_ADDRWIN) & I365_ENA_IO(0)) && 672 - (check_region(start, stop-start+1) != 0) && 673 - ((start & 0xfeef) != 0x02e8)) 674 - return 1; 675 - else 676 - return 0; 672 + ((start & 0xfeef) != 0x02e8)) { 673 + if (!request_region(start, stop-start+1, "i82365")) 674 + return 1; 675 + release_region(start, stop-start+1); 676 + } 677 + 678 + return 0; 677 679 } 678 680 679 681 /*====================================================================*/ ··· 698 696 struct i82365_socket *t = &socket[sockets-ns]; 699 697 700 698 base = sockets-ns; 701 - if (t->ioaddr > 0) request_region(t->ioaddr, 2, "i82365"); 699 + if (t->ioaddr > 0) { 700 + if (!request_region(t->ioaddr, 2, "i82365")) { 701 + printk(KERN_ERR "i82365: IO region conflict at %#lx, not available\n", 702 + t->ioaddr); 703 + return; 704 + } 705 + } 702 706 703 707 if (base == 0) printk("\n"); 704 708 printk(KERN_INFO " %s", pcic[type].name); ··· 811 803 } 812 804 #endif 813 805 814 - if (check_region(i365_base, 2) != 0) { 806 + if (!request_region(i365_base, 2, "i82365")) { 815 807 if (sockets == 0) 816 808 printk("port conflict at %#lx\n", i365_base); 817 809 return; ··· 1449 1441 i365_set(i, I365_CSCINT, 0); 1450 1442 release_region(socket[i].ioaddr, 2); 1451 1443 } 1444 + release_region(i365_base, 2); 1452 1445 #ifdef CONFIG_PNP 1453 1446 if (i82365_pnpdev) 1454 1447 pnp_disable_dev(i82365_pnpdev);
-34
drivers/pcmcia/pcmcia_compat.c
··· 74 74 } 75 75 EXPORT_SYMBOL(pcmcia_validate_cis); 76 76 77 - int pcmcia_get_configuration_info(client_handle_t handle, 78 - config_info_t *config) 79 - { 80 - struct pcmcia_socket *s; 81 - 82 - if ((CHECK_HANDLE(handle)) || !config) 83 - return CS_BAD_HANDLE; 84 - s = SOCKET(handle); 85 - if (!s) 86 - return CS_BAD_HANDLE; 87 - return pccard_get_configuration_info(s, handle->Function, config); 88 - } 89 - EXPORT_SYMBOL(pcmcia_get_configuration_info); 90 77 91 78 int pcmcia_reset_card(client_handle_t handle, client_req_t *req) 92 79 { ··· 88 101 return pccard_reset_card(skt); 89 102 } 90 103 EXPORT_SYMBOL(pcmcia_reset_card); 91 - 92 - int pcmcia_get_status(client_handle_t handle, cs_status_t *status) 93 - { 94 - struct pcmcia_socket *s; 95 - if (CHECK_HANDLE(handle)) 96 - return CS_BAD_HANDLE; 97 - s = SOCKET(handle); 98 - return pccard_get_status(s, handle->Function, status); 99 - } 100 - EXPORT_SYMBOL(pcmcia_get_status); 101 - 102 - int pcmcia_access_configuration_register(client_handle_t handle, 103 - conf_reg_t *reg) 104 - { 105 - struct pcmcia_socket *s; 106 - if (CHECK_HANDLE(handle)) 107 - return CS_BAD_HANDLE; 108 - s = SOCKET(handle); 109 - return pccard_access_configuration_register(s, handle->Function, reg); 110 - } 111 - EXPORT_SYMBOL(pcmcia_access_configuration_register); 112 104
+786
drivers/pcmcia/pcmcia_ioctl.c
··· 1 + /* 2 + * pcmcia_ioctl.c -- ioctl interface for cardmgr and cardctl 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + * 8 + * The initial developer of the original code is David A. Hinds 9 + * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds 10 + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 11 + * 12 + * (C) 1999 David A. Hinds 13 + * (C) 2003 - 2004 Dominik Brodowski 14 + */ 15 + 16 + /* 17 + * This file will go away soon. 18 + */ 19 + 20 + 21 + #include <linux/config.h> 22 + #include <linux/kernel.h> 23 + #include <linux/module.h> 24 + #include <linux/init.h> 25 + #include <linux/major.h> 26 + #include <linux/errno.h> 27 + #include <linux/ioctl.h> 28 + #include <linux/proc_fs.h> 29 + #include <linux/poll.h> 30 + #include <linux/pci.h> 31 + #include <linux/workqueue.h> 32 + 33 + #define IN_CARD_SERVICES 34 + #include <pcmcia/version.h> 35 + #include <pcmcia/cs_types.h> 36 + #include <pcmcia/cs.h> 37 + #include <pcmcia/cistpl.h> 38 + #include <pcmcia/ds.h> 39 + #include <pcmcia/ss.h> 40 + 41 + #include "cs_internal.h" 42 + #include "ds_internal.h" 43 + 44 + static int major_dev = -1; 45 + 46 + 47 + /* Device user information */ 48 + #define MAX_EVENTS 32 49 + #define USER_MAGIC 0x7ea4 50 + #define CHECK_USER(u) \ 51 + (((u) == NULL) || ((u)->user_magic != USER_MAGIC)) 52 + 53 + typedef struct user_info_t { 54 + u_int user_magic; 55 + int event_head, event_tail; 56 + event_t event[MAX_EVENTS]; 57 + struct user_info_t *next; 58 + struct pcmcia_socket *socket; 59 + } user_info_t; 60 + 61 + 62 + #ifdef DEBUG 63 + extern int ds_pc_debug; 64 + #define cs_socket_name(skt) ((skt)->dev.class_id) 65 + 66 + #define ds_dbg(lvl, fmt, arg...) do { \ 67 + if (ds_pc_debug >= lvl) \ 68 + printk(KERN_DEBUG "ds: " fmt , ## arg); \ 69 + } while (0) 70 + #else 71 + #define ds_dbg(lvl, fmt, arg...) do { } while (0) 72 + #endif 73 + 74 + static const char *release = "Linux Kernel Card Services"; 75 + 76 + /** pcmcia_get_card_services_info 77 + * 78 + * Return information about this version of Card Services 79 + */ 80 + static int pcmcia_get_card_services_info(servinfo_t *info) 81 + { 82 + unsigned int socket_count = 0; 83 + struct list_head *tmp; 84 + info->Signature[0] = 'C'; 85 + info->Signature[1] = 'S'; 86 + down_read(&pcmcia_socket_list_rwsem); 87 + list_for_each(tmp, &pcmcia_socket_list) 88 + socket_count++; 89 + up_read(&pcmcia_socket_list_rwsem); 90 + info->Count = socket_count; 91 + info->Revision = CS_RELEASE_CODE; 92 + info->CSLevel = 0x0210; 93 + info->VendorString = (char *)release; 94 + return CS_SUCCESS; 95 + } /* get_card_services_info */ 96 + 97 + 98 + /* backwards-compatible accessing of driver --- by name! */ 99 + 100 + static struct pcmcia_driver * get_pcmcia_driver (dev_info_t *dev_info) 101 + { 102 + struct device_driver *drv; 103 + struct pcmcia_driver *p_drv; 104 + 105 + drv = driver_find((char *) dev_info, &pcmcia_bus_type); 106 + if (!drv) 107 + return NULL; 108 + 109 + p_drv = container_of(drv, struct pcmcia_driver, drv); 110 + 111 + return (p_drv); 112 + } 113 + 114 + 115 + #ifdef CONFIG_PROC_FS 116 + static struct proc_dir_entry *proc_pccard = NULL; 117 + 118 + static int proc_read_drivers_callback(struct device_driver *driver, void *d) 119 + { 120 + char **p = d; 121 + struct pcmcia_driver *p_drv = container_of(driver, 122 + struct pcmcia_driver, drv); 123 + 124 + *p += sprintf(*p, "%-24.24s 1 %d\n", p_drv->drv.name, 125 + #ifdef CONFIG_MODULE_UNLOAD 126 + (p_drv->owner) ? module_refcount(p_drv->owner) : 1 127 + #else 128 + 1 129 + #endif 130 + ); 131 + d = (void *) p; 132 + 133 + return 0; 134 + } 135 + 136 + static int proc_read_drivers(char *buf, char **start, off_t pos, 137 + int count, int *eof, void *data) 138 + { 139 + char *p = buf; 140 + 141 + bus_for_each_drv(&pcmcia_bus_type, NULL, 142 + (void *) &p, proc_read_drivers_callback); 143 + 144 + return (p - buf); 145 + } 146 + #endif 147 + 148 + /*====================================================================== 149 + 150 + These manage a ring buffer of events pending for one user process 151 + 152 + ======================================================================*/ 153 + 154 + 155 + static int queue_empty(user_info_t *user) 156 + { 157 + return (user->event_head == user->event_tail); 158 + } 159 + 160 + static event_t get_queued_event(user_info_t *user) 161 + { 162 + user->event_tail = (user->event_tail+1) % MAX_EVENTS; 163 + return user->event[user->event_tail]; 164 + } 165 + 166 + static void queue_event(user_info_t *user, event_t event) 167 + { 168 + user->event_head = (user->event_head+1) % MAX_EVENTS; 169 + if (user->event_head == user->event_tail) 170 + user->event_tail = (user->event_tail+1) % MAX_EVENTS; 171 + user->event[user->event_head] = event; 172 + } 173 + 174 + void handle_event(struct pcmcia_socket *s, event_t event) 175 + { 176 + user_info_t *user; 177 + for (user = s->user; user; user = user->next) 178 + queue_event(user, event); 179 + wake_up_interruptible(&s->queue); 180 + } 181 + 182 + 183 + /*====================================================================== 184 + 185 + bind_request() and bind_device() are merged by now. Register_client() 186 + is called right at the end of bind_request(), during the driver's 187 + ->attach() call. Individual descriptions: 188 + 189 + bind_request() connects a socket to a particular client driver. 190 + It looks up the specified device ID in the list of registered 191 + drivers, binds it to the socket, and tries to create an instance 192 + of the device. unbind_request() deletes a driver instance. 193 + 194 + Bind_device() associates a device driver with a particular socket. 195 + It is normally called by Driver Services after it has identified 196 + a newly inserted card. An instance of that driver will then be 197 + eligible to register as a client of this socket. 198 + 199 + Register_client() uses the dev_info_t handle to match the 200 + caller with a socket. The driver must have already been bound 201 + to a socket with bind_device() -- in fact, bind_device() 202 + allocates the client structure that will be used. 203 + 204 + ======================================================================*/ 205 + 206 + static int bind_request(struct pcmcia_socket *s, bind_info_t *bind_info) 207 + { 208 + struct pcmcia_driver *p_drv; 209 + struct pcmcia_device *p_dev; 210 + int ret = 0; 211 + unsigned long flags; 212 + 213 + s = pcmcia_get_socket(s); 214 + if (!s) 215 + return -EINVAL; 216 + 217 + ds_dbg(2, "bind_request(%d, '%s')\n", s->sock, 218 + (char *)bind_info->dev_info); 219 + 220 + p_drv = get_pcmcia_driver(&bind_info->dev_info); 221 + if (!p_drv) { 222 + ret = -EINVAL; 223 + goto err_put; 224 + } 225 + 226 + if (!try_module_get(p_drv->owner)) { 227 + ret = -EINVAL; 228 + goto err_put_driver; 229 + } 230 + 231 + spin_lock_irqsave(&pcmcia_dev_list_lock, flags); 232 + list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { 233 + if (p_dev->func == bind_info->function) { 234 + if ((p_dev->dev.driver == &p_drv->drv)) { 235 + if (p_dev->cardmgr) { 236 + /* if there's already a device 237 + * registered, and it was registered 238 + * by userspace before, we need to 239 + * return the "instance". */ 240 + spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 241 + bind_info->instance = p_dev->instance; 242 + ret = -EBUSY; 243 + goto err_put_module; 244 + } else { 245 + /* the correct driver managed to bind 246 + * itself magically to the correct 247 + * device. */ 248 + spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 249 + p_dev->cardmgr = p_drv; 250 + ret = 0; 251 + goto err_put_module; 252 + } 253 + } else if (!p_dev->dev.driver) { 254 + /* there's already a device available where 255 + * no device has been bound to yet. So we don't 256 + * need to register a device! */ 257 + spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 258 + goto rescan; 259 + } 260 + } 261 + } 262 + spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 263 + 264 + p_dev = pcmcia_device_add(s, bind_info->function); 265 + if (!p_dev) { 266 + ret = -EIO; 267 + goto err_put_module; 268 + } 269 + 270 + rescan: 271 + p_dev->cardmgr = p_drv; 272 + 273 + /* if a driver is already running, we can abort */ 274 + if (p_dev->dev.driver) 275 + goto err_put_module; 276 + 277 + /* 278 + * Prevent this racing with a card insertion. 279 + */ 280 + down(&s->skt_sem); 281 + bus_rescan_devices(&pcmcia_bus_type); 282 + up(&s->skt_sem); 283 + 284 + /* check whether the driver indeed matched. I don't care if this 285 + * is racy or not, because it can only happen on cardmgr access 286 + * paths... 287 + */ 288 + if (!(p_dev->dev.driver == &p_drv->drv)) 289 + p_dev->cardmgr = NULL; 290 + 291 + err_put_module: 292 + module_put(p_drv->owner); 293 + err_put_driver: 294 + put_driver(&p_drv->drv); 295 + err_put: 296 + pcmcia_put_socket(s); 297 + 298 + return (ret); 299 + } /* bind_request */ 300 + 301 + #ifdef CONFIG_CARDBUS 302 + 303 + static struct pci_bus *pcmcia_lookup_bus(struct pcmcia_socket *s) 304 + { 305 + if (!s || !(s->state & SOCKET_CARDBUS)) 306 + return NULL; 307 + 308 + return s->cb_dev->subordinate; 309 + } 310 + #endif 311 + 312 + static int get_device_info(struct pcmcia_socket *s, bind_info_t *bind_info, int first) 313 + { 314 + dev_node_t *node; 315 + struct pcmcia_device *p_dev; 316 + unsigned long flags; 317 + int ret = 0; 318 + 319 + #ifdef CONFIG_CARDBUS 320 + /* 321 + * Some unbelievably ugly code to associate the PCI cardbus 322 + * device and its driver with the PCMCIA "bind" information. 323 + */ 324 + { 325 + struct pci_bus *bus; 326 + 327 + bus = pcmcia_lookup_bus(s); 328 + if (bus) { 329 + struct list_head *list; 330 + struct pci_dev *dev = NULL; 331 + 332 + list = bus->devices.next; 333 + while (list != &bus->devices) { 334 + struct pci_dev *pdev = pci_dev_b(list); 335 + list = list->next; 336 + 337 + if (first) { 338 + dev = pdev; 339 + break; 340 + } 341 + 342 + /* Try to handle "next" here some way? */ 343 + } 344 + if (dev && dev->driver) { 345 + strlcpy(bind_info->name, dev->driver->name, DEV_NAME_LEN); 346 + bind_info->major = 0; 347 + bind_info->minor = 0; 348 + bind_info->next = NULL; 349 + return 0; 350 + } 351 + } 352 + } 353 + #endif 354 + 355 + spin_lock_irqsave(&pcmcia_dev_list_lock, flags); 356 + list_for_each_entry(p_dev, &s->devices_list, socket_device_list) { 357 + if (p_dev->func == bind_info->function) { 358 + p_dev = pcmcia_get_dev(p_dev); 359 + if (!p_dev) 360 + continue; 361 + goto found; 362 + } 363 + } 364 + spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 365 + return -ENODEV; 366 + 367 + found: 368 + spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); 369 + 370 + if ((!p_dev->instance) || 371 + (p_dev->instance->state & DEV_CONFIG_PENDING)) { 372 + ret = -EAGAIN; 373 + goto err_put; 374 + } 375 + 376 + if (first) 377 + node = p_dev->instance->dev; 378 + else 379 + for (node = p_dev->instance->dev; node; node = node->next) 380 + if (node == bind_info->next) 381 + break; 382 + if (!node) { 383 + ret = -ENODEV; 384 + goto err_put; 385 + } 386 + 387 + strlcpy(bind_info->name, node->dev_name, DEV_NAME_LEN); 388 + bind_info->major = node->major; 389 + bind_info->minor = node->minor; 390 + bind_info->next = node->next; 391 + 392 + err_put: 393 + pcmcia_put_dev(p_dev); 394 + return (ret); 395 + } /* get_device_info */ 396 + 397 + 398 + static int ds_open(struct inode *inode, struct file *file) 399 + { 400 + socket_t i = iminor(inode); 401 + struct pcmcia_socket *s; 402 + user_info_t *user; 403 + 404 + ds_dbg(0, "ds_open(socket %d)\n", i); 405 + 406 + s = pcmcia_get_socket_by_nr(i); 407 + if (!s) 408 + return -ENODEV; 409 + s = pcmcia_get_socket(s); 410 + if (!s) 411 + return -ENODEV; 412 + 413 + if ((file->f_flags & O_ACCMODE) != O_RDONLY) { 414 + if (s->pcmcia_state.busy) { 415 + pcmcia_put_socket(s); 416 + return -EBUSY; 417 + } 418 + else 419 + s->pcmcia_state.busy = 1; 420 + } 421 + 422 + user = kmalloc(sizeof(user_info_t), GFP_KERNEL); 423 + if (!user) { 424 + pcmcia_put_socket(s); 425 + return -ENOMEM; 426 + } 427 + user->event_tail = user->event_head = 0; 428 + user->next = s->user; 429 + user->user_magic = USER_MAGIC; 430 + user->socket = s; 431 + s->user = user; 432 + file->private_data = user; 433 + 434 + if (s->pcmcia_state.present) 435 + queue_event(user, CS_EVENT_CARD_INSERTION); 436 + return 0; 437 + } /* ds_open */ 438 + 439 + /*====================================================================*/ 440 + 441 + static int ds_release(struct inode *inode, struct file *file) 442 + { 443 + struct pcmcia_socket *s; 444 + user_info_t *user, **link; 445 + 446 + ds_dbg(0, "ds_release(socket %d)\n", iminor(inode)); 447 + 448 + user = file->private_data; 449 + if (CHECK_USER(user)) 450 + goto out; 451 + 452 + s = user->socket; 453 + 454 + /* Unlink user data structure */ 455 + if ((file->f_flags & O_ACCMODE) != O_RDONLY) { 456 + s->pcmcia_state.busy = 0; 457 + } 458 + file->private_data = NULL; 459 + for (link = &s->user; *link; link = &(*link)->next) 460 + if (*link == user) break; 461 + if (link == NULL) 462 + goto out; 463 + *link = user->next; 464 + user->user_magic = 0; 465 + kfree(user); 466 + pcmcia_put_socket(s); 467 + out: 468 + return 0; 469 + } /* ds_release */ 470 + 471 + /*====================================================================*/ 472 + 473 + static ssize_t ds_read(struct file *file, char __user *buf, 474 + size_t count, loff_t *ppos) 475 + { 476 + struct pcmcia_socket *s; 477 + user_info_t *user; 478 + int ret; 479 + 480 + ds_dbg(2, "ds_read(socket %d)\n", iminor(file->f_dentry->d_inode)); 481 + 482 + if (count < 4) 483 + return -EINVAL; 484 + 485 + user = file->private_data; 486 + if (CHECK_USER(user)) 487 + return -EIO; 488 + 489 + s = user->socket; 490 + if (s->pcmcia_state.dead) 491 + return -EIO; 492 + 493 + ret = wait_event_interruptible(s->queue, !queue_empty(user)); 494 + if (ret == 0) 495 + ret = put_user(get_queued_event(user), (int __user *)buf) ? -EFAULT : 4; 496 + 497 + return ret; 498 + } /* ds_read */ 499 + 500 + /*====================================================================*/ 501 + 502 + static ssize_t ds_write(struct file *file, const char __user *buf, 503 + size_t count, loff_t *ppos) 504 + { 505 + ds_dbg(2, "ds_write(socket %d)\n", iminor(file->f_dentry->d_inode)); 506 + 507 + if (count != 4) 508 + return -EINVAL; 509 + if ((file->f_flags & O_ACCMODE) == O_RDONLY) 510 + return -EBADF; 511 + 512 + return -EIO; 513 + } /* ds_write */ 514 + 515 + /*====================================================================*/ 516 + 517 + /* No kernel lock - fine */ 518 + static u_int ds_poll(struct file *file, poll_table *wait) 519 + { 520 + struct pcmcia_socket *s; 521 + user_info_t *user; 522 + 523 + ds_dbg(2, "ds_poll(socket %d)\n", iminor(file->f_dentry->d_inode)); 524 + 525 + user = file->private_data; 526 + if (CHECK_USER(user)) 527 + return POLLERR; 528 + s = user->socket; 529 + /* 530 + * We don't check for a dead socket here since that 531 + * will send cardmgr into an endless spin. 532 + */ 533 + poll_wait(file, &s->queue, wait); 534 + if (!queue_empty(user)) 535 + return POLLIN | POLLRDNORM; 536 + return 0; 537 + } /* ds_poll */ 538 + 539 + /*====================================================================*/ 540 + 541 + extern int pcmcia_adjust_resource_info(adjust_t *adj); 542 + 543 + static int ds_ioctl(struct inode * inode, struct file * file, 544 + u_int cmd, u_long arg) 545 + { 546 + struct pcmcia_socket *s; 547 + void __user *uarg = (char __user *)arg; 548 + u_int size; 549 + int ret, err; 550 + ds_ioctl_arg_t *buf; 551 + user_info_t *user; 552 + 553 + ds_dbg(2, "ds_ioctl(socket %d, %#x, %#lx)\n", iminor(inode), cmd, arg); 554 + 555 + user = file->private_data; 556 + if (CHECK_USER(user)) 557 + return -EIO; 558 + 559 + s = user->socket; 560 + if (s->pcmcia_state.dead) 561 + return -EIO; 562 + 563 + size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT; 564 + if (size > sizeof(ds_ioctl_arg_t)) return -EINVAL; 565 + 566 + /* Permission check */ 567 + if (!(cmd & IOC_OUT) && !capable(CAP_SYS_ADMIN)) 568 + return -EPERM; 569 + 570 + if (cmd & IOC_IN) { 571 + if (!access_ok(VERIFY_READ, uarg, size)) { 572 + ds_dbg(3, "ds_ioctl(): verify_read = %d\n", -EFAULT); 573 + return -EFAULT; 574 + } 575 + } 576 + if (cmd & IOC_OUT) { 577 + if (!access_ok(VERIFY_WRITE, uarg, size)) { 578 + ds_dbg(3, "ds_ioctl(): verify_write = %d\n", -EFAULT); 579 + return -EFAULT; 580 + } 581 + } 582 + buf = kmalloc(sizeof(ds_ioctl_arg_t), GFP_KERNEL); 583 + if (!buf) 584 + return -ENOMEM; 585 + 586 + err = ret = 0; 587 + 588 + if (cmd & IOC_IN) __copy_from_user((char *)buf, uarg, size); 589 + 590 + switch (cmd) { 591 + case DS_ADJUST_RESOURCE_INFO: 592 + ret = pcmcia_adjust_resource_info(&buf->adjust); 593 + break; 594 + case DS_GET_CARD_SERVICES_INFO: 595 + ret = pcmcia_get_card_services_info(&buf->servinfo); 596 + break; 597 + case DS_GET_CONFIGURATION_INFO: 598 + if (buf->config.Function && 599 + (buf->config.Function >= s->functions)) 600 + ret = CS_BAD_ARGS; 601 + else 602 + ret = pccard_get_configuration_info(s, 603 + buf->config.Function, &buf->config); 604 + break; 605 + case DS_GET_FIRST_TUPLE: 606 + down(&s->skt_sem); 607 + pcmcia_validate_mem(s); 608 + up(&s->skt_sem); 609 + ret = pccard_get_first_tuple(s, BIND_FN_ALL, &buf->tuple); 610 + break; 611 + case DS_GET_NEXT_TUPLE: 612 + ret = pccard_get_next_tuple(s, BIND_FN_ALL, &buf->tuple); 613 + break; 614 + case DS_GET_TUPLE_DATA: 615 + buf->tuple.TupleData = buf->tuple_parse.data; 616 + buf->tuple.TupleDataMax = sizeof(buf->tuple_parse.data); 617 + ret = pccard_get_tuple_data(s, &buf->tuple); 618 + break; 619 + case DS_PARSE_TUPLE: 620 + buf->tuple.TupleData = buf->tuple_parse.data; 621 + ret = pccard_parse_tuple(&buf->tuple, &buf->tuple_parse.parse); 622 + break; 623 + case DS_RESET_CARD: 624 + ret = pccard_reset_card(s); 625 + break; 626 + case DS_GET_STATUS: 627 + if (buf->status.Function && 628 + (buf->status.Function >= s->functions)) 629 + ret = CS_BAD_ARGS; 630 + else 631 + ret = pccard_get_status(s, buf->status.Function, &buf->status); 632 + break; 633 + case DS_VALIDATE_CIS: 634 + down(&s->skt_sem); 635 + pcmcia_validate_mem(s); 636 + up(&s->skt_sem); 637 + ret = pccard_validate_cis(s, BIND_FN_ALL, &buf->cisinfo); 638 + break; 639 + case DS_SUSPEND_CARD: 640 + ret = pcmcia_suspend_card(s); 641 + break; 642 + case DS_RESUME_CARD: 643 + ret = pcmcia_resume_card(s); 644 + break; 645 + case DS_EJECT_CARD: 646 + err = pcmcia_eject_card(s); 647 + break; 648 + case DS_INSERT_CARD: 649 + err = pcmcia_insert_card(s); 650 + break; 651 + case DS_ACCESS_CONFIGURATION_REGISTER: 652 + if ((buf->conf_reg.Action == CS_WRITE) && !capable(CAP_SYS_ADMIN)) { 653 + err = -EPERM; 654 + goto free_out; 655 + } 656 + if (buf->conf_reg.Function && 657 + (buf->conf_reg.Function >= s->functions)) 658 + ret = CS_BAD_ARGS; 659 + else 660 + ret = pccard_access_configuration_register(s, 661 + buf->conf_reg.Function, &buf->conf_reg); 662 + break; 663 + case DS_GET_FIRST_REGION: 664 + case DS_GET_NEXT_REGION: 665 + case DS_BIND_MTD: 666 + if (!capable(CAP_SYS_ADMIN)) { 667 + err = -EPERM; 668 + goto free_out; 669 + } else { 670 + static int printed = 0; 671 + if (!printed) { 672 + printk(KERN_WARNING "2.6. kernels use pcmciamtd instead of memory_cs.c and do not require special\n"); 673 + printk(KERN_WARNING "MTD handling any more.\n"); 674 + printed++; 675 + } 676 + } 677 + err = -EINVAL; 678 + goto free_out; 679 + break; 680 + case DS_GET_FIRST_WINDOW: 681 + ret = pcmcia_get_window(s, &buf->win_info.handle, 0, 682 + &buf->win_info.window); 683 + break; 684 + case DS_GET_NEXT_WINDOW: 685 + ret = pcmcia_get_window(s, &buf->win_info.handle, 686 + buf->win_info.handle->index + 1, &buf->win_info.window); 687 + break; 688 + case DS_GET_MEM_PAGE: 689 + ret = pcmcia_get_mem_page(buf->win_info.handle, 690 + &buf->win_info.map); 691 + break; 692 + case DS_REPLACE_CIS: 693 + ret = pcmcia_replace_cis(s, &buf->cisdump); 694 + break; 695 + case DS_BIND_REQUEST: 696 + if (!capable(CAP_SYS_ADMIN)) { 697 + err = -EPERM; 698 + goto free_out; 699 + } 700 + err = bind_request(s, &buf->bind_info); 701 + break; 702 + case DS_GET_DEVICE_INFO: 703 + err = get_device_info(s, &buf->bind_info, 1); 704 + break; 705 + case DS_GET_NEXT_DEVICE: 706 + err = get_device_info(s, &buf->bind_info, 0); 707 + break; 708 + case DS_UNBIND_REQUEST: 709 + err = 0; 710 + break; 711 + default: 712 + err = -EINVAL; 713 + } 714 + 715 + if ((err == 0) && (ret != CS_SUCCESS)) { 716 + ds_dbg(2, "ds_ioctl: ret = %d\n", ret); 717 + switch (ret) { 718 + case CS_BAD_SOCKET: case CS_NO_CARD: 719 + err = -ENODEV; break; 720 + case CS_BAD_ARGS: case CS_BAD_ATTRIBUTE: case CS_BAD_IRQ: 721 + case CS_BAD_TUPLE: 722 + err = -EINVAL; break; 723 + case CS_IN_USE: 724 + err = -EBUSY; break; 725 + case CS_OUT_OF_RESOURCE: 726 + err = -ENOSPC; break; 727 + case CS_NO_MORE_ITEMS: 728 + err = -ENODATA; break; 729 + case CS_UNSUPPORTED_FUNCTION: 730 + err = -ENOSYS; break; 731 + default: 732 + err = -EIO; break; 733 + } 734 + } 735 + 736 + if (cmd & IOC_OUT) { 737 + if (__copy_to_user(uarg, (char *)buf, size)) 738 + err = -EFAULT; 739 + } 740 + 741 + free_out: 742 + kfree(buf); 743 + return err; 744 + } /* ds_ioctl */ 745 + 746 + /*====================================================================*/ 747 + 748 + static struct file_operations ds_fops = { 749 + .owner = THIS_MODULE, 750 + .open = ds_open, 751 + .release = ds_release, 752 + .ioctl = ds_ioctl, 753 + .read = ds_read, 754 + .write = ds_write, 755 + .poll = ds_poll, 756 + }; 757 + 758 + void __init pcmcia_setup_ioctl(void) { 759 + int i; 760 + 761 + /* Set up character device for user mode clients */ 762 + i = register_chrdev(0, "pcmcia", &ds_fops); 763 + if (i < 0) 764 + printk(KERN_NOTICE "unable to find a free device # for " 765 + "Driver Services (error=%d)\n", i); 766 + else 767 + major_dev = i; 768 + 769 + #ifdef CONFIG_PROC_FS 770 + proc_pccard = proc_mkdir("pccard", proc_bus); 771 + if (proc_pccard) 772 + create_proc_read_entry("drivers",0,proc_pccard,proc_read_drivers,NULL); 773 + #endif 774 + } 775 + 776 + 777 + void __exit pcmcia_cleanup_ioctl(void) { 778 + #ifdef CONFIG_PROC_FS 779 + if (proc_pccard) { 780 + remove_proc_entry("drivers", proc_pccard); 781 + remove_proc_entry("pccard", proc_bus); 782 + } 783 + #endif 784 + if (major_dev != -1) 785 + unregister_chrdev(major_dev, "pcmcia"); 786 + }
+998
drivers/pcmcia/pcmcia_resource.c
··· 1 + /* 2 + * PCMCIA 16-bit resource management functions 3 + * 4 + * The initial developer of the original code is David A. Hinds 5 + * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds 6 + * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 7 + * 8 + * Copyright (C) 1999 David A. Hinds 9 + * Copyright (C) 2004-2005 Dominik Brodowski 10 + * 11 + * This program is free software; you can redistribute it and/or modify 12 + * it under the terms of the GNU General Public License version 2 as 13 + * published by the Free Software Foundation. 14 + * 15 + */ 16 + 17 + #include <linux/config.h> 18 + #include <linux/module.h> 19 + #include <linux/kernel.h> 20 + #include <linux/interrupt.h> 21 + #include <linux/delay.h> 22 + #include <linux/pci.h> 23 + #include <linux/device.h> 24 + 25 + #define IN_CARD_SERVICES 26 + #include <pcmcia/version.h> 27 + #include <pcmcia/cs_types.h> 28 + #include <pcmcia/ss.h> 29 + #include <pcmcia/cs.h> 30 + #include <pcmcia/bulkmem.h> 31 + #include <pcmcia/cistpl.h> 32 + #include <pcmcia/cisreg.h> 33 + #include <pcmcia/ds.h> 34 + 35 + #include "cs_internal.h" 36 + #include "ds_internal.h" 37 + 38 + 39 + /* Access speed for IO windows */ 40 + static int io_speed = 0; 41 + module_param(io_speed, int, 0444); 42 + 43 + 44 + #ifdef CONFIG_PCMCIA_PROBE 45 + /* mask of IRQs already reserved by other cards, we should avoid using them */ 46 + static u8 pcmcia_used_irq[NR_IRQS]; 47 + #endif 48 + 49 + 50 + #ifdef DEBUG 51 + extern int ds_pc_debug; 52 + #define cs_socket_name(skt) ((skt)->dev.class_id) 53 + 54 + #define ds_dbg(skt, lvl, fmt, arg...) do { \ 55 + if (ds_pc_debug >= lvl) \ 56 + printk(KERN_DEBUG "pcmcia_resource: %s: " fmt, \ 57 + cs_socket_name(skt) , ## arg); \ 58 + } while (0) 59 + #else 60 + #define ds_dbg(lvl, fmt, arg...) do { } while (0) 61 + #endif 62 + 63 + 64 + 65 + /** alloc_io_space 66 + * 67 + * Special stuff for managing IO windows, because they are scarce 68 + */ 69 + 70 + static int alloc_io_space(struct pcmcia_socket *s, u_int attr, ioaddr_t *base, 71 + ioaddr_t num, u_int lines) 72 + { 73 + int i; 74 + kio_addr_t try, align; 75 + 76 + align = (*base) ? (lines ? 1<<lines : 0) : 1; 77 + if (align && (align < num)) { 78 + if (*base) { 79 + ds_dbg(s, 0, "odd IO request: num %#x align %#lx\n", 80 + num, align); 81 + align = 0; 82 + } else 83 + while (align && (align < num)) align <<= 1; 84 + } 85 + if (*base & ~(align-1)) { 86 + ds_dbg(s, 0, "odd IO request: base %#x align %#lx\n", 87 + *base, align); 88 + align = 0; 89 + } 90 + if ((s->features & SS_CAP_STATIC_MAP) && s->io_offset) { 91 + *base = s->io_offset | (*base & 0x0fff); 92 + s->io[0].Attributes = attr; 93 + return 0; 94 + } 95 + /* Check for an already-allocated window that must conflict with 96 + * what was asked for. It is a hack because it does not catch all 97 + * potential conflicts, just the most obvious ones. 98 + */ 99 + for (i = 0; i < MAX_IO_WIN; i++) 100 + if ((s->io[i].NumPorts != 0) && 101 + ((s->io[i].BasePort & (align-1)) == *base)) 102 + return 1; 103 + for (i = 0; i < MAX_IO_WIN; i++) { 104 + if (s->io[i].NumPorts == 0) { 105 + s->io[i].res = pcmcia_find_io_region(*base, num, align, s); 106 + if (s->io[i].res) { 107 + s->io[i].Attributes = attr; 108 + s->io[i].BasePort = *base = s->io[i].res->start; 109 + s->io[i].NumPorts = s->io[i].InUse = num; 110 + break; 111 + } else 112 + return 1; 113 + } else if (s->io[i].Attributes != attr) 114 + continue; 115 + /* Try to extend top of window */ 116 + try = s->io[i].BasePort + s->io[i].NumPorts; 117 + if ((*base == 0) || (*base == try)) 118 + if (pcmcia_adjust_io_region(s->io[i].res, s->io[i].res->start, 119 + s->io[i].res->end + num, s) == 0) { 120 + *base = try; 121 + s->io[i].NumPorts += num; 122 + s->io[i].InUse += num; 123 + break; 124 + } 125 + /* Try to extend bottom of window */ 126 + try = s->io[i].BasePort - num; 127 + if ((*base == 0) || (*base == try)) 128 + if (pcmcia_adjust_io_region(s->io[i].res, s->io[i].res->start - num, 129 + s->io[i].res->end, s) == 0) { 130 + s->io[i].BasePort = *base = try; 131 + s->io[i].NumPorts += num; 132 + s->io[i].InUse += num; 133 + break; 134 + } 135 + } 136 + return (i == MAX_IO_WIN); 137 + } /* alloc_io_space */ 138 + 139 + 140 + static void release_io_space(struct pcmcia_socket *s, ioaddr_t base, 141 + ioaddr_t num) 142 + { 143 + int i; 144 + 145 + for (i = 0; i < MAX_IO_WIN; i++) { 146 + if ((s->io[i].BasePort <= base) && 147 + (s->io[i].BasePort+s->io[i].NumPorts >= base+num)) { 148 + s->io[i].InUse -= num; 149 + /* Free the window if no one else is using it */ 150 + if (s->io[i].InUse == 0) { 151 + s->io[i].NumPorts = 0; 152 + release_resource(s->io[i].res); 153 + kfree(s->io[i].res); 154 + s->io[i].res = NULL; 155 + } 156 + } 157 + } 158 + } /* release_io_space */ 159 + 160 + 161 + /** pccard_access_configuration_register 162 + * 163 + * Access_configuration_register() reads and writes configuration 164 + * registers in attribute memory. Memory window 0 is reserved for 165 + * this and the tuple reading services. 166 + */ 167 + 168 + int pccard_access_configuration_register(struct pcmcia_socket *s, 169 + unsigned int function, 170 + conf_reg_t *reg) 171 + { 172 + config_t *c; 173 + int addr; 174 + u_char val; 175 + 176 + if (!s || !s->config) 177 + return CS_NO_CARD; 178 + 179 + c = &s->config[function]; 180 + 181 + if (c == NULL) 182 + return CS_NO_CARD; 183 + 184 + if (!(c->state & CONFIG_LOCKED)) 185 + return CS_CONFIGURATION_LOCKED; 186 + 187 + addr = (c->ConfigBase + reg->Offset) >> 1; 188 + 189 + switch (reg->Action) { 190 + case CS_READ: 191 + pcmcia_read_cis_mem(s, 1, addr, 1, &val); 192 + reg->Value = val; 193 + break; 194 + case CS_WRITE: 195 + val = reg->Value; 196 + pcmcia_write_cis_mem(s, 1, addr, 1, &val); 197 + break; 198 + default: 199 + return CS_BAD_ARGS; 200 + break; 201 + } 202 + return CS_SUCCESS; 203 + } /* pccard_access_configuration_register */ 204 + 205 + int pcmcia_access_configuration_register(client_handle_t handle, 206 + conf_reg_t *reg) 207 + { 208 + struct pcmcia_socket *s; 209 + if (CHECK_HANDLE(handle)) 210 + return CS_BAD_HANDLE; 211 + s = SOCKET(handle); 212 + return pccard_access_configuration_register(s, handle->Function, reg); 213 + } 214 + EXPORT_SYMBOL(pcmcia_access_configuration_register); 215 + 216 + 217 + 218 + int pccard_get_configuration_info(struct pcmcia_socket *s, 219 + unsigned int function, 220 + config_info_t *config) 221 + { 222 + config_t *c; 223 + 224 + if (!(s->state & SOCKET_PRESENT)) 225 + return CS_NO_CARD; 226 + 227 + config->Function = function; 228 + 229 + #ifdef CONFIG_CARDBUS 230 + if (s->state & SOCKET_CARDBUS) { 231 + memset(config, 0, sizeof(config_info_t)); 232 + config->Vcc = s->socket.Vcc; 233 + config->Vpp1 = config->Vpp2 = s->socket.Vpp; 234 + config->Option = s->cb_dev->subordinate->number; 235 + if (s->state & SOCKET_CARDBUS_CONFIG) { 236 + config->Attributes = CONF_VALID_CLIENT; 237 + config->IntType = INT_CARDBUS; 238 + config->AssignedIRQ = s->irq.AssignedIRQ; 239 + if (config->AssignedIRQ) 240 + config->Attributes |= CONF_ENABLE_IRQ; 241 + config->BasePort1 = s->io[0].BasePort; 242 + config->NumPorts1 = s->io[0].NumPorts; 243 + } 244 + return CS_SUCCESS; 245 + } 246 + #endif 247 + 248 + c = (s->config != NULL) ? &s->config[function] : NULL; 249 + 250 + if ((c == NULL) || !(c->state & CONFIG_LOCKED)) { 251 + config->Attributes = 0; 252 + config->Vcc = s->socket.Vcc; 253 + config->Vpp1 = config->Vpp2 = s->socket.Vpp; 254 + return CS_SUCCESS; 255 + } 256 + 257 + /* !!! This is a hack !!! */ 258 + memcpy(&config->Attributes, &c->Attributes, sizeof(config_t)); 259 + config->Attributes |= CONF_VALID_CLIENT; 260 + config->CardValues = c->CardValues; 261 + config->IRQAttributes = c->irq.Attributes; 262 + config->AssignedIRQ = s->irq.AssignedIRQ; 263 + config->BasePort1 = c->io.BasePort1; 264 + config->NumPorts1 = c->io.NumPorts1; 265 + config->Attributes1 = c->io.Attributes1; 266 + config->BasePort2 = c->io.BasePort2; 267 + config->NumPorts2 = c->io.NumPorts2; 268 + config->Attributes2 = c->io.Attributes2; 269 + config->IOAddrLines = c->io.IOAddrLines; 270 + 271 + return CS_SUCCESS; 272 + } /* pccard_get_configuration_info */ 273 + 274 + int pcmcia_get_configuration_info(client_handle_t handle, 275 + config_info_t *config) 276 + { 277 + struct pcmcia_socket *s; 278 + 279 + if ((CHECK_HANDLE(handle)) || !config) 280 + return CS_BAD_HANDLE; 281 + s = SOCKET(handle); 282 + if (!s) 283 + return CS_BAD_HANDLE; 284 + return pccard_get_configuration_info(s, handle->Function, config); 285 + } 286 + EXPORT_SYMBOL(pcmcia_get_configuration_info); 287 + 288 + 289 + /** pcmcia_get_window 290 + */ 291 + int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, 292 + int idx, win_req_t *req) 293 + { 294 + window_t *win; 295 + int w; 296 + 297 + if (!s || !(s->state & SOCKET_PRESENT)) 298 + return CS_NO_CARD; 299 + for (w = idx; w < MAX_WIN; w++) 300 + if (s->state & SOCKET_WIN_REQ(w)) 301 + break; 302 + if (w == MAX_WIN) 303 + return CS_NO_MORE_ITEMS; 304 + win = &s->win[w]; 305 + req->Base = win->ctl.res->start; 306 + req->Size = win->ctl.res->end - win->ctl.res->start + 1; 307 + req->AccessSpeed = win->ctl.speed; 308 + req->Attributes = 0; 309 + if (win->ctl.flags & MAP_ATTRIB) 310 + req->Attributes |= WIN_MEMORY_TYPE_AM; 311 + if (win->ctl.flags & MAP_ACTIVE) 312 + req->Attributes |= WIN_ENABLE; 313 + if (win->ctl.flags & MAP_16BIT) 314 + req->Attributes |= WIN_DATA_WIDTH_16; 315 + if (win->ctl.flags & MAP_USE_WAIT) 316 + req->Attributes |= WIN_USE_WAIT; 317 + *handle = win; 318 + return CS_SUCCESS; 319 + } /* pcmcia_get_window */ 320 + EXPORT_SYMBOL(pcmcia_get_window); 321 + 322 + 323 + /** pccard_get_status 324 + * 325 + * Get the current socket state bits. We don't support the latched 326 + * SocketState yet: I haven't seen any point for it. 327 + */ 328 + 329 + int pccard_get_status(struct pcmcia_socket *s, unsigned int function, 330 + cs_status_t *status) 331 + { 332 + config_t *c; 333 + int val; 334 + 335 + s->ops->get_status(s, &val); 336 + status->CardState = status->SocketState = 0; 337 + status->CardState |= (val & SS_DETECT) ? CS_EVENT_CARD_DETECT : 0; 338 + status->CardState |= (val & SS_CARDBUS) ? CS_EVENT_CB_DETECT : 0; 339 + status->CardState |= (val & SS_3VCARD) ? CS_EVENT_3VCARD : 0; 340 + status->CardState |= (val & SS_XVCARD) ? CS_EVENT_XVCARD : 0; 341 + if (s->state & SOCKET_SUSPEND) 342 + status->CardState |= CS_EVENT_PM_SUSPEND; 343 + if (!(s->state & SOCKET_PRESENT)) 344 + return CS_NO_CARD; 345 + 346 + c = (s->config != NULL) ? &s->config[function] : NULL; 347 + if ((c != NULL) && (c->state & CONFIG_LOCKED) && 348 + (c->IntType & (INT_MEMORY_AND_IO | INT_ZOOMED_VIDEO))) { 349 + u_char reg; 350 + if (c->Present & PRESENT_PIN_REPLACE) { 351 + pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_PRR)>>1, 1, &reg); 352 + status->CardState |= 353 + (reg & PRR_WP_STATUS) ? CS_EVENT_WRITE_PROTECT : 0; 354 + status->CardState |= 355 + (reg & PRR_READY_STATUS) ? CS_EVENT_READY_CHANGE : 0; 356 + status->CardState |= 357 + (reg & PRR_BVD2_STATUS) ? CS_EVENT_BATTERY_LOW : 0; 358 + status->CardState |= 359 + (reg & PRR_BVD1_STATUS) ? CS_EVENT_BATTERY_DEAD : 0; 360 + } else { 361 + /* No PRR? Then assume we're always ready */ 362 + status->CardState |= CS_EVENT_READY_CHANGE; 363 + } 364 + if (c->Present & PRESENT_EXT_STATUS) { 365 + pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_ESR)>>1, 1, &reg); 366 + status->CardState |= 367 + (reg & ESR_REQ_ATTN) ? CS_EVENT_REQUEST_ATTENTION : 0; 368 + } 369 + return CS_SUCCESS; 370 + } 371 + status->CardState |= 372 + (val & SS_WRPROT) ? CS_EVENT_WRITE_PROTECT : 0; 373 + status->CardState |= 374 + (val & SS_BATDEAD) ? CS_EVENT_BATTERY_DEAD : 0; 375 + status->CardState |= 376 + (val & SS_BATWARN) ? CS_EVENT_BATTERY_LOW : 0; 377 + status->CardState |= 378 + (val & SS_READY) ? CS_EVENT_READY_CHANGE : 0; 379 + return CS_SUCCESS; 380 + } /* pccard_get_status */ 381 + 382 + int pcmcia_get_status(client_handle_t handle, cs_status_t *status) 383 + { 384 + struct pcmcia_socket *s; 385 + if (CHECK_HANDLE(handle)) 386 + return CS_BAD_HANDLE; 387 + s = SOCKET(handle); 388 + return pccard_get_status(s, handle->Function, status); 389 + } 390 + EXPORT_SYMBOL(pcmcia_get_status); 391 + 392 + 393 + 394 + /** pcmcia_get_mem_page 395 + * 396 + * Change the card address of an already open memory window. 397 + */ 398 + int pcmcia_get_mem_page(window_handle_t win, memreq_t *req) 399 + { 400 + if ((win == NULL) || (win->magic != WINDOW_MAGIC)) 401 + return CS_BAD_HANDLE; 402 + req->Page = 0; 403 + req->CardOffset = win->ctl.card_start; 404 + return CS_SUCCESS; 405 + } /* pcmcia_get_mem_page */ 406 + EXPORT_SYMBOL(pcmcia_get_mem_page); 407 + 408 + 409 + int pcmcia_map_mem_page(window_handle_t win, memreq_t *req) 410 + { 411 + struct pcmcia_socket *s; 412 + if ((win == NULL) || (win->magic != WINDOW_MAGIC)) 413 + return CS_BAD_HANDLE; 414 + if (req->Page != 0) 415 + return CS_BAD_PAGE; 416 + s = win->sock; 417 + win->ctl.card_start = req->CardOffset; 418 + if (s->ops->set_mem_map(s, &win->ctl) != 0) 419 + return CS_BAD_OFFSET; 420 + return CS_SUCCESS; 421 + } /* pcmcia_map_mem_page */ 422 + EXPORT_SYMBOL(pcmcia_map_mem_page); 423 + 424 + 425 + /** pcmcia_modify_configuration 426 + * 427 + * Modify a locked socket configuration 428 + */ 429 + int pcmcia_modify_configuration(client_handle_t handle, 430 + modconf_t *mod) 431 + { 432 + struct pcmcia_socket *s; 433 + config_t *c; 434 + 435 + if (CHECK_HANDLE(handle)) 436 + return CS_BAD_HANDLE; 437 + s = SOCKET(handle); 438 + c = CONFIG(handle); 439 + if (!(s->state & SOCKET_PRESENT)) 440 + return CS_NO_CARD; 441 + if (!(c->state & CONFIG_LOCKED)) 442 + return CS_CONFIGURATION_LOCKED; 443 + 444 + if (mod->Attributes & CONF_IRQ_CHANGE_VALID) { 445 + if (mod->Attributes & CONF_ENABLE_IRQ) { 446 + c->Attributes |= CONF_ENABLE_IRQ; 447 + s->socket.io_irq = s->irq.AssignedIRQ; 448 + } else { 449 + c->Attributes &= ~CONF_ENABLE_IRQ; 450 + s->socket.io_irq = 0; 451 + } 452 + s->ops->set_socket(s, &s->socket); 453 + } 454 + 455 + if (mod->Attributes & CONF_VCC_CHANGE_VALID) 456 + return CS_BAD_VCC; 457 + 458 + /* We only allow changing Vpp1 and Vpp2 to the same value */ 459 + if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) && 460 + (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { 461 + if (mod->Vpp1 != mod->Vpp2) 462 + return CS_BAD_VPP; 463 + c->Vpp1 = c->Vpp2 = s->socket.Vpp = mod->Vpp1; 464 + if (s->ops->set_socket(s, &s->socket)) 465 + return CS_BAD_VPP; 466 + } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) || 467 + (mod->Attributes & CONF_VPP2_CHANGE_VALID)) 468 + return CS_BAD_VPP; 469 + 470 + return CS_SUCCESS; 471 + } /* modify_configuration */ 472 + EXPORT_SYMBOL(pcmcia_modify_configuration); 473 + 474 + 475 + int pcmcia_release_configuration(client_handle_t handle) 476 + { 477 + pccard_io_map io = { 0, 0, 0, 0, 1 }; 478 + struct pcmcia_socket *s; 479 + int i; 480 + 481 + if (CHECK_HANDLE(handle) || 482 + !(handle->state & CLIENT_CONFIG_LOCKED)) 483 + return CS_BAD_HANDLE; 484 + handle->state &= ~CLIENT_CONFIG_LOCKED; 485 + s = SOCKET(handle); 486 + 487 + #ifdef CONFIG_CARDBUS 488 + if (handle->state & CLIENT_CARDBUS) 489 + return CS_SUCCESS; 490 + #endif 491 + 492 + if (!(handle->state & CLIENT_STALE)) { 493 + config_t *c = CONFIG(handle); 494 + if (--(s->lock_count) == 0) { 495 + s->socket.flags = SS_OUTPUT_ENA; /* Is this correct? */ 496 + s->socket.Vpp = 0; 497 + s->socket.io_irq = 0; 498 + s->ops->set_socket(s, &s->socket); 499 + } 500 + if (c->state & CONFIG_IO_REQ) 501 + for (i = 0; i < MAX_IO_WIN; i++) { 502 + if (s->io[i].NumPorts == 0) 503 + continue; 504 + s->io[i].Config--; 505 + if (s->io[i].Config != 0) 506 + continue; 507 + io.map = i; 508 + s->ops->set_io_map(s, &io); 509 + } 510 + c->state &= ~CONFIG_LOCKED; 511 + } 512 + 513 + return CS_SUCCESS; 514 + } /* pcmcia_release_configuration */ 515 + EXPORT_SYMBOL(pcmcia_release_configuration); 516 + 517 + 518 + /** pcmcia_release_io 519 + * 520 + * Release_io() releases the I/O ranges allocated by a client. This 521 + * may be invoked some time after a card ejection has already dumped 522 + * the actual socket configuration, so if the client is "stale", we 523 + * don't bother checking the port ranges against the current socket 524 + * values. 525 + */ 526 + int pcmcia_release_io(client_handle_t handle, io_req_t *req) 527 + { 528 + struct pcmcia_socket *s; 529 + 530 + if (CHECK_HANDLE(handle) || !(handle->state & CLIENT_IO_REQ)) 531 + return CS_BAD_HANDLE; 532 + handle->state &= ~CLIENT_IO_REQ; 533 + s = SOCKET(handle); 534 + 535 + #ifdef CONFIG_CARDBUS 536 + if (handle->state & CLIENT_CARDBUS) 537 + return CS_SUCCESS; 538 + #endif 539 + 540 + if (!(handle->state & CLIENT_STALE)) { 541 + config_t *c = CONFIG(handle); 542 + if (c->state & CONFIG_LOCKED) 543 + return CS_CONFIGURATION_LOCKED; 544 + if ((c->io.BasePort1 != req->BasePort1) || 545 + (c->io.NumPorts1 != req->NumPorts1) || 546 + (c->io.BasePort2 != req->BasePort2) || 547 + (c->io.NumPorts2 != req->NumPorts2)) 548 + return CS_BAD_ARGS; 549 + c->state &= ~CONFIG_IO_REQ; 550 + } 551 + 552 + release_io_space(s, req->BasePort1, req->NumPorts1); 553 + if (req->NumPorts2) 554 + release_io_space(s, req->BasePort2, req->NumPorts2); 555 + 556 + return CS_SUCCESS; 557 + } /* pcmcia_release_io */ 558 + EXPORT_SYMBOL(pcmcia_release_io); 559 + 560 + 561 + int pcmcia_release_irq(client_handle_t handle, irq_req_t *req) 562 + { 563 + struct pcmcia_socket *s; 564 + if (CHECK_HANDLE(handle) || !(handle->state & CLIENT_IRQ_REQ)) 565 + return CS_BAD_HANDLE; 566 + handle->state &= ~CLIENT_IRQ_REQ; 567 + s = SOCKET(handle); 568 + 569 + if (!(handle->state & CLIENT_STALE)) { 570 + config_t *c = CONFIG(handle); 571 + if (c->state & CONFIG_LOCKED) 572 + return CS_CONFIGURATION_LOCKED; 573 + if (c->irq.Attributes != req->Attributes) 574 + return CS_BAD_ATTRIBUTE; 575 + if (s->irq.AssignedIRQ != req->AssignedIRQ) 576 + return CS_BAD_IRQ; 577 + if (--s->irq.Config == 0) { 578 + c->state &= ~CONFIG_IRQ_REQ; 579 + s->irq.AssignedIRQ = 0; 580 + } 581 + } 582 + 583 + if (req->Attributes & IRQ_HANDLE_PRESENT) { 584 + free_irq(req->AssignedIRQ, req->Instance); 585 + } 586 + 587 + #ifdef CONFIG_PCMCIA_PROBE 588 + pcmcia_used_irq[req->AssignedIRQ]--; 589 + #endif 590 + 591 + return CS_SUCCESS; 592 + } /* pcmcia_release_irq */ 593 + EXPORT_SYMBOL(pcmcia_release_irq); 594 + 595 + 596 + int pcmcia_release_window(window_handle_t win) 597 + { 598 + struct pcmcia_socket *s; 599 + 600 + if ((win == NULL) || (win->magic != WINDOW_MAGIC)) 601 + return CS_BAD_HANDLE; 602 + s = win->sock; 603 + if (!(win->handle->state & CLIENT_WIN_REQ(win->index))) 604 + return CS_BAD_HANDLE; 605 + 606 + /* Shut down memory window */ 607 + win->ctl.flags &= ~MAP_ACTIVE; 608 + s->ops->set_mem_map(s, &win->ctl); 609 + s->state &= ~SOCKET_WIN_REQ(win->index); 610 + 611 + /* Release system memory */ 612 + if (win->ctl.res) { 613 + release_resource(win->ctl.res); 614 + kfree(win->ctl.res); 615 + win->ctl.res = NULL; 616 + } 617 + win->handle->state &= ~CLIENT_WIN_REQ(win->index); 618 + 619 + win->magic = 0; 620 + 621 + return CS_SUCCESS; 622 + } /* pcmcia_release_window */ 623 + EXPORT_SYMBOL(pcmcia_release_window); 624 + 625 + 626 + int pcmcia_request_configuration(client_handle_t handle, 627 + config_req_t *req) 628 + { 629 + int i; 630 + u_int base; 631 + struct pcmcia_socket *s; 632 + config_t *c; 633 + pccard_io_map iomap; 634 + 635 + if (CHECK_HANDLE(handle)) 636 + return CS_BAD_HANDLE; 637 + s = SOCKET(handle); 638 + if (!(s->state & SOCKET_PRESENT)) 639 + return CS_NO_CARD; 640 + 641 + #ifdef CONFIG_CARDBUS 642 + if (handle->state & CLIENT_CARDBUS) 643 + return CS_UNSUPPORTED_MODE; 644 + #endif 645 + 646 + if (req->IntType & INT_CARDBUS) 647 + return CS_UNSUPPORTED_MODE; 648 + c = CONFIG(handle); 649 + if (c->state & CONFIG_LOCKED) 650 + return CS_CONFIGURATION_LOCKED; 651 + 652 + /* Do power control. We don't allow changes in Vcc. */ 653 + if (s->socket.Vcc != req->Vcc) 654 + return CS_BAD_VCC; 655 + if (req->Vpp1 != req->Vpp2) 656 + return CS_BAD_VPP; 657 + s->socket.Vpp = req->Vpp1; 658 + if (s->ops->set_socket(s, &s->socket)) 659 + return CS_BAD_VPP; 660 + 661 + c->Vcc = req->Vcc; c->Vpp1 = c->Vpp2 = req->Vpp1; 662 + 663 + /* Pick memory or I/O card, DMA mode, interrupt */ 664 + c->IntType = req->IntType; 665 + c->Attributes = req->Attributes; 666 + if (req->IntType & INT_MEMORY_AND_IO) 667 + s->socket.flags |= SS_IOCARD; 668 + if (req->IntType & INT_ZOOMED_VIDEO) 669 + s->socket.flags |= SS_ZVCARD | SS_IOCARD; 670 + if (req->Attributes & CONF_ENABLE_DMA) 671 + s->socket.flags |= SS_DMA_MODE; 672 + if (req->Attributes & CONF_ENABLE_SPKR) 673 + s->socket.flags |= SS_SPKR_ENA; 674 + if (req->Attributes & CONF_ENABLE_IRQ) 675 + s->socket.io_irq = s->irq.AssignedIRQ; 676 + else 677 + s->socket.io_irq = 0; 678 + s->ops->set_socket(s, &s->socket); 679 + s->lock_count++; 680 + 681 + /* Set up CIS configuration registers */ 682 + base = c->ConfigBase = req->ConfigBase; 683 + c->Present = c->CardValues = req->Present; 684 + if (req->Present & PRESENT_COPY) { 685 + c->Copy = req->Copy; 686 + pcmcia_write_cis_mem(s, 1, (base + CISREG_SCR)>>1, 1, &c->Copy); 687 + } 688 + if (req->Present & PRESENT_OPTION) { 689 + if (s->functions == 1) { 690 + c->Option = req->ConfigIndex & COR_CONFIG_MASK; 691 + } else { 692 + c->Option = req->ConfigIndex & COR_MFC_CONFIG_MASK; 693 + c->Option |= COR_FUNC_ENA|COR_IREQ_ENA; 694 + if (req->Present & PRESENT_IOBASE_0) 695 + c->Option |= COR_ADDR_DECODE; 696 + } 697 + if (c->state & CONFIG_IRQ_REQ) 698 + if (!(c->irq.Attributes & IRQ_FORCED_PULSE)) 699 + c->Option |= COR_LEVEL_REQ; 700 + pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &c->Option); 701 + mdelay(40); 702 + } 703 + if (req->Present & PRESENT_STATUS) { 704 + c->Status = req->Status; 705 + pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &c->Status); 706 + } 707 + if (req->Present & PRESENT_PIN_REPLACE) { 708 + c->Pin = req->Pin; 709 + pcmcia_write_cis_mem(s, 1, (base + CISREG_PRR)>>1, 1, &c->Pin); 710 + } 711 + if (req->Present & PRESENT_EXT_STATUS) { 712 + c->ExtStatus = req->ExtStatus; 713 + pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, &c->ExtStatus); 714 + } 715 + if (req->Present & PRESENT_IOBASE_0) { 716 + u_char b = c->io.BasePort1 & 0xff; 717 + pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b); 718 + b = (c->io.BasePort1 >> 8) & 0xff; 719 + pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b); 720 + } 721 + if (req->Present & PRESENT_IOSIZE) { 722 + u_char b = c->io.NumPorts1 + c->io.NumPorts2 - 1; 723 + pcmcia_write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b); 724 + } 725 + 726 + /* Configure I/O windows */ 727 + if (c->state & CONFIG_IO_REQ) { 728 + iomap.speed = io_speed; 729 + for (i = 0; i < MAX_IO_WIN; i++) 730 + if (s->io[i].NumPorts != 0) { 731 + iomap.map = i; 732 + iomap.flags = MAP_ACTIVE; 733 + switch (s->io[i].Attributes & IO_DATA_PATH_WIDTH) { 734 + case IO_DATA_PATH_WIDTH_16: 735 + iomap.flags |= MAP_16BIT; break; 736 + case IO_DATA_PATH_WIDTH_AUTO: 737 + iomap.flags |= MAP_AUTOSZ; break; 738 + default: 739 + break; 740 + } 741 + iomap.start = s->io[i].BasePort; 742 + iomap.stop = iomap.start + s->io[i].NumPorts - 1; 743 + s->ops->set_io_map(s, &iomap); 744 + s->io[i].Config++; 745 + } 746 + } 747 + 748 + c->state |= CONFIG_LOCKED; 749 + handle->state |= CLIENT_CONFIG_LOCKED; 750 + return CS_SUCCESS; 751 + } /* pcmcia_request_configuration */ 752 + EXPORT_SYMBOL(pcmcia_request_configuration); 753 + 754 + 755 + /** pcmcia_request_io 756 + * 757 + * Request_io() reserves ranges of port addresses for a socket. 758 + * I have not implemented range sharing or alias addressing. 759 + */ 760 + int pcmcia_request_io(client_handle_t handle, io_req_t *req) 761 + { 762 + struct pcmcia_socket *s; 763 + config_t *c; 764 + 765 + if (CHECK_HANDLE(handle)) 766 + return CS_BAD_HANDLE; 767 + s = SOCKET(handle); 768 + if (!(s->state & SOCKET_PRESENT)) 769 + return CS_NO_CARD; 770 + 771 + if (handle->state & CLIENT_CARDBUS) { 772 + #ifdef CONFIG_CARDBUS 773 + handle->state |= CLIENT_IO_REQ; 774 + return CS_SUCCESS; 775 + #else 776 + return CS_UNSUPPORTED_FUNCTION; 777 + #endif 778 + } 779 + 780 + if (!req) 781 + return CS_UNSUPPORTED_MODE; 782 + c = CONFIG(handle); 783 + if (c->state & CONFIG_LOCKED) 784 + return CS_CONFIGURATION_LOCKED; 785 + if (c->state & CONFIG_IO_REQ) 786 + return CS_IN_USE; 787 + if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) 788 + return CS_BAD_ATTRIBUTE; 789 + if ((req->NumPorts2 > 0) && 790 + (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) 791 + return CS_BAD_ATTRIBUTE; 792 + 793 + if (alloc_io_space(s, req->Attributes1, &req->BasePort1, 794 + req->NumPorts1, req->IOAddrLines)) 795 + return CS_IN_USE; 796 + 797 + if (req->NumPorts2) { 798 + if (alloc_io_space(s, req->Attributes2, &req->BasePort2, 799 + req->NumPorts2, req->IOAddrLines)) { 800 + release_io_space(s, req->BasePort1, req->NumPorts1); 801 + return CS_IN_USE; 802 + } 803 + } 804 + 805 + c->io = *req; 806 + c->state |= CONFIG_IO_REQ; 807 + handle->state |= CLIENT_IO_REQ; 808 + return CS_SUCCESS; 809 + } /* pcmcia_request_io */ 810 + EXPORT_SYMBOL(pcmcia_request_io); 811 + 812 + 813 + /** pcmcia_request_irq 814 + * 815 + * Request_irq() reserves an irq for this client. 816 + * 817 + * Also, since Linux only reserves irq's when they are actually 818 + * hooked, we don't guarantee that an irq will still be available 819 + * when the configuration is locked. Now that I think about it, 820 + * there might be a way to fix this using a dummy handler. 821 + */ 822 + 823 + #ifdef CONFIG_PCMCIA_PROBE 824 + static irqreturn_t test_action(int cpl, void *dev_id, struct pt_regs *regs) 825 + { 826 + return IRQ_NONE; 827 + } 828 + #endif 829 + 830 + int pcmcia_request_irq(client_handle_t handle, irq_req_t *req) 831 + { 832 + struct pcmcia_socket *s; 833 + config_t *c; 834 + int ret = CS_IN_USE, irq = 0; 835 + struct pcmcia_device *p_dev = handle_to_pdev(handle); 836 + 837 + if (CHECK_HANDLE(handle)) 838 + return CS_BAD_HANDLE; 839 + s = SOCKET(handle); 840 + if (!(s->state & SOCKET_PRESENT)) 841 + return CS_NO_CARD; 842 + c = CONFIG(handle); 843 + if (c->state & CONFIG_LOCKED) 844 + return CS_CONFIGURATION_LOCKED; 845 + if (c->state & CONFIG_IRQ_REQ) 846 + return CS_IN_USE; 847 + 848 + #ifdef CONFIG_PCMCIA_PROBE 849 + if (s->irq.AssignedIRQ != 0) { 850 + /* If the interrupt is already assigned, it must be the same */ 851 + irq = s->irq.AssignedIRQ; 852 + } else { 853 + int try; 854 + u32 mask = s->irq_mask; 855 + void *data = NULL; 856 + 857 + for (try = 0; try < 64; try++) { 858 + irq = try % 32; 859 + 860 + /* marked as available by driver, and not blocked by userspace? */ 861 + if (!((mask >> irq) & 1)) 862 + continue; 863 + 864 + /* avoid an IRQ which is already used by a PCMCIA card */ 865 + if ((try < 32) && pcmcia_used_irq[irq]) 866 + continue; 867 + 868 + /* register the correct driver, if possible, of check whether 869 + * registering a dummy handle works, i.e. if the IRQ isn't 870 + * marked as used by the kernel resource management core */ 871 + ret = request_irq(irq, 872 + (req->Attributes & IRQ_HANDLE_PRESENT) ? req->Handler : test_action, 873 + ((req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) || 874 + (s->functions > 1) || 875 + (irq == s->pci_irq)) ? SA_SHIRQ : 0, 876 + p_dev->dev.bus_id, 877 + (req->Attributes & IRQ_HANDLE_PRESENT) ? req->Instance : data); 878 + if (!ret) { 879 + if (!(req->Attributes & IRQ_HANDLE_PRESENT)) 880 + free_irq(irq, data); 881 + break; 882 + } 883 + } 884 + } 885 + #endif 886 + if (ret) { 887 + if (!s->pci_irq) 888 + return ret; 889 + irq = s->pci_irq; 890 + } 891 + 892 + if (ret && req->Attributes & IRQ_HANDLE_PRESENT) { 893 + if (request_irq(irq, req->Handler, 894 + ((req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) || 895 + (s->functions > 1) || 896 + (irq == s->pci_irq)) ? SA_SHIRQ : 0, 897 + p_dev->dev.bus_id, req->Instance)) 898 + return CS_IN_USE; 899 + } 900 + 901 + c->irq.Attributes = req->Attributes; 902 + s->irq.AssignedIRQ = req->AssignedIRQ = irq; 903 + s->irq.Config++; 904 + 905 + c->state |= CONFIG_IRQ_REQ; 906 + handle->state |= CLIENT_IRQ_REQ; 907 + 908 + #ifdef CONFIG_PCMCIA_PROBE 909 + pcmcia_used_irq[irq]++; 910 + #endif 911 + 912 + return CS_SUCCESS; 913 + } /* pcmcia_request_irq */ 914 + EXPORT_SYMBOL(pcmcia_request_irq); 915 + 916 + 917 + /** pcmcia_request_window 918 + * 919 + * Request_window() establishes a mapping between card memory space 920 + * and system memory space. 921 + */ 922 + int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle_t *wh) 923 + { 924 + struct pcmcia_socket *s; 925 + window_t *win; 926 + u_long align; 927 + int w; 928 + 929 + if (CHECK_HANDLE(*handle)) 930 + return CS_BAD_HANDLE; 931 + s = (*handle)->Socket; 932 + if (!(s->state & SOCKET_PRESENT)) 933 + return CS_NO_CARD; 934 + if (req->Attributes & (WIN_PAGED | WIN_SHARED)) 935 + return CS_BAD_ATTRIBUTE; 936 + 937 + /* Window size defaults to smallest available */ 938 + if (req->Size == 0) 939 + req->Size = s->map_size; 940 + align = (((s->features & SS_CAP_MEM_ALIGN) || 941 + (req->Attributes & WIN_STRICT_ALIGN)) ? 942 + req->Size : s->map_size); 943 + if (req->Size & (s->map_size-1)) 944 + return CS_BAD_SIZE; 945 + if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || 946 + (req->Base & (align-1))) 947 + return CS_BAD_BASE; 948 + if (req->Base) 949 + align = 0; 950 + 951 + /* Allocate system memory window */ 952 + for (w = 0; w < MAX_WIN; w++) 953 + if (!(s->state & SOCKET_WIN_REQ(w))) break; 954 + if (w == MAX_WIN) 955 + return CS_OUT_OF_RESOURCE; 956 + 957 + win = &s->win[w]; 958 + win->magic = WINDOW_MAGIC; 959 + win->index = w; 960 + win->handle = *handle; 961 + win->sock = s; 962 + 963 + if (!(s->features & SS_CAP_STATIC_MAP)) { 964 + win->ctl.res = pcmcia_find_mem_region(req->Base, req->Size, align, 965 + (req->Attributes & WIN_MAP_BELOW_1MB), s); 966 + if (!win->ctl.res) 967 + return CS_IN_USE; 968 + } 969 + (*handle)->state |= CLIENT_WIN_REQ(w); 970 + 971 + /* Configure the socket controller */ 972 + win->ctl.map = w+1; 973 + win->ctl.flags = 0; 974 + win->ctl.speed = req->AccessSpeed; 975 + if (req->Attributes & WIN_MEMORY_TYPE) 976 + win->ctl.flags |= MAP_ATTRIB; 977 + if (req->Attributes & WIN_ENABLE) 978 + win->ctl.flags |= MAP_ACTIVE; 979 + if (req->Attributes & WIN_DATA_WIDTH_16) 980 + win->ctl.flags |= MAP_16BIT; 981 + if (req->Attributes & WIN_USE_WAIT) 982 + win->ctl.flags |= MAP_USE_WAIT; 983 + win->ctl.card_start = 0; 984 + if (s->ops->set_mem_map(s, &win->ctl) != 0) 985 + return CS_BAD_ARGS; 986 + s->state |= SOCKET_WIN_REQ(w); 987 + 988 + /* Return window handle */ 989 + if (s->features & SS_CAP_STATIC_MAP) { 990 + req->Base = win->ctl.static_start; 991 + } else { 992 + req->Base = win->ctl.res->start; 993 + } 994 + *wh = win; 995 + 996 + return CS_SUCCESS; 997 + } /* pcmcia_request_window */ 998 + EXPORT_SYMBOL(pcmcia_request_window);
+7 -4
drivers/pcmcia/rsrc_mgr.c
··· 72 72 /* you can't use the old interface if the new 73 73 * one was used before */ 74 74 spin_lock_irqsave(&s->lock, flags); 75 - if ((s->resource_setup_done) && 75 + if ((s->resource_setup_new) && 76 76 !(s->resource_setup_old)) { 77 77 spin_unlock_irqrestore(&s->lock, flags); 78 78 continue; ··· 105 105 } 106 106 EXPORT_SYMBOL(pcmcia_validate_mem); 107 107 108 - int adjust_io_region(struct resource *res, unsigned long r_start, 108 + int pcmcia_adjust_io_region(struct resource *res, unsigned long r_start, 109 109 unsigned long r_end, struct pcmcia_socket *s) 110 110 { 111 111 if (s->resource_ops->adjust_io_region) 112 112 return s->resource_ops->adjust_io_region(res, r_start, r_end, s); 113 113 return -ENOMEM; 114 114 } 115 + EXPORT_SYMBOL(pcmcia_adjust_io_region); 115 116 116 - struct resource *find_io_region(unsigned long base, int num, 117 + struct resource *pcmcia_find_io_region(unsigned long base, int num, 117 118 unsigned long align, struct pcmcia_socket *s) 118 119 { 119 120 if (s->resource_ops->find_io) 120 121 return s->resource_ops->find_io(base, num, align, s); 121 122 return NULL; 122 123 } 124 + EXPORT_SYMBOL(pcmcia_find_io_region); 123 125 124 - struct resource *find_mem_region(u_long base, u_long num, u_long align, 126 + struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align, 125 127 int low, struct pcmcia_socket *s) 126 128 { 127 129 if (s->resource_ops->find_mem) 128 130 return s->resource_ops->find_mem(base, num, align, low, s); 129 131 return NULL; 130 132 } 133 + EXPORT_SYMBOL(pcmcia_find_mem_region); 131 134 132 135 void release_resource_db(struct pcmcia_socket *s) 133 136 {
+114 -56
drivers/pcmcia/rsrc_nonstatic.c
··· 372 372 base, base+num-1); 373 373 bad = fail = 0; 374 374 step = (num < 0x20000) ? 0x2000 : ((num>>4) & ~0x1fff); 375 + /* don't allow too large steps */ 376 + if (step > 0x800000) 377 + step = 0x800000; 375 378 /* cis_readable wants to map 2x map_size */ 376 379 if (step < 2 * s->map_size) 377 380 step = 2 * s->map_size; ··· 468 465 469 466 for (m = s_data->mem_db.next; m != &s_data->mem_db; m = mm.next) { 470 467 mm = *m; 471 - if (do_mem_probe(mm.base, mm.num, s)) 472 - break; 468 + do_mem_probe(mm.base, mm.num, s); 473 469 } 474 470 } 475 471 ··· 603 601 604 602 ======================================================================*/ 605 603 606 - struct resource *nonstatic_find_io_region(unsigned long base, int num, 604 + static struct resource *nonstatic_find_io_region(unsigned long base, int num, 607 605 unsigned long align, struct pcmcia_socket *s) 608 606 { 609 607 struct resource *res = make_resource(0, num, IORESOURCE_IO, s->dev.class_id); ··· 637 635 return res; 638 636 } 639 637 640 - struct resource * nonstatic_find_mem_region(u_long base, u_long num, u_long align, 641 - int low, struct pcmcia_socket *s) 638 + static struct resource * nonstatic_find_mem_region(u_long base, u_long num, 639 + u_long align, int low, struct pcmcia_socket *s) 642 640 { 643 641 struct resource *res = make_resource(0, num, IORESOURCE_MEM, s->dev.class_id); 644 642 struct socket_data *s_data = s->resource_data; ··· 685 683 } 686 684 687 685 688 - static int adjust_memory(struct pcmcia_socket *s, adjust_t *adj) 686 + static int adjust_memory(struct pcmcia_socket *s, unsigned int action, unsigned long start, unsigned long end) 689 687 { 690 - u_long base, num; 691 688 struct socket_data *data = s->resource_data; 692 - int ret; 689 + unsigned long size = end - start + 1; 690 + int ret = 0; 693 691 694 - base = adj->resource.memory.Base; 695 - num = adj->resource.memory.Size; 696 - if ((num == 0) || (base+num-1 < base)) 697 - return CS_BAD_SIZE; 698 - 699 - ret = CS_SUCCESS; 692 + if (end <= start) 693 + return -EINVAL; 700 694 701 695 down(&rsrc_sem); 702 - switch (adj->Action) { 696 + switch (action) { 703 697 case ADD_MANAGED_RESOURCE: 704 - ret = add_interval(&data->mem_db, base, num); 698 + ret = add_interval(&data->mem_db, start, size); 705 699 break; 706 700 case REMOVE_MANAGED_RESOURCE: 707 - ret = sub_interval(&data->mem_db, base, num); 708 - if (ret == CS_SUCCESS) { 701 + ret = sub_interval(&data->mem_db, start, size); 702 + if (!ret) { 709 703 struct pcmcia_socket *socket; 710 704 down_read(&pcmcia_socket_list_rwsem); 711 705 list_for_each_entry(socket, &pcmcia_socket_list, socket_list) ··· 710 712 } 711 713 break; 712 714 default: 713 - ret = CS_UNSUPPORTED_FUNCTION; 715 + ret = -EINVAL; 714 716 } 715 717 up(&rsrc_sem); 716 718 ··· 718 720 } 719 721 720 722 721 - static int adjust_io(struct pcmcia_socket *s, adjust_t *adj) 723 + static int adjust_io(struct pcmcia_socket *s, unsigned int action, unsigned long start, unsigned long end) 722 724 { 723 725 struct socket_data *data = s->resource_data; 724 - kio_addr_t base, num; 725 - int ret = CS_SUCCESS; 726 + unsigned long size = end - start + 1; 727 + int ret = 0; 726 728 727 - base = adj->resource.io.BasePort; 728 - num = adj->resource.io.NumPorts; 729 - if ((base < 0) || (base > 0xffff)) 730 - return CS_BAD_BASE; 731 - if ((num <= 0) || (base+num > 0x10000) || (base+num <= base)) 732 - return CS_BAD_SIZE; 729 + if (end <= start) 730 + return -EINVAL; 731 + 732 + if (end > IO_SPACE_LIMIT) 733 + return -EINVAL; 733 734 734 735 down(&rsrc_sem); 735 - switch (adj->Action) { 736 + switch (action) { 736 737 case ADD_MANAGED_RESOURCE: 737 - if (add_interval(&data->io_db, base, num) != 0) { 738 - ret = CS_IN_USE; 738 + if (add_interval(&data->io_db, start, size) != 0) { 739 + ret = -EBUSY; 739 740 break; 740 741 } 741 742 #ifdef CONFIG_PCMCIA_PROBE 742 743 if (probe_io) 743 - do_io_probe(s, base, num); 744 + do_io_probe(s, start, size); 744 745 #endif 745 746 break; 746 747 case REMOVE_MANAGED_RESOURCE: 747 - sub_interval(&data->io_db, base, num); 748 + sub_interval(&data->io_db, start, size); 748 749 break; 749 750 default: 750 - ret = CS_UNSUPPORTED_FUNCTION; 751 + ret = -EINVAL; 751 752 break; 752 753 } 753 754 up(&rsrc_sem); ··· 757 760 758 761 static int nonstatic_adjust_resource_info(struct pcmcia_socket *s, adjust_t *adj) 759 762 { 763 + unsigned long end; 764 + 760 765 switch (adj->Resource) { 761 766 case RES_MEMORY_RANGE: 762 - return adjust_memory(s, adj); 767 + end = adj->resource.memory.Base + adj->resource.memory.Size - 1; 768 + return adjust_memory(s, adj->Action, adj->resource.memory.Base, end); 763 769 case RES_IO_RANGE: 764 - return adjust_io(s, adj); 770 + end = adj->resource.io.BasePort + adj->resource.io.NumPorts - 1; 771 + return adjust_io(s, adj->Action, adj->resource.io.BasePort, end); 765 772 } 766 773 return CS_UNSUPPORTED_FUNCTION; 767 774 } 775 + 776 + #ifdef CONFIG_PCI 777 + static int nonstatic_autoadd_resources(struct pcmcia_socket *s) 778 + { 779 + struct resource *res; 780 + int i, done = 0; 781 + 782 + if (!s->cb_dev || !s->cb_dev->bus) 783 + return -ENODEV; 784 + 785 + #if defined(CONFIG_X86) || defined(CONFIG_X86_64) 786 + /* If this is the root bus, the risk of hitting 787 + * some strange system devices which aren't protected 788 + * by either ACPI resource tables or properly requested 789 + * resources is too big. Therefore, don't do auto-adding 790 + * of resources at the moment. 791 + */ 792 + if (s->cb_dev->bus->number == 0) 793 + return -EINVAL; 794 + #endif 795 + 796 + for (i=0; i < PCI_BUS_NUM_RESOURCES; i++) { 797 + res = s->cb_dev->bus->resource[i]; 798 + if (!res) 799 + continue; 800 + 801 + if (res->flags & IORESOURCE_IO) { 802 + if (res == &ioport_resource) 803 + continue; 804 + printk(KERN_INFO "pcmcia: parent PCI bridge I/O window: 0x%lx - 0x%lx\n", 805 + res->start, res->end); 806 + if (!adjust_io(s, ADD_MANAGED_RESOURCE, res->start, res->end)) 807 + done |= IORESOURCE_IO; 808 + 809 + } 810 + 811 + if (res->flags & IORESOURCE_MEM) { 812 + if (res == &iomem_resource) 813 + continue; 814 + printk(KERN_INFO "pcmcia: parent PCI bridge Memory window: 0x%lx - 0x%lx\n", 815 + res->start, res->end); 816 + if (!adjust_memory(s, ADD_MANAGED_RESOURCE, res->start, res->end)) 817 + done |= IORESOURCE_MEM; 818 + } 819 + } 820 + 821 + /* if we got at least one of IO, and one of MEM, we can be glad and 822 + * activate the PCMCIA subsystem */ 823 + if (done & (IORESOURCE_MEM | IORESOURCE_IO)) 824 + s->resource_setup_done = 1; 825 + 826 + return 0; 827 + } 828 + 829 + #else 830 + 831 + static inline int nonstatic_autoadd_resources(struct pcmcia_socket *s) 832 + { 833 + return -ENODEV; 834 + } 835 + 836 + #endif 837 + 768 838 769 839 static int nonstatic_init(struct pcmcia_socket *s) 770 840 { ··· 846 782 data->io_db.next = &data->io_db; 847 783 848 784 s->resource_data = (void *) data; 785 + 786 + nonstatic_autoadd_resources(s); 849 787 850 788 return 0; 851 789 } ··· 911 845 { 912 846 struct pcmcia_socket *s = class_get_devdata(class_dev); 913 847 unsigned long start_addr, end_addr; 914 - unsigned int add = 1; 915 - adjust_t adj; 848 + unsigned int add = ADD_MANAGED_RESOURCE; 916 849 ssize_t ret = 0; 917 850 918 851 ret = sscanf (buf, "+ 0x%lx - 0x%lx", &start_addr, &end_addr); 919 852 if (ret != 2) { 920 853 ret = sscanf (buf, "- 0x%lx - 0x%lx", &start_addr, &end_addr); 921 - add = 0; 854 + add = REMOVE_MANAGED_RESOURCE; 922 855 if (ret != 2) { 923 856 ret = sscanf (buf, "0x%lx - 0x%lx", &start_addr, &end_addr); 924 - add = 1; 857 + add = ADD_MANAGED_RESOURCE; 925 858 if (ret != 2) 926 859 return -EINVAL; 927 860 } ··· 928 863 if (end_addr <= start_addr) 929 864 return -EINVAL; 930 865 931 - adj.Action = add ? ADD_MANAGED_RESOURCE : REMOVE_MANAGED_RESOURCE; 932 - adj.Resource = RES_IO_RANGE; 933 - adj.resource.io.BasePort = start_addr; 934 - adj.resource.io.NumPorts = end_addr - start_addr + 1; 935 - 936 - ret = adjust_io(s, &adj); 866 + ret = adjust_io(s, add, start_addr, end_addr); 867 + if (!ret) 868 + s->resource_setup_new = 1; 937 869 938 870 return ret ? ret : count; 939 871 } ··· 963 901 { 964 902 struct pcmcia_socket *s = class_get_devdata(class_dev); 965 903 unsigned long start_addr, end_addr; 966 - unsigned int add = 1; 967 - adjust_t adj; 904 + unsigned int add = ADD_MANAGED_RESOURCE; 968 905 ssize_t ret = 0; 969 906 970 907 ret = sscanf (buf, "+ 0x%lx - 0x%lx", &start_addr, &end_addr); 971 908 if (ret != 2) { 972 909 ret = sscanf (buf, "- 0x%lx - 0x%lx", &start_addr, &end_addr); 973 - add = 0; 910 + add = REMOVE_MANAGED_RESOURCE; 974 911 if (ret != 2) { 975 912 ret = sscanf (buf, "0x%lx - 0x%lx", &start_addr, &end_addr); 976 - add = 1; 913 + add = ADD_MANAGED_RESOURCE; 977 914 if (ret != 2) 978 915 return -EINVAL; 979 916 } ··· 980 919 if (end_addr <= start_addr) 981 920 return -EINVAL; 982 921 983 - adj.Action = add ? ADD_MANAGED_RESOURCE : REMOVE_MANAGED_RESOURCE; 984 - adj.Resource = RES_MEMORY_RANGE; 985 - adj.resource.memory.Base = start_addr; 986 - adj.resource.memory.Size = end_addr - start_addr + 1; 987 - 988 - ret = adjust_memory(s, &adj); 922 + ret = adjust_memory(s, add, start_addr, end_addr); 923 + if (!ret) 924 + s->resource_setup_new = 1; 989 925 990 926 return ret ? ret : count; 991 927 }
+162 -16
drivers/pcmcia/socket_sysfs.c
··· 163 163 return -EINVAL; 164 164 165 165 spin_lock_irqsave(&s->lock, flags); 166 - if (!s->resource_setup_done) { 166 + if (!s->resource_setup_done) 167 167 s->resource_setup_done = 1; 168 - spin_unlock_irqrestore(&s->lock, flags); 169 - 170 - down(&s->skt_sem); 171 - if ((s->callback) && 172 - (s->state & SOCKET_PRESENT) && 173 - !(s->state & SOCKET_CARDBUS)) { 174 - if (try_module_get(s->callback->owner)) { 175 - s->callback->resources_done(s); 176 - module_put(s->callback->owner); 177 - } 178 - } 179 - up(&s->skt_sem); 180 - 181 - return count; 182 - } 183 168 spin_unlock_irqrestore(&s->lock, flags); 169 + 170 + down(&s->skt_sem); 171 + if ((s->callback) && 172 + (s->state & SOCKET_PRESENT) && 173 + !(s->state & SOCKET_CARDBUS)) { 174 + if (try_module_get(s->callback->owner)) { 175 + s->callback->requery(s); 176 + module_put(s->callback->owner); 177 + } 178 + } 179 + up(&s->skt_sem); 184 180 185 181 return count; 186 182 } 187 183 static CLASS_DEVICE_ATTR(available_resources_setup_done, 0600, pccard_show_resource, pccard_store_resource); 184 + 185 + 186 + static ssize_t pccard_extract_cis(struct pcmcia_socket *s, char *buf, loff_t off, size_t count) 187 + { 188 + tuple_t tuple; 189 + int status, i; 190 + loff_t pointer = 0; 191 + ssize_t ret = 0; 192 + u_char *tuplebuffer; 193 + u_char *tempbuffer; 194 + 195 + tuplebuffer = kmalloc(sizeof(u_char) * 256, GFP_KERNEL); 196 + if (!tuplebuffer) 197 + return -ENOMEM; 198 + 199 + tempbuffer = kmalloc(sizeof(u_char) * 258, GFP_KERNEL); 200 + if (!tempbuffer) { 201 + ret = -ENOMEM; 202 + goto free_tuple; 203 + } 204 + 205 + memset(&tuple, 0, sizeof(tuple_t)); 206 + 207 + tuple.Attributes = TUPLE_RETURN_LINK | TUPLE_RETURN_COMMON; 208 + tuple.DesiredTuple = RETURN_FIRST_TUPLE; 209 + tuple.TupleOffset = 0; 210 + 211 + status = pccard_get_first_tuple(s, BIND_FN_ALL, &tuple); 212 + while (!status) { 213 + tuple.TupleData = tuplebuffer; 214 + tuple.TupleDataMax = 255; 215 + memset(tuplebuffer, 0, sizeof(u_char) * 255); 216 + 217 + status = pccard_get_tuple_data(s, &tuple); 218 + if (status) 219 + break; 220 + 221 + if (off < (pointer + 2 + tuple.TupleDataLen)) { 222 + tempbuffer[0] = tuple.TupleCode & 0xff; 223 + tempbuffer[1] = tuple.TupleLink & 0xff; 224 + for (i = 0; i < tuple.TupleDataLen; i++) 225 + tempbuffer[i + 2] = tuplebuffer[i] & 0xff; 226 + 227 + for (i = 0; i < (2 + tuple.TupleDataLen); i++) { 228 + if (((i + pointer) >= off) && 229 + (i + pointer) < (off + count)) { 230 + buf[ret] = tempbuffer[i]; 231 + ret++; 232 + } 233 + } 234 + } 235 + 236 + pointer += 2 + tuple.TupleDataLen; 237 + 238 + if (pointer >= (off + count)) 239 + break; 240 + 241 + if (tuple.TupleCode == CISTPL_END) 242 + break; 243 + status = pccard_get_next_tuple(s, BIND_FN_ALL, &tuple); 244 + } 245 + 246 + kfree(tempbuffer); 247 + free_tuple: 248 + kfree(tuplebuffer); 249 + 250 + return (ret); 251 + } 252 + 253 + static ssize_t pccard_show_cis(struct kobject *kobj, char *buf, loff_t off, size_t count) 254 + { 255 + unsigned int size = 0x200; 256 + 257 + if (off >= size) 258 + count = 0; 259 + else { 260 + struct pcmcia_socket *s; 261 + cisinfo_t cisinfo; 262 + 263 + if (off + count > size) 264 + count = size - off; 265 + 266 + s = to_socket(container_of(kobj, struct class_device, kobj)); 267 + 268 + if (!(s->state & SOCKET_PRESENT)) 269 + return -ENODEV; 270 + if (pccard_validate_cis(s, BIND_FN_ALL, &cisinfo)) 271 + return -EIO; 272 + if (!cisinfo.Chains) 273 + return -ENODATA; 274 + 275 + count = pccard_extract_cis(s, buf, off, count); 276 + } 277 + 278 + return (count); 279 + } 280 + 281 + static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, size_t count) 282 + { 283 + struct pcmcia_socket *s = to_socket(container_of(kobj, struct class_device, kobj)); 284 + cisdump_t *cis; 285 + ssize_t ret = count; 286 + 287 + if (off) 288 + return -EINVAL; 289 + 290 + if (count >= 0x200) 291 + return -EINVAL; 292 + 293 + if (!(s->state & SOCKET_PRESENT)) 294 + return -ENODEV; 295 + 296 + cis = kmalloc(sizeof(cisdump_t), GFP_KERNEL); 297 + if (!cis) 298 + return -ENOMEM; 299 + memset(cis, 0, sizeof(cisdump_t)); 300 + 301 + cis->Length = count + 1; 302 + memcpy(cis->Data, buf, count); 303 + 304 + if (pcmcia_replace_cis(s, cis)) 305 + ret = -EIO; 306 + 307 + kfree(cis); 308 + 309 + if (!ret) { 310 + down(&s->skt_sem); 311 + if ((s->callback) && (s->state & SOCKET_PRESENT) && 312 + !(s->state & SOCKET_CARDBUS)) { 313 + if (try_module_get(s->callback->owner)) { 314 + s->callback->requery(s); 315 + module_put(s->callback->owner); 316 + } 317 + } 318 + up(&s->skt_sem); 319 + } 320 + 321 + 322 + return (ret); 323 + } 188 324 189 325 190 326 static struct class_device_attribute *pccard_socket_attributes[] = { ··· 335 199 NULL, 336 200 }; 337 201 202 + static struct bin_attribute pccard_cis_attr = { 203 + .attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR, .owner = THIS_MODULE}, 204 + .size = 0x200, 205 + .read = pccard_show_cis, 206 + .write = pccard_store_cis, 207 + }; 208 + 338 209 static int __devinit pccard_sysfs_add_socket(struct class_device *class_dev) 339 210 { 340 211 struct class_device_attribute **attr; ··· 352 209 if (ret) 353 210 break; 354 211 } 212 + if (!ret) 213 + ret = sysfs_create_bin_file(&class_dev->kobj, &pccard_cis_attr); 355 214 356 215 return ret; 357 216 } ··· 362 217 { 363 218 struct class_device_attribute **attr; 364 219 220 + sysfs_remove_bin_file(&class_dev->kobj, &pccard_cis_attr); 365 221 for (attr = pccard_socket_attributes; *attr; attr++) 366 222 class_device_remove_file(class_dev, *attr); 367 223 }
+5 -1
drivers/pcmcia/yenta_socket.c
··· 549 549 unsigned offset; 550 550 unsigned mask; 551 551 552 + res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr; 553 + /* Already allocated? */ 554 + if (res->parent) 555 + return 0; 556 + 552 557 /* The granularity of the memory limit is 4kB, on IO it's 4 bytes */ 553 558 mask = ~0xfff; 554 559 if (type & IORESOURCE_IO) ··· 561 556 562 557 offset = 0x1c + 8*nr; 563 558 bus = socket->dev->subordinate; 564 - res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr; 565 559 res->name = bus->name; 566 560 res->flags = type; 567 561 res->start = 0;
+11
drivers/scsi/pcmcia/aha152x_stub.c
··· 318 318 return 0; 319 319 } 320 320 321 + static struct pcmcia_device_id aha152x_ids[] = { 322 + PCMCIA_DEVICE_PROD_ID123("New Media", "SCSI", "Bus Toaster", 0xcdf7e4cc, 0x35f26476, 0xa8851d6e), 323 + PCMCIA_DEVICE_PROD_ID123("NOTEWORTHY", "SCSI", "Bus Toaster", 0xad89c6e8, 0x35f26476, 0xa8851d6e), 324 + PCMCIA_DEVICE_PROD_ID12("Adaptec, Inc.", "APA-1460 SCSI Host Adapter", 0x24ba9738, 0x3a3c3d20), 325 + PCMCIA_DEVICE_PROD_ID12("New Media Corporation", "Multimedia Sound/SCSI", 0x085a850b, 0x80a6535c), 326 + PCMCIA_DEVICE_PROD_ID12("NOTEWORTHY", "NWCOMB02 SCSI/AUDIO COMBO CARD", 0xad89c6e8, 0x5f9a615b), 327 + PCMCIA_DEVICE_NULL, 328 + }; 329 + MODULE_DEVICE_TABLE(pcmcia, aha152x_ids); 330 + 321 331 static struct pcmcia_driver aha152x_cs_driver = { 322 332 .owner = THIS_MODULE, 323 333 .drv = { ··· 335 325 }, 336 326 .attach = aha152x_attach, 337 327 .detach = aha152x_detach, 328 + .id_table = aha152x_ids, 338 329 }; 339 330 340 331 static int __init init_aha152x_cs(void)
+10
drivers/scsi/pcmcia/fdomain_stub.c
··· 299 299 return 0; 300 300 } /* fdomain_event */ 301 301 302 + 303 + static struct pcmcia_device_id fdomain_ids[] = { 304 + PCMCIA_DEVICE_PROD_ID12("IBM Corp.", "SCSI PCMCIA Card", 0xe3736c88, 0x859cad20), 305 + PCMCIA_DEVICE_PROD_ID1("SCSI PCMCIA Adapter Card", 0x8dacb57e), 306 + PCMCIA_DEVICE_PROD_ID12(" SIMPLE TECHNOLOGY Corporation", "SCSI PCMCIA Credit Card Controller", 0x182bdafe, 0xc80d106f), 307 + PCMCIA_DEVICE_NULL, 308 + }; 309 + MODULE_DEVICE_TABLE(pcmcia, fdomain_ids); 310 + 302 311 static struct pcmcia_driver fdomain_cs_driver = { 303 312 .owner = THIS_MODULE, 304 313 .drv = { ··· 315 306 }, 316 307 .attach = fdomain_attach, 317 308 .detach = fdomain_detach, 309 + .id_table = fdomain_ids, 318 310 }; 319 311 320 312 static int __init init_fdomain_cs(void)
+13
drivers/scsi/pcmcia/nsp_cs.c
··· 2125 2125 * module entry point 2126 2126 *====================================================================*/ 2127 2127 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,68)) 2128 + static struct pcmcia_device_id nsp_cs_ids[] = { 2129 + PCMCIA_DEVICE_PROD_ID123("IO DATA", "CBSC16 ", "1", 0x547e66dc, 0x0d63a3fd, 0x51de003a), 2130 + PCMCIA_DEVICE_PROD_ID123("KME ", "SCSI-CARD-001", "1", 0x534c02bc, 0x52008408, 0x51de003a), 2131 + PCMCIA_DEVICE_PROD_ID123("KME ", "SCSI-CARD-002", "1", 0x534c02bc, 0xcb09d5b2, 0x51de003a), 2132 + PCMCIA_DEVICE_PROD_ID123("KME ", "SCSI-CARD-003", "1", 0x534c02bc, 0xbc0ee524, 0x51de003a), 2133 + PCMCIA_DEVICE_PROD_ID123("KME ", "SCSI-CARD-004", "1", 0x534c02bc, 0x226a7087, 0x51de003a), 2134 + PCMCIA_DEVICE_PROD_ID123("WBT", "NinjaSCSI-3", "R1.0", 0xc7ba805f, 0xfdc7c97d, 0x6973710e), 2135 + PCMCIA_DEVICE_PROD_ID123("WORKBIT", "UltraNinja-16", "1", 0x28191418, 0xb70f4b09, 0x51de003a), 2136 + PCMCIA_DEVICE_NULL 2137 + }; 2138 + MODULE_DEVICE_TABLE(pcmcia, nsp_cs_ids); 2139 + 2128 2140 static struct pcmcia_driver nsp_driver = { 2129 2141 .owner = THIS_MODULE, 2130 2142 .drv = { ··· 2144 2132 }, 2145 2133 .attach = nsp_cs_attach, 2146 2134 .detach = nsp_cs_detach, 2135 + .id_table = nsp_cs_ids, 2147 2136 }; 2148 2137 #endif 2149 2138
+22
drivers/scsi/pcmcia/qlogic_stub.c
··· 395 395 return 0; 396 396 } /* qlogic_event */ 397 397 398 + static struct pcmcia_device_id qlogic_ids[] = { 399 + PCMCIA_DEVICE_PROD_ID12("EIger Labs", "PCMCIA-to-SCSI Adapter", 0x88395fa7, 0x33b7a5e6), 400 + PCMCIA_DEVICE_PROD_ID12("EPSON", "SCSI-2 PC Card SC200", 0xd361772f, 0x299d1751), 401 + PCMCIA_DEVICE_PROD_ID12("MACNICA", "MIRACLE SCSI-II mPS110", 0x20841b68, 0xab3c3b6d), 402 + PCMCIA_DEVICE_PROD_ID12("MIDORI ELECTRONICS ", "CN-SC43", 0x6534382a, 0xd67eee79), 403 + PCMCIA_DEVICE_PROD_ID12("NEC", "PC-9801N-J03R", 0x18df0ba0, 0x24662e8a), 404 + PCMCIA_DEVICE_PROD_ID12("KME ", "KXLC003", 0x82375a27, 0xf68e5bf7), 405 + PCMCIA_DEVICE_PROD_ID12("KME ", "KXLC004", 0x82375a27, 0x68eace54), 406 + PCMCIA_DEVICE_PROD_ID12("KME", "KXLC101", 0x3faee676, 0x194250ec), 407 + PCMCIA_DEVICE_PROD_ID12("QLOGIC CORPORATION", "pc05", 0xd77b2930, 0xa85b2735), 408 + PCMCIA_DEVICE_PROD_ID12("QLOGIC CORPORATION", "pc05 rev 1.10", 0xd77b2930, 0x70f8b5f8), 409 + PCMCIA_DEVICE_PROD_ID123("KME", "KXLC002", "00", 0x3faee676, 0x81896b61, 0xf99f065f), 410 + PCMCIA_DEVICE_PROD_ID12("RATOC System Inc.", "SCSI2 CARD 37", 0x85c10e17, 0x1a2640c1), 411 + PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "SCSC200A PC CARD SCSI", 0xb4585a1a, 0xa6f06ebe), 412 + PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "SCSC200B PC CARD SCSI-10", 0xb4585a1a, 0x0a88dea0), 413 + /* these conflict with other cards! */ 414 + /* PCMCIA_DEVICE_PROD_ID123("MACNICA", "MIRACLE SCSI", "mPS100", 0x20841b68, 0xf8dedaeb, 0x89f7fafb), */ 415 + /* PCMCIA_DEVICE_PROD_ID123("MACNICA", "MIRACLE SCSI", "mPS100", 0x20841b68, 0xf8dedaeb, 0x89f7fafb), */ 416 + PCMCIA_DEVICE_NULL, 417 + }; 418 + MODULE_DEVICE_TABLE(pcmcia, qlogic_ids); 398 419 399 420 static struct pcmcia_driver qlogic_cs_driver = { 400 421 .owner = THIS_MODULE, ··· 424 403 }, 425 404 .attach = qlogic_attach, 426 405 .detach = qlogic_detach, 406 + .id_table = qlogic_ids, 427 407 }; 428 408 429 409 static int __init init_qlogic_cs(void)
+9
drivers/scsi/pcmcia/sym53c500_cs.c
··· 999 999 MODULE_DESCRIPTION("SYM53C500 PCMCIA SCSI driver"); 1000 1000 MODULE_LICENSE("GPL"); 1001 1001 1002 + static struct pcmcia_device_id sym53c500_ids[] = { 1003 + PCMCIA_DEVICE_PROD_ID12("BASICS by New Media Corporation", "SCSI Sym53C500", 0x23c78a9d, 0x0099e7f7), 1004 + PCMCIA_DEVICE_PROD_ID12("New Media Corporation", "SCSI Bus Toaster Sym53C500", 0x085a850b, 0x45432eb8), 1005 + PCMCIA_DEVICE_PROD_ID2("SCSI9000", 0x21648f44), 1006 + PCMCIA_DEVICE_NULL, 1007 + }; 1008 + MODULE_DEVICE_TABLE(pcmcia, sym53c500_ids); 1009 + 1002 1010 static struct pcmcia_driver sym53c500_cs_driver = { 1003 1011 .owner = THIS_MODULE, 1004 1012 .drv = { ··· 1014 1006 }, 1015 1007 .attach = SYM53C500_attach, 1016 1008 .detach = SYM53C500_detach, 1009 + .id_table = sym53c500_ids, 1017 1010 }; 1018 1011 1019 1012 static int __init
+106
drivers/serial/serial_cs.c
··· 772 772 return 0; 773 773 } 774 774 775 + static struct pcmcia_device_id serial_ids[] = { 776 + PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0057, 0x0021), 777 + PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0089, 0x110a), 778 + PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0104, 0x000a), 779 + PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0105, 0xea15), 780 + PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0109, 0x0501), 781 + PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0138, 0x110a), 782 + PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0140, 0x000a), 783 + PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0143, 0x3341), 784 + PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0143, 0xc0ab), 785 + PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x016c, 0x0081), 786 + PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x021b, 0x0101), 787 + PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x08a1, 0xc0ab), 788 + PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0105, 0x0d0a), 789 + PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0105, 0x0e0a), 790 + PCMCIA_PFC_DEVICE_PROD_ID123(1, "MEGAHERTZ", "CC/XJEM3288", "DATA/FAX/CELL ETHERNET MODEM", 0xf510db04, 0x04cd2988, 0x46a52d63), 791 + PCMCIA_PFC_DEVICE_PROD_ID123(1, "MEGAHERTZ", "CC/XJEM3336", "DATA/FAX/CELL ETHERNET MODEM", 0xf510db04, 0x0143b773, 0x46a52d63), 792 + PCMCIA_PFC_DEVICE_PROD_ID123(1, "MEGAHERTZ", "EM1144T", "PCMCIA MODEM", 0xf510db04, 0x856d66c8, 0xbd6c43ef), 793 + PCMCIA_PFC_DEVICE_PROD_ID123(1, "MEGAHERTZ", "XJEM1144/CCEM1144", "PCMCIA MODEM", 0xf510db04, 0x52d21e1e, 0xbd6c43ef), 794 + PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "CEM28", 0x2e3ee845, 0x0ea978ea), 795 + PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "CEM33", 0x2e3ee845, 0x80609023), 796 + PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "CEM56", 0x2e3ee845, 0xa650c32a), 797 + PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "REM10", 0x2e3ee845, 0x76df1d29), 798 + PCMCIA_PFC_DEVICE_PROD_ID13(1, "Xircom", "XEM5600", 0x2e3ee845, 0xf1403719), 799 + PCMCIA_PFC_DEVICE_PROD_ID12(1, "AnyCom", "Fast Ethernet ", 0x578ba6e7, 0x02d92d1e), 800 + PCMCIA_PFC_DEVICE_PROD_ID12(1, "D-Link", "DME336T", 0x1a424a1c, 0xb23897ff), 801 + PCMCIA_PFC_DEVICE_PROD_ID12(1, "Gateway 2000", "XJEM3336", 0xdd9989be, 0x662c394c), 802 + PCMCIA_PFC_DEVICE_PROD_ID12(1, "Grey Cell", "GCS3000", 0x2a151fac, 0x48b932ae), 803 + PCMCIA_PFC_DEVICE_PROD_ID12(1, "Linksys", "EtherFast 10&100 + 56K PC Card (PCMLM56)", 0x0733cc81, 0xb3765033), 804 + PCMCIA_PFC_DEVICE_PROD_ID12(1, "LINKSYS", "PCMLM336", 0xf7cb0b07, 0x7a821b58), 805 + PCMCIA_PFC_DEVICE_PROD_ID12(1, "MEGAHERTZ", "XJEM1144/CCEM1144", 0xf510db04, 0x52d21e1e), 806 + PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 807 + PCMCIA_PFC_DEVICE_PROD_ID12(1, "Ositech", "Trumpcard", 0x0c2f80cd, 0x0573c29f), 808 + PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "ComboCard", 0xdcfe12d3, 0xcd8906cc), 809 + PCMCIA_PFC_DEVICE_PROD_ID12(1, "PCMCIAs", "LanModem", 0xdcfe12d3, 0xc67c648f), 810 + PCMCIA_PFC_DEVICE_PROD_ID12(1, "TDK", "GlobalNetworker 3410/3412", 0x1eae9475, 0xd9a93bed), 811 + PCMCIA_PFC_DEVICE_PROD_ID12(1, "Xircom", "CreditCard Ethernet", 0x2e3ee845, 0xc0e778c2), 812 + PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0104, 0x0070), 813 + PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0101, 0x0562), 814 + PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0104, 0x0070), 815 + PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x016c, 0x0020), 816 + PCMCIA_MFC_DEVICE_PROD_ID123(1, "APEX DATA", "MULTICARD", "ETHERNET-MODEM", 0x11c2da09, 0x7289dc5d, 0xaad95e1f), 817 + PCMCIA_MFC_DEVICE_PROD_ID12(1, "IBM", "Home and Away 28.8 PC Card ", 0xb569a6e5, 0x5bd4ff2c), 818 + PCMCIA_MFC_DEVICE_PROD_ID12(1, "IBM", "Home and Away Credit Card Adapter", 0xb569a6e5, 0x4bdf15c3), 819 + PCMCIA_MFC_DEVICE_PROD_ID12(1, "IBM", "w95 Home and Away Credit Card ", 0xb569a6e5, 0xae911c15), 820 + PCMCIA_MFC_DEVICE_PROD_ID1(1, "Motorola MARQUIS", 0xf03e4e77), 821 + PCMCIA_MFC_DEVICE_PROD_ID2(1, "FAX/Modem/Ethernet Combo Card ", 0x1ed59302), 822 + PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0301), 823 + PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0039), 824 + PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0006), 825 + PCMCIA_DEVICE_MANF_CARD(0x0105, 0x410a), 826 + PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0d50), 827 + PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0d51), 828 + PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0d52), 829 + PCMCIA_DEVICE_MANF_CARD(0x010b, 0x0d53), 830 + PCMCIA_DEVICE_MANF_CARD(0x010b, 0xd180), 831 + PCMCIA_DEVICE_MANF_CARD(0x0137, 0x000e), 832 + PCMCIA_DEVICE_MANF_CARD(0x0137, 0x001b), 833 + PCMCIA_DEVICE_MANF_CARD(0x0137, 0x0025), 834 + PCMCIA_DEVICE_MANF_CARD(0x0137, 0x0045), 835 + PCMCIA_DEVICE_MANF_CARD(0x0137, 0x0052), 836 + PCMCIA_DEVICE_PROD_ID134("ADV", "TECH", "COMpad-32/85", 0x67459937, 0x916d02ba, 0x8fbe92ae), 837 + PCMCIA_DEVICE_PROD_ID124("GATEWAY2000", "CC3144", "PCMCIA MODEM", 0x506bccae, 0xcb3685f1, 0xbd6c43ef), 838 + PCMCIA_DEVICE_PROD_ID14("MEGAHERTZ", "PCMCIA MODEM", 0xf510db04, 0xbd6c43ef), 839 + PCMCIA_DEVICE_PROD_ID124("TOSHIBA", "T144PF", "PCMCIA MODEM", 0xb4585a1a, 0x7271409c, 0xbd6c43ef), 840 + PCMCIA_DEVICE_PROD_ID123("FUJITSU", "FC14F ", "MBH10213", 0x6ee5a3d8, 0x30ead12b, 0xb00f05a0), 841 + PCMCIA_DEVICE_PROD_ID13("MEGAHERTZ", "V.34 PCMCIA MODEM", 0xf510db04, 0xbb2cce4a), 842 + PCMCIA_DEVICE_PROD_ID12("Brain Boxes", "Bluetooth PC Card", 0xee138382, 0xd4ce9b02), 843 + PCMCIA_DEVICE_PROD_ID12("CIRRUS LOGIC", "FAX MODEM", 0xe625f451, 0xcecd6dfa), 844 + PCMCIA_DEVICE_PROD_ID12("COMPAQ", "PCMCIA 28800 FAX/DATA MODEM", 0xa3a3062c, 0x8cbd7c76), 845 + PCMCIA_DEVICE_PROD_ID12("COMPAQ", "PCMCIA 33600 FAX/DATA MODEM", 0xa3a3062c, 0x5a00ce95), 846 + PCMCIA_DEVICE_PROD_ID12("Computerboards, Inc.", "PCM-COM422", 0xd0b78f51, 0x7e2d49ed), 847 + PCMCIA_DEVICE_PROD_ID12("Dr. Neuhaus", "FURY CARD 14K4", 0x76942813, 0x8b96ce65), 848 + PCMCIA_DEVICE_PROD_ID12("Intelligent", "ANGIA FAX/MODEM", 0xb496e65e, 0xf31602a6), 849 + PCMCIA_DEVICE_PROD_ID12("Intel", "MODEM 2400", 0x816cc815, 0x23539b80), 850 + PCMCIA_DEVICE_PROD_ID12("IOTech Inc ", "PCMCIA Dual RS-232 Serial Port Card", 0x3bd2d898, 0x92abc92f), 851 + PCMCIA_DEVICE_PROD_ID12("MACRONIX", "FAX/MODEM", 0x668388b3, 0x3f9bdf2f), 852 + PCMCIA_DEVICE_PROD_ID12("Multi-Tech", "MT1432LT", 0x5f73be51, 0x0b3e2383), 853 + PCMCIA_DEVICE_PROD_ID12("Multi-Tech", "MT2834LT", 0x5f73be51, 0x4cd7c09e), 854 + PCMCIA_DEVICE_PROD_ID12("OEM ", "C288MX ", 0xb572d360, 0xd2385b7a), 855 + PCMCIA_DEVICE_PROD_ID12("PCMCIA ", "C336MX ", 0x99bcafe9, 0xaa25bcab), 856 + PCMCIA_DEVICE_PROD_ID12("Quatech Inc", "PCMCIA Dual RS-232 Serial Port Card", 0xc4420b35, 0x92abc92f), 857 + PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "PCMCIA", "EN2218-LAN/MODEM", 0x281f1c5d, 0x570f348e, "PCMLM28.cis"), 858 + PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "PCMCIA", "UE2218-LAN/MODEM", 0x281f1c5d, 0x6fdcacee, "PCMLM28.cis"), 859 + PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "Psion Dacom", "Gold Card V34 Ethernet", 0xf5f025c2, 0x338e8155, "PCMLM28.cis"), 860 + PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "Psion Dacom", "Gold Card V34 Ethernet GSM", 0xf5f025c2, 0x4ae85d35, "PCMLM28.cis"), 861 + PCMCIA_PFC_DEVICE_CIS_PROD_ID12(1, "LINKSYS", "PCMLM28", 0xf7cb0b07, 0x66881874, "PCMLM28.cis"), 862 + PCMCIA_MFC_DEVICE_CIS_PROD_ID12(1, "DAYNA COMMUNICATIONS", "LAN AND MODEM MULTIFUNCTION", 0x8fdf8f89, 0xdd5ed9e8, "DP83903.cis"), 863 + PCMCIA_MFC_DEVICE_CIS_PROD_ID4(1, "NSC MF LAN/Modem", 0x58fc6056, "DP83903.cis"), 864 + PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0556, "3CCFEM556.cis"), 865 + PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0175, 0x0000, "DP83903.cis"), 866 + PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x0035, "3CXEM556.cis"), 867 + PCMCIA_MFC_DEVICE_CIS_MANF_CARD(1, 0x0101, 0x003d, "3CXEM556.cis"), 868 + PCMCIA_DEVICE_CIS_PROD_ID12("MultiTech", "PCMCIA 56K DataFax", 0x842047ee, 0xc2efcf03, "MT5634ZLX.cis"), 869 + PCMCIA_DEVICE_CIS_PROD_ID12("ADVANTECH", "COMpad-32/85B-4", 0x96913a85, 0xcec8f102, "COMpad4.cis"), 870 + PCMCIA_DEVICE_CIS_PROD_ID123("ADVANTECH", "COMpad-32/85", "1.0", 0x96913a85, 0x8fbe92ae, 0x0877b627, "COMpad2.cis"), 871 + PCMCIA_DEVICE_CIS_PROD_ID2("RS-COM 2P", 0xad20b156, "RS-COM-2P.cis"), 872 + /* too generic */ 873 + /* PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0160, 0x0002), */ 874 + /* PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0160, 0x0002), */ 875 + PCMCIA_DEVICE_FUNC_ID(2), 876 + PCMCIA_DEVICE_NULL, 877 + }; 878 + MODULE_DEVICE_TABLE(pcmcia, serial_ids); 879 + 775 880 static struct pcmcia_driver serial_cs_driver = { 776 881 .owner = THIS_MODULE, 777 882 .drv = { ··· 884 779 }, 885 780 .attach = serial_attach, 886 781 .detach = serial_detach, 782 + .id_table = serial_ids, 887 783 }; 888 784 889 785 static int __init init_serial_cs(void)
+7
drivers/telephony/ixj_pcmcia.c
··· 295 295 return 0; 296 296 } 297 297 298 + static struct pcmcia_device_id ixj_ids[] = { 299 + PCMCIA_DEVICE_MANF_CARD(0x0257, 0x0600), 300 + PCMCIA_DEVICE_NULL 301 + }; 302 + MODULE_DEVICE_TABLE(pcmcia, ixj_ids); 303 + 298 304 static struct pcmcia_driver ixj_driver = { 299 305 .owner = THIS_MODULE, 300 306 .drv = { ··· 308 302 }, 309 303 .attach = ixj_attach, 310 304 .detach = ixj_detach, 305 + .id_table = ixj_ids, 311 306 }; 312 307 313 308 static int __init ixj_pcmcia_init(void)
+8 -13
drivers/usb/host/sl811_cs.c
··· 68 68 69 69 static dev_link_t *dev_list = NULL; 70 70 71 - static int irq_list[4] = { -1 }; 72 - static int irq_list_count; 73 - 74 - module_param_array(irq_list, int, &irq_list_count, 0444); 75 - 76 - INT_MODULE_PARM(irq_mask, 0xdeb8); 77 - 78 71 typedef struct local_info_t { 79 72 dev_link_t link; 80 73 dev_node_t node; ··· 366 373 local_info_t *local; 367 374 dev_link_t *link; 368 375 client_reg_t client_reg; 369 - int ret, i; 376 + int ret; 370 377 371 378 local = kmalloc(sizeof(local_info_t), GFP_KERNEL); 372 379 if (!local) ··· 378 385 /* Initialize */ 379 386 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; 380 387 link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID; 381 - if (irq_list[0] == -1) 382 - link->irq.IRQInfo2 = irq_mask; 383 - else 384 - for (i = 0; i < irq_list_count; i++) 385 - link->irq.IRQInfo2 |= 1 << irq_list[i]; 386 388 link->irq.Handler = NULL; 387 389 388 390 link->conf.Attributes = 0; ··· 406 418 return link; 407 419 } 408 420 421 + static struct pcmcia_device_id sl811_ids[] = { 422 + PCMCIA_DEVICE_MANF_CARD(0xc015, 0x0001), /* RATOC USB HOST CF+ Card */ 423 + PCMCIA_DEVICE_NULL, 424 + }; 425 + MODULE_DEVICE_TABLE(pcmcia, sl811_ids); 426 + 409 427 static struct pcmcia_driver sl811_cs_driver = { 410 428 .owner = THIS_MODULE, 411 429 .drv = { ··· 419 425 }, 420 426 .attach = sl811_cs_attach, 421 427 .detach = sl811_cs_detach, 428 + .id_table = sl811_ids, 422 429 }; 423 430 424 431 /*====================================================================*/
+8 -4
include/asm-i386/ide.h
··· 41 41 42 42 static __inline__ unsigned long ide_default_io_base(int index) 43 43 { 44 + if (pci_find_device(PCI_ANY_ID, PCI_ANY_ID, NULL) == NULL) { 45 + switch(index) { 46 + case 2: return 0x1e8; 47 + case 3: return 0x168; 48 + case 4: return 0x1e0; 49 + case 5: return 0x160; 50 + } 51 + } 44 52 switch (index) { 45 53 case 0: return 0x1f0; 46 54 case 1: return 0x170; 47 - case 2: return 0x1e8; 48 - case 3: return 0x168; 49 - case 4: return 0x1e0; 50 - case 5: return 0x160; 51 55 default: 52 56 return 0; 53 57 }
+2
include/asm-sparc64/auxio.h
··· 75 75 76 76 #ifndef __ASSEMBLY__ 77 77 78 + extern void __iomem *auxio_register; 79 + 78 80 #define AUXIO_LTE_ON 1 79 81 #define AUXIO_LTE_OFF 0 80 82
+8 -8
include/asm-sparc64/floppy.h
··· 159 159 * underruns. If non-zero, doing_pdma encodes the direction of 160 160 * the transfer for debugging. 1=read 2=write 161 161 */ 162 - char *pdma_vaddr; 162 + unsigned char *pdma_vaddr; 163 163 unsigned long pdma_size; 164 164 volatile int doing_pdma = 0; 165 165 ··· 209 209 pdma_areasize = pdma_size; 210 210 } 211 211 212 - /* Our low-level entry point in arch/sparc/kernel/entry.S */ 213 - extern irqreturn_t floppy_hardint(int irq, void *unused, struct pt_regs *regs); 212 + extern irqreturn_t sparc_floppy_irq(int, void *, struct pt_regs *); 214 213 215 214 static int sun_fd_request_irq(void) 216 215 { ··· 219 220 if(!once) { 220 221 once = 1; 221 222 222 - error = request_fast_irq(FLOPPY_IRQ, floppy_hardint, 223 - SA_INTERRUPT, "floppy", NULL); 223 + error = request_irq(FLOPPY_IRQ, sparc_floppy_irq, 224 + SA_INTERRUPT, "floppy", NULL); 224 225 225 226 return ((error == 0) ? 0 : -1); 226 227 } ··· 614 615 struct linux_ebus *ebus; 615 616 struct linux_ebus_device *edev = NULL; 616 617 unsigned long config = 0; 617 - unsigned long auxio_reg; 618 + void __iomem *auxio_reg; 618 619 619 620 for_each_ebus(ebus) { 620 621 for_each_ebusdev(edev, ebus) { ··· 641 642 /* Make sure the high density bit is set, some systems 642 643 * (most notably Ultra5/Ultra10) come up with it clear. 643 644 */ 644 - auxio_reg = edev->resource[2].start; 645 + auxio_reg = (void __iomem *) edev->resource[2].start; 645 646 writel(readl(auxio_reg)|0x2, auxio_reg); 646 647 647 648 sun_pci_ebus_dev = ebus->self; ··· 649 650 spin_lock_init(&sun_pci_fd_ebus_dma.lock); 650 651 651 652 /* XXX ioremap */ 652 - sun_pci_fd_ebus_dma.regs = edev->resource[1].start; 653 + sun_pci_fd_ebus_dma.regs = (void __iomem *) 654 + edev->resource[1].start; 653 655 if (!sun_pci_fd_ebus_dma.regs) 654 656 return 0; 655 657
+1 -6
include/asm-sparc64/irq.h
··· 19 19 /* You should not mess with this directly. That's the job of irq.c. 20 20 * 21 21 * If you make changes here, please update hand coded assembler of 22 - * SBUS/floppy interrupt handler in entry.S -DaveM 22 + * the vectored interrupt trap handler in entry.S -DaveM 23 23 * 24 24 * This is currently one DCACHE line, two buckets per L2 cache 25 25 * line. Keep this in mind please. ··· 121 121 extern void enable_irq(unsigned int); 122 122 extern unsigned int build_irq(int pil, int inofixup, unsigned long iclr, unsigned long imap); 123 123 extern unsigned int sbus_build_irq(void *sbus, unsigned int ino); 124 - 125 - extern int request_fast_irq(unsigned int irq, 126 - irqreturn_t (*handler)(int, void *, struct pt_regs *), 127 - unsigned long flags, __const__ char *devname, 128 - void *dev_id); 129 124 130 125 static __inline__ void set_softint(unsigned long bits) 131 126 {
+2 -1
include/asm-sparc64/rwsem.h
··· 55 55 "add %%g1, %1, %%g7\n\t" 56 56 "cas [%2], %%g1, %%g7\n\t" 57 57 "cmp %%g1, %%g7\n\t" 58 + "membar #StoreLoad | #StoreStore\n\t" 58 59 "bne,pn %%icc, 1b\n\t" 59 - " membar #StoreLoad | #StoreStore\n\t" 60 + " nop\n\t" 60 61 "mov %%g7, %0\n\t" 61 62 : "=&r" (tmp) 62 63 : "0" (tmp), "r" (sem)
+19 -10
include/asm-sparc64/spinlock.h
··· 52 52 53 53 __asm__ __volatile__( 54 54 "1: ldstub [%1], %0\n" 55 + " membar #StoreLoad | #StoreStore\n" 55 56 " brnz,pn %0, 2f\n" 56 - " membar #StoreLoad | #StoreStore\n" 57 + " nop\n" 57 58 " .subsection 2\n" 58 59 "2: ldub [%1], %0\n" 60 + " membar #LoadLoad\n" 59 61 " brnz,pt %0, 2b\n" 60 - " membar #LoadLoad\n" 62 + " nop\n" 61 63 " ba,a,pt %%xcc, 1b\n" 62 64 " .previous" 63 65 : "=&r" (tmp) ··· 97 95 98 96 __asm__ __volatile__( 99 97 "1: ldstub [%2], %0\n" 100 - " brnz,pn %0, 2f\n" 101 98 " membar #StoreLoad | #StoreStore\n" 99 + " brnz,pn %0, 2f\n" 100 + " nop\n" 102 101 " .subsection 2\n" 103 102 "2: rdpr %%pil, %1\n" 104 103 " wrpr %3, %%pil\n" 105 104 "3: ldub [%2], %0\n" 106 - " brnz,pt %0, 3b\n" 107 105 " membar #LoadLoad\n" 106 + " brnz,pt %0, 3b\n" 107 + " nop\n" 108 108 " ba,pt %%xcc, 1b\n" 109 - " wrpr %1, %%pil\n" 109 + " wrpr %1, %%pil\n" 110 110 " .previous" 111 111 : "=&r" (tmp1), "=&r" (tmp2) 112 112 : "r"(lock), "r"(flags) ··· 166 162 "4: add %0, 1, %1\n" 167 163 " cas [%2], %0, %1\n" 168 164 " cmp %0, %1\n" 165 + " membar #StoreLoad | #StoreStore\n" 169 166 " bne,pn %%icc, 1b\n" 170 - " membar #StoreLoad | #StoreStore\n" 167 + " nop\n" 171 168 " .subsection 2\n" 172 169 "2: ldsw [%2], %0\n" 170 + " membar #LoadLoad\n" 173 171 " brlz,pt %0, 2b\n" 174 - " membar #LoadLoad\n" 172 + " nop\n" 175 173 " ba,a,pt %%xcc, 4b\n" 176 174 " .previous" 177 175 : "=&r" (tmp1), "=&r" (tmp2) ··· 210 204 "4: or %0, %3, %1\n" 211 205 " cas [%2], %0, %1\n" 212 206 " cmp %0, %1\n" 207 + " membar #StoreLoad | #StoreStore\n" 213 208 " bne,pn %%icc, 1b\n" 214 - " membar #StoreLoad | #StoreStore\n" 209 + " nop\n" 215 210 " .subsection 2\n" 216 211 "2: lduw [%2], %0\n" 212 + " membar #LoadLoad\n" 217 213 " brnz,pt %0, 2b\n" 218 - " membar #LoadLoad\n" 214 + " nop\n" 219 215 " ba,a,pt %%xcc, 4b\n" 220 216 " .previous" 221 217 : "=&r" (tmp1), "=&r" (tmp2) ··· 248 240 " or %0, %4, %1\n" 249 241 " cas [%3], %0, %1\n" 250 242 " cmp %0, %1\n" 243 + " membar #StoreLoad | #StoreStore\n" 251 244 " bne,pn %%icc, 1b\n" 252 - " membar #StoreLoad | #StoreStore\n" 245 + " nop\n" 253 246 " mov 1, %2\n" 254 247 "2:" 255 248 : "=&r" (tmp1), "=&r" (tmp2), "=&r" (result)
-1
include/asm-sparc64/spitfire.h
··· 111 111 "membar #Sync" 112 112 : /* No outputs */ 113 113 : "r" (tag), "r" (addr), "i" (ASI_DCACHE_TAG)); 114 - __asm__ __volatile__ ("membar #Sync" : : : "memory"); 115 114 } 116 115 117 116 /* The instruction cache lines are flushed with this, but note that
+46
include/linux/mod_devicetable.h
··· 175 175 }; 176 176 177 177 178 + /* PCMCIA */ 179 + 180 + struct pcmcia_device_id { 181 + __u16 match_flags; 182 + 183 + __u16 manf_id; 184 + __u16 card_id; 185 + 186 + __u8 func_id; 187 + 188 + /* for real multi-function devices */ 189 + __u8 function; 190 + 191 + /* for pseude multi-function devices */ 192 + __u8 device_no; 193 + 194 + __u32 prod_id_hash[4]; 195 + 196 + /* not matched against in kernelspace*/ 197 + #ifdef __KERNEL__ 198 + const char * prod_id[4]; 199 + #else 200 + kernel_ulong_t prod_id[4]; 201 + #endif 202 + 203 + /* not matched against */ 204 + kernel_ulong_t driver_info; 205 + #ifdef __KERNEL__ 206 + char * cisfile; 207 + #else 208 + kernel_ulong_t cisfile; 209 + #endif 210 + }; 211 + 212 + #define PCMCIA_DEV_ID_MATCH_MANF_ID 0x0001 213 + #define PCMCIA_DEV_ID_MATCH_CARD_ID 0x0002 214 + #define PCMCIA_DEV_ID_MATCH_FUNC_ID 0x0004 215 + #define PCMCIA_DEV_ID_MATCH_FUNCTION 0x0008 216 + #define PCMCIA_DEV_ID_MATCH_PROD_ID1 0x0010 217 + #define PCMCIA_DEV_ID_MATCH_PROD_ID2 0x0020 218 + #define PCMCIA_DEV_ID_MATCH_PROD_ID3 0x0040 219 + #define PCMCIA_DEV_ID_MATCH_PROD_ID4 0x0080 220 + #define PCMCIA_DEV_ID_MATCH_DEVICE_NO 0x0100 221 + #define PCMCIA_DEV_ID_MATCH_FAKE_CIS 0x0200 222 + #define PCMCIA_DEV_ID_MATCH_ANONYMOUS 0x0400 223 + 178 224 #endif /* LINUX_MOD_DEVICETABLE_H */
+2
include/linux/pci_ids.h
··· 1815 1815 #define PCI_VENDOR_ID_ITE 0x1283 1816 1816 #define PCI_DEVICE_ID_ITE_IT8172G 0x8172 1817 1817 #define PCI_DEVICE_ID_ITE_IT8172G_AUDIO 0x0801 1818 + #define PCI_DEVICE_ID_ITE_8211 0x8211 1819 + #define PCI_DEVICE_ID_ITE_8212 0x8212 1818 1820 #define PCI_DEVICE_ID_ITE_8872 0x8872 1819 1821 #define PCI_DEVICE_ID_ITE_IT8330G_0 0xe886 1820 1822
+2
include/pcmcia/ciscode.h
··· 112 112 113 113 #define MANFID_TDK 0x0105 114 114 #define PRODID_TDK_CF010 0x0900 115 + #define PRODID_TDK_NP9610 0x0d0a 116 + #define PRODID_TDK_MN3200 0x0e0a 115 117 #define PRODID_TDK_GN3410 0x4815 116 118 117 119 #define MANFID_TOSHIBA 0x0098
-2
include/pcmcia/cs.h
··· 396 396 int pcmcia_access_configuration_register(client_handle_t handle, conf_reg_t *reg); 397 397 int pcmcia_deregister_client(client_handle_t handle); 398 398 int pcmcia_get_configuration_info(client_handle_t handle, config_info_t *config); 399 - int pcmcia_get_card_services_info(servinfo_t *info); 400 399 int pcmcia_get_first_window(window_handle_t *win, win_req_t *req); 401 400 int pcmcia_get_next_window(window_handle_t *win, win_req_t *req); 402 401 int pcmcia_get_status(client_handle_t handle, cs_status_t *status); ··· 416 417 int pcmcia_resume_card(struct pcmcia_socket *skt); 417 418 int pcmcia_eject_card(struct pcmcia_socket *skt); 418 419 int pcmcia_insert_card(struct pcmcia_socket *skt); 419 - int pcmcia_report_error(client_handle_t handle, error_info_t *err); 420 420 421 421 struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt); 422 422 void pcmcia_put_socket(struct pcmcia_socket *skt);
+249
include/pcmcia/device_id.h
··· 1 + /* 2 + * Copyright (2003-2004) Dominik Brodowski <linux@brodo.de> 3 + * David Woodhouse 4 + * 5 + * License: GPL v2 6 + */ 7 + 8 + #define PCMCIA_DEVICE_MANF_CARD(manf, card) { \ 9 + .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \ 10 + PCMCIA_DEV_ID_MATCH_CARD_ID, \ 11 + .manf_id = (manf), \ 12 + .card_id = (card), } 13 + 14 + #define PCMCIA_DEVICE_FUNC_ID(func) { \ 15 + .match_flags = PCMCIA_DEV_ID_MATCH_FUNC_ID, \ 16 + .func_id = (func), } 17 + 18 + #define PCMCIA_DEVICE_PROD_ID1(v1, vh1) { \ 19 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1, \ 20 + .prod_id = { (v1), NULL, NULL, NULL }, \ 21 + .prod_id_hash = { (vh1), 0, 0, 0 }, } 22 + 23 + #define PCMCIA_DEVICE_PROD_ID2(v2, vh2) { \ 24 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID2, \ 25 + .prod_id = { NULL, (v2), NULL, NULL }, \ 26 + .prod_id_hash = { 0, (vh2), 0, 0 }, } 27 + 28 + #define PCMCIA_DEVICE_PROD_ID12(v1, v2, vh1, vh2) { \ 29 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 30 + PCMCIA_DEV_ID_MATCH_PROD_ID2, \ 31 + .prod_id = { (v1), (v2), NULL, NULL }, \ 32 + .prod_id_hash = { (vh1), (vh2), 0, 0 }, } 33 + 34 + #define PCMCIA_DEVICE_PROD_ID13(v1, v3, vh1, vh3) { \ 35 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 36 + PCMCIA_DEV_ID_MATCH_PROD_ID3, \ 37 + .prod_id = { (v1), NULL, (v3), NULL }, \ 38 + .prod_id_hash = { (vh1), 0, (vh3), 0 }, } 39 + 40 + #define PCMCIA_DEVICE_PROD_ID14(v1, v4, vh1, vh4) { \ 41 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 42 + PCMCIA_DEV_ID_MATCH_PROD_ID4, \ 43 + .prod_id = { (v1), NULL, NULL, (v4) }, \ 44 + .prod_id_hash = { (vh1), 0, 0, (vh4) }, } 45 + 46 + #define PCMCIA_DEVICE_PROD_ID123(v1, v2, v3, vh1, vh2, vh3) { \ 47 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 48 + PCMCIA_DEV_ID_MATCH_PROD_ID2| \ 49 + PCMCIA_DEV_ID_MATCH_PROD_ID3, \ 50 + .prod_id = { (v1), (v2), (v3), NULL },\ 51 + .prod_id_hash = { (vh1), (vh2), (vh3), 0 }, } 52 + 53 + #define PCMCIA_DEVICE_PROD_ID124(v1, v2, v4, vh1, vh2, vh4) { \ 54 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 55 + PCMCIA_DEV_ID_MATCH_PROD_ID2| \ 56 + PCMCIA_DEV_ID_MATCH_PROD_ID4, \ 57 + .prod_id = { (v1), (v2), NULL, (v4) }, \ 58 + .prod_id_hash = { (vh1), (vh2), 0, (vh4) }, } 59 + 60 + #define PCMCIA_DEVICE_PROD_ID134(v1, v3, v4, vh1, vh3, vh4) { \ 61 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 62 + PCMCIA_DEV_ID_MATCH_PROD_ID3| \ 63 + PCMCIA_DEV_ID_MATCH_PROD_ID4, \ 64 + .prod_id = { (v1), NULL, (v3), (v4) }, \ 65 + .prod_id_hash = { (vh1), 0, (vh3), (vh4) }, } 66 + 67 + #define PCMCIA_DEVICE_PROD_ID1234(v1, v2, v3, v4, vh1, vh2, vh3, vh4) { \ 68 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 69 + PCMCIA_DEV_ID_MATCH_PROD_ID2| \ 70 + PCMCIA_DEV_ID_MATCH_PROD_ID3| \ 71 + PCMCIA_DEV_ID_MATCH_PROD_ID4, \ 72 + .prod_id = { (v1), (v2), (v3), (v4) }, \ 73 + .prod_id_hash = { (vh1), (vh2), (vh3), (vh4) }, } 74 + 75 + 76 + /* multi-function devices */ 77 + 78 + #define PCMCIA_MFC_DEVICE_MANF_CARD(mfc, manf, card) { \ 79 + .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \ 80 + PCMCIA_DEV_ID_MATCH_CARD_ID| \ 81 + PCMCIA_DEV_ID_MATCH_FUNCTION, \ 82 + .manf_id = (manf), \ 83 + .card_id = (card), \ 84 + .function = (mfc), } 85 + 86 + #define PCMCIA_MFC_DEVICE_PROD_ID1(mfc, v1, vh1) { \ 87 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 88 + PCMCIA_DEV_ID_MATCH_FUNCTION, \ 89 + .prod_id = { (v1), NULL, NULL, NULL }, \ 90 + .prod_id_hash = { (vh1), 0, 0, 0 }, \ 91 + .function = (mfc), } 92 + 93 + #define PCMCIA_MFC_DEVICE_PROD_ID2(mfc, v2, vh2) { \ 94 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID2| \ 95 + PCMCIA_DEV_ID_MATCH_FUNCTION, \ 96 + .prod_id = { NULL, (v2), NULL, NULL }, \ 97 + .prod_id_hash = { 0, (vh2), 0, 0 }, \ 98 + .function = (mfc), } 99 + 100 + #define PCMCIA_MFC_DEVICE_PROD_ID12(mfc, v1, v2, vh1, vh2) { \ 101 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 102 + PCMCIA_DEV_ID_MATCH_PROD_ID2| \ 103 + PCMCIA_DEV_ID_MATCH_FUNCTION, \ 104 + .prod_id = { (v1), (v2), NULL, NULL }, \ 105 + .prod_id_hash = { (vh1), (vh2), 0, 0 }, \ 106 + .function = (mfc), } 107 + 108 + #define PCMCIA_MFC_DEVICE_PROD_ID13(mfc, v1, v3, vh1, vh3) { \ 109 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 110 + PCMCIA_DEV_ID_MATCH_PROD_ID3| \ 111 + PCMCIA_DEV_ID_MATCH_FUNCTION, \ 112 + .prod_id = { (v1), NULL, (v3), NULL }, \ 113 + .prod_id_hash = { (vh1), 0, (vh3), 0 }, \ 114 + .function = (mfc), } 115 + 116 + #define PCMCIA_MFC_DEVICE_PROD_ID123(mfc, v1, v2, v3, vh1, vh2, vh3) { \ 117 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 118 + PCMCIA_DEV_ID_MATCH_PROD_ID2| \ 119 + PCMCIA_DEV_ID_MATCH_PROD_ID3| \ 120 + PCMCIA_DEV_ID_MATCH_FUNCTION, \ 121 + .prod_id = { (v1), (v2), (v3), NULL },\ 122 + .prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \ 123 + .function = (mfc), } 124 + 125 + /* pseudo multi-function devices */ 126 + 127 + #define PCMCIA_PFC_DEVICE_MANF_CARD(mfc, manf, card) { \ 128 + .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \ 129 + PCMCIA_DEV_ID_MATCH_CARD_ID| \ 130 + PCMCIA_DEV_ID_MATCH_DEVICE_NO, \ 131 + .manf_id = (manf), \ 132 + .card_id = (card), \ 133 + .device_no = (mfc), } 134 + 135 + #define PCMCIA_PFC_DEVICE_PROD_ID1(mfc, v1, vh1) { \ 136 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 137 + PCMCIA_DEV_ID_MATCH_DEVICE_NO, \ 138 + .prod_id = { (v1), NULL, NULL, NULL }, \ 139 + .prod_id_hash = { (vh1), 0, 0, 0 }, \ 140 + .device_no = (mfc), } 141 + 142 + #define PCMCIA_PFC_DEVICE_PROD_ID2(mfc, v2, vh2) { \ 143 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID2| \ 144 + PCMCIA_DEV_ID_MATCH_DEVICE_NO, \ 145 + .prod_id = { NULL, (v2), NULL, NULL }, \ 146 + .prod_id_hash = { 0, (vh2), 0, 0 }, \ 147 + .device_no = (mfc), } 148 + 149 + #define PCMCIA_PFC_DEVICE_PROD_ID12(mfc, v1, v2, vh1, vh2) { \ 150 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 151 + PCMCIA_DEV_ID_MATCH_PROD_ID2| \ 152 + PCMCIA_DEV_ID_MATCH_DEVICE_NO, \ 153 + .prod_id = { (v1), (v2), NULL, NULL }, \ 154 + .prod_id_hash = { (vh1), (vh2), 0, 0 }, \ 155 + .device_no = (mfc), } 156 + 157 + #define PCMCIA_PFC_DEVICE_PROD_ID13(mfc, v1, v3, vh1, vh3) { \ 158 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 159 + PCMCIA_DEV_ID_MATCH_PROD_ID3| \ 160 + PCMCIA_DEV_ID_MATCH_DEVICE_NO, \ 161 + .prod_id = { (v1), NULL, (v3), NULL }, \ 162 + .prod_id_hash = { (vh1), 0, (vh3), 0 }, \ 163 + .device_no = (mfc), } 164 + 165 + #define PCMCIA_PFC_DEVICE_PROD_ID123(mfc, v1, v2, v3, vh1, vh2, vh3) { \ 166 + .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 167 + PCMCIA_DEV_ID_MATCH_PROD_ID2| \ 168 + PCMCIA_DEV_ID_MATCH_PROD_ID3| \ 169 + PCMCIA_DEV_ID_MATCH_DEVICE_NO, \ 170 + .prod_id = { (v1), (v2), (v3), NULL },\ 171 + .prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \ 172 + .device_no = (mfc), } 173 + 174 + /* cards needing a CIS override */ 175 + 176 + #define PCMCIA_DEVICE_CIS_MANF_CARD(manf, card, _cisfile) { \ 177 + .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \ 178 + PCMCIA_DEV_ID_MATCH_MANF_ID| \ 179 + PCMCIA_DEV_ID_MATCH_CARD_ID, \ 180 + .manf_id = (manf), \ 181 + .card_id = (card), \ 182 + .cisfile = (_cisfile)} 183 + 184 + #define PCMCIA_DEVICE_CIS_PROD_ID12(v1, v2, vh1, vh2, _cisfile) { \ 185 + .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \ 186 + PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 187 + PCMCIA_DEV_ID_MATCH_PROD_ID2, \ 188 + .prod_id = { (v1), (v2), NULL, NULL }, \ 189 + .prod_id_hash = { (vh1), (vh2), 0, 0 }, \ 190 + .cisfile = (_cisfile)} 191 + 192 + #define PCMCIA_DEVICE_CIS_PROD_ID123(v1, v2, v3, vh1, vh2, vh3, _cisfile) { \ 193 + .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \ 194 + PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 195 + PCMCIA_DEV_ID_MATCH_PROD_ID2| \ 196 + PCMCIA_DEV_ID_MATCH_PROD_ID3, \ 197 + .prod_id = { (v1), (v2), (v3), NULL },\ 198 + .prod_id_hash = { (vh1), (vh2), (vh3), 0 }, \ 199 + .cisfile = (_cisfile)} 200 + 201 + 202 + #define PCMCIA_DEVICE_CIS_PROD_ID2(v2, vh2, _cisfile) { \ 203 + .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \ 204 + PCMCIA_DEV_ID_MATCH_PROD_ID2, \ 205 + .prod_id = { NULL, (v2), NULL, NULL }, \ 206 + .prod_id_hash = { 0, (vh2), 0, 0 }, \ 207 + .cisfile = (_cisfile)} 208 + 209 + #define PCMCIA_PFC_DEVICE_CIS_PROD_ID12(mfc, v1, v2, vh1, vh2, _cisfile) { \ 210 + .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \ 211 + PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 212 + PCMCIA_DEV_ID_MATCH_PROD_ID2| \ 213 + PCMCIA_DEV_ID_MATCH_DEVICE_NO, \ 214 + .prod_id = { (v1), (v2), NULL, NULL }, \ 215 + .prod_id_hash = { (vh1), (vh2), 0, 0 },\ 216 + .device_no = (mfc), \ 217 + .cisfile = (_cisfile)} 218 + 219 + #define PCMCIA_MFC_DEVICE_CIS_MANF_CARD(mfc, manf, card, _cisfile) { \ 220 + .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \ 221 + PCMCIA_DEV_ID_MATCH_MANF_ID| \ 222 + PCMCIA_DEV_ID_MATCH_CARD_ID| \ 223 + PCMCIA_DEV_ID_MATCH_FUNCTION, \ 224 + .manf_id = (manf), \ 225 + .card_id = (card), \ 226 + .function = (mfc), \ 227 + .cisfile = (_cisfile)} 228 + 229 + #define PCMCIA_MFC_DEVICE_CIS_PROD_ID12(mfc, v1, v2, vh1, vh2, _cisfile) { \ 230 + .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \ 231 + PCMCIA_DEV_ID_MATCH_PROD_ID1| \ 232 + PCMCIA_DEV_ID_MATCH_PROD_ID2| \ 233 + PCMCIA_DEV_ID_MATCH_FUNCTION, \ 234 + .prod_id = { (v1), (v2), NULL, NULL }, \ 235 + .prod_id_hash = { (vh1), (vh2), 0, 0 }, \ 236 + .function = (mfc), \ 237 + .cisfile = (_cisfile)} 238 + 239 + #define PCMCIA_MFC_DEVICE_CIS_PROD_ID4(mfc, v4, vh4, _cisfile) { \ 240 + .match_flags = PCMCIA_DEV_ID_MATCH_FAKE_CIS | \ 241 + PCMCIA_DEV_ID_MATCH_PROD_ID4| \ 242 + PCMCIA_DEV_ID_MATCH_FUNCTION, \ 243 + .prod_id = { NULL, NULL, NULL, (v4) }, \ 244 + .prod_id_hash = { 0, 0, 0, (vh4) }, \ 245 + .function = (mfc), \ 246 + .cisfile = (_cisfile)} 247 + 248 + 249 + #define PCMCIA_DEVICE_NULL { .match_flags = 0, }
+6 -3
include/pcmcia/ds.h
··· 18 18 19 19 #include <pcmcia/bulkmem.h> 20 20 #include <pcmcia/cs_types.h> 21 + #include <pcmcia/device_id.h> 22 + #include <linux/mod_devicetable.h> 21 23 22 24 typedef struct tuple_parse_t { 23 25 tuple_t tuple; ··· 131 129 132 130 struct pcmcia_socket; 133 131 134 - extern struct bus_type pcmcia_bus_type; 135 - 136 132 struct pcmcia_driver { 137 133 dev_link_t *(*attach)(void); 138 134 void (*detach)(dev_link_t *); 139 135 struct module *owner; 136 + struct pcmcia_device_id *id_table; 140 137 struct device_driver drv; 141 138 }; 142 139 ··· 174 173 u8 has_manf_id:1; 175 174 u8 has_card_id:1; 176 175 u8 has_func_id:1; 177 - u8 reserved:5; 176 + 177 + u8 allow_func_id_match:1; 178 + u8 reserved:4; 178 179 179 180 u8 func_id; 180 181 u16 manf_id;
+30 -4
include/pcmcia/ss.h
··· 15 15 #ifndef _LINUX_SS_H 16 16 #define _LINUX_SS_H 17 17 18 + #include <linux/config.h> 19 + #include <linux/device.h> 20 + 18 21 #include <pcmcia/cs_types.h> 19 22 #include <pcmcia/cs.h> 20 23 #include <pcmcia/bulkmem.h> 21 - #include <linux/device.h> 22 24 23 25 /* Definitions for card status flags for GetStatus */ 24 26 #define SS_WRPROT 0x0001 ··· 173 171 174 172 struct config_t; 175 173 struct pcmcia_callback; 176 - 174 + struct user_info_t; 177 175 178 176 struct pcmcia_socket { 179 177 struct module *owner; ··· 218 216 219 217 /* is set to one if resource setup is done using adjust_resource_info() */ 220 218 u8 resource_setup_old:1; 219 + u8 resource_setup_new:1; 221 220 222 - u8 reserved:6; 221 + u8 reserved:5; 223 222 224 223 /* socket operations */ 225 224 struct pccard_operations * ops; ··· 244 241 unsigned int thread_events; 245 242 246 243 /* pcmcia (16-bit) */ 247 - struct pcmcia_bus_socket *pcmcia; 248 244 struct pcmcia_callback *callback; 245 + 246 + #if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) 247 + struct list_head devices_list; /* PCMCIA devices */ 248 + u8 device_count; /* the number of devices, used 249 + * only internally and subject 250 + * to incorrectness and change */ 251 + 252 + struct { 253 + u8 present:1, /* PCMCIA card is present in socket */ 254 + busy:1, /* "master" ioctl is used */ 255 + dead:1, /* pcmcia module is being unloaded */ 256 + device_add_pending:1, /* a pseudo-multifunction-device 257 + * add event is pending */ 258 + reserved:4; 259 + } pcmcia_state; 260 + 261 + struct work_struct device_add; /* for adding further pseudo-multifunction 262 + * devices */ 263 + 264 + #ifdef CONFIG_PCMCIA_IOCTL 265 + struct user_info_t *user; 266 + wait_queue_head_t queue; 267 + #endif 268 + #endif 249 269 250 270 /* cardbus (32-bit) */ 251 271 #ifdef CONFIG_CARDBUS
+39
scripts/mod/file2alias.c
··· 287 287 return 1; 288 288 } 289 289 290 + /* Looks like: pcmcia:mNcNfNfnNpfnNvaNvbNvcNvdN. */ 291 + static int do_pcmcia_entry(const char *filename, 292 + struct pcmcia_device_id *id, char *alias) 293 + { 294 + unsigned int i; 295 + 296 + id->manf_id = TO_NATIVE(id->manf_id); 297 + id->card_id = TO_NATIVE(id->card_id); 298 + id->func_id = TO_NATIVE(id->func_id); 299 + id->function = TO_NATIVE(id->function); 300 + id->device_no = TO_NATIVE(id->device_no); 301 + for (i=0; i<4; i++) { 302 + id->prod_id_hash[i] = TO_NATIVE(id->prod_id_hash[i]); 303 + } 304 + 305 + strcpy(alias, "pcmcia:"); 306 + ADD(alias, "m", id->match_flags & PCMCIA_DEV_ID_MATCH_MANF_ID, 307 + id->manf_id); 308 + ADD(alias, "c", id->match_flags & PCMCIA_DEV_ID_MATCH_CARD_ID, 309 + id->card_id); 310 + ADD(alias, "f", id->match_flags & PCMCIA_DEV_ID_MATCH_FUNC_ID, 311 + id->func_id); 312 + ADD(alias, "fn", id->match_flags & PCMCIA_DEV_ID_MATCH_FUNCTION, 313 + id->function); 314 + ADD(alias, "pfn", id->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO, 315 + id->device_no); 316 + ADD(alias, "pa", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID1, id->prod_id_hash[0]); 317 + ADD(alias, "pb", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID2, id->prod_id_hash[1]); 318 + ADD(alias, "pc", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID3, id->prod_id_hash[2]); 319 + ADD(alias, "pd", id->match_flags & PCMCIA_DEV_ID_MATCH_PROD_ID4, id->prod_id_hash[3]); 320 + 321 + return 1; 322 + } 323 + 324 + 325 + 290 326 /* Ignore any prefix, eg. v850 prepends _ */ 291 327 static inline int sym_is(const char *symbol, const char *name) 292 328 { ··· 398 362 else if (sym_is(symname, "__mod_pnp_card_device_table")) 399 363 do_table(symval, sym->st_size, sizeof(struct pnp_card_device_id), 400 364 do_pnp_card_entry, mod); 365 + else if (sym_is(symname, "__mod_pcmcia_device_table")) 366 + do_table(symval, sym->st_size, sizeof(struct pcmcia_device_id), 367 + do_pcmcia_entry, mod); 401 368 } 402 369 403 370 /* Now add out buffered information to the generated C source */
+8 -1
sound/pcmcia/pdaudiocf/pdaudiocf.c
··· 380 380 /* 381 381 * Module entry points 382 382 */ 383 + static struct pcmcia_device_id snd_pdacf_ids[] = { 384 + PCMCIA_DEVICE_MANF_CARD(0x015d, 0x4c45), 385 + PCMCIA_DEVICE_NULL 386 + }; 387 + MODULE_DEVICE_TABLE(pcmcia, snd_pdacf_ids); 388 + 383 389 static struct pcmcia_driver pdacf_cs_driver = { 384 390 .owner = THIS_MODULE, 385 391 .drv = { 386 392 .name = "snd-pdaudiocf", 387 393 }, 388 394 .attach = snd_pdacf_attach, 389 - .detach = snd_pdacf_detach 395 + .detach = snd_pdacf_detach, 396 + .id_table = snd_pdacf_ids, 390 397 }; 391 398 392 399 static int __init init_pdacf(void)
+8 -12
sound/pcmcia/vx/vxpocket.c
··· 18 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 21 - /* 22 - please add the following as /etc/pcmcia/vxpocket.conf: 23 - 24 - device "snd-vxpocket" 25 - class "audio" module "snd-vxpocket" 26 - 27 - card "Digigram VX-POCKET" 28 - manfid 0x01f1, 0x0100 29 - bind "snd-vxpocket" 30 - 31 - */ 32 21 33 22 #include <sound/driver.h> 34 23 #include <linux/init.h> ··· 129 140 * Module entry points 130 141 */ 131 142 143 + static struct pcmcia_device_id vxp_ids[] = { 144 + PCMCIA_DEVICE_MANF_CARD(0x01f1, 0x0100), 145 + PCMCIA_DEVICE_NULL 146 + }; 147 + MODULE_DEVICE_TABLE(pcmcia, vxp_ids); 148 + 132 149 static struct pcmcia_driver vxp_cs_driver = { 133 150 .owner = THIS_MODULE, 134 151 .drv = { 135 152 .name = DEV_INFO, 136 153 }, 137 154 .attach = vxp_attach, 138 - .detach = vxp_detach 155 + .detach = vxp_detach, 156 + .id_table = vxp_ids, 139 157 }; 140 158 141 159 static int __init init_vxpocket(void)