diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2010-09-19 23:20:44 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2010-09-19 23:20:44 +0200 |
commit | ec91b8ae6735a3f2977dc886ea63ff28e1aeef41 (patch) | |
tree | 67ac2a696cdd345b543d8415c74166bed11e9d4f /linux/dev | |
parent | 9d952fb2d44ec2199a1d08999ff7a68aa26e9507 (diff) | |
parent | 45fcd2d09c15820e58e2334b80f7367d2f98ebb7 (diff) |
Merge branch 'master' into HEAD
Conflicts:
ChangeLog
kern/bootstrap.c
kern/debug.c
vm/vm_object.c
Diffstat (limited to 'linux/dev')
-rw-r--r-- | linux/dev/arch/i386/kernel/irq.c | 14 | ||||
-rw-r--r-- | linux/dev/drivers/net/Space.c | 4 | ||||
-rw-r--r-- | linux/dev/glue/block.c | 25 | ||||
-rw-r--r-- | linux/dev/glue/kmem.c | 5 | ||||
-rw-r--r-- | linux/dev/glue/net.c | 26 | ||||
-rw-r--r-- | linux/dev/include/asm-i386/segment.h | 375 | ||||
-rw-r--r-- | linux/dev/include/linux/netdevice.h | 1 | ||||
-rw-r--r-- | linux/dev/kernel/printk.c | 2 | ||||
-rw-r--r-- | linux/dev/net/core/dev.c | 28 |
9 files changed, 90 insertions, 390 deletions
diff --git a/linux/dev/arch/i386/kernel/irq.c b/linux/dev/arch/i386/kernel/irq.c index 4bed353d..8966dea1 100644 --- a/linux/dev/arch/i386/kernel/irq.c +++ b/linux/dev/arch/i386/kernel/irq.c @@ -47,7 +47,7 @@ #include <asm/io.h> #include <asm/hardirq.h> -extern int linux_timer_intr (void); +extern void linux_timer_intr (void); extern spl_t splhigh (void); extern spl_t spl0 (void); extern void form_pic_mask (void); @@ -99,13 +99,13 @@ extern spl_t curr_ipl; extern int curr_pic_mask; extern int pic_mask[]; -extern int intnull (), prtnull (); +extern void intnull (), prtnull (); /* * Generic interrupt handler for Linux devices. * Set up a fake `struct pt_regs' then call the real handler. */ -static int +static void linux_intr (int irq) { struct pt_regs regs; @@ -128,9 +128,6 @@ linux_intr (int irq) restore_flags (flags); intr_count--; - - /* Not used. by OKUJI Yoshinori. */ - return 0; } /* @@ -208,11 +205,10 @@ enable_irq (unsigned int irq_nr) /* * Default interrupt handler for Linux. */ -int +void linux_bad_intr (int irq) { mask_irq (irq); - return 0; } static int @@ -685,7 +681,7 @@ void __global_restore_flags(unsigned long flags) #endif -static int (*old_clock_handler) (); +static void (*old_clock_handler) (); static int old_clock_pri; void diff --git a/linux/dev/drivers/net/Space.c b/linux/dev/drivers/net/Space.c index db40d0ce..213fa9b5 100644 --- a/linux/dev/drivers/net/Space.c +++ b/linux/dev/drivers/net/Space.c @@ -93,6 +93,7 @@ extern int yellowfin_probe(struct device *); extern int eepro100_probe(struct device *); extern int epic100_probe(struct device *); extern int rtl8139_probe(struct device *); +extern int sis900_probe(struct device *); extern int tlan_probe(struct device *); extern int isa515_probe(struct device *); extern int pcnet32_probe(struct device *); @@ -137,6 +138,9 @@ ethif_probe(struct device *dev) #ifdef CONFIG_RTL8139 && rtl8139_probe(dev) #endif +#ifdef CONFIG_SIS900 + && sis900_probe(dev) +#endif #ifdef CONFIG_VIA_RHINE && via_rhine_probe(dev) #endif diff --git a/linux/dev/glue/block.c b/linux/dev/glue/block.c index c06b5d27..b920fb62 100644 --- a/linux/dev/glue/block.c +++ b/linux/dev/glue/block.c @@ -572,7 +572,7 @@ out: } #define BH_Bounce 16 -#define MAX_BUF VM_MAP_COPY_PAGE_LIST_MAX +#define MAX_BUF 8 /* Perform read/write operation RW on device DEV starting at *off to/from buffer *BUF of size *RESID. @@ -627,7 +627,7 @@ rdwr_full (int rw, kdev_t dev, loff_t *off, char **buf, int *resid, int bshift) bh->b_size = cc; bhp[i] = bh; nb += cc >> bshift; - blk += nb; + blk += cc >> bshift; if (++i == MAX_BUF) break; } @@ -1704,6 +1704,25 @@ device_get_status (void *d, dev_flavor_t flavor, dev_status_t status, return D_SUCCESS; } +static io_return_t +device_set_status (void *d, dev_flavor_t flavor, dev_status_t status, + mach_msg_type_number_t *status_count) +{ + struct block_data *bd = d; + + switch (flavor) + { + case BLKRRPART: + { + DECL_DATA; + INIT_DATA(); + return (*bd->ds->fops->ioctl) (&td.inode, &td.file, flavor, 0); + } + } + + return D_INVALID_OPERATION; +} + struct device_emulation_ops linux_block_emulation_ops = { NULL, @@ -1715,7 +1734,7 @@ struct device_emulation_ops linux_block_emulation_ops = NULL, device_read, NULL, - NULL, + device_set_status, device_get_status, NULL, NULL, diff --git a/linux/dev/glue/kmem.c b/linux/dev/glue/kmem.c index 908d0869..8c21ce7d 100644 --- a/linux/dev/glue/kmem.c +++ b/linux/dev/glue/kmem.c @@ -48,6 +48,7 @@ extern int printf (const char *, ...); Increase MEM_CHUNKS if the kernel is running out of memory. */ #define MEM_CHUNK_SIZE (64 * 1024) #define MEM_CHUNKS 7 +#define MEM_DMA_LIMIT (16 * 1024 * 1024) /* Mininum amount that linux_kmalloc will allocate. */ #define MIN_ALLOC 12 @@ -100,7 +101,7 @@ linux_kmem_init () { /* Allocate memory. */ pages_free[i].start = (unsigned long) alloc_contig_mem (MEM_CHUNK_SIZE, - 16 * 1024 * 1024, + MEM_DMA_LIMIT, 0xffff, &pages); assert (pages_free[i].start); @@ -109,7 +110,7 @@ linux_kmem_init () /* Sanity check: ensure pages are contiguous and within DMA limits. */ for (p = pages, j = 0; j < MEM_CHUNK_SIZE - PAGE_SIZE; j += PAGE_SIZE) { - assert (p->phys_addr < 16 * 1024 * 1024); + assert (p->phys_addr < MEM_DMA_LIMIT); assert (p->phys_addr + PAGE_SIZE == ((vm_page_t) p->pageq.next)->phys_addr); diff --git a/linux/dev/glue/net.c b/linux/dev/glue/net.c index b76e0986..095428d3 100644 --- a/linux/dev/glue/net.c +++ b/linux/dev/glue/net.c @@ -533,6 +533,17 @@ static io_return_t device_get_status (void *d, dev_flavor_t flavor, dev_status_t status, mach_msg_type_number_t *count) { + if (flavor == NET_FLAGS) + { + struct net_data *net = (struct net_data *) d; + + if (*count != 1) + return D_INVALID_SIZE; + + status[0] = net->dev->flags; + return D_SUCCESS; + } + if(flavor >= SIOCIWFIRST && flavor <= SIOCIWLAST) { /* handle wireless ioctl */ @@ -592,6 +603,21 @@ static io_return_t device_set_status(void *d, dev_flavor_t flavor, dev_status_t status, mach_msg_type_number_t count) { + if (flavor == NET_FLAGS) + { + if (count != 1) + return D_INVALID_SIZE; + + short flags = status[0]; + struct net_data *net = (struct net_data *) d; + + dev_change_flags (net->dev, flags); + + /* Change the flags of the Mach device, too. */ + net->ifnet.if_flags = net->dev->flags; + return D_SUCCESS; + } + if(flavor < SIOCIWFIRST || flavor > SIOCIWLAST) return D_INVALID_OPERATION; diff --git a/linux/dev/include/asm-i386/segment.h b/linux/dev/include/asm-i386/segment.h deleted file mode 100644 index d3f6d27b..00000000 --- a/linux/dev/include/asm-i386/segment.h +++ /dev/null @@ -1,375 +0,0 @@ -#ifndef _ASM_SEGMENT_H -#define _ASM_SEGMENT_H - -#ifdef MACH - -#define KERNEL_CS 0x08 -#define KERNEL_DS 0x10 - -#define USER_CS 0x17 -#define USER_DS 0x1F - -#else /* !MACH */ - -#define KERNEL_CS 0x10 -#define KERNEL_DS 0x18 - -#define USER_CS 0x23 -#define USER_DS 0x2B - -#endif /* !MACH */ - -#ifndef __ASSEMBLY__ - -/* - * Uh, these should become the main single-value transfer routines.. - * They automatically use the right size if we just have the right - * pointer type.. - */ -#define put_user(x,ptr) __put_user((unsigned long)(x),(ptr),sizeof(*(ptr))) -#define get_user(ptr) ((__typeof__(*(ptr)))__get_user((ptr),sizeof(*(ptr)))) - -/* - * This is a silly but good way to make sure that - * the __put_user function is indeed always optimized, - * and that we use the correct sizes.. - */ -extern int bad_user_access_length(void); - -/* - * dummy pointer type structure.. gcc won't try to do something strange - * this way.. - */ -struct __segment_dummy { unsigned long a[100]; }; -#define __sd(x) ((struct __segment_dummy *) (x)) -#define __const_sd(x) ((const struct __segment_dummy *) (x)) - -static inline void __put_user(unsigned long x, void * y, int size) -{ - switch (size) { - case 1: - __asm__ ("movb %b1,%%fs:%0" - :"=m" (*__sd(y)) - :"iq" ((unsigned char) x), "m" (*__sd(y))); - break; - case 2: - __asm__ ("movw %w1,%%fs:%0" - :"=m" (*__sd(y)) - :"ir" ((unsigned short) x), "m" (*__sd(y))); - break; - case 4: - __asm__ ("movl %1,%%fs:%0" - :"=m" (*__sd(y)) - :"ir" (x), "m" (*__sd(y))); - break; - default: - bad_user_access_length(); - } -} - -static inline unsigned long __get_user(const void * y, int size) -{ - unsigned long result; - - switch (size) { - case 1: - __asm__ ("movb %%fs:%1,%b0" - :"=q" (result) - :"m" (*__const_sd(y))); - return (unsigned char) result; - case 2: - __asm__ ("movw %%fs:%1,%w0" - :"=r" (result) - :"m" (*__const_sd(y))); - return (unsigned short) result; - case 4: - __asm__ ("movl %%fs:%1,%0" - :"=r" (result) - :"m" (*__const_sd(y))); - return result; - default: - return bad_user_access_length(); - } -} - -#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ < 95) -static inline void __generic_memcpy_tofs(void * to, const void * from, unsigned long n) -{ - __asm__ volatile - ("cld\n" - "push %%es\n" - "push %%fs\n" - "cmpl $3,%0\n" - "pop %%es\n" - "jbe 1f\n" - "movl %%edi,%%ecx\n" - "negl %%ecx\n" - "andl $3,%%ecx\n" - "subl %%ecx,%0\n" - "rep; movsb\n" - "movl %0,%%ecx\n" - "shrl $2,%%ecx\n" - "rep; movsl\n" - "andl $3,%0\n" - "1: movl %0,%%ecx\n" - "rep; movsb\n" - "pop %%es\n" - :"=abd" (n) - :"0" (n),"D" ((long) to),"S" ((long) from) - :"cx","di","si"); -} - -static inline void __constant_memcpy_tofs(void * to, const void * from, unsigned long n) -{ - switch (n) { - case 0: - return; - case 1: - __put_user(*(const char *) from, (char *) to, 1); - return; - case 2: - __put_user(*(const short *) from, (short *) to, 2); - return; - case 3: - __put_user(*(const short *) from, (short *) to, 2); - __put_user(*(2+(const char *) from), 2+(char *) to, 1); - return; - case 4: - __put_user(*(const int *) from, (int *) to, 4); - return; - case 8: - __put_user(*(const int *) from, (int *) to, 4); - __put_user(*(1+(const int *) from), 1+(int *) to, 4); - return; - case 12: - __put_user(*(const int *) from, (int *) to, 4); - __put_user(*(1+(const int *) from), 1+(int *) to, 4); - __put_user(*(2+(const int *) from), 2+(int *) to, 4); - return; - case 16: - __put_user(*(const int *) from, (int *) to, 4); - __put_user(*(1+(const int *) from), 1+(int *) to, 4); - __put_user(*(2+(const int *) from), 2+(int *) to, 4); - __put_user(*(3+(const int *) from), 3+(int *) to, 4); - return; - } -#define COMMON(x) \ -__asm__("cld\n\t" \ - "push %%es\n\t" \ - "push %%fs\n\t" \ - "pop %%es\n\t" \ - "rep ; movsl\n\t" \ - x \ - "pop %%es" \ - : /* no outputs */ \ - :"c" (n/4),"D" ((long) to),"S" ((long) from) \ - :"cx","di","si") - - switch (n % 4) { - case 0: - COMMON(""); - return; - case 1: - COMMON("movsb\n\t"); - return; - case 2: - COMMON("movsw\n\t"); - return; - case 3: - COMMON("movsw\n\tmovsb\n\t"); - return; - } -#undef COMMON -} - -static inline void __generic_memcpy_fromfs(void * to, const void * from, unsigned long n) -{ - __asm__ volatile - ("cld\n" - "cmpl $3,%0\n" - "jbe 1f\n" - "movl %%edi,%%ecx\n" - "negl %%ecx\n" - "andl $3,%%ecx\n" - "subl %%ecx,%0\n" - "fs; rep; movsb\n" - "movl %0,%%ecx\n" - "shrl $2,%%ecx\n" - "fs; rep; movsl\n" - "andl $3,%0\n" - "1:movl %0,%%ecx\n" - "fs; rep; movsb\n" - :"=abd" (n) - :"0" (n),"D" ((long) to),"S" ((long) from) - :"cx","di","si", "memory"); -} - -static inline void __constant_memcpy_fromfs(void * to, const void * from, unsigned long n) -{ - switch (n) { - case 0: - return; - case 1: - *(char *)to = __get_user((const char *) from, 1); - return; - case 2: - *(short *)to = __get_user((const short *) from, 2); - return; - case 3: - *(short *) to = __get_user((const short *) from, 2); - *((char *) to + 2) = __get_user(2+(const char *) from, 1); - return; - case 4: - *(int *) to = __get_user((const int *) from, 4); - return; - case 8: - *(int *) to = __get_user((const int *) from, 4); - *(1+(int *) to) = __get_user(1+(const int *) from, 4); - return; - case 12: - *(int *) to = __get_user((const int *) from, 4); - *(1+(int *) to) = __get_user(1+(const int *) from, 4); - *(2+(int *) to) = __get_user(2+(const int *) from, 4); - return; - case 16: - *(int *) to = __get_user((const int *) from, 4); - *(1+(int *) to) = __get_user(1+(const int *) from, 4); - *(2+(int *) to) = __get_user(2+(const int *) from, 4); - *(3+(int *) to) = __get_user(3+(const int *) from, 4); - return; - } -#define COMMON(x) \ -__asm__("cld\n\t" \ - "rep ; fs ; movsl\n\t" \ - x \ - : /* no outputs */ \ - :"c" (n/4),"D" ((long) to),"S" ((long) from) \ - :"cx","di","si","memory") - - switch (n % 4) { - case 0: - COMMON(""); - return; - case 1: - COMMON("fs ; movsb"); - return; - case 2: - COMMON("fs ; movsw"); - return; - case 3: - COMMON("fs ; movsw\n\tfs ; movsb"); - return; - } -#undef COMMON -} - -#define memcpy_fromfs(to, from, n) \ -(__builtin_constant_p(n) ? \ - __constant_memcpy_fromfs((to),(from),(n)) : \ - __generic_memcpy_fromfs((to),(from),(n))) - -#define memcpy_tofs(to, from, n) \ -(__builtin_constant_p(n) ? \ - __constant_memcpy_tofs((to),(from),(n)) : \ - __generic_memcpy_tofs((to),(from),(n))) - - -#else /* code for gcc-2.95.x and newer follows */ - -static inline void memcpy_fromfs(void * to, const void * from, unsigned long n) -{ - char *d = (char *)to; - const char *s = (const char *)from; - while (n-- > 0) { - *d++ = __get_user(s++, 1); - } -} - -static inline void memcpy_tofs(void * to, const void * from, unsigned long n) -{ - char *d = (char *)to; - const char *s = (const char *)from; - while (n-- > 0) { - __put_user(*s++, d++, 1); - } -} - -#endif /* not gcc-2.95 */ - -/* - * These are deprecated.. - * - * Use "put_user()" and "get_user()" with the proper pointer types instead. - */ - -#define get_fs_byte(addr) __get_user((const unsigned char *)(addr),1) -#define get_fs_word(addr) __get_user((const unsigned short *)(addr),2) -#define get_fs_long(addr) __get_user((const unsigned int *)(addr),4) - -#define put_fs_byte(x,addr) __put_user((x),(unsigned char *)(addr),1) -#define put_fs_word(x,addr) __put_user((x),(unsigned short *)(addr),2) -#define put_fs_long(x,addr) __put_user((x),(unsigned int *)(addr),4) - -#ifdef WE_REALLY_WANT_TO_USE_A_BROKEN_INTERFACE - -static inline unsigned short get_user_word(const short *addr) -{ - return __get_user(addr, 2); -} - -static inline unsigned char get_user_byte(const char * addr) -{ - return __get_user(addr,1); -} - -static inline unsigned long get_user_long(const int *addr) -{ - return __get_user(addr, 4); -} - -static inline void put_user_byte(char val,char *addr) -{ - __put_user(val, addr, 1); -} - -static inline void put_user_word(short val,short * addr) -{ - __put_user(val, addr, 2); -} - -static inline void put_user_long(unsigned long val,int * addr) -{ - __put_user(val, addr, 4); -} - -#endif - -/* - * Someone who knows GNU asm better than I should double check the following. - * It seems to work, but I don't know if I'm doing something subtly wrong. - * --- TYT, 11/24/91 - * [ nothing wrong here, Linus: I just changed the ax to be any reg ] - */ - -static inline unsigned long get_fs(void) -{ - unsigned long _v; - __asm__("mov %%fs,%w0":"=r" (_v):"0" (0)); - return _v; -} - -static inline unsigned long get_ds(void) -{ - unsigned long _v; - __asm__("mov %%ds,%w0":"=r" (_v):"0" (0)); - return _v; -} - -static inline void set_fs(unsigned long val) -{ - __asm__ __volatile__("mov %w0,%%fs": /* no output */ :"r" (val)); -} - -#endif /* __ASSEMBLY__ */ - -#endif /* _ASM_SEGMENT_H */ diff --git a/linux/dev/include/linux/netdevice.h b/linux/dev/include/linux/netdevice.h index ff25df16..e1a9a34d 100644 --- a/linux/dev/include/linux/netdevice.h +++ b/linux/dev/include/linux/netdevice.h @@ -271,6 +271,7 @@ extern void net_bh(void); extern void dev_tint(struct linux_device *dev); #endif +extern int dev_change_flags(struct linux_device *dev, short flags); extern int dev_get_info(char *buffer, char **start, off_t offset, int length, int dummy); extern int dev_ioctl(unsigned int cmd, void *); diff --git a/linux/dev/kernel/printk.c b/linux/dev/kernel/printk.c index 9dc86cb3..1c45b245 100644 --- a/linux/dev/kernel/printk.c +++ b/linux/dev/kernel/printk.c @@ -27,6 +27,7 @@ #include <stdarg.h> #include <asm/system.h> #include <kern/assert.h> +#include <device/cons.h> static char buf[2048]; @@ -40,7 +41,6 @@ printk (char *fmt, ...) { va_list args; int n, flags; - extern void cnputc (); char *p, *msg, *buf_end; static int msg_level = -1; diff --git a/linux/dev/net/core/dev.c b/linux/dev/net/core/dev.c index efe02467..cbdf8ccf 100644 --- a/linux/dev/net/core/dev.c +++ b/linux/dev/net/core/dev.c @@ -1618,3 +1618,31 @@ int net_dev_init(void) init_bh(NET_BH, net_bh); return 0; } + +/* + * Change the flags of device DEV to FLAGS. + */ +int dev_change_flags (struct device *dev, short flags) +{ + if (securelevel > 0) + flags &= ~IFF_PROMISC; + + /* + * Set the flags on our device. + */ + + dev->flags = (flags & + (IFF_BROADCAST | IFF_DEBUG | IFF_LOOPBACK | + IFF_POINTOPOINT | IFF_NOTRAILERS | IFF_RUNNING | + IFF_NOARP | IFF_PROMISC | IFF_ALLMULTI | IFF_SLAVE + | IFF_MASTER | IFF_MULTICAST)) + | (dev->flags & (IFF_SOFTHEADERS|IFF_UP)); + + /* The flags are taken into account (multicast, promiscuous, ...) + in the set_multicast_list handler. */ + if ((dev->flags & IFF_UP) && dev->set_multicast_list != NULL) + dev->set_multicast_list (dev); + + return 0; +} + |