Commit 067239c0 authored by Marcel Holtmann's avatar Marcel Holtmann

Merge bk://linux.bkbits.net/linux-2.5

into hostme.bitkeeper.com:/ua/repos/l/linux-bt/bt-2.5
parents d876e551 f7353c67
...@@ -24,6 +24,7 @@ sequences). To utilise this ability, you have to do 8 things: ...@@ -24,6 +24,7 @@ sequences). To utilise this ability, you have to do 8 things:
kernel with the ewrk3 configuration turned off and reboot. kernel with the ewrk3 configuration turned off and reboot.
5) insmod ewrk3.o 5) insmod ewrk3.o
[Alan Cox: Changed this so you can insmod ewrk3.o irq=x io=y] [Alan Cox: Changed this so you can insmod ewrk3.o irq=x io=y]
[Adam Kropelin: Multiple cards now supported by irq=x1,x2 io=y1,y2]
6) run the net startup bits for your new eth?? interface manually 6) run the net startup bits for your new eth?? interface manually
(usually /etc/rc.inet[12] at boot time). (usually /etc/rc.inet[12] at boot time).
7) enjoy! 7) enjoy!
......
...@@ -264,23 +264,34 @@ void kd_mksound(unsigned int hz, unsigned int ticks) ...@@ -264,23 +264,34 @@ void kd_mksound(unsigned int hz, unsigned int ticks)
/* /*
* Setting the keyboard rate. * Setting the keyboard rate.
*/ */
static inline unsigned int ms_to_jiffies(unsigned int ms) {
unsigned int j;
j = (ms * HZ + 500) / 1000;
return (j > 0) ? j : 1;
}
int kbd_rate(struct kbd_repeat *rep) int kbd_rate(struct kbd_repeat *rep)
{ {
struct list_head * node; struct list_head *node;
unsigned int d = 0;
if (rep->rate < 0 || rep->delay < 0) unsigned int p = 0;
return -EINVAL;
list_for_each(node,&kbd_handler.h_list) { list_for_each(node,&kbd_handler.h_list) {
struct input_handle *handle = to_handle_h(node); struct input_handle *handle = to_handle_h(node);
if (test_bit(EV_REP, handle->dev->evbit)) { struct input_dev *dev = handle->dev;
if (rep->rate > HZ) rep->rate = HZ;
handle->dev->rep[REP_PERIOD] = rep->rate ? (HZ / rep->rate) : 0; if (test_bit(EV_REP, dev->evbit)) {
handle->dev->rep[REP_DELAY] = rep->delay * HZ / 1000; if (rep->delay > 0)
if (handle->dev->rep[REP_DELAY] < handle->dev->rep[REP_PERIOD]) dev->rep[REP_DELAY] = ms_to_jiffies(rep->delay);
handle->dev->rep[REP_DELAY] = handle->dev->rep[REP_PERIOD]; if (rep->period > 0)
dev->rep[REP_PERIOD] = ms_to_jiffies(rep->period);
d = dev->rep[REP_DELAY] * 1000 / HZ;
p = dev->rep[REP_PERIOD] * 1000 / HZ;
} }
} }
rep->delay = d;
rep->period = p;
return 0; return 0;
} }
......
...@@ -430,6 +430,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -430,6 +430,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
case KDKBDREP: case KDKBDREP:
{ {
struct kbd_repeat kbrep; struct kbd_repeat kbrep;
int err;
if (!capable(CAP_SYS_TTY_CONFIG)) if (!capable(CAP_SYS_TTY_CONFIG))
return -EPERM; return -EPERM;
...@@ -437,8 +438,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -437,8 +438,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
if (copy_from_user(&kbrep, (void *)arg, if (copy_from_user(&kbrep, (void *)arg,
sizeof(struct kbd_repeat))) sizeof(struct kbd_repeat)))
return -EFAULT; return -EFAULT;
if ((i = kbd_rate( &kbrep ))) err = kbd_rate(&kbrep);
return i; if (err)
return err;
if (copy_to_user((void *)arg, &kbrep, if (copy_to_user((void *)arg, &kbrep,
sizeof(struct kbd_repeat))) sizeof(struct kbd_repeat)))
return -EFAULT; return -EFAULT;
......
...@@ -244,6 +244,7 @@ static int atkbd_command(struct atkbd *atkbd, unsigned char *param, int command) ...@@ -244,6 +244,7 @@ static int atkbd_command(struct atkbd *atkbd, unsigned char *param, int command)
while (atkbd->cmdcnt && timeout--) udelay(10); while (atkbd->cmdcnt && timeout--) udelay(10);
if (param)
for (i = 0; i < receive; i++) for (i = 0; i < receive; i++)
param[i] = atkbd->cmdbuf[(receive - 1) - i]; param[i] = atkbd->cmdbuf[(receive - 1) - i];
......
...@@ -49,7 +49,7 @@ static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned i ...@@ -49,7 +49,7 @@ static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned i
udev = (struct uinput_device *)dev->private; udev = (struct uinput_device *)dev->private;
udev->head = (udev->head + 1) & 0xF; udev->head = (udev->head + 1) % UINPUT_BUFFER_SIZE;
udev->buff[udev->head].type = type; udev->buff[udev->head].type = type;
udev->buff[udev->head].code = code; udev->buff[udev->head].code = code;
udev->buff[udev->head].value = value; udev->buff[udev->head].value = value;
...@@ -87,14 +87,14 @@ static int uinput_create_device(struct uinput_device *udev) ...@@ -87,14 +87,14 @@ static int uinput_create_device(struct uinput_device *udev)
input_register_device(udev->dev); input_register_device(udev->dev);
udev->state |= UIST_CREATED; set_bit(UIST_CREATED, &(udev->state));
return 0; return 0;
} }
static int uinput_destroy_device(struct uinput_device *udev) static int uinput_destroy_device(struct uinput_device *udev)
{ {
if (!(udev->state & UIST_CREATED)) { if (!test_bit(UIST_CREATED, &(udev->state))) {
printk(KERN_WARNING "%s: create the device first\n", UINPUT_NAME); printk(KERN_WARNING "%s: create the device first\n", UINPUT_NAME);
return -EINVAL; return -EINVAL;
} }
...@@ -135,6 +135,39 @@ static int uinput_open(struct inode *inode, struct file *file) ...@@ -135,6 +135,39 @@ static int uinput_open(struct inode *inode, struct file *file)
return -ENOMEM; return -ENOMEM;
} }
static int uinput_validate_absbits(struct input_dev *dev)
{
unsigned int cnt;
int retval = 0;
for (cnt = 0; cnt < ABS_MAX; cnt++) {
if (!test_bit(cnt, dev->absbit))
continue;
if (/*!dev->absmin[cnt] || !dev->absmax[cnt] || */
(dev->absmax[cnt] <= dev->absmin[cnt])) {
printk(KERN_DEBUG
"%s: invalid abs[%02x] min:%d max:%d\n",
UINPUT_NAME, cnt,
dev->absmin[cnt], dev->absmax[cnt]);
retval = -EINVAL;
break;
}
if ((dev->absflat[cnt] < dev->absmin[cnt]) ||
(dev->absflat[cnt] > dev->absmax[cnt])) {
printk(KERN_DEBUG
"%s: absflat[%02x] out of range: %d "
"(min:%d/max:%d)\n",
UINPUT_NAME, cnt, dev->absflat[cnt],
dev->absmin[cnt], dev->absmax[cnt]);
retval = -EINVAL;
break;
}
}
return retval;
}
static int uinput_alloc_device(struct file *file, const char *buffer, size_t count) static int uinput_alloc_device(struct file *file, const char *buffer, size_t count)
{ {
struct uinput_user_dev user_dev; struct uinput_user_dev user_dev;
...@@ -145,13 +178,16 @@ static int uinput_alloc_device(struct file *file, const char *buffer, size_t cou ...@@ -145,13 +178,16 @@ static int uinput_alloc_device(struct file *file, const char *buffer, size_t cou
retval = count; retval = count;
udev = (struct uinput_device *)file->private_data;
dev = udev->dev;
if (copy_from_user(&user_dev, buffer, sizeof(struct uinput_user_dev))) { if (copy_from_user(&user_dev, buffer, sizeof(struct uinput_user_dev))) {
retval = -EFAULT; retval = -EFAULT;
goto exit; goto exit;
} }
udev = (struct uinput_device *)file->private_data; if (NULL != dev->name)
dev = udev->dev; kfree(dev->name);
size = strnlen(user_dev.name, UINPUT_MAX_NAME_SIZE); size = strnlen(user_dev.name, UINPUT_MAX_NAME_SIZE);
dev->name = kmalloc(size + 1, GFP_KERNEL); dev->name = kmalloc(size + 1, GFP_KERNEL);
...@@ -168,7 +204,7 @@ static int uinput_alloc_device(struct file *file, const char *buffer, size_t cou ...@@ -168,7 +204,7 @@ static int uinput_alloc_device(struct file *file, const char *buffer, size_t cou
dev->id.version = user_dev.id.version; dev->id.version = user_dev.id.version;
dev->ff_effects_max = user_dev.ff_effects_max; dev->ff_effects_max = user_dev.ff_effects_max;
size = sizeof(unsigned long) * NBITS(ABS_MAX + 1); size = sizeof(int) * (ABS_MAX + 1);
memcpy(dev->absmax, user_dev.absmax, size); memcpy(dev->absmax, user_dev.absmax, size);
memcpy(dev->absmin, user_dev.absmin, size); memcpy(dev->absmin, user_dev.absmin, size);
memcpy(dev->absfuzz, user_dev.absfuzz, size); memcpy(dev->absfuzz, user_dev.absfuzz, size);
...@@ -177,33 +213,20 @@ static int uinput_alloc_device(struct file *file, const char *buffer, size_t cou ...@@ -177,33 +213,20 @@ static int uinput_alloc_device(struct file *file, const char *buffer, size_t cou
/* check if absmin/absmax/absfuzz/absflat are filled as /* check if absmin/absmax/absfuzz/absflat are filled as
* told in Documentation/input/input-programming.txt */ * told in Documentation/input/input-programming.txt */
if (test_bit(EV_ABS, dev->evbit)) { if (test_bit(EV_ABS, dev->evbit)) {
unsigned int cnt; retval = uinput_validate_absbits(dev);
for (cnt = 1; cnt < ABS_MAX; cnt++) if (retval < 0)
if (test_bit(cnt, dev->absbit) && kfree(dev->name);
(!dev->absmin[cnt] ||
!dev->absmax[cnt] ||
!dev->absfuzz[cnt] ||
!dev->absflat[cnt])) {
printk(KERN_DEBUG "%s: set abs fields "
"first\n", UINPUT_NAME);
retval = -EINVAL;
goto free_name;
}
} }
exit: exit:
return retval; return retval;
free_name:
kfree(dev->name);
goto exit;
} }
static int uinput_write(struct file *file, const char *buffer, size_t count, loff_t *ppos) static int uinput_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
{ {
struct uinput_device *udev = file->private_data; struct uinput_device *udev = file->private_data;
if (test_bit(UIST_CREATED, &(udev->state))) {
if (udev->state & UIST_CREATED) {
struct input_event ev; struct input_event ev;
if (copy_from_user(&ev, buffer, sizeof(struct input_event))) if (copy_from_user(&ev, buffer, sizeof(struct input_event)))
...@@ -221,22 +244,27 @@ static ssize_t uinput_read(struct file *file, char *buffer, size_t count, loff_t ...@@ -221,22 +244,27 @@ static ssize_t uinput_read(struct file *file, char *buffer, size_t count, loff_t
struct uinput_device *udev = file->private_data; struct uinput_device *udev = file->private_data;
int retval = 0; int retval = 0;
if (udev->head == udev->tail && (udev->state & UIST_CREATED) && (file->f_flags & O_NONBLOCK)) if (!test_bit(UIST_CREATED, &(udev->state)))
return -ENODEV;
if ((udev->head == udev->tail) && (file->f_flags & O_NONBLOCK))
return -EAGAIN; return -EAGAIN;
retval = wait_event_interruptible(udev->waitq, retval = wait_event_interruptible(udev->waitq,
udev->head != udev->tail && (udev->state & UIST_CREATED)); (udev->head != udev->tail) ||
!test_bit(UIST_CREATED, &(udev->state)));
if (retval) if (retval)
return retval; return retval;
if (!(udev->state & UIST_CREATED)) if (!test_bit(UIST_CREATED, &(udev->state)))
return -ENODEV; return -ENODEV;
while (udev->head != udev->tail && retval + sizeof(struct uinput_device) <= count) { while ((udev->head != udev->tail) &&
(retval + sizeof(struct uinput_device) <= count)) {
if (copy_to_user(buffer + retval, &(udev->buff[udev->tail]), if (copy_to_user(buffer + retval, &(udev->buff[udev->tail]),
sizeof(struct input_event))) return -EFAULT; sizeof(struct input_event))) return -EFAULT;
udev->tail = (udev->tail + 1) % (UINPUT_BUFFER_SIZE - 1); udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE;
retval += sizeof(struct input_event); retval += sizeof(struct input_event);
} }
...@@ -257,7 +285,7 @@ static unsigned int uinput_poll(struct file *file, poll_table *wait) ...@@ -257,7 +285,7 @@ static unsigned int uinput_poll(struct file *file, poll_table *wait)
static int uinput_burn_device(struct uinput_device *udev) static int uinput_burn_device(struct uinput_device *udev)
{ {
if (udev->state & UIST_CREATED) if (test_bit(UIST_CREATED, &(udev->state)))
uinput_destroy_device(udev); uinput_destroy_device(udev);
kfree(udev->dev); kfree(udev->dev);
...@@ -282,50 +310,52 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -282,50 +310,52 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd
udev = (struct uinput_device *)file->private_data; udev = (struct uinput_device *)file->private_data;
if (cmd >= UI_SET_EVBIT && (udev->state & UIST_CREATED)) /* device attributes can not be changed after the device is created */
if (cmd >= UI_SET_EVBIT && test_bit(UIST_CREATED, &(udev->state)))
return -EINVAL; return -EINVAL;
switch (cmd) { switch (cmd) {
case UI_DEV_CREATE: case UI_DEV_CREATE:
retval = uinput_create_device(udev); retval = uinput_create_device(udev);
break; break;
case UI_DEV_DESTROY: case UI_DEV_DESTROY:
retval = uinput_destroy_device(udev); retval = uinput_destroy_device(udev);
break; break;
case UI_SET_EVBIT: case UI_SET_EVBIT:
set_bit(arg, udev->dev->evbit); set_bit(arg, udev->dev->evbit);
break; break;
case UI_SET_KEYBIT: case UI_SET_KEYBIT:
set_bit(arg, udev->dev->keybit); set_bit(arg, udev->dev->keybit);
break; break;
case UI_SET_RELBIT: case UI_SET_RELBIT:
set_bit(arg, udev->dev->relbit); set_bit(arg, udev->dev->relbit);
break; break;
case UI_SET_ABSBIT: case UI_SET_ABSBIT:
set_bit(arg, udev->dev->absbit); set_bit(arg, udev->dev->absbit);
break; break;
case UI_SET_MSCBIT: case UI_SET_MSCBIT:
set_bit(arg, udev->dev->mscbit); set_bit(arg, udev->dev->mscbit);
break; break;
case UI_SET_LEDBIT: case UI_SET_LEDBIT:
set_bit(arg, udev->dev->ledbit); set_bit(arg, udev->dev->ledbit);
break; break;
case UI_SET_SNDBIT: case UI_SET_SNDBIT:
set_bit(arg, udev->dev->sndbit); set_bit(arg, udev->dev->sndbit);
break; break;
case UI_SET_FFBIT: case UI_SET_FFBIT:
set_bit(arg, udev->dev->ffbit); set_bit(arg, udev->dev->ffbit);
break; break;
default: default:
retval = -EFAULT; retval = -EFAULT;
} }
......
...@@ -26,14 +26,16 @@ MODULE_DESCRIPTION("i8042 keyboard and mouse controller driver"); ...@@ -26,14 +26,16 @@ MODULE_DESCRIPTION("i8042 keyboard and mouse controller driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_PARM(i8042_noaux, "1i"); MODULE_PARM(i8042_noaux, "1i");
MODULE_PARM(i8042_nomux, "1i");
MODULE_PARM(i8042_unlock, "1i"); MODULE_PARM(i8042_unlock, "1i");
MODULE_PARM(i8042_reset, "1i"); MODULE_PARM(i8042_reset, "1i");
MODULE_PARM(i8042_direct, "1i"); MODULE_PARM(i8042_direct, "1i");
MODULE_PARM(i8042_dumbkbd, "1i"); MODULE_PARM(i8042_dumbkbd, "1i");
static int i8042_reset;
static int i8042_noaux; static int i8042_noaux;
static int i8042_nomux;
static int i8042_unlock; static int i8042_unlock;
static int i8042_reset;
static int i8042_direct; static int i8042_direct;
static int i8042_dumbkbd; static int i8042_dumbkbd;
...@@ -220,7 +222,6 @@ static int i8042_aux_write(struct serio *port, unsigned char c) ...@@ -220,7 +222,6 @@ static int i8042_aux_write(struct serio *port, unsigned char c)
return retval; return retval;
} }
/* /*
* i8042_open() is called when a port is open by the higher layer. * i8042_open() is called when a port is open by the higher layer.
* It allocates the interrupt and enables in in the chip. * It allocates the interrupt and enables in in the chip.
...@@ -323,8 +324,8 @@ static struct serio i8042_aux_port = ...@@ -323,8 +324,8 @@ static struct serio i8042_aux_port =
static struct i8042_values i8042_mux_values[4]; static struct i8042_values i8042_mux_values[4];
static struct serio i8042_mux_port[4]; static struct serio i8042_mux_port[4];
static char i8042_mux_names[4][16]; static char i8042_mux_names[4][32];
static char i8042_mux_short[4][8]; static char i8042_mux_short[4][16];
static char i8042_mux_phys[4][32]; static char i8042_mux_phys[4][32];
/* /*
...@@ -364,15 +365,15 @@ static void i8042_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -364,15 +365,15 @@ static void i8042_interrupt(int irq, void *dev_id, struct pt_regs *regs)
dfl = ((str & I8042_STR_PARITY) ? SERIO_PARITY : 0) | dfl = ((str & I8042_STR_PARITY) ? SERIO_PARITY : 0) |
((str & I8042_STR_TIMEOUT) ? SERIO_TIMEOUT : 0); ((str & I8042_STR_TIMEOUT) ? SERIO_TIMEOUT : 0);
if (i8042_mux_values[0].exists && (buffer[i].str & I8042_STR_AUXDATA)) { if (i8042_mux_values[0].exists && (str & I8042_STR_AUXDATA)) {
if (buffer[i].str & I8042_STR_MUXERR) { if (str & I8042_STR_MUXERR) {
switch (buffer[i].data) { switch (data) {
case 0xfd: case 0xfd:
case 0xfe: dfl = SERIO_TIMEOUT; break; case 0xfe: dfl = SERIO_TIMEOUT; break;
case 0xff: dfl = SERIO_PARITY; break; case 0xff: dfl = SERIO_PARITY; break;
} }
buffer[i].data = 0xfe; data = 0xfe;
} else dfl = 0; } else dfl = 0;
dbg("%02x <- i8042 (interrupt, aux%d, %d%s%s)", dbg("%02x <- i8042 (interrupt, aux%d, %d%s%s)",
...@@ -380,8 +381,7 @@ static void i8042_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -380,8 +381,7 @@ static void i8042_interrupt(int irq, void *dev_id, struct pt_regs *regs)
dfl & SERIO_PARITY ? ", bad parity" : "", dfl & SERIO_PARITY ? ", bad parity" : "",
dfl & SERIO_TIMEOUT ? ", timeout" : ""); dfl & SERIO_TIMEOUT ? ", timeout" : "");
if (i8042_mux_values[(str >> 6)].exists) serio_interrupt(i8042_mux_port + ((str >> 6) & 3), data, dfl);
serio_interrupt(i8042_mux_port + (str >> 6), buffer[i].data, dfl);
continue; continue;
} }
...@@ -390,8 +390,8 @@ static void i8042_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -390,8 +390,8 @@ static void i8042_interrupt(int irq, void *dev_id, struct pt_regs *regs)
dfl & SERIO_PARITY ? ", bad parity" : "", dfl & SERIO_PARITY ? ", bad parity" : "",
dfl & SERIO_TIMEOUT ? ", timeout" : ""); dfl & SERIO_TIMEOUT ? ", timeout" : "");
if (i8042_aux_values.exists && (buffer[i].str & I8042_STR_AUXDATA)) { if (i8042_aux_values.exists && (str & I8042_STR_AUXDATA)) {
serio_interrupt(&i8042_aux_port, buffer[i].data, dfl); serio_interrupt(&i8042_aux_port, data, dfl);
continue; continue;
} }
...@@ -602,8 +602,14 @@ static int __init i8042_check_mux(struct i8042_values *values) ...@@ -602,8 +602,14 @@ static int __init i8042_check_mux(struct i8042_values *values)
if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param == 0x5b) if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param == 0x5b)
return -1; return -1;
printk(KERN_INFO "i8042.c: Detected active multiplexing controller, rev%d.%d.\n", printk(KERN_INFO "i8042.c: Detected active multiplexing controller, rev %d.%d.\n",
~param >> 4, ~param & 0xf); (~param >> 4) & 0xf, ~param & 0xf);
/*
* In MUX mode the keyboard translation seems to be always off.
*/
i8042_direct = 1;
/* /*
* Disable all muxed ports by disabling AUX. * Disable all muxed ports by disabling AUX.
...@@ -742,6 +748,12 @@ static int __init i8042_setup_reset(char *str) ...@@ -742,6 +748,12 @@ static int __init i8042_setup_reset(char *str)
static int __init i8042_setup_noaux(char *str) static int __init i8042_setup_noaux(char *str)
{ {
i8042_noaux = 1; i8042_noaux = 1;
i8042_nomux = 1;
return 1;
}
static int __init i8042_setup_nomux(char *str)
{
i8042_nomux = 1;
return 1; return 1;
} }
static int __init i8042_setup_unlock(char *str) static int __init i8042_setup_unlock(char *str)
...@@ -762,6 +774,7 @@ static int __init i8042_setup_dumbkbd(char *str) ...@@ -762,6 +774,7 @@ static int __init i8042_setup_dumbkbd(char *str)
__setup("i8042_reset", i8042_setup_reset); __setup("i8042_reset", i8042_setup_reset);
__setup("i8042_noaux", i8042_setup_noaux); __setup("i8042_noaux", i8042_setup_noaux);
__setup("i8042_nomux", i8042_setup_nomux);
__setup("i8042_unlock", i8042_setup_unlock); __setup("i8042_unlock", i8042_setup_unlock);
__setup("i8042_direct", i8042_setup_direct); __setup("i8042_direct", i8042_setup_direct);
__setup("i8042_dumbkbd", i8042_setup_dumbkbd); __setup("i8042_dumbkbd", i8042_setup_dumbkbd);
...@@ -796,6 +809,7 @@ static void __init i8042_init_mux_values(struct i8042_values *values, struct ser ...@@ -796,6 +809,7 @@ static void __init i8042_init_mux_values(struct i8042_values *values, struct ser
sprintf(i8042_mux_short[index], "AUX%d", index); sprintf(i8042_mux_short[index], "AUX%d", index);
port->name = i8042_mux_names[index]; port->name = i8042_mux_names[index];
port->phys = i8042_mux_phys[index]; port->phys = i8042_mux_phys[index];
port->driver = values;
values->name = i8042_mux_short[index]; values->name = i8042_mux_short[index];
values->mux = index; values->mux = index;
} }
...@@ -821,7 +835,7 @@ int __init i8042_init(void) ...@@ -821,7 +835,7 @@ int __init i8042_init(void)
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
i8042_init_mux_values(i8042_mux_values + i, i8042_mux_port + i, i); i8042_init_mux_values(i8042_mux_values + i, i8042_mux_port + i, i);
if (!i8042_noaux && !i8042_check_mux(&i8042_aux_values)) if (!i8042_nomux && !i8042_check_mux(&i8042_aux_values))
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
i8042_port_register(i8042_mux_values + i, i8042_mux_port + i); i8042_port_register(i8042_mux_values + i, i8042_mux_port + i);
else else
......
...@@ -49,11 +49,13 @@ ...@@ -49,11 +49,13 @@
- Power Management support - Power Management support
v1.18c 1Mar2002 David Ruggiero <jdr@farfalle.com> v1.18c 1Mar2002 David Ruggiero <jdr@farfalle.com>
- Full duplex support - Full duplex support
v1.19 16Oct2002 Zwane Mwaikambo <zwane@linuxpower.ca>
- Additional ethtool features
*/ */
#define DRV_NAME "3c509" #define DRV_NAME "3c509"
#define DRV_VERSION "1.18c" #define DRV_VERSION "1.19"
#define DRV_RELDATE "1Mar2002" #define DRV_RELDATE "16Oct2002"
/* A few values that may be tweaked. */ /* A few values that may be tweaked. */
...@@ -140,6 +142,8 @@ enum RxFilter { ...@@ -140,6 +142,8 @@ enum RxFilter {
#define TX_STATUS 0x0B #define TX_STATUS 0x0B
#define TX_FREE 0x0C /* Remaining free bytes in Tx buffer. */ #define TX_FREE 0x0C /* Remaining free bytes in Tx buffer. */
#define WN0_CONF_CTRL 0x04 /* Window 0: Configuration control register */
#define WN0_ADDR_CONF 0x06 /* Window 0: Address configuration register */
#define WN0_IRQ 0x08 /* Window 0: Set IRQ line in bits 12-15. */ #define WN0_IRQ 0x08 /* Window 0: Set IRQ line in bits 12-15. */
#define WN4_MEDIA 0x0A /* Window 4: Various transcvr/media bits. */ #define WN4_MEDIA 0x0A /* Window 4: Various transcvr/media bits. */
#define MEDIA_TP 0x00C0 /* Enable link beat and jabber for 10baseT. */ #define MEDIA_TP 0x00C0 /* Enable link beat and jabber for 10baseT. */
...@@ -981,6 +985,119 @@ el3_close(struct net_device *dev) ...@@ -981,6 +985,119 @@ el3_close(struct net_device *dev)
return 0; return 0;
} }
static int
el3_link_ok(struct net_device *dev)
{
int ioaddr = dev->base_addr;
u16 tmp;
EL3WINDOW(4);
tmp = inw(ioaddr + WN4_MEDIA);
EL3WINDOW(1);
return tmp & (1<<11);
}
static int
el3_netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
{
u16 tmp;
int ioaddr = dev->base_addr;
EL3WINDOW(0);
/* obtain current tranceiver via WN4_MEDIA? */
tmp = inw(ioaddr + WN0_ADDR_CONF);
ecmd->transceiver = XCVR_INTERNAL;
switch (tmp >> 14) {
case 0:
ecmd->port = PORT_TP;
break;
case 1:
ecmd->port = PORT_AUI;
ecmd->transceiver = XCVR_EXTERNAL;
break;
case 3:
ecmd->port = PORT_BNC;
default:
break;
}
ecmd->duplex = DUPLEX_HALF;
ecmd->supported = 0;
tmp = inw(ioaddr + WN0_CONF_CTRL);
if (tmp & (1<<13))
ecmd->supported |= SUPPORTED_AUI;
if (tmp & (1<<12))
ecmd->supported |= SUPPORTED_BNC;
if (tmp & (1<<9)) {
ecmd->supported |= SUPPORTED_TP | SUPPORTED_10baseT_Half |
SUPPORTED_10baseT_Full; /* hmm... */
EL3WINDOW(4);
tmp = inw(ioaddr + WN4_NETDIAG);
if (tmp & FD_ENABLE)
ecmd->duplex = DUPLEX_FULL;
}
ecmd->speed = SPEED_10;
EL3WINDOW(1);
return 0;
}
static int
el3_netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd)
{
u16 tmp;
int ioaddr = dev->base_addr;
if (ecmd->speed != SPEED_10)
return -EINVAL;
if ((ecmd->duplex != DUPLEX_HALF) && (ecmd->duplex != DUPLEX_FULL))
return -EINVAL;
if ((ecmd->transceiver != XCVR_INTERNAL) && (ecmd->transceiver != XCVR_EXTERNAL))
return -EINVAL;
/* change XCVR type */
EL3WINDOW(0);
tmp = inw(ioaddr + WN0_ADDR_CONF);
switch (ecmd->port) {
case PORT_TP:
tmp &= ~(3<<14);
dev->if_port = 0;
break;
case PORT_AUI:
tmp |= (1<<14);
dev->if_port = 1;
break;
case PORT_BNC:
tmp |= (3<<14);
dev->if_port = 3;
break;
default:
return -EINVAL;
}
outw(tmp, ioaddr + WN0_ADDR_CONF);
if (dev->if_port == 3) {
/* fire up the DC-DC convertor if BNC gets enabled */
tmp = inw(ioaddr + WN0_ADDR_CONF);
if (tmp & (3 << 14)) {
outw(StartCoax, ioaddr + EL3_CMD);
udelay(800);
} else
return -EIO;
}
EL3WINDOW(4);
tmp = inw(ioaddr + WN4_NETDIAG);
if (ecmd->duplex == DUPLEX_FULL)
tmp |= FD_ENABLE;
else
tmp &= ~FD_ENABLE;
outw(tmp, ioaddr + WN4_NETDIAG);
EL3WINDOW(1);
return 0;
}
/** /**
* netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls * netdev_ethtool_ioctl: Handle network interface SIOCETHTOOL ioctls
* @dev: network interface on which out-of-band action is to be performed * @dev: network interface on which out-of-band action is to be performed
...@@ -989,9 +1106,11 @@ el3_close(struct net_device *dev) ...@@ -989,9 +1106,11 @@ el3_close(struct net_device *dev)
* Process the various commands of the SIOCETHTOOL interface. * Process the various commands of the SIOCETHTOOL interface.
*/ */
static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr) static int
netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
{ {
u32 ethcmd; u32 ethcmd;
struct el3_private *lp = dev->priv;
/* dev_ioctl() in ../../net/core/dev.c has already checked /* dev_ioctl() in ../../net/core/dev.c has already checked
capable(CAP_NET_ADMIN), so don't bother with that here. */ capable(CAP_NET_ADMIN), so don't bother with that here. */
...@@ -1010,6 +1129,41 @@ static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr) ...@@ -1010,6 +1129,41 @@ static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
return 0; return 0;
} }
/* get settings */
case ETHTOOL_GSET: {
int ret;
struct ethtool_cmd ecmd = { ETHTOOL_GSET };
spin_lock_irq(&lp->lock);
ret = el3_netdev_get_ecmd(dev, &ecmd);
spin_unlock_irq(&lp->lock);
if (copy_to_user(useraddr, &ecmd, sizeof(ecmd)))
return -EFAULT;
return ret;
}
/* set settings */
case ETHTOOL_SSET: {
int ret;
struct ethtool_cmd ecmd;
if (copy_from_user(&ecmd, useraddr, sizeof(ecmd)))
return -EFAULT;
spin_lock_irq(&lp->lock);
ret = el3_netdev_set_ecmd(dev, &ecmd);
spin_unlock_irq(&lp->lock);
return ret;
}
/* get link status */
case ETHTOOL_GLINK: {
struct ethtool_value edata = { ETHTOOL_GLINK };
spin_lock_irq(&lp->lock);
edata.data = el3_link_ok(dev);
spin_unlock_irq(&lp->lock);
if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
return 0;
}
/* get message-level */ /* get message-level */
case ETHTOOL_GMSGLVL: { case ETHTOOL_GMSGLVL: {
struct ethtool_value edata = {ETHTOOL_GMSGLVL}; struct ethtool_value edata = {ETHTOOL_GMSGLVL};
...@@ -1043,7 +1197,8 @@ static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr) ...@@ -1043,7 +1197,8 @@ static int netdev_ethtool_ioctl (struct net_device *dev, void *useraddr)
* Process the various out-of-band ioctls passed to this driver. * Process the various out-of-band ioctls passed to this driver.
*/ */
static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) static int
netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
{ {
int rc = 0; int rc = 0;
...@@ -1060,7 +1215,8 @@ static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -1060,7 +1215,8 @@ static int netdev_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
return rc; return rc;
} }
static void el3_down(struct net_device *dev) static void
el3_down(struct net_device *dev)
{ {
int ioaddr = dev->base_addr; int ioaddr = dev->base_addr;
...@@ -1077,7 +1233,7 @@ static void el3_down(struct net_device *dev) ...@@ -1077,7 +1233,7 @@ static void el3_down(struct net_device *dev)
/* Turn off thinnet power. Green! */ /* Turn off thinnet power. Green! */
outw(StopCoax, ioaddr + EL3_CMD); outw(StopCoax, ioaddr + EL3_CMD);
else if (dev->if_port == 0) { else if (dev->if_port == 0) {
/* Disable link beat and jabber, if_port may change ere next open(). */ /* Disable link beat and jabber, if_port may change here next open(). */
EL3WINDOW(4); EL3WINDOW(4);
outw(inw(ioaddr + WN4_MEDIA) & ~MEDIA_TP, ioaddr + WN4_MEDIA); outw(inw(ioaddr + WN4_MEDIA) & ~MEDIA_TP, ioaddr + WN4_MEDIA);
} }
...@@ -1087,7 +1243,8 @@ static void el3_down(struct net_device *dev) ...@@ -1087,7 +1243,8 @@ static void el3_down(struct net_device *dev)
update_stats(dev); update_stats(dev);
} }
static void el3_up(struct net_device *dev) static void
el3_up(struct net_device *dev)
{ {
int i, sw_info, net_diag; int i, sw_info, net_diag;
int ioaddr = dev->base_addr; int ioaddr = dev->base_addr;
...@@ -1176,7 +1333,8 @@ static void el3_up(struct net_device *dev) ...@@ -1176,7 +1333,8 @@ static void el3_up(struct net_device *dev)
/* Power Management support functions */ /* Power Management support functions */
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int el3_suspend(struct pm_dev *pdev) static int
el3_suspend(struct pm_dev *pdev)
{ {
unsigned long flags; unsigned long flags;
struct net_device *dev; struct net_device *dev;
...@@ -1202,7 +1360,8 @@ static int el3_suspend(struct pm_dev *pdev) ...@@ -1202,7 +1360,8 @@ static int el3_suspend(struct pm_dev *pdev)
return 0; return 0;
} }
static int el3_resume(struct pm_dev *pdev) static int
el3_resume(struct pm_dev *pdev)
{ {
unsigned long flags; unsigned long flags;
struct net_device *dev; struct net_device *dev;
...@@ -1228,7 +1387,8 @@ static int el3_resume(struct pm_dev *pdev) ...@@ -1228,7 +1387,8 @@ static int el3_resume(struct pm_dev *pdev)
return 0; return 0;
} }
static int el3_pm_callback(struct pm_dev *pdev, pm_request_t rqst, void *data) static int
el3_pm_callback(struct pm_dev *pdev, pm_request_t rqst, void *data)
{ {
switch (rqst) { switch (rqst) {
case PM_SUSPEND: case PM_SUSPEND:
......
...@@ -186,6 +186,11 @@ ...@@ -186,6 +186,11 @@
* also added text to distinguish type of load balancing (rr or xor) * also added text to distinguish type of load balancing (rr or xor)
* - change arp_ip_target module param from "1-12s" (array of 12 ptrs) * - change arp_ip_target module param from "1-12s" (array of 12 ptrs)
* to "s" (a single ptr) * to "s" (a single ptr)
*
* 2002/09/18 - Jay Vosburgh <fubar at us dot ibm dot com>
* - Fixed up bond_check_dev_link() (and callers): removed some magic
* numbers, banished local MII_ defines, wrapped ioctl calls to
* prevent EFAULT errors
*/ */
#include <linux/config.h> #include <linux/config.h>
...@@ -228,15 +233,6 @@ ...@@ -228,15 +233,6 @@
#define BOND_LINK_MON_INTERV 0 #define BOND_LINK_MON_INTERV 0
#endif #endif
#undef MII_LINK_UP
#define MII_LINK_UP 0x04
#undef MII_ENDOF_NWAY
#define MII_ENDOF_NWAY 0x20
#undef MII_LINK_READY
#define MII_LINK_READY (MII_LINK_UP)
#ifndef BOND_LINK_ARP_INTERV #ifndef BOND_LINK_ARP_INTERV
#define BOND_LINK_ARP_INTERV 0 #define BOND_LINK_ARP_INTERV 0
#endif #endif
...@@ -387,12 +383,24 @@ static slave_t *bond_detach_slave(bonding_t *bond, slave_t *slave) ...@@ -387,12 +383,24 @@ static slave_t *bond_detach_slave(bonding_t *bond, slave_t *slave)
} }
/* /*
* if <dev> supports MII link status reporting, check its link * Less bad way to call ioctl from within the kernel; this needs to be
* and report it as a bit field in a short int : * done some other way to get the call out of interrupt context.
* - 0x04 means link is up, * Needs "ioctl" variable to be supplied by calling context.
* - 0x20 means end of autonegociation */
* If the device doesn't support MII, then we only report 0x24, #define IOCTL(dev, arg, cmd) ({ \
* meaning that the link is up and running since we can't check it. int ret; \
mm_segment_t fs = get_fs(); \
set_fs(get_ds()); \
ret = ioctl(dev, arg, cmd); \
set_fs(fs); \
ret; })
/*
* if <dev> supports MII link status reporting, check its link status.
*
* Return either BMSR_LSTATUS, meaning that the link is up (or we
* can't tell and just pretend it is), or 0, meaning that the link is
* down.
*/ */
static u16 bond_check_dev_link(struct net_device *dev) static u16 bond_check_dev_link(struct net_device *dev)
{ {
...@@ -401,7 +409,8 @@ static u16 bond_check_dev_link(struct net_device *dev) ...@@ -401,7 +409,8 @@ static u16 bond_check_dev_link(struct net_device *dev)
struct mii_ioctl_data *mii; struct mii_ioctl_data *mii;
struct ethtool_value etool; struct ethtool_value etool;
if ((ioctl = dev->do_ioctl) != NULL) { /* ioctl to access MII */ ioctl = dev->do_ioctl;
if (ioctl) {
/* TODO: set pointer to correct ioctl on a per team member */ /* TODO: set pointer to correct ioctl on a per team member */
/* bases to make this more efficient. that is, once */ /* bases to make this more efficient. that is, once */
/* we determine the correct ioctl, we will always */ /* we determine the correct ioctl, we will always */
...@@ -415,9 +424,9 @@ static u16 bond_check_dev_link(struct net_device *dev) ...@@ -415,9 +424,9 @@ static u16 bond_check_dev_link(struct net_device *dev)
/* effect... */ /* effect... */
etool.cmd = ETHTOOL_GLINK; etool.cmd = ETHTOOL_GLINK;
ifr.ifr_data = (char*)&etool; ifr.ifr_data = (char*)&etool;
if (ioctl(dev, &ifr, SIOCETHTOOL) == 0) { if (IOCTL(dev, &ifr, SIOCETHTOOL) == 0) {
if (etool.data == 1) { if (etool.data == 1) {
return(MII_LINK_READY); return BMSR_LSTATUS;
} }
else { else {
return(0); return(0);
...@@ -431,21 +440,17 @@ static u16 bond_check_dev_link(struct net_device *dev) ...@@ -431,21 +440,17 @@ static u16 bond_check_dev_link(struct net_device *dev)
/* Yes, the mii is overlaid on the ifreq.ifr_ifru */ /* Yes, the mii is overlaid on the ifreq.ifr_ifru */
mii = (struct mii_ioctl_data *)&ifr.ifr_data; mii = (struct mii_ioctl_data *)&ifr.ifr_data;
if (ioctl(dev, &ifr, SIOCGMIIPHY) != 0) { if (IOCTL(dev, &ifr, SIOCGMIIPHY) != 0) {
return MII_LINK_READY; /* can't tell */ return BMSR_LSTATUS; /* can't tell */
} }
mii->reg_num = 1; mii->reg_num = MII_BMSR;
if (ioctl(dev, &ifr, SIOCGMIIREG) == 0) { if (IOCTL(dev, &ifr, SIOCGMIIREG) == 0) {
/* return mii->val_out & BMSR_LSTATUS;
* mii->val_out contains MII reg 1, BMSR
* 0x0004 means link established
*/
return mii->val_out;
} }
} }
return MII_LINK_READY; /* spoof link up ( we can't check it) */ return BMSR_LSTATUS; /* spoof link up ( we can't check it) */
} }
static u16 bond_check_mii_link(bonding_t *bond) static u16 bond_check_mii_link(bonding_t *bond)
...@@ -459,7 +464,7 @@ static u16 bond_check_mii_link(bonding_t *bond) ...@@ -459,7 +464,7 @@ static u16 bond_check_mii_link(bonding_t *bond)
read_unlock(&bond->ptrlock); read_unlock(&bond->ptrlock);
read_unlock_irqrestore(&bond->lock, flags); read_unlock_irqrestore(&bond->lock, flags);
return (has_active_interface ? MII_LINK_READY : 0); return (has_active_interface ? BMSR_LSTATUS : 0);
} }
static int bond_open(struct net_device *dev) static int bond_open(struct net_device *dev)
...@@ -797,8 +802,8 @@ static int bond_enslave(struct net_device *master_dev, ...@@ -797,8 +802,8 @@ static int bond_enslave(struct net_device *master_dev,
new_slave->link_failure_count = 0; new_slave->link_failure_count = 0;
/* check for initial state */ /* check for initial state */
if ((miimon <= 0) || ((bond_check_dev_link(slave_dev) & MII_LINK_READY) if ((miimon <= 0) ||
== MII_LINK_READY)) { (bond_check_dev_link(slave_dev) == BMSR_LSTATUS)) {
#ifdef BONDING_DEBUG #ifdef BONDING_DEBUG
printk(KERN_CRIT "Initial state of slave_dev is BOND_LINK_UP\n"); printk(KERN_CRIT "Initial state of slave_dev is BOND_LINK_UP\n");
#endif #endif
...@@ -1220,7 +1225,7 @@ static void bond_mii_monitor(struct net_device *master) ...@@ -1220,7 +1225,7 @@ static void bond_mii_monitor(struct net_device *master)
switch (slave->link) { switch (slave->link) {
case BOND_LINK_UP: /* the link was up */ case BOND_LINK_UP: /* the link was up */
if ((link_state & MII_LINK_UP) == MII_LINK_UP) { if (link_state == BMSR_LSTATUS) {
/* link stays up, tell that this one /* link stays up, tell that this one
is immediately available */ is immediately available */
if (IS_UP(dev) && (mindelay > -2)) { if (IS_UP(dev) && (mindelay > -2)) {
...@@ -1256,7 +1261,7 @@ static void bond_mii_monitor(struct net_device *master) ...@@ -1256,7 +1261,7 @@ static void bond_mii_monitor(struct net_device *master)
ensure proper action to be taken ensure proper action to be taken
*/ */
case BOND_LINK_FAIL: /* the link has just gone down */ case BOND_LINK_FAIL: /* the link has just gone down */
if ((link_state & MII_LINK_UP) == 0) { if (link_state != BMSR_LSTATUS) {
/* link stays down */ /* link stays down */
if (slave->delay <= 0) { if (slave->delay <= 0) {
/* link down for too long time */ /* link down for too long time */
...@@ -1285,7 +1290,7 @@ static void bond_mii_monitor(struct net_device *master) ...@@ -1285,7 +1290,7 @@ static void bond_mii_monitor(struct net_device *master)
} else { } else {
slave->delay--; slave->delay--;
} }
} else if ((link_state & MII_LINK_READY) == MII_LINK_READY) { } else {
/* link up again */ /* link up again */
slave->link = BOND_LINK_UP; slave->link = BOND_LINK_UP;
printk(KERN_INFO printk(KERN_INFO
...@@ -1304,7 +1309,7 @@ static void bond_mii_monitor(struct net_device *master) ...@@ -1304,7 +1309,7 @@ static void bond_mii_monitor(struct net_device *master)
} }
break; break;
case BOND_LINK_DOWN: /* the link was down */ case BOND_LINK_DOWN: /* the link was down */
if ((link_state & MII_LINK_READY) != MII_LINK_READY) { if (link_state != BMSR_LSTATUS) {
/* the link stays down, nothing more to do */ /* the link stays down, nothing more to do */
break; break;
} else { /* link going up */ } else { /* link going up */
...@@ -1326,7 +1331,7 @@ static void bond_mii_monitor(struct net_device *master) ...@@ -1326,7 +1331,7 @@ static void bond_mii_monitor(struct net_device *master)
case there's something to do. case there's something to do.
*/ */
case BOND_LINK_BACK: /* the link has just come back */ case BOND_LINK_BACK: /* the link has just come back */
if ((link_state & MII_LINK_UP) == 0) { if (link_state != BMSR_LSTATUS) {
/* link down again */ /* link down again */
slave->link = BOND_LINK_DOWN; slave->link = BOND_LINK_DOWN;
printk(KERN_INFO printk(KERN_INFO
...@@ -1335,8 +1340,7 @@ static void bond_mii_monitor(struct net_device *master) ...@@ -1335,8 +1340,7 @@ static void bond_mii_monitor(struct net_device *master)
master->name, master->name,
(updelay - slave->delay) * miimon, (updelay - slave->delay) * miimon,
dev->name); dev->name);
} } else {
else if ((link_state & MII_LINK_READY) == MII_LINK_READY) {
/* link stays up */ /* link stays up */
if (slave->delay == 0) { if (slave->delay == 0) {
/* now the link has been up for long time enough */ /* now the link has been up for long time enough */
...@@ -2110,7 +2114,7 @@ static int bond_get_info(char *buf, char **start, off_t offset, int length) ...@@ -2110,7 +2114,7 @@ static int bond_get_info(char *buf, char **start, off_t offset, int length)
len += sprintf(buf + len, "MII Status: "); len += sprintf(buf + len, "MII Status: ");
len += sprintf(buf + len, len += sprintf(buf + len,
link == MII_LINK_READY ? "up\n" : "down\n"); link == BMSR_LSTATUS ? "up\n" : "down\n");
len += sprintf(buf + len, "MII Polling Interval (ms): %d\n", len += sprintf(buf + len, "MII Polling Interval (ms): %d\n",
miimon); miimon);
len += sprintf(buf + len, "Up Delay (ms): %d\n", updelay); len += sprintf(buf + len, "Up Delay (ms): %d\n", updelay);
......
...@@ -135,7 +135,7 @@ static int e1000_init_module(void); ...@@ -135,7 +135,7 @@ static int e1000_init_module(void);
static void e1000_exit_module(void); static void e1000_exit_module(void);
static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent); static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static void e1000_remove(struct pci_dev *pdev); static void e1000_remove(struct pci_dev *pdev);
static void e1000_sw_init(struct e1000_adapter *adapter); static int e1000_sw_init(struct e1000_adapter *adapter);
static int e1000_open(struct net_device *netdev); static int e1000_open(struct net_device *netdev);
static int e1000_close(struct net_device *netdev); static int e1000_close(struct net_device *netdev);
static int e1000_setup_tx_resources(struct e1000_adapter *adapter); static int e1000_setup_tx_resources(struct e1000_adapter *adapter);
...@@ -415,7 +415,8 @@ e1000_probe(struct pci_dev *pdev, ...@@ -415,7 +415,8 @@ e1000_probe(struct pci_dev *pdev,
/* setup the private structure */ /* setup the private structure */
e1000_sw_init(adapter); if(e1000_sw_init(adapter))
goto err_sw_init;
if(adapter->hw.mac_type >= e1000_82543) { if(adapter->hw.mac_type >= e1000_82543) {
netdev->features = NETIF_F_SG | netdev->features = NETIF_F_SG |
...@@ -500,6 +501,7 @@ e1000_probe(struct pci_dev *pdev, ...@@ -500,6 +501,7 @@ e1000_probe(struct pci_dev *pdev,
cards_found++; cards_found++;
return 0; return 0;
err_sw_init:
err_eeprom: err_eeprom:
iounmap(adapter->hw.hw_addr); iounmap(adapter->hw.hw_addr);
err_ioremap: err_ioremap:
...@@ -555,7 +557,7 @@ e1000_remove(struct pci_dev *pdev) ...@@ -555,7 +557,7 @@ e1000_remove(struct pci_dev *pdev)
* OS network device settings (MTU size). * OS network device settings (MTU size).
**/ **/
static void __devinit static int __devinit
e1000_sw_init(struct e1000_adapter *adapter) e1000_sw_init(struct e1000_adapter *adapter)
{ {
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
...@@ -564,11 +566,11 @@ e1000_sw_init(struct e1000_adapter *adapter) ...@@ -564,11 +566,11 @@ e1000_sw_init(struct e1000_adapter *adapter)
/* PCI config space info */ /* PCI config space info */
pci_read_config_word(pdev, PCI_VENDOR_ID, &hw->vendor_id); hw->vendor_id = pdev->vendor;
pci_read_config_word(pdev, PCI_DEVICE_ID, &hw->device_id); hw->device_id = pdev->device;
pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, hw->subsystem_vendor_id = pdev->subsystem_vendor;
&hw->subsystem_vendor_id); hw->subsystem_id = pdev->subsystem_device;
pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &hw->subsystem_id);
pci_read_config_byte(pdev, PCI_REVISION_ID, &hw->revision_id); pci_read_config_byte(pdev, PCI_REVISION_ID, &hw->revision_id);
pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word); pci_read_config_word(pdev, PCI_COMMAND, &hw->pci_cmd_word);
...@@ -581,7 +583,7 @@ e1000_sw_init(struct e1000_adapter *adapter) ...@@ -581,7 +583,7 @@ e1000_sw_init(struct e1000_adapter *adapter)
if (e1000_set_mac_type(hw)) { if (e1000_set_mac_type(hw)) {
E1000_ERR("Unknown MAC Type\n"); E1000_ERR("Unknown MAC Type\n");
BUG(); return -1;
} }
/* flow control settings */ /* flow control settings */
...@@ -622,6 +624,8 @@ e1000_sw_init(struct e1000_adapter *adapter) ...@@ -622,6 +624,8 @@ e1000_sw_init(struct e1000_adapter *adapter)
atomic_set(&adapter->irq_sem, 1); atomic_set(&adapter->irq_sem, 1);
spin_lock_init(&adapter->stats_lock); spin_lock_init(&adapter->stats_lock);
return 0;
} }
/** /**
......
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
kernel with the ewrk3 configuration turned off and reboot. kernel with the ewrk3 configuration turned off and reboot.
5) insmod ewrk3.o 5) insmod ewrk3.o
[Alan Cox: Changed this so you can insmod ewrk3.o irq=x io=y] [Alan Cox: Changed this so you can insmod ewrk3.o irq=x io=y]
[Adam Kropelin: now accepts irq=x1,x2 io=y1,y2 for multiple cards]
6) run the net startup bits for your new eth?? interface manually 6) run the net startup bits for your new eth?? interface manually
(usually /etc/rc.inet[12] at boot time). (usually /etc/rc.inet[12] at boot time).
7) enjoy! 7) enjoy!
...@@ -134,6 +135,8 @@ ...@@ -134,6 +135,8 @@
0.43 16-Aug-96 Update alloc_device() to conform to de4x5.c 0.43 16-Aug-96 Update alloc_device() to conform to de4x5.c
0.44 08-Nov-01 use library crc32 functions <Matt_Domsch@dell.com> 0.44 08-Nov-01 use library crc32 functions <Matt_Domsch@dell.com>
0.45 19-Jul-02 fix unaligned access on alpha <martin@bruli.net> 0.45 19-Jul-02 fix unaligned access on alpha <martin@bruli.net>
0.46 10-Oct-02 cli/sti removal <VDA@port.imtp.ilyichevsk.odessa.ua>
Multiple NIC support when module <akropel1@rochester.rr.com>
========================================================================= =========================================================================
*/ */
...@@ -167,7 +170,7 @@ ...@@ -167,7 +170,7 @@
#include "ewrk3.h" #include "ewrk3.h"
static char version[] __initdata = static char version[] __initdata =
"ewrk3.c:v0.43a 2001/02/04 davies@maniac.ultranet.com\n"; "ewrk3.c:v0.46 2002/10/09 davies@maniac.ultranet.com\n";
#ifdef EWRK3_DEBUG #ifdef EWRK3_DEBUG
static int ewrk3_debug = EWRK3_DEBUG; static int ewrk3_debug = EWRK3_DEBUG;
...@@ -196,6 +199,7 @@ static int ewrk3_debug = 1; ...@@ -196,6 +199,7 @@ static int ewrk3_debug = 1;
#define EWRK3_IOP_INC 0x20 /* I/O address increment */ #define EWRK3_IOP_INC 0x20 /* I/O address increment */
#define EWRK3_TOTAL_SIZE 0x20 /* required I/O address length */ #define EWRK3_TOTAL_SIZE 0x20 /* required I/O address length */
/* If you change this, remember to also change MODULE_PARM array limits */
#ifndef MAX_NUM_EWRK3S #ifndef MAX_NUM_EWRK3S
#define MAX_NUM_EWRK3S 21 #define MAX_NUM_EWRK3S 21
#endif #endif
...@@ -1716,6 +1720,11 @@ static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -1716,6 +1720,11 @@ static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
break; break;
case EWRK3_SET_MCA: /* Set a multicast address */ case EWRK3_SET_MCA: /* Set a multicast address */
if (capable(CAP_NET_ADMIN)) { if (capable(CAP_NET_ADMIN)) {
if (ioc->len > 1024)
{
status = -EINVAL;
break;
}
if (copy_from_user(tmp->addr, ioc->data, ETH_ALEN * ioc->len)) { if (copy_from_user(tmp->addr, ioc->data, ETH_ALEN * ioc->len)) {
status = -EFAULT; status = -EFAULT;
break; break;
...@@ -1843,35 +1852,62 @@ static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -1843,35 +1852,62 @@ static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
} }
#ifdef MODULE #ifdef MODULE
static struct net_device thisEthwrk; static struct net_device *ewrk3_devs[MAX_NUM_EWRK3S];
static int io = 0x300; /* <--- EDIT THESE LINES FOR YOUR CONFIGURATION */ static int ndevs;
static int irq = 5; /* or use the insmod io= irq= options */ static int io[MAX_NUM_EWRK3S+1] = { 0x300, 0, }; /* <--- EDIT THESE LINES FOR YOUR CONFIGURATION */
static int irq[MAX_NUM_EWRK3S+1] = { 5, 0, }; /* or use the insmod io= irq= options */
MODULE_PARM(io, "i"); /* '21' below should really be 'MAX_NUM_EWRK3S' */
MODULE_PARM(irq, "i"); MODULE_PARM(io, "0-21i");
MODULE_PARM_DESC(io, "EtherWORKS 3 I/O base address"); MODULE_PARM(irq, "0-21i");
MODULE_PARM_DESC(irq, "EtherWORKS 3 IRQ number"); MODULE_PARM_DESC(io, "EtherWORKS 3 I/O base address(es)");
MODULE_PARM_DESC(irq, "EtherWORKS 3 IRQ number(s)");
int init_module(void) int init_module(void)
{ {
thisEthwrk.base_addr = io; int i=0;
thisEthwrk.irq = irq;
thisEthwrk.init = ewrk3_probe; while( io[i] && irq[i] ) {
if (register_netdev(&thisEthwrk) != 0) ewrk3_devs[ndevs] = kmalloc(sizeof(struct net_device), GFP_KERNEL);
return -EIO; if (!ewrk3_devs[ndevs])
return 0; goto error;
memset(ewrk3_devs[ndevs], 0, sizeof(struct net_device));
ewrk3_devs[ndevs]->base_addr = io[i];
ewrk3_devs[ndevs]->irq = irq[i];
ewrk3_devs[ndevs]->init = ewrk3_probe;
if (register_netdev(ewrk3_devs[ndevs]) == 0)
ndevs++;
else
kfree(ewrk3_devs[ndevs]);
i++;
}
return ndevs ? 0 : -EIO;
error:
cleanup_module();
return -ENOMEM;
} }
void cleanup_module(void) void cleanup_module(void)
{ {
unregister_netdev(&thisEthwrk); int i;
if (thisEthwrk.priv) {
kfree(thisEthwrk.priv); for( i=0; i<ndevs; i++ )
thisEthwrk.priv = NULL; {
unregister_netdev(ewrk3_devs[i]);
if (ewrk3_devs[i]->priv) {
kfree(ewrk3_devs[i]->priv);
ewrk3_devs[i]->priv = NULL;
} }
thisEthwrk.irq = 0; ewrk3_devs[i]->irq = 0;
release_region(thisEthwrk.base_addr, EWRK3_TOTAL_SIZE); release_region(ewrk3_devs[i]->base_addr, EWRK3_TOTAL_SIZE);
kfree(ewrk3_devs[i]);
ewrk3_devs[i] = NULL;
}
} }
#endif /* MODULE */ #endif /* MODULE */
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
......
...@@ -55,12 +55,22 @@ CONFIG_NSC_FIR ...@@ -55,12 +55,22 @@ CONFIG_NSC_FIR
<file:Documentation/modules.txt>. The module will be called <file:Documentation/modules.txt>. The module will be called
nsc-ircc.o. nsc-ircc.o.
CONFIG_TOSHIBA_FIR CONFIG_TOSHIBA_OLD
Say Y here if you want to build support for the Toshiba Type-O IR Say Y here if you want to build support for the Toshiba Type-O IR
chipset. This chipset is used by the Toshiba Libretto 100CT, and chipset. This chipset is used by the Toshiba Libretto 100CT, and
many more laptops. If you want to compile it as a module, say M many more laptops. This driver is obsolete, will no more be
here and read <file:Documentation/modules.txt>. The module will be maintained and will be removed in favor of the new driver.
called toshoboe.o. If you want to compile it as a module, say M here and read
<file:Documentation/modules.txt>.
The module will be called toshoboe.o.
CONFIG_TOSHIBA_FIR
Say Y here if you want to build support for the Toshiba Type-O IR
and Donau oboe chipsets. These chipsets are used by the Toshiba
Libretto 100/110CT, Tecra 8100, Portege 7020 and many more laptops.
If you want to compile it as a module, say M here and read
<file:Documentation/modules.txt>.
The module will be called donauboe.o.
CONFIG_SMC_IRCC_FIR CONFIG_SMC_IRCC_FIR
Say Y here if you want to build support for the SMC Infrared Say Y here if you want to build support for the SMC Infrared
...@@ -165,3 +175,18 @@ CONFIG_ACT200L_DONGLE ...@@ -165,3 +175,18 @@ CONFIG_ACT200L_DONGLE
the normal 9-pin serial port connector, and can currently only be the normal 9-pin serial port connector, and can currently only be
used by IrTTY. To activate support for ACTiSYS IR-200L dongles used by IrTTY. To activate support for ACTiSYS IR-200L dongles
you will have to start irattach like this: "irattach -d act200l". you will have to start irattach like this: "irattach -d act200l".
Mobile Action MA600 dongle (Experimental)
CONFIG_MA600_DONGLE
Say Y here if you want to build support for the Mobile Action MA600
dongle. If you want to compile it as a module, say M here and read
<file:Documentation/modules.txt>. The MA600 dongle attaches to
the normal 9-pin serial port connector, and can currently only be
tested on IrCOMM. To activate support for MA600 dongles you will
have to insert "irattach -d ma600" in the /etc/irda/drivers script.
Note: irutils 0.9.15 requires no modification. irutils 0.9.9 needs
modification. For more information, download the following tar gzip
file.
There is a pre-compiled module on
<http://engsvr.ust.hk/~eetwl95/download/ma600-2.4.x.tar.gz>
...@@ -28,6 +28,7 @@ comment 'FIR device drivers' ...@@ -28,6 +28,7 @@ comment 'FIR device drivers'
dep_tristate 'IrDA USB dongles (EXPERIMENTAL)' CONFIG_USB_IRDA $CONFIG_IRDA $CONFIG_USB $CONFIG_EXPERIMENTAL dep_tristate 'IrDA USB dongles (EXPERIMENTAL)' CONFIG_USB_IRDA $CONFIG_IRDA $CONFIG_USB $CONFIG_EXPERIMENTAL
dep_tristate 'NSC PC87108/PC87338' CONFIG_NSC_FIR $CONFIG_IRDA dep_tristate 'NSC PC87108/PC87338' CONFIG_NSC_FIR $CONFIG_IRDA
dep_tristate 'Winbond W83977AF (IR)' CONFIG_WINBOND_FIR $CONFIG_IRDA dep_tristate 'Winbond W83977AF (IR)' CONFIG_WINBOND_FIR $CONFIG_IRDA
dep_tristate 'Toshiba Type-O IR Port (old driver)' CONFIG_TOSHIBA_OLD $CONFIG_IRDA
dep_tristate 'Toshiba Type-O IR Port' CONFIG_TOSHIBA_FIR $CONFIG_IRDA dep_tristate 'Toshiba Type-O IR Port' CONFIG_TOSHIBA_FIR $CONFIG_IRDA
if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then if [ "$CONFIG_EXPERIMENTAL" != "n" ]; then
dep_tristate 'SMC IrCC (EXPERIMENTAL)' CONFIG_SMC_IRCC_FIR $CONFIG_IRDA dep_tristate 'SMC IrCC (EXPERIMENTAL)' CONFIG_SMC_IRCC_FIR $CONFIG_IRDA
......
...@@ -13,7 +13,8 @@ obj-$(CONFIG_USB_IRDA) += irda-usb.o ...@@ -13,7 +13,8 @@ obj-$(CONFIG_USB_IRDA) += irda-usb.o
obj-$(CONFIG_NSC_FIR) += nsc-ircc.o obj-$(CONFIG_NSC_FIR) += nsc-ircc.o
obj-$(CONFIG_WINBOND_FIR) += w83977af_ir.o obj-$(CONFIG_WINBOND_FIR) += w83977af_ir.o
obj-$(CONFIG_SA1100_FIR) += sa1100_ir.o obj-$(CONFIG_SA1100_FIR) += sa1100_ir.o
obj-$(CONFIG_TOSHIBA_FIR) += toshoboe.o obj-$(CONFIG_TOSHIBA_OLD) += toshoboe.o
obj-$(CONFIG_TOSHIBA_FIR) += donauboe.o
obj-$(CONFIG_SMC_IRCC_FIR) += smc-ircc.o irport.o obj-$(CONFIG_SMC_IRCC_FIR) += smc-ircc.o irport.o
obj-$(CONFIG_ALI_FIR) += ali-ircc.o obj-$(CONFIG_ALI_FIR) += ali-ircc.o
obj-$(CONFIG_VLSI_FIR) += vlsi_ir.o obj-$(CONFIG_VLSI_FIR) += vlsi_ir.o
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -243,7 +243,7 @@ unsigned int mii_check_media (struct mii_if_info *mii, ...@@ -243,7 +243,7 @@ unsigned int mii_check_media (struct mii_if_info *mii,
/* figure out media and duplex from advertise and LPA values */ /* figure out media and duplex from advertise and LPA values */
media = mii_nway_result(lpa & advertise); media = mii_nway_result(lpa & advertise);
duplex = (media & (ADVERTISE_100FULL | ADVERTISE_10FULL)) ? 1 : 0; duplex = (media & ADVERTISE_FULL) ? 1 : 0;
if (ok_to_print) if (ok_to_print)
printk(KERN_INFO "%s: link up, %sMbps, %s-duplex, lpa 0x%04X\n", printk(KERN_INFO "%s: link up, %sMbps, %s-duplex, lpa 0x%04X\n",
......
This diff is collapsed.
...@@ -253,7 +253,7 @@ static int __init tms_pci_init (void) ...@@ -253,7 +253,7 @@ static int __init tms_pci_init (void)
return 0; return 0;
} }
static void __devexit tms_pci_rmmod (void) static void __exit tms_pci_rmmod (void)
{ {
pci_unregister_driver (&tms_pci_driver); pci_unregister_driver (&tms_pci_driver);
} }
......
...@@ -107,7 +107,7 @@ struct uctrl_status { ...@@ -107,7 +107,7 @@ struct uctrl_status {
u8 speaker_volume; /* 0x23 */ u8 speaker_volume; /* 0x23 */
u8 control_tft_brightness; /* 0x24 */ u8 control_tft_brightness; /* 0x24 */
u8 control_kbd_repeat_delay; /* 0x28 */ u8 control_kbd_repeat_delay; /* 0x28 */
u8 control_kbd_repeat_rate; /* 0x29 */ u8 control_kbd_repeat_period; /* 0x29 */
u8 control_screen_contrast; /* 0x2F */ u8 control_screen_contrast; /* 0x2F */
}; };
......
...@@ -57,11 +57,6 @@ fi ...@@ -57,11 +57,6 @@ fi
source drivers/scsi/aic7xxx/Config.in source drivers/scsi/aic7xxx/Config.in
if [ "$CONFIG_SCSI_AIC7XXX" != "y" ]; then if [ "$CONFIG_SCSI_AIC7XXX" != "y" ]; then
dep_tristate 'Old Adaptec AIC7xxx support' CONFIG_SCSI_AIC7XXX_OLD $CONFIG_SCSI dep_tristate 'Old Adaptec AIC7xxx support' CONFIG_SCSI_AIC7XXX_OLD $CONFIG_SCSI
if [ "$CONFIG_SCSI_AIC7XXX_OLD" != "n" ]; then
bool ' Enable Tagged Command Queueing (TCQ) by default' CONFIG_AIC7XXX_OLD_TCQ_ON_BY_DEFAULT
int ' Maximum number of TCQ commands per device' CONFIG_AIC7XXX_OLD_CMDS_PER_DEVICE 8
bool ' Collect statistics to report in /proc' CONFIG_AIC7XXX_OLD_PROC_STATS
fi
fi fi
# All the I2O code and drivers do not seem to be 64bit safe. # All the I2O code and drivers do not seem to be 64bit safe.
if [ "$CONFIG_X86_64" != "y" ]; then if [ "$CONFIG_X86_64" != "y" ]; then
......
This diff is collapsed.
...@@ -283,6 +283,17 @@ enum esp_rev { ...@@ -283,6 +283,17 @@ enum esp_rev {
espunknown = 0x09 espunknown = 0x09
}; };
/* We allocate one of these for each scsi device and attach it to
* SDptr->hostdata for use in the driver
*/
struct esp_device {
unsigned char sync_min_period;
unsigned char sync_max_offset;
unsigned sync:1;
unsigned wide:1;
unsigned disconnect:1;
};
/* We get one of these for each ESP probed. */ /* We get one of these for each ESP probed. */
struct NCR_ESP { struct NCR_ESP {
struct NCR_ESP *next; /* Next ESP on probed or NULL */ struct NCR_ESP *next; /* Next ESP on probed or NULL */
......
This diff is collapsed.
...@@ -46,7 +46,6 @@ ...@@ -46,7 +46,6 @@
eh_host_reset_handler: NULL, \ eh_host_reset_handler: NULL, \
abort: aic7xxx_abort, \ abort: aic7xxx_abort, \
reset: aic7xxx_reset, \ reset: aic7xxx_reset, \
select_queue_depths: NULL, \
slave_attach: aic7xxx_slave_attach, \ slave_attach: aic7xxx_slave_attach, \
slave_detach: aic7xxx_slave_detach, \ slave_detach: aic7xxx_slave_detach, \
bios_param: aic7xxx_biosparam, \ bios_param: aic7xxx_biosparam, \
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#define BLS (&aic7xxx_buffer[size]) #define BLS (&aic7xxx_buffer[size])
#define HDRB \ #define HDRB \
" < 2K 2K+ 4K+ 8K+ 16K+ 32K+ 64K+ 128K+" " 0 - 4K 4 - 16K 16 - 64K 64 - 256K 256K - 1M 1M+"
#ifdef PROC_DEBUG #ifdef PROC_DEBUG
extern int vsprintf(char *, const char *, va_list); extern int vsprintf(char *, const char *, va_list);
...@@ -85,10 +85,12 @@ aic7xxx_proc_info ( char *buffer, char **start, off_t offset, int length, ...@@ -85,10 +85,12 @@ aic7xxx_proc_info ( char *buffer, char **start, off_t offset, int length,
{ {
struct Scsi_Host *HBAptr; struct Scsi_Host *HBAptr;
struct aic7xxx_host *p; struct aic7xxx_host *p;
struct aic_dev_data *aic_dev;
struct scsi_device *sdptr;
int size = 0; int size = 0;
unsigned char i; unsigned char i;
struct aic7xxx_xferstats *sp; unsigned char tindex;
unsigned char target; struct list_head *list_item;
HBAptr = NULL; HBAptr = NULL;
...@@ -130,14 +132,9 @@ aic7xxx_proc_info ( char *buffer, char **start, off_t offset, int length, ...@@ -130,14 +132,9 @@ aic7xxx_proc_info ( char *buffer, char **start, off_t offset, int length,
*/ */
size = 4096; size = 4096;
for (target = 0; target < MAX_TARGETS; target++) list_for_each(list_item, &p->aic_devs)
{ {
if (p->dev_flags[target] & DEVICE_PRESENT)
#ifdef AIC7XXX_PROC_STATS
size += 512; size += 512;
#else
size += 256;
#endif
} }
if (aic7xxx_buffer_size != size) if (aic7xxx_buffer_size != size)
{ {
...@@ -166,11 +163,6 @@ aic7xxx_proc_info ( char *buffer, char **start, off_t offset, int length, ...@@ -166,11 +163,6 @@ aic7xxx_proc_info ( char *buffer, char **start, off_t offset, int length,
size += sprintf(BLS, " TCQ Enabled By Default : Enabled\n"); size += sprintf(BLS, " TCQ Enabled By Default : Enabled\n");
#else #else
size += sprintf(BLS, " TCQ Enabled By Default : Disabled\n"); size += sprintf(BLS, " TCQ Enabled By Default : Disabled\n");
#endif
#ifdef AIC7XXX_PROC_STATS
size += sprintf(BLS, " AIC7XXX_PROC_STATS : Enabled\n");
#else
size += sprintf(BLS, " AIC7XXX_PROC_STATS : Disabled\n");
#endif #endif
size += sprintf(BLS, "\n"); size += sprintf(BLS, "\n");
size += sprintf(BLS, "Adapter Configuration:\n"); size += sprintf(BLS, "Adapter Configuration:\n");
...@@ -271,8 +263,6 @@ aic7xxx_proc_info ( char *buffer, char **start, off_t offset, int length, ...@@ -271,8 +263,6 @@ aic7xxx_proc_info ( char *buffer, char **start, off_t offset, int length,
{ {
size += sprintf(BLS, " Ultra Enable Flags: 0x%04x\n", p->ultraenb); size += sprintf(BLS, " Ultra Enable Flags: 0x%04x\n", p->ultraenb);
} }
size += sprintf(BLS, " Tag Queue Enable Flags: 0x%04x\n", p->tagenable);
size += sprintf(BLS, "Ordered Queue Tag Flags: 0x%04x\n", p->orderedtag);
size += sprintf(BLS, "Default Tag Queue Depth: %d\n", AIC7XXX_CMDS_PER_DEVICE); size += sprintf(BLS, "Default Tag Queue Depth: %d\n", AIC7XXX_CMDS_PER_DEVICE);
size += sprintf(BLS, " Tagged Queue By Device array for aic7xxx host " size += sprintf(BLS, " Tagged Queue By Device array for aic7xxx host "
"instance %d:\n", p->instance); "instance %d:\n", p->instance);
...@@ -280,43 +270,27 @@ aic7xxx_proc_info ( char *buffer, char **start, off_t offset, int length, ...@@ -280,43 +270,27 @@ aic7xxx_proc_info ( char *buffer, char **start, off_t offset, int length,
for(i=0; i < (MAX_TARGETS - 1); i++) for(i=0; i < (MAX_TARGETS - 1); i++)
size += sprintf(BLS, "%d,",aic7xxx_tag_info[p->instance].tag_commands[i]); size += sprintf(BLS, "%d,",aic7xxx_tag_info[p->instance].tag_commands[i]);
size += sprintf(BLS, "%d}\n",aic7xxx_tag_info[p->instance].tag_commands[i]); size += sprintf(BLS, "%d}\n",aic7xxx_tag_info[p->instance].tag_commands[i]);
size += sprintf(BLS, " Actual queue depth per device for aic7xxx host "
"instance %d:\n", p->instance);
size += sprintf(BLS, " {");
for(i=0; i < (MAX_TARGETS - 1); i++)
size += sprintf(BLS, "%d,", p->dev_max_queue_depth[i]);
size += sprintf(BLS, "%d}\n", p->dev_max_queue_depth[i]);
size += sprintf(BLS, "\n"); size += sprintf(BLS, "\n");
size += sprintf(BLS, "Statistics:\n\n"); size += sprintf(BLS, "Statistics:\n\n");
for (target = 0; target < MAX_TARGETS; target++) list_for_each(list_item, &p->aic_devs)
{
sp = &p->stats[target];
if ((p->dev_flags[target] & DEVICE_PRESENT) == 0)
{
continue;
}
if (p->features & AHC_TWIN)
{
size += sprintf(BLS, "(scsi%d:%d:%d:%d)\n",
p->host_no, (target >> 3), (target & 0x7), 0);
}
else
{ {
aic_dev = list_entry(list_item, struct aic_dev_data, list);
sdptr = aic_dev->SDptr;
tindex = sdptr->channel << 3 | sdptr->id;
size += sprintf(BLS, "(scsi%d:%d:%d:%d)\n", size += sprintf(BLS, "(scsi%d:%d:%d:%d)\n",
p->host_no, 0, target, 0); p->host_no, sdptr->channel, sdptr->id, sdptr->lun);
}
size += sprintf(BLS, " Device using %s/%s", size += sprintf(BLS, " Device using %s/%s",
(p->transinfo[target].cur_width == MSG_EXT_WDTR_BUS_16_BIT) ? (aic_dev->cur.width == MSG_EXT_WDTR_BUS_16_BIT) ?
"Wide" : "Narrow", "Wide" : "Narrow",
(p->transinfo[target].cur_offset != 0) ? (aic_dev->cur.offset != 0) ?
"Sync transfers at " : "Async transfers.\n" ); "Sync transfers at " : "Async transfers.\n" );
if (p->transinfo[target].cur_offset != 0) if (aic_dev->cur.offset != 0)
{ {
struct aic7xxx_syncrate *sync_rate; struct aic7xxx_syncrate *sync_rate;
unsigned char options = p->transinfo[target].cur_options; unsigned char options = aic_dev->cur.options;
int period = p->transinfo[target].cur_period; int period = aic_dev->cur.period;
int rate = (p->transinfo[target].cur_width == int rate = (aic_dev->cur.width ==
MSG_EXT_WDTR_BUS_16_BIT) ? 1 : 0; MSG_EXT_WDTR_BUS_16_BIT) ? 1 : 0;
sync_rate = aic7xxx_find_syncrate(p, &period, 0, &options); sync_rate = aic7xxx_find_syncrate(p, &period, 0, &options);
...@@ -324,50 +298,45 @@ aic7xxx_proc_info ( char *buffer, char **start, off_t offset, int length, ...@@ -324,50 +298,45 @@ aic7xxx_proc_info ( char *buffer, char **start, off_t offset, int length,
{ {
size += sprintf(BLS, "%s MByte/sec, offset %d\n", size += sprintf(BLS, "%s MByte/sec, offset %d\n",
sync_rate->rate[rate], sync_rate->rate[rate],
p->transinfo[target].cur_offset ); aic_dev->cur.offset );
} }
else else
{ {
size += sprintf(BLS, "3.3 MByte/sec, offset %d\n", size += sprintf(BLS, "3.3 MByte/sec, offset %d\n",
p->transinfo[target].cur_offset ); aic_dev->cur.offset );
} }
} }
size += sprintf(BLS, " Transinfo settings: "); size += sprintf(BLS, " Transinfo settings: ");
size += sprintf(BLS, "current(%d/%d/%d/%d), ", size += sprintf(BLS, "current(%d/%d/%d/%d), ",
p->transinfo[target].cur_period, aic_dev->cur.period,
p->transinfo[target].cur_offset, aic_dev->cur.offset,
p->transinfo[target].cur_width, aic_dev->cur.width,
p->transinfo[target].cur_options); aic_dev->cur.options);
size += sprintf(BLS, "goal(%d/%d/%d/%d), ", size += sprintf(BLS, "goal(%d/%d/%d/%d), ",
p->transinfo[target].goal_period, aic_dev->goal.period,
p->transinfo[target].goal_offset, aic_dev->goal.offset,
p->transinfo[target].goal_width, aic_dev->goal.width,
p->transinfo[target].goal_options); aic_dev->goal.options);
size += sprintf(BLS, "user(%d/%d/%d/%d)\n", size += sprintf(BLS, "user(%d/%d/%d/%d)\n",
p->transinfo[target].user_period, p->user[tindex].period,
p->transinfo[target].user_offset, p->user[tindex].offset,
p->transinfo[target].user_width, p->user[tindex].width,
p->transinfo[target].user_options); p->user[tindex].options);
#ifdef AIC7XXX_PROC_STATS
size += sprintf(BLS, " Total transfers %ld (%ld reads and %ld writes)\n", size += sprintf(BLS, " Total transfers %ld (%ld reads and %ld writes)\n",
sp->r_total + sp->w_total, sp->r_total, sp->w_total); aic_dev->r_total + aic_dev->w_total, aic_dev->r_total, aic_dev->w_total);
size += sprintf(BLS, "%s\n", HDRB); size += sprintf(BLS, "%s\n", HDRB);
size += sprintf(BLS, " Reads:"); size += sprintf(BLS, " Reads:");
for (i = 0; i < NUMBER(sp->r_bins); i++) for (i = 0; i < NUMBER(aic_dev->r_bins); i++)
{ {
size += sprintf(BLS, " %7ld", sp->r_bins[i]); size += sprintf(BLS, " %7ld", aic_dev->r_bins[i]);
} }
size += sprintf(BLS, "\n"); size += sprintf(BLS, "\n");
size += sprintf(BLS, " Writes:"); size += sprintf(BLS, " Writes:");
for (i = 0; i < NUMBER(sp->w_bins); i++) for (i = 0; i < NUMBER(aic_dev->w_bins); i++)
{ {
size += sprintf(BLS, " %7ld", sp->w_bins[i]); size += sprintf(BLS, " %7ld", aic_dev->w_bins[i]);
} }
size += sprintf(BLS, "\n"); size += sprintf(BLS, "\n");
#else
size += sprintf(BLS, " Total transfers %ld (%ld reads and %ld writes)\n",
sp->r_total + sp->w_total, sp->r_total, sp->w_total);
#endif /* AIC7XXX_PROC_STATS */
size += sprintf(BLS, "\n\n"); size += sprintf(BLS, "\n\n");
} }
......
This diff is collapsed.
...@@ -64,6 +64,17 @@ enum esp_rev { ...@@ -64,6 +64,17 @@ enum esp_rev {
espunknown = 0x07 espunknown = 0x07
}; };
/* We allocate one of these for each scsi device and attach it to
* SDptr->hostdata for use in the driver
*/
struct esp_device {
unsigned char sync_min_period;
unsigned char sync_max_offset;
unsigned sync:1;
unsigned wide:1;
unsigned disconnect:1;
};
/* We get one of these for each ESP probed. */ /* We get one of these for each ESP probed. */
struct esp { struct esp {
unsigned long eregs; /* ESP controller registers */ unsigned long eregs; /* ESP controller registers */
...@@ -399,7 +410,7 @@ extern int esp_abort(Scsi_Cmnd *); ...@@ -399,7 +410,7 @@ extern int esp_abort(Scsi_Cmnd *);
extern int esp_reset(Scsi_Cmnd *, unsigned int); extern int esp_reset(Scsi_Cmnd *, unsigned int);
extern int esp_proc_info(char *buffer, char **start, off_t offset, int length, extern int esp_proc_info(char *buffer, char **start, off_t offset, int length,
int hostno, int inout); int hostno, int inout);
extern int esp_revoke(Scsi_Device* SDptr); extern void esp_slave_detach(Scsi_Device* SDptr);
#ifdef CONFIG_SPARC64 #ifdef CONFIG_SPARC64
#define SCSI_SPARC_ESP { \ #define SCSI_SPARC_ESP { \
...@@ -407,7 +418,7 @@ extern int esp_revoke(Scsi_Device* SDptr); ...@@ -407,7 +418,7 @@ extern int esp_revoke(Scsi_Device* SDptr);
proc_info: &esp_proc_info, \ proc_info: &esp_proc_info, \
name: "Sun ESP 100/100a/200", \ name: "Sun ESP 100/100a/200", \
detect: esp_detect, \ detect: esp_detect, \
revoke: esp_revoke, \ slave_detach: esp_slave_detach, \
info: esp_info, \ info: esp_info, \
command: esp_command, \ command: esp_command, \
queuecommand: esp_queue, \ queuecommand: esp_queue, \
...@@ -427,7 +438,7 @@ extern int esp_revoke(Scsi_Device* SDptr); ...@@ -427,7 +438,7 @@ extern int esp_revoke(Scsi_Device* SDptr);
proc_info: &esp_proc_info, \ proc_info: &esp_proc_info, \
name: "Sun ESP 100/100a/200", \ name: "Sun ESP 100/100a/200", \
detect: esp_detect, \ detect: esp_detect, \
revoke: esp_revoke, \ slave_detach: esp_slave_detach, \
info: esp_info, \ info: esp_info, \
command: esp_command, \ command: esp_command, \
queuecommand: esp_queue, \ queuecommand: esp_queue, \
......
...@@ -433,6 +433,7 @@ int ips_eh_abort(Scsi_Cmnd *); ...@@ -433,6 +433,7 @@ int ips_eh_abort(Scsi_Cmnd *);
int ips_eh_reset(Scsi_Cmnd *); int ips_eh_reset(Scsi_Cmnd *);
int ips_queue(Scsi_Cmnd *, void (*) (Scsi_Cmnd *)); int ips_queue(Scsi_Cmnd *, void (*) (Scsi_Cmnd *));
int ips_biosparam(Disk *, struct block_device *, int *); int ips_biosparam(Disk *, struct block_device *, int *);
int ips_slave_attach(Scsi_Device *);
const char * ips_info(struct Scsi_Host *); const char * ips_info(struct Scsi_Host *);
void do_ipsintr(int, void *, struct pt_regs *); void do_ipsintr(int, void *, struct pt_regs *);
static int ips_hainit(ips_ha_t *); static int ips_hainit(ips_ha_t *);
...@@ -481,7 +482,7 @@ static int ips_flash_firmware(ips_ha_t *, ips_passthru_t *, ips_scb_t *); ...@@ -481,7 +482,7 @@ static int ips_flash_firmware(ips_ha_t *, ips_passthru_t *, ips_scb_t *);
static void ips_free_flash_copperhead(ips_ha_t *ha); static void ips_free_flash_copperhead(ips_ha_t *ha);
static void ips_get_bios_version(ips_ha_t *, int); static void ips_get_bios_version(ips_ha_t *, int);
static void ips_identify_controller(ips_ha_t *); static void ips_identify_controller(ips_ha_t *);
static void ips_select_queue_depth(struct Scsi_Host *, Scsi_Device *); //static void ips_select_queue_depth(struct Scsi_Host *, Scsi_Device *);
static void ips_chkstatus(ips_ha_t *, IPS_STATUS *); static void ips_chkstatus(ips_ha_t *, IPS_STATUS *);
static void ips_enable_int_copperhead(ips_ha_t *); static void ips_enable_int_copperhead(ips_ha_t *);
static void ips_enable_int_copperhead_memio(ips_ha_t *); static void ips_enable_int_copperhead_memio(ips_ha_t *);
...@@ -1087,7 +1088,7 @@ ips_detect(Scsi_Host_Template *SHT) { ...@@ -1087,7 +1088,7 @@ ips_detect(Scsi_Host_Template *SHT) {
sh->n_io_port = io_addr ? 255 : 0; sh->n_io_port = io_addr ? 255 : 0;
sh->unique_id = (io_addr) ? io_addr : mem_addr; sh->unique_id = (io_addr) ? io_addr : mem_addr;
sh->irq = irq; sh->irq = irq;
sh->select_queue_depths = ips_select_queue_depth; //sh->select_queue_depths = ips_select_queue_depth;
sh->sg_tablesize = sh->hostt->sg_tablesize; sh->sg_tablesize = sh->hostt->sg_tablesize;
sh->can_queue = sh->hostt->can_queue; sh->can_queue = sh->hostt->can_queue;
sh->cmd_per_lun = sh->hostt->cmd_per_lun; sh->cmd_per_lun = sh->hostt->cmd_per_lun;
...@@ -1827,7 +1828,7 @@ ips_biosparam(Disk *disk, struct block_device *dev, int geom[]) { ...@@ -1827,7 +1828,7 @@ ips_biosparam(Disk *disk, struct block_device *dev, int geom[]) {
/* Select queue depths for the devices on the contoller */ /* Select queue depths for the devices on the contoller */
/* */ /* */
/****************************************************************************/ /****************************************************************************/
static void /*static void
ips_select_queue_depth(struct Scsi_Host *host, Scsi_Device *scsi_devs) { ips_select_queue_depth(struct Scsi_Host *host, Scsi_Device *scsi_devs) {
Scsi_Device *device; Scsi_Device *device;
ips_ha_t *ha; ips_ha_t *ha;
...@@ -1860,6 +1861,30 @@ ips_select_queue_depth(struct Scsi_Host *host, Scsi_Device *scsi_devs) { ...@@ -1860,6 +1861,30 @@ ips_select_queue_depth(struct Scsi_Host *host, Scsi_Device *scsi_devs) {
} }
} }
} }
*/
/****************************************************************************/
/* */
/* Routine Name: ips_slave_attach */
/* */
/* Routine Description: */
/* */
/* Set queue depths on devices once scan is complete */
/* */
/****************************************************************************/
int
ips_slave_attach(Scsi_Device *SDptr)
{
ips_ha_t *ha;
int min;
ha = IPS_HA(SDptr->host);
min = ha->max_cmds / 4;
if (min < 8)
min = ha->max_cmds - 1;
scsi_adjust_queue_depth(SDptr, MSG_ORDERED_TAG, min);
return 0;
}
/****************************************************************************/ /****************************************************************************/
/* */ /* */
...@@ -7407,7 +7432,7 @@ static int ips_init_phase1( struct pci_dev *pci_dev, int *indexPtr ) ...@@ -7407,7 +7432,7 @@ static int ips_init_phase1( struct pci_dev *pci_dev, int *indexPtr )
sh->n_io_port = io_addr ? 255 : 0; sh->n_io_port = io_addr ? 255 : 0;
sh->unique_id = (io_addr) ? io_addr : mem_addr; sh->unique_id = (io_addr) ? io_addr : mem_addr;
sh->irq = irq; sh->irq = irq;
sh->select_queue_depths = ips_select_queue_depth; //sh->select_queue_depths = ips_select_queue_depth;
sh->sg_tablesize = sh->hostt->sg_tablesize; sh->sg_tablesize = sh->hostt->sg_tablesize;
sh->can_queue = sh->hostt->can_queue; sh->can_queue = sh->hostt->can_queue;
sh->cmd_per_lun = sh->hostt->cmd_per_lun; sh->cmd_per_lun = sh->hostt->cmd_per_lun;
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
extern int ips_eh_reset(Scsi_Cmnd *); extern int ips_eh_reset(Scsi_Cmnd *);
extern int ips_queue(Scsi_Cmnd *, void (*) (Scsi_Cmnd *)); extern int ips_queue(Scsi_Cmnd *, void (*) (Scsi_Cmnd *));
extern int ips_biosparam(Disk *, struct block_device *, int *); extern int ips_biosparam(Disk *, struct block_device *, int *);
extern int ips_slave_attach(Scsi_Device *);
extern const char * ips_info(struct Scsi_Host *); extern const char * ips_info(struct Scsi_Host *);
extern void do_ips(int, void *, struct pt_regs *); extern void do_ips(int, void *, struct pt_regs *);
...@@ -481,7 +482,8 @@ ...@@ -481,7 +482,8 @@
eh_host_reset_handler : ips_eh_reset, \ eh_host_reset_handler : ips_eh_reset, \
abort : NULL, \ abort : NULL, \
reset : NULL, \ reset : NULL, \
slave_attach : NULL, \ slave_attach : ips_slave_attach, \
slave_detach : NULL, \
bios_param : ips_biosparam, \ bios_param : ips_biosparam, \
can_queue : 0, \ can_queue : 0, \
this_id: -1, \ this_id: -1, \
......
...@@ -1624,11 +1624,40 @@ void scsi_adjust_queue_depth(Scsi_Device *SDpnt, int tagged, int tags) ...@@ -1624,11 +1624,40 @@ void scsi_adjust_queue_depth(Scsi_Device *SDpnt, int tagged, int tags)
/* /*
* refuse to set tagged depth to an unworkable size * refuse to set tagged depth to an unworkable size
*/ */
if(tags == 0) if(tags <= 0)
return; return;
/*
* Limit max queue depth on a single lun to 256 for now. Remember,
* we allocate a struct scsi_command for each of these and keep it
* around forever. Too deep of a depth just wastes memory.
*/
if(tags > 256)
return;
spin_lock_irqsave(&device_request_lock, flags); spin_lock_irqsave(&device_request_lock, flags);
SDpnt->new_queue_depth = tags; SDpnt->new_queue_depth = tags;
SDpnt->tagged_queue = tagged; switch(tagged) {
case MSG_ORDERED_TAG:
SDpnt->ordered_tags = 1;
SDpnt->simple_tags = 1;
break;
case MSG_SIMPLE_TAG:
SDpnt->ordered_tags = 0;
SDpnt->simple_tags = 1;
break;
default:
printk(KERN_WARNING "(scsi%d:%d:%d:%d) "
"scsi_adjust_queue_depth, bad queue type, "
"disabled\n", SDpnt->host->host_no,
SDpnt->channel, SDpnt->id, SDpnt->lun);
case 0:
SDpnt->ordered_tags = SDpnt->simple_tags = 0;
if(SDpnt->host->cmd_per_lun)
SDpnt->new_queue_depth = SDpnt->host->cmd_per_lun;
else
SDpnt->new_queue_depth = 1;
break;
}
spin_unlock_irqrestore(&device_request_lock, flags); spin_unlock_irqrestore(&device_request_lock, flags);
if(SDpnt->queue_depth == 0) if(SDpnt->queue_depth == 0)
{ {
......
This diff is collapsed.
...@@ -424,6 +424,14 @@ int scsi_ioctl(Scsi_Device * dev, int cmd, void *arg) ...@@ -424,6 +424,14 @@ int scsi_ioctl(Scsi_Device * dev, int cmd, void *arg)
return 0; return 0;
case SCSI_IOCTL_GET_BUS_NUMBER: case SCSI_IOCTL_GET_BUS_NUMBER:
return put_user(dev->host->host_no, (int *) arg); return put_user(dev->host->host_no, (int *) arg);
/*
* The next two ioctls either need to go or need to be changed to
* pass tagged queueing changes through the low level drivers.
* Simply enabling or disabling tagged queueing without the knowledge
* of the low level driver is a *BAD* thing.
*
* Oct. 10, 2002 - Doug Ledford <dledford@redhat.com>
*/
case SCSI_IOCTL_TAGGED_ENABLE: case SCSI_IOCTL_TAGGED_ENABLE:
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
......
This diff is collapsed.
...@@ -348,7 +348,7 @@ static void hidinput_configure_usage(struct hid_device *device, struct hid_field ...@@ -348,7 +348,7 @@ static void hidinput_configure_usage(struct hid_device *device, struct hid_field
set_bit(usage->type, input->evbit); set_bit(usage->type, input->evbit);
while (usage->code <= max && test_and_set_bit(usage->code, bit)) { while (usage->code <= max && test_and_set_bit(usage->code, bit)) {
usage->code = find_next_zero_bit(bit, max + 1, usage->code); usage->code = find_next_zero_bit(bit, usage->code, max + 1);
} }
if (usage->code > max) return; if (usage->code > max) return;
......
...@@ -12,7 +12,7 @@ fi ...@@ -12,7 +12,7 @@ fi
# msdos and Joliet want NLS # msdos and Joliet want NLS
if [ "$CONFIG_JOLIET" = "y" -o "$CONFIG_FAT_FS" != "n" \ if [ "$CONFIG_JOLIET" = "y" -o "$CONFIG_FAT_FS" != "n" \
-o "$CONFIG_NTFS_FS" != "n" -o "$CONFIG_NCPFS_NLS" = "y" \ -o "$CONFIG_NTFS_FS" != "n" -o "$CONFIG_NCPFS_NLS" = "y" \
-o "$CONFIG_SMB_NLS" = "y" -o "$CONFIG_JFS_FS" != "n" -o "$CONFIG_CIFS" != "n"]; then -o "$CONFIG_SMB_NLS" = "y" -o "$CONFIG_JFS_FS" != "n" -o "$CONFIG_CIFS" != "n" ]; then
define_bool CONFIG_NLS y define_bool CONFIG_NLS y
else else
define_bool CONFIG_NLS n define_bool CONFIG_NLS n
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment