diff options
author | Thomas Schwinge <tschwinge@gnu.org> | 2006-07-26 23:04:47 +0000 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gnu.org> | 2009-06-18 00:26:38 +0200 |
commit | 253d524b348018470c53c8f8382f6d367daede24 (patch) | |
tree | 00dfb230e5be6fea4faf1cfa7a9d8a7b0da6c656 /linux | |
parent | affb871b497129f7f191cfaf7bd458342b22c05f (diff) |
2006-07-27 Stefan Siegl <stesie@brokenpipe.de>
* linux/pcmcia-cs/clients/xirc2ps_cs.c (busy_loop): Replace the code by
a call to __udelay.
* linux/pcmcia-cs/include/linux/init.h: Adapt to our Linux environment.
* linux/pcmcia-cs/include/linux/slab.h: Use `#include', not
`#include_next'.
* linux/pcmcia-cs/include/pcmcia/mem_op.h: Adapt to our Linux
environment and fix GCC 4.0 complaints.
* linux/pcmcia-cs/include/pcmcia/version.h: Always assume that
CONFIG_PCMCIA is not defined.
* linux/pcmcia-cs/modules/cs.c (init_pcmcia_cs): Don't make it static.
* linux/pcmcia-cs/modules/ds.c: Use some magic to avoid duplicate
definition `io_req_t'.
(ds_open, ds_release, ds_read, ds_write, ds_select, ds_poll, ds_fops):
Hide functions if MACH is defined.
Likewise for the module handling code.
(ds_ioctl): Use plain `memcpy' if MACH is defined.
(init_pcmcia_ds): Don't register charcater devices if MACH is defined.
Include "../glue/ds.c".
* linux/pcmcia-cs/modules/i82365.c (test_irq): Adapt to GNU Mach.
(init_i82365): Don't make it static.
* linux/pcmcia-cs/modules/pci_fixup.c (pci_devices): Don't define if
MACH is defined.
* linux/pcmcia-cs/wireless/orinoco.c: Adapt to our Linux environment.
Diffstat (limited to 'linux')
-rw-r--r-- | linux/pcmcia-cs/clients/xirc2ps_cs.c | 5 | ||||
-rw-r--r-- | linux/pcmcia-cs/include/linux/init.h | 11 | ||||
-rw-r--r-- | linux/pcmcia-cs/include/linux/slab.h | 2 | ||||
-rw-r--r-- | linux/pcmcia-cs/include/pcmcia/mem_op.h | 20 | ||||
-rw-r--r-- | linux/pcmcia-cs/include/pcmcia/version.h | 4 | ||||
-rw-r--r-- | linux/pcmcia-cs/modules/cs.c | 2 | ||||
-rw-r--r-- | linux/pcmcia-cs/modules/ds.c | 35 | ||||
-rw-r--r-- | linux/pcmcia-cs/modules/i82365.c | 20 | ||||
-rw-r--r-- | linux/pcmcia-cs/modules/pci_fixup.c | 3 | ||||
-rw-r--r-- | linux/pcmcia-cs/wireless/orinoco.c | 25 |
10 files changed, 100 insertions, 27 deletions
diff --git a/linux/pcmcia-cs/clients/xirc2ps_cs.c b/linux/pcmcia-cs/clients/xirc2ps_cs.c index 0cf41d3..9db947d 100644 --- a/linux/pcmcia-cs/clients/xirc2ps_cs.c +++ b/linux/pcmcia-cs/clients/xirc2ps_cs.c @@ -442,6 +442,10 @@ get_tuple(int fn, client_handle_t handle, tuple_t *tuple, cisparse_t *parse) static void busy_loop(u_long len) { +#ifdef MACH + /* TODO: Is this really what we want? */ + __udelay(1000000 / HZ * len); +#else if (in_interrupt()) { u_long timeout = jiffies + len; u_long flags; @@ -454,6 +458,7 @@ busy_loop(u_long len) __set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(len); } +#endif } diff --git a/linux/pcmcia-cs/include/linux/init.h b/linux/pcmcia-cs/include/linux/init.h index dae55c2..06da72d 100644 --- a/linux/pcmcia-cs/include/linux/init.h +++ b/linux/pcmcia-cs/include/linux/init.h @@ -1,9 +1,6 @@ #ifndef _COMPAT_INIT_H #define _COMPAT_INIT_H -#include <linux/version.h> - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)) && defined(MODULE) #define __init #define __initdata #define __exit @@ -12,10 +9,10 @@ #define __devinitdata #define __devexit #define __devexitdata -#define module_init(x) int init_module(void) { return x(); } -#define module_exit(x) void cleanup_module(void) { x(); } -#else -#include_next <linux/init.h> + +#ifndef module_init +#define module_init(x) +#define module_exit(x) #endif #ifndef __devexit_p diff --git a/linux/pcmcia-cs/include/linux/slab.h b/linux/pcmcia-cs/include/linux/slab.h index 960d9c5..634084d 100644 --- a/linux/pcmcia-cs/include/linux/slab.h +++ b/linux/pcmcia-cs/include/linux/slab.h @@ -4,7 +4,7 @@ #include <linux/version.h> #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)) -#include_next <linux/malloc.h> +#include <linux/malloc.h> #else #include_next <linux/slab.h> #endif diff --git a/linux/pcmcia-cs/include/pcmcia/mem_op.h b/linux/pcmcia-cs/include/pcmcia/mem_op.h index 6e7f795..9230faa 100644 --- a/linux/pcmcia-cs/include/pcmcia/mem_op.h +++ b/linux/pcmcia-cs/include/pcmcia/mem_op.h @@ -50,7 +50,7 @@ static inline void copy_pc_to_user(void *to, const void *from, size_t n) n -= odd; while (n) { put_user(readl_ns(from), (int *)to); - (char *)from += 4; (char *)to += 4; n -= 4; + from += 4; to += 4; n -= 4; } while (odd--) put_user(readb((char *)from++), (char *)to++); @@ -63,12 +63,12 @@ static inline void copy_user_to_pc(void *to, const void *from, size_t n) size_t odd = (n & 3); n -= odd; while (n) { - get_user(l, (int *)from); + l = get_user((int *)from); writel_ns(l, to); - (char *)to += 4; (char *)from += 4; n -= 4; + to += 4; from += 4; n -= 4; } while (odd--) { - get_user(c, (char *)from++); + c = get_user((char *)from++); writeb(c, (char *)to++); } } @@ -81,7 +81,7 @@ static inline void copy_from_pc(void *to, const void *from, size_t n) n -= odd; while (n) { *(u_short *)to = readw_ns(from); - (char *)to += 2; (char *)from += 2; n -= 2; + to += 2; from += 2; n -= 2; } if (odd) *(u_char *)to = readb(from); @@ -93,7 +93,7 @@ static inline void copy_to_pc(void *to, const void *from, size_t n) n -= odd; while (n) { writew_ns(*(u_short *)from, to); - (char *)to += 2; (char *)from += 2; n -= 2; + to += 2; from += 2; n -= 2; } if (odd) writeb(*(u_char *)from, to); @@ -105,7 +105,7 @@ static inline void copy_pc_to_user(void *to, const void *from, size_t n) n -= odd; while (n) { put_user(readw_ns(from), (short *)to); - (char *)to += 2; (char *)from += 2; n -= 2; + to += 2; from += 2; n -= 2; } if (odd) put_user(readb(from), (char *)to); @@ -118,12 +118,12 @@ static inline void copy_user_to_pc(void *to, const void *from, size_t n) size_t odd = (n & 1); n -= odd; while (n) { - get_user(s, (short *)from); + s = get_user((short *)from); writew_ns(s, to); - (char *)to += 2; (char *)from += 2; n -= 2; + to += 2; from += 2; n -= 2; } if (odd) { - get_user(c, (char *)from); + c = get_user((char *)from); writeb(c, to); } } diff --git a/linux/pcmcia-cs/include/pcmcia/version.h b/linux/pcmcia-cs/include/pcmcia/version.h index 7f67ee7..bc2aef3 100644 --- a/linux/pcmcia-cs/include/pcmcia/version.h +++ b/linux/pcmcia-cs/include/pcmcia/version.h @@ -5,9 +5,5 @@ #define VERSION(v,p,s) (((v)<<16)+(p<<8)+s) -#ifdef CONFIG_PCMCIA -#include_next <pcmcia/version.h> -#else #define CS_RELEASE CS_PKG_RELEASE #define CS_RELEASE_CODE CS_PKG_RELEASE_CODE -#endif diff --git a/linux/pcmcia-cs/modules/cs.c b/linux/pcmcia-cs/modules/cs.c index 99ee192..949b190 100644 --- a/linux/pcmcia-cs/modules/cs.c +++ b/linux/pcmcia-cs/modules/cs.c @@ -2322,7 +2322,7 @@ EXPORT_SYMBOL(pci_set_power_state); #endif -static int __init init_pcmcia_cs(void) +int __init init_pcmcia_cs(void) { printk(KERN_INFO "%s\n", release); #ifdef UTS_RELEASE diff --git a/linux/pcmcia-cs/modules/ds.c b/linux/pcmcia-cs/modules/ds.c index b6eb10e..e4579ea 100644 --- a/linux/pcmcia-cs/modules/ds.c +++ b/linux/pcmcia-cs/modules/ds.c @@ -48,12 +48,19 @@ #include <linux/poll.h> #endif +/* + * <pcmcia/cs.h> defines io_req_t which is not used in this file, but + * which clashes with the io_req_t needed for the Mach devices. Rename + * it to cardservice_io_req_t to avoid this clash. + */ +#define io_req_t cardservice_io_req_t #include <pcmcia/version.h> #include <pcmcia/cs_types.h> #include <pcmcia/cs.h> #include <pcmcia/bulkmem.h> #include <pcmcia/cistpl.h> #include <pcmcia/ds.h> +#undef io_req_t /*====================================================================*/ @@ -516,6 +523,9 @@ static int unbind_request(int i, bind_info_t *bind_info) ======================================================================*/ +/* Disable all the ds filesystem operations. */ +#ifndef MACH + static int ds_open(struct inode *inode, struct file *file) { socket_t i = MINOR(inode->i_rdev); @@ -699,6 +709,8 @@ static u_int ds_poll(struct file *file, poll_table *wait) /*====================================================================*/ +#endif /* !defined(MACH) */ + static int ds_ioctl(struct inode * inode, struct file * file, u_int cmd, u_long arg) { @@ -721,6 +733,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, if (!(cmd & IOC_OUT) && !capable(CAP_SYS_ADMIN)) return -EPERM; +#ifndef MACH if (cmd & IOC_IN) { err = verify_area(VERIFY_READ, (char *)arg, size); if (err) { @@ -735,10 +748,15 @@ static int ds_ioctl(struct inode * inode, struct file * file, return err; } } +#endif err = ret = 0; +#ifndef MACH if (cmd & IOC_IN) copy_from_user((char *)&buf, (char *)arg, size); +#else + if (cmd & IOC_IN) memcpy((char *) &buf, (char *) arg, size); +#endif switch (cmd) { case DS_ADJUST_RESOURCE_INFO: @@ -857,13 +875,19 @@ static int ds_ioctl(struct inode * inode, struct file * file, } } +#ifndef MACH if (cmd & IOC_OUT) copy_to_user((char *)arg, (char *)&buf, size); +#else + if (cmd & IOC_OUT) memcpy((char *) arg, (char *) &buf, size); +#endif return err; } /* ds_ioctl */ /*====================================================================*/ +#ifndef MACH + static struct file_operations ds_fops = { open: ds_open, release: ds_release, @@ -896,6 +920,8 @@ EXPORT_SYMBOL(unregister_pccard_driver); #endif +#endif /* !defined(MACH) */ + /*====================================================================*/ int __init init_pcmcia_ds(void) @@ -961,6 +987,7 @@ int __init init_pcmcia_ds(void) } } +#ifndef MACH /* Set up character device for user mode clients */ i = register_chrdev(0, "pcmcia", &ds_fops); if (i == -EBUSY) @@ -969,6 +996,7 @@ int __init init_pcmcia_ds(void) else major_dev = i; register_symtab(&ds_symtab); +#endif #ifdef HAS_PROC_BUS if (proc_pccard) @@ -1002,3 +1030,10 @@ void __exit cleanup_module(void) } #endif + +/*====================================================================*/ + +/* Include the interface glue code to GNU Mach. */ +#include "../glue/ds.c" + +/*====================================================================*/ diff --git a/linux/pcmcia-cs/modules/i82365.c b/linux/pcmcia-cs/modules/i82365.c index fc1c782..9aaf540 100644 --- a/linux/pcmcia-cs/modules/i82365.c +++ b/linux/pcmcia-cs/modules/i82365.c @@ -1171,8 +1171,20 @@ static u_int __init test_irq(socket_info_t *s, int irq, int pci) return 1; } irq_hits = 0; + +#ifndef MACH __set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(HZ/100); +#else + /* TODO: Is this really what we want? */ + { + unsigned long flags; + + save_flags(flags); + + mdelay(1); +#endif + if (irq_hits && !irq_shared) { free_irq(irq, socket); DEBUG(2, " spurious hit!\n"); @@ -1198,6 +1210,12 @@ static u_int __init test_irq(socket_info_t *s, int irq, int pci) mdelay(1); } +#ifdef MACH + restore_flags(flags); + } + +#endif + free_irq(irq, socket); /* mask all interrupts */ @@ -2456,7 +2474,7 @@ static int pcic_service(u_int sock, u_int cmd, void *arg) /*====================================================================*/ -static int __init init_i82365(void) +int __init init_i82365(void) { servinfo_t serv; CardServices(GetCardServicesInfo, &serv); diff --git a/linux/pcmcia-cs/modules/pci_fixup.c b/linux/pcmcia-cs/modules/pci_fixup.c index b892f63..3b5551a 100644 --- a/linux/pcmcia-cs/modules/pci_fixup.c +++ b/linux/pcmcia-cs/modules/pci_fixup.c @@ -48,7 +48,10 @@ u32 pci_irq_mask = 0; ======================================================================*/ #if (LINUX_VERSION_CODE < VERSION(2,1,0)) +#ifndef MACH +/* Already defined in drivers/pci/pci.c. */ struct pci_dev *pci_devices = NULL; +#endif struct pci_bus pci_root = { parent: NULL, children: NULL, diff --git a/linux/pcmcia-cs/wireless/orinoco.c b/linux/pcmcia-cs/wireless/orinoco.c index ed7bb83..1f70b6e 100644 --- a/linux/pcmcia-cs/wireless/orinoco.c +++ b/linux/pcmcia-cs/wireless/orinoco.c @@ -506,6 +506,20 @@ MODULE_PARM(suppress_linkstatus, "i"); HERMES_MAX_MULTICAST : 0)*/ #define MAX_MULTICAST(priv) (HERMES_MAX_MULTICAST) +/* + * MACH related stuff... + */ + +#ifdef MACH + +#undef copy_to_user +#define copy_to_user(a,b,c) (memcpy(a,b,c), 0) + +#define verify_area(a,b,c) (0) +#define copy_from_user(a,b,c) (memcpy(a,b,c), 0) + +#endif + /********************************************************************/ /* Data tables */ /********************************************************************/ @@ -1805,7 +1819,6 @@ static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw) /* Pass the packet to the networking stack */ netif_rx(skb); stats->rx_packets++; - stats->rx_bytes += length; return; @@ -2357,7 +2370,7 @@ orinoco_xmit(struct sk_buff *skb, struct net_device *dev) safest approach). */ stats->tx_errors++; orinoco_unlock(priv, &flags); - dev_kfree_skb(skb); + dev_kfree_skb(skb, FREE_WRITE); TRACE_EXIT(dev->name); return 0; } @@ -2435,7 +2448,6 @@ orinoco_xmit(struct sk_buff *skb, struct net_device *dev) } dev->trans_start = jiffies; - stats->tx_bytes += data_off + data_len; orinoco_unlock(priv, &flags); @@ -2956,6 +2968,13 @@ static int orinoco_ioctl_getnick(struct net_device *dev, struct iw_point *nrq) nrq->length = strlen(nickbuf)+1; +#ifdef MACH + if(! nrq->pointer) { + printk(KERN_INFO "orinoco_ioctl_getnick: no nrq pointer.\n"); + return -EFAULT; + } +#endif + if (copy_to_user(nrq->pointer, nickbuf, sizeof(nickbuf))) return -EFAULT; |