Commit a9ff99a8 authored by Steve French's avatar Steve French

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

into hostme.bitkeeper.com:/repos/c/cifs/linux-2.5cifs
parents 9a7aaef7 583953a5
......@@ -458,6 +458,13 @@ void nmi_watchdog_tick (struct pt_regs * regs)
wrmsr(MSR_P4_IQ_CCCR0, P4_NMI_IQ_CCCR0, 0);
apic_write(APIC_LVTPC, APIC_DM_NMI);
}
else if (nmi_perfctr_msr == MSR_P6_PERFCTR0) {
/* Only P6 based Pentium M need to re-unmask
* the apic vector but it doesn't hurt
* other P6 variant */
apic_write(APIC_LVTPC,
apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED);
}
wrmsr(nmi_perfctr_msr, -(cpu_khz/nmi_hz*1000), -1);
}
}
......
......@@ -487,7 +487,7 @@ _GLOBAL(enter_rtas)
mflr r0
std r0,16(r1)
stdu r1,-RTAS_FRAME_SIZE(r1) /* Save SP and create stack space. */
/* Because RTAS is running in 32b mode, it clobbers the high order half
* of all registers that it saves. We therefore save those registers
* RTAS might touch to the stack. (r0, r3-r13 are caller saved)
......@@ -512,12 +512,25 @@ _GLOBAL(enter_rtas)
mfsrr1 r10
std r10,_SRR1(r1)
/* There is no way it is acceptable to get here with interrupts enabled,
* check it with the asm equivalent of WARN_ON
*/
mfmsr r6
andi. r0,r6,MSR_EE
1: tdnei r0,0
.section __bug_table,"a"
.llong 1b,__LINE__ + 0x1000000, 1f, 2f
.previous
.section .rodata,"a"
1: .asciz __FILE__
2: .asciz "enter_rtas"
.previous
/* Unfortunately, the stack pointer and the MSR are also clobbered,
* so they are saved in the PACA which allows us to restore
* our original state after RTAS returns.
*/
std r1,PACAR1(r13)
mfmsr r6
std r6,PACASAVEDMSR(r13)
/* Setup our real return addr */
......
......@@ -93,8 +93,13 @@
_stext:
#ifdef CONFIG_PPC_PSERIES
_STATIC(__start)
/* NOP this out unconditionally */
BEGIN_FTR_SECTION
b .__start_initialization_pSeries
END_FTR_SECTION(0, 1)
#endif
/* Catch branch to 0 in real mode */
trap
#ifdef CONFIG_PPC_ISERIES
/*
* At offset 0x20, there is a pointer to iSeries LPAR data.
......
......@@ -1926,6 +1926,11 @@ finish_node(struct device_node *np, unsigned long mem_start,
np->name = get_property(np, "name", 0);
np->type = get_property(np, "device_type", 0);
if (!np->name)
np->name = "<NULL>";
if (!np->type)
np->type = "<NULL>";
/* get the device addresses and interrupts */
if (ifunc != NULL)
mem_start = ifunc(np, mem_start, naddrc, nsizec);
......
......@@ -68,15 +68,20 @@ char rtas_data_buf[RTAS_DATA_BUF_SIZE]__page_aligned;
void
call_rtas_display_status(char c)
{
struct rtas_args *rtas = &(get_paca()->xRtas);
struct rtas_args *args = &(get_paca()->xRtas);
unsigned long s;
spin_lock_irqsave(&rtas.lock, s);
rtas->token = 10;
rtas->nargs = 1;
rtas->nret = 1;
rtas->rets = (rtas_arg_t *)&(rtas->args[1]);
rtas->args[0] = (int)c;
args->token = 10;
args->nargs = 1;
args->nret = 1;
args->rets = (rtas_arg_t *)&(args->args[1]);
args->args[0] = (int)c;
enter_rtas((void *)__pa((unsigned long)rtas));
enter_rtas((void *)__pa((unsigned long)args));
spin_unlock_irqrestore(&rtas.lock, s);
}
int
......@@ -91,8 +96,9 @@ rtas_token(const char *service)
return tokp ? *tokp : RTAS_UNKNOWN_SERVICE;
}
void
log_rtas_error(struct rtas_args *rtas_args)
static int
__log_rtas_error(struct rtas_args *rtas_args)
{
struct rtas_args err_args, temp_args;
......@@ -111,13 +117,24 @@ log_rtas_error(struct rtas_args *rtas_args)
PPCDBG(PPCDBG_RTAS, "\tentering rtas with 0x%lx\n",
(void *)__pa((unsigned long)&err_args));
enter_rtas((void *)__pa((unsigned long)&get_paca()->xRtas));
PPCDBG(PPCDBG_RTAS, "\treturned from rtas ...\n");
PPCDBG(PPCDBG_RTAS, "\treturned from rtas ...\n");
err_args = get_paca()->xRtas;
get_paca()->xRtas = temp_args;
if (err_args.rets[0] == 0)
return err_args.rets[0];
}
void
log_rtas_error(struct rtas_args *rtas_args)
{
unsigned long s;
int rc;
spin_lock_irqsave(&rtas.lock, s);
rc = __log_rtas_error(rtas_args);
spin_unlock_irqrestore(&rtas.lock, s);
if (rc == 0)
log_error(rtas_err_buf, ERR_TYPE_RTAS_LOG, 0);
}
......@@ -126,9 +143,10 @@ rtas_call(int token, int nargs, int nret,
unsigned long *outputs, ...)
{
va_list list;
int i;
int i, logit = 0;
unsigned long s;
struct rtas_args *rtas_args = &(get_paca()->xRtas);
long ret;
PPCDBG(PPCDBG_RTAS, "Entering rtas_call\n");
PPCDBG(PPCDBG_RTAS, "\ttoken = 0x%x\n", token);
......@@ -138,6 +156,9 @@ rtas_call(int token, int nargs, int nret,
if (token == RTAS_UNKNOWN_SERVICE)
return -1;
/* Gotta do something different here, use global lock for now... */
spin_lock_irqsave(&rtas.lock, s);
rtas_args->token = token;
rtas_args->nargs = nargs;
rtas_args->nret = nret;
......@@ -150,26 +171,16 @@ rtas_call(int token, int nargs, int nret,
va_end(list);
for (i = 0; i < nret; ++i)
rtas_args->rets[i] = 0;
rtas_args->rets[i] = 0;
#if 0 /* Gotta do something different here, use global lock for now... */
spin_lock_irqsave(&rtas_args->lock, s);
#else
spin_lock_irqsave(&rtas.lock, s);
#endif
PPCDBG(PPCDBG_RTAS, "\tentering rtas with 0x%lx\n",
(void *)__pa((unsigned long)rtas_args));
enter_rtas((void *)__pa((unsigned long)rtas_args));
PPCDBG(PPCDBG_RTAS, "\treturned from rtas ...\n");
if (rtas_args->rets[0] == -1)
log_rtas_error(rtas_args);
logit = (__log_rtas_error(rtas_args) == 0);
#if 0 /* Gotta do something different here, use global lock for now... */
spin_unlock_irqrestore(&rtas_args->lock, s);
#else
spin_unlock_irqrestore(&rtas.lock, s);
#endif
ifppcdebug(PPCDBG_RTAS) {
for(i=0; i < nret ;i++)
udbg_printf("\tnret[%d] = 0x%lx\n", i, (ulong)rtas_args->rets[i]);
......@@ -178,7 +189,15 @@ rtas_call(int token, int nargs, int nret,
if (nret > 1 && outputs != NULL)
for (i = 0; i < nret-1; ++i)
outputs[i] = rtas_args->rets[i+1];
return (ulong)((nret > 0) ? rtas_args->rets[0] : 0);
ret = (ulong)((nret > 0) ? rtas_args->rets[0] : 0);
/* Gotta do something different here, use global lock for now... */
spin_unlock_irqrestore(&rtas.lock, s);
if (logit)
log_error(rtas_err_buf, ERR_TYPE_RTAS_LOG, 0);
return ret;
}
/* Given an RTAS status code of 990n compute the hinted delay of 10^n
......@@ -464,12 +483,12 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
enter_rtas((void *)__pa((unsigned long)&get_paca()->xRtas));
args = get_paca()->xRtas;
spin_unlock_irqrestore(&rtas.lock, flags);
args.rets = (rtas_arg_t *)&(args.args[nargs]);
if (args.rets[0] == -1)
log_rtas_error(&args);
spin_unlock_irqrestore(&rtas.lock, flags);
/* Copy out args. */
if (copy_to_user(uargs->args + nargs,
args.args + nargs,
......@@ -485,7 +504,9 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
void rtas_stop_self(void)
{
struct rtas_args *rtas_args = &(get_paca()->xRtas);
unsigned long s;
spin_lock_irqsave(&rtas.lock, s);
rtas_args->token = rtas_token("stop-self");
BUG_ON(rtas_args->token == RTAS_UNKNOWN_SERVICE);
rtas_args->nargs = 0;
......@@ -495,6 +516,8 @@ void rtas_stop_self(void)
printk("%u %u Ready to die...\n",
smp_processor_id(), hard_smp_processor_id());
enter_rtas((void *)__pa(rtas_args));
spin_unlock_irqrestore(&rtas.lock, s);
panic("Alas, I survived.\n");
}
#endif /* CONFIG_HOTPLUG_CPU */
......
......@@ -9,14 +9,14 @@ config FW_LOADER
the kernel tree does.
config DEBUG_DRIVER
bool "Driver Core verbose debug messages"
depends on DEBUG_KERNEL
help
Say Y here if you want the Driver core to produce a bunch of
debug messages to the system log. Select this if you are having a
problem with the driver core and want to see more of what is
going on.
bool "Driver Core verbose debug messages"
depends on DEBUG_KERNEL
help
Say Y here if you want the Driver core to produce a bunch of
debug messages to the system log. Select this if you are having a
problem with the driver core and want to see more of what is
going on.
If you are unsure about this, say N here.
If you are unsure about this, say N here.
endmenu
......@@ -155,8 +155,7 @@ static int class_device_dev_link(struct class_device * class_dev)
static void class_device_dev_unlink(struct class_device * class_dev)
{
if (class_dev->dev)
sysfs_remove_link(&class_dev->kobj, "device");
sysfs_remove_link(&class_dev->kobj, "device");
}
static int class_device_driver_link(struct class_device * class_dev)
......@@ -169,8 +168,7 @@ static int class_device_driver_link(struct class_device * class_dev)
static void class_device_driver_unlink(struct class_device * class_dev)
{
if ((class_dev->dev) && (class_dev->dev->driver))
sysfs_remove_link(&class_dev->kobj, "driver");
sysfs_remove_link(&class_dev->kobj, "driver");
}
......
......@@ -35,6 +35,7 @@
#include <linux/init.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/smp_lock.h>
#include <linux/device.h>
#include <asm/atarihw.h>
#include <asm/traps.h>
......@@ -149,6 +150,8 @@ static struct dsp56k_device {
int tx_wsize, rx_wsize;
} dsp56k;
static struct class_simple *dsp56k_class;
static int dsp56k_reset(void)
{
u_char status;
......@@ -502,6 +505,8 @@ static char banner[] __initdata = KERN_INFO "DSP56k driver installed\n";
static int __init dsp56k_init_driver(void)
{
int err = 0;
if(!MACH_IS_ATARI || !ATARIHW_PRESENT(DSP56K)) {
printk("DSP56k driver: Hardware not present\n");
return -ENODEV;
......@@ -511,17 +516,35 @@ static int __init dsp56k_init_driver(void)
printk("DSP56k driver: Unable to register driver\n");
return -ENODEV;
}
dsp56k_class = class_simple_create(THIS_MODULE, "dsp56k");
if (IS_ERR(dsp56k_class)) {
err = PTR_ERR(dsp56k_class);
goto out_chrdev;
}
class_simple_device_add(dsp56k_class, MKDEV(DSP56K_MAJOR, 0), NULL, "dsp56k");
devfs_mk_cdev(MKDEV(DSP56K_MAJOR, 0),
err = devfs_mk_cdev(MKDEV(DSP56K_MAJOR, 0),
S_IFCHR | S_IRUSR | S_IWUSR, "dsp56k");
if(err)
goto out_class;
printk(banner);
return 0;
goto out;
out_class:
class_simple_device_remove(MKDEV(DSP56K_MAJOR, 0));
class_simple_destroy(dsp56k_class);
out_chrdev:
unregister_chrdev(DSP56K_MAJOR, "dsp56k");
out:
return err;
}
module_init(dsp56k_init_driver);
static void __exit dsp56k_cleanup_driver(void)
{
class_simple_device_remove(MKDEV(DSP56K_MAJOR, 0));
class_simple_destroy(dsp56k_class);
unregister_chrdev(DSP56K_MAJOR, "dsp56k");
devfs_remove("dsp56k");
}
......
......@@ -38,6 +38,7 @@
#include <linux/zftape.h>
#include <linux/init.h>
#include <linux/device.h>
#include "../zftape/zftape-init.h"
#include "../zftape/zftape-read.h"
......@@ -103,6 +104,8 @@ static struct file_operations zft_cdev =
.release = zft_close,
};
static struct class_simple *zft_class;
/* Open floppy tape device
*/
static int zft_open(struct inode *ino, struct file *filep)
......@@ -341,22 +344,29 @@ KERN_INFO
"installing zftape VFS interface for ftape driver ...");
TRACE_CATCH(register_chrdev(QIC117_TAPE_MAJOR, "zft", &zft_cdev),);
zft_class = class_simple_create(THIS_MODULE, "zft");
for (i = 0; i < 4; i++) {
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i), NULL, "qft%i", i);
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i),
S_IFCHR | S_IRUSR | S_IWUSR,
"qft%i", i);
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 4), NULL, "nqft%i", i);
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 4),
S_IFCHR | S_IRUSR | S_IWUSR,
"nqft%i", i);
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 16), NULL, "zqft%i", i);
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 16),
S_IFCHR | S_IRUSR | S_IWUSR,
"zqft%i", i);
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 20), NULL, "nzqft%i", i);
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 20),
S_IFCHR | S_IRUSR | S_IWUSR,
"nzqft%i", i);
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 32), NULL, "rawqft%i", i);
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 32),
S_IFCHR | S_IRUSR | S_IWUSR,
"rawqft%i", i);
class_simple_device_add(zft_class, MKDEV(QIC117_TAPE_MAJOR, i + 36), NULL, "nrawrawqft%i", i);
devfs_mk_cdev(MKDEV(QIC117_TAPE_MAJOR, i + 36),
S_IFCHR | S_IRUSR | S_IWUSR,
"nrawqft%i", i);
......@@ -386,12 +396,19 @@ static void zft_exit(void)
}
for (i = 0; i < 4; i++) {
devfs_remove("qft%i", i);
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i));
devfs_remove("nqft%i", i);
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 4));
devfs_remove("zqft%i", i);
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 16));
devfs_remove("nzqft%i", i);
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 20));
devfs_remove("rawqft%i", i);
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 32));
devfs_remove("nrawqft%i", i);
class_simple_device_remove(MKDEV(QIC117_TAPE_MAJOR, i + 36));
}
class_simple_destroy(zft_class);
zft_uninit_mem(); /* release remaining memory, if any */
printk(KERN_INFO "zftape successfully unloaded.\n");
TRACE_EXIT;
......
......@@ -40,6 +40,7 @@
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/device.h>
#include <asm/io.h>
#include <asm/uaccess.h>
......@@ -795,6 +796,8 @@ static int stli_timeron;
/*****************************************************************************/
static struct class_simple *istallion_class;
#ifdef MODULE
/*
......@@ -853,9 +856,12 @@ static void __exit istallion_module_exit(void)
return;
}
put_tty_driver(stli_serial);
for (i = 0; i < 4; i++)
for (i = 0; i < 4; i++) {
devfs_remove("staliomem/%d", i);
class_simple_device_remove(MKDEV(STL_SIOMEMMAJOR, i));
}
devfs_remove("staliomem");
class_simple_destroy(istallion_class);
if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem")))
printk("STALLION: failed to un-register serial memory device, "
"errno=%d\n", -i);
......@@ -5310,10 +5316,13 @@ int __init stli_init(void)
"device\n");
devfs_mk_dir("staliomem");
istallion_class = class_simple_create(THIS_MODULE, "staliomem");
for (i = 0; i < 4; i++) {
devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i),
S_IFCHR | S_IRUSR | S_IWUSR,
"staliomem/%d", i);
class_simple_device_add(istallion_class, MKDEV(STL_SIOMEMMAJOR, i),
NULL, "staliomem%d", i);
}
/*
......
......@@ -41,6 +41,7 @@
#include <linux/init.h>
#include <linux/smp_lock.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/device.h>
#include <asm/io.h>
#include <asm/uaccess.h>
......@@ -732,6 +733,8 @@ static struct file_operations stl_fsiomem = {
/*****************************************************************************/
static struct class_simple *stallion_class;
#ifdef MODULE
/*
......@@ -788,12 +791,15 @@ static void __exit stallion_module_exit(void)
restore_flags(flags);
return;
}
for (i = 0; i < 4; i++)
for (i = 0; i < 4; i++) {
devfs_remove("staliomem/%d", i);
class_simple_device_remove(MKDEV(STL_SIOMEMMAJOR, i));
}
devfs_remove("staliomem");
if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem")))
printk("STALLION: failed to un-register serial memory device, "
"errno=%d\n", -i);
class_simple_destroy(stallion_class);
if (stl_tmpwritebuf != (char *) NULL)
kfree(stl_tmpwritebuf);
......@@ -3181,10 +3187,12 @@ int __init stl_init(void)
printk("STALLION: failed to register serial board device\n");
devfs_mk_dir("staliomem");
stallion_class = class_simple_create(THIS_MODULE, "staliomem");
for (i = 0; i < 4; i++) {
devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i),
S_IFCHR|S_IRUSR|S_IWUSR,
"staliomem/%d", i);
class_simple_device_add(stallion_class, MKDEV(STL_SIOMEMMAJOR, i), NULL, "staliomem%d", i);
}
stl_serial->owner = THIS_MODULE;
......
......@@ -67,7 +67,7 @@
/*
* Version Information
*/
#define DRIVER_VERSION "1.17"
#define DRIVER_VERSION "1.19"
#define DRIVER_AUTHOR "Romain Lievin <roms@lpg.ticalc.org>"
#define DRIVER_DESC "Device driver for TI/PC parallel link cables"
#define DRIVER_LICENSE "GPL"
......@@ -361,10 +361,13 @@ tipar_ioctl(struct inode *inode, struct file *file,
switch (cmd) {
case IOCTL_TIPAR_DELAY:
delay = (int)arg; //get_user(delay, &arg);
break;
delay = (int)arg; //get_user(delay, &arg);
break;
case IOCTL_TIPAR_TIMEOUT:
timeout = (int)arg; //get_user(timeout, &arg);
if (arg != 0)
timeout = (int)arg;
else
retval = -EINVAL;
break;
default:
retval = -ENOTTY;
......@@ -399,7 +402,10 @@ tipar_setup(char *str)
str = get_options(str, ARRAY_SIZE(ints), ints);
if (ints[0] > 0) {
timeout = ints[1];
if (ints[1] != 0)
timeout = ints[1];
else
printk("tipar: wrong timeout value (0), using default value instead.");
if (ints[0] > 1) {
delay = ints[2];
}
......
......@@ -94,6 +94,7 @@
#include <linux/init.h>
#include <linux/smp_lock.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/device.h>
#include <asm/dma.h>
#include <asm/system.h>
......@@ -229,6 +230,8 @@ static const char *format_names[] = {
"600" /* untested. */
};
static struct class_simple *tpqic02_class;
/* `exception_list' is needed for exception status reporting.
* Exceptions 1..14 are defined by QIC-02 rev F.
......@@ -2696,23 +2699,32 @@ int __init qic02_tape_init(void)
return -ENODEV;
}
tpqic02_class = class_simple_create(THIS_MODULE, TPQIC02_NAME);
class_simple_device_add(tpqic02_class, MKDEV(QIC02_TAPE_MAJOR, 2), NULL, "ntpqic11");
devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 2),
S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "ntpqic11");
class_simple_device_add(tpqic02_class, MKDEV(QIC02_TAPE_MAJOR, 3), NULL, "tpqic11");
devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 3),
S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "tpqic11");
class_simple_device_add(tpqic02_class, MKDEV(QIC02_TAPE_MAJOR, 4), NULL, "ntpqic24");
devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 4),
S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "ntpqic24");
class_simple_device_add(tpqic02_class, MKDEV(QIC02_TAPE_MAJOR, 5), NULL, "tpqic24");
devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 5),
S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "tpqic24");
class_simple_device_add(tpqic02_class, MKDEV(QIC02_TAPE_MAJOR, 6), NULL, "ntpqic20");
devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 6),
S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "ntpqic120");
class_simple_device_add(tpqic02_class, MKDEV(QIC02_TAPE_MAJOR, 7), NULL, "tpqic20");
devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 7),
S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "tpqic120");
class_simple_device_add(tpqic02_class, MKDEV(QIC02_TAPE_MAJOR, 8), NULL, "ntpqic50");
devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 8),
S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "ntpqic150");
class_simple_device_add(tpqic02_class, MKDEV(QIC02_TAPE_MAJOR, 9), NULL, "tpqic50");
devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 9),
S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "tpqic150");
......@@ -2757,13 +2769,23 @@ static void qic02_module_exit(void)
qic02_release_resources();
devfs_remove("ntpqic11");
class_simple_device_remove(MKDEV(QIC02_TAPE_MAJOR, 2));
devfs_remove("tpqic11");
class_simple_device_remove(MKDEV(QIC02_TAPE_MAJOR, 3));
devfs_remove("ntpqic24");
class_simple_device_remove(MKDEV(QIC02_TAPE_MAJOR, 4));
devfs_remove("tpqic24");
class_simple_device_remove(MKDEV(QIC02_TAPE_MAJOR, 5));
devfs_remove("ntpqic120");
class_simple_device_remove(MKDEV(QIC02_TAPE_MAJOR, 6));
devfs_remove("tpqic120");
class_simple_device_remove(MKDEV(QIC02_TAPE_MAJOR, 7));
devfs_remove("ntpqic150");
class_simple_device_remove(MKDEV(QIC02_TAPE_MAJOR, 8));
devfs_remove("tpqic150");
class_simple_device_remove(MKDEV(QIC02_TAPE_MAJOR, 9));
class_simple_destroy(tpqic02_class);
}
static int qic02_module_init(void)
......
......@@ -36,6 +36,7 @@
#include <linux/kbd_kern.h>
#include <linux/console.h>
#include <linux/smp_lock.h>
#include <linux/device.h>
#include <asm/uaccess.h>
#include <asm/byteorder.h>
#include <asm/unaligned.h>
......@@ -469,6 +470,8 @@ static struct file_operations vcs_fops = {
.open = vcs_open,
};
static struct class_simple *vc_class;
void vcs_make_devfs(struct tty_struct *tty)
{
devfs_mk_cdev(MKDEV(VCS_MAJOR, tty->index + 1),
......@@ -477,19 +480,26 @@ void vcs_make_devfs(struct tty_struct *tty)
devfs_mk_cdev(MKDEV(VCS_MAJOR, tty->index + 129),
S_IFCHR|S_IRUSR|S_IWUSR,
"vcc/a%u", tty->index + 1);
class_simple_device_add(vc_class, MKDEV(VCS_MAJOR, tty->index + 1), NULL, "vcs%u", tty->index + 1);
class_simple_device_add(vc_class, MKDEV(VCS_MAJOR, tty->index + 129), NULL, "vcsa%u", tty->index + 1);
}
void vcs_remove_devfs(struct tty_struct *tty)
{
devfs_remove("vcc/%u", tty->index + 1);
devfs_remove("vcc/a%u", tty->index + 1);
class_simple_device_remove(MKDEV(VCS_MAJOR, tty->index + 1));
class_simple_device_remove(MKDEV(VCS_MAJOR, tty->index + 129));
}
int __init vcs_init(void)
{
if (register_chrdev(VCS_MAJOR, "vcs", &vcs_fops))
panic("unable to get major %d for vcs device", VCS_MAJOR);
vc_class = class_simple_create(THIS_MODULE, "vc");
devfs_mk_cdev(MKDEV(VCS_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/0");
devfs_mk_cdev(MKDEV(VCS_MAJOR, 128), S_IFCHR|S_IRUSR|S_IWUSR, "vcc/a0");
class_simple_device_add(vc_class, MKDEV(VCS_MAJOR, 0), NULL, "vcs");
class_simple_device_add(vc_class, MKDEV(VCS_MAJOR, 128), NULL, "vcsa");
return 0;
}
......@@ -2617,6 +2617,8 @@ static struct tty_operations con_ops = {
int __init vty_init(void)
{
vcs_init();
console_driver = alloc_tty_driver(MAX_NR_CONSOLES);
if (!console_driver)
panic("Couldn't allocate console driver\n");
......@@ -2644,7 +2646,6 @@ int __init vty_init(void)
#ifdef CONFIG_FRAMEBUFFER_CONSOLE
fb_console_init();
#endif
vcs_init();
return 0;
}
......
......@@ -124,7 +124,7 @@ config IEEE1394_SBP2_PHYS_DMA
config IEEE1394_ETH1394
tristate "Ethernet over 1394"
depends on IEEE1394 && EXPERIMENTAL
depends on IEEE1394 && EXPERIMENTAL && INET
select IEEE1394_CONFIG_ROM_IP1394
select IEEE1394_EXTRA_CONFIG_ROMS
help
......
......@@ -319,7 +319,7 @@ void ohci1394_stop_it_ctx(struct ti_ohci *ohci, int ctx, int synchronous)
control = reg_read(ohci, OHCI1394_IsoXmitContextControlSet + ctx * 16);
if ((control & OHCI1394_CONTEXT_ACTIVE) == 0)
break;
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1);
}
......@@ -408,7 +408,7 @@ static void stream_shift_packet_lists(unsigned long l)
/* Now that we know the list is non-empty, we can get the head
* of the list without locking, because the process context
* only adds to the tail.
* only adds to the tail.
*/
pl = list_entry(s->dma_packet_lists.next, struct packet_list, link);
last = &pl->packets[PACKET_LIST_SIZE - 1];
......@@ -424,7 +424,7 @@ static void stream_shift_packet_lists(unsigned long l)
if (last->db->payload_desc.status == 0) {
HPSB_INFO("weird interrupt...");
return;
}
}
/* If the last descriptor block does not specify a branch
* address, we have a sample underflow.
......@@ -469,7 +469,7 @@ static struct packet *stream_current_packet(struct stream *s)
return &s->current_packet_list->packets[s->current_packet];
}
static void stream_queue_packet(struct stream *s)
{
s->current_packet++;
......@@ -543,13 +543,13 @@ void packet_initialize(struct packet *p, struct packet *next)
DMA_CTL_OUTPUT_MORE | DMA_CTL_IMMEDIATE | 8;
if (next) {
p->db->payload_desc.control =
p->db->payload_desc.control =
DMA_CTL_OUTPUT_LAST | DMA_CTL_BRANCH;
p->db->payload_desc.branch = next->db_bus | 3;
p->db->header_desc.skip = next->db_bus | 3;
}
else {
p->db->payload_desc.control =
p->db->payload_desc.control =
DMA_CTL_OUTPUT_LAST | DMA_CTL_BRANCH |
DMA_CTL_UPDATE | DMA_CTL_IRQ;
p->db->payload_desc.branch = 0;
......@@ -580,7 +580,7 @@ struct packet_list *packet_list_alloc(struct stream *s)
for (i = 0; i < PACKET_LIST_SIZE; i++) {
if (i < PACKET_LIST_SIZE - 1)
next = &pl->packets[i + 1];
else
else
next = NULL;
packet_initialize(&pl->packets[i], next);
}
......@@ -695,7 +695,7 @@ static u32 get_header_bits(struct stream *s, int sub_frame, u32 sample)
case AMDTP_FORMAT_IEC958_PCM:
case AMDTP_FORMAT_IEC958_AC3:
return get_iec958_header_bits(s, sub_frame, sample);
case AMDTP_FORMAT_RAW:
return 0x40;
......@@ -739,18 +739,18 @@ static void fill_packet(struct stream *s, struct packet *packet, int nevents)
/* Fill IEEE1394 headers */
packet->db->header_desc.header[0] =
(IEEE1394_SPEED_100 << 16) | (0x01 << 14) |
(IEEE1394_SPEED_100 << 16) | (0x01 << 14) |
(s->iso_channel << 8) | (TCODE_ISO_DATA << 4);
packet->db->header_desc.header[1] = size << 16;
/* Calculate synchronization timestamp (syt). First we
* determine syt_index, that is, the index in the packet of
* the sample for which the timestamp is valid. */
syt_index = (s->syt_interval - s->dbc) & (s->syt_interval - 1);
if (syt_index < nevents) {
syt = ((atomic_read(&s->cycle_count) << 12) |
syt = ((atomic_read(&s->cycle_count) << 12) |
s->cycle_offset.integer) & 0xffff;
fraction_add(&s->cycle_offset,
fraction_add(&s->cycle_offset,
&s->cycle_offset, &s->ticks_per_syt_offset);
/* This next addition should be modulo 8000 (0x1f40),
......@@ -763,7 +763,7 @@ static void fill_packet(struct stream *s, struct packet *packet, int nevents)
syt = 0xffff;
atomic_inc(&s->cycle_count2);
/* Fill cip header */
packet->payload->eoh0 = 0;
packet->payload->sid = s->host->host->node_id & 0x3f;
......@@ -1072,7 +1072,7 @@ void stream_free(struct stream *s)
* that sometimes generates an it transmit interrupt if we
* later re-enable the context.
*/
wait_event_interruptible(s->packet_list_wait,
wait_event_interruptible(s->packet_list_wait,
list_empty(&s->dma_packet_lists));
ohci1394_stop_it_ctx(s->host->ohci, s->iso_tasklet.context, 1);
......@@ -1102,7 +1102,7 @@ static ssize_t amdtp_write(struct file *file, const char *buffer, size_t count,
unsigned char *p;
int i;
size_t length;
if (s->packet_pool == NULL)
return -EBADFD;
......@@ -1123,16 +1123,16 @@ static ssize_t amdtp_write(struct file *file, const char *buffer, size_t count,
return -EFAULT;
if (s->input->length < s->input->size)
continue;
stream_flush(s);
if (s->current_packet_list != NULL)
continue;
if (file->f_flags & O_NONBLOCK)
return i + length > 0 ? i + length : -EAGAIN;
if (wait_event_interruptible(s->packet_list_wait,
if (wait_event_interruptible(s->packet_list_wait,
!list_empty(&s->free_packet_lists)))
return -EINTR;
}
......@@ -1152,7 +1152,7 @@ static int amdtp_ioctl(struct inode *inode, struct file *file,
case AMDTP_IOC_CHANNEL:
if (copy_from_user(&cfg, (struct amdtp_ioctl *) arg, sizeof cfg))
return -EFAULT;
else
else
return stream_configure(s, cmd, &cfg);
default:
......@@ -1266,6 +1266,7 @@ static int __init amdtp_init_module (void)
{
cdev_init(&amdtp_cdev, &amdtp_fops);
amdtp_cdev.owner = THIS_MODULE;
kobject_set_name(&amdtp_cdev.kobj, "amdtp");
if (cdev_add(&amdtp_cdev, IEEE1394_AMDTP_DEV, 16)) {
HPSB_ERR("amdtp: unable to add char device");
return -EIO;
......
......@@ -24,7 +24,7 @@
*
* The dimension field specifies the dimension of the signal, that is,
* the number of audio channels. Only AMDTP_FORMAT_RAW supports
* settings greater than 2.
* settings greater than 2.
*
* The mode field specifies which transmission mode to use. The AMDTP
* specifies two different transmission modes: blocking and
......
......@@ -187,14 +187,14 @@ static int pcr_read(struct hpsb_host *host, int nodeid, quadlet_t *buf,
int csraddr = addr - CSR_REGISTER_BASE;
int plug;
struct cmp_host *ch;
if (length != 4)
return RCODE_TYPE_ERROR;
ch = hpsb_get_hostinfo(&cmp_highlevel, host);
if (csraddr == 0x900) {
*buf = cpu_to_be32(ch->u.ompr_quadlet);
return RCODE_COMPLETE;
return RCODE_COMPLETE;
}
else if (csraddr < 0x904 + ch->u.ompr.nplugs * 4) {
plug = (csraddr - 0x904) / 4;
......@@ -206,7 +206,7 @@ static int pcr_read(struct hpsb_host *host, int nodeid, quadlet_t *buf,
}
else if (csraddr == 0x980) {
*buf = cpu_to_be32(ch->v.impr_quadlet);
return RCODE_COMPLETE;
return RCODE_COMPLETE;
}
else if (csraddr < 0x984 + ch->v.impr.nplugs * 4) {
plug = (csraddr - 0x984) / 4;
......@@ -225,10 +225,10 @@ static int pcr_lock(struct hpsb_host *host, int nodeid, quadlet_t *store,
struct cmp_host *ch;
ch = hpsb_get_hostinfo(&cmp_highlevel, host);
if (extcode != EXTCODE_COMPARE_SWAP)
if (extcode != EXTCODE_COMPARE_SWAP)
return RCODE_TYPE_ERROR;
if (csraddr == 0x900) {
/* FIXME: Ignore writes to bits 30-31 and 0-7 */
*store = cpu_to_be32(ch->u.ompr_quadlet);
......
......@@ -130,23 +130,23 @@ static void host_reset(struct hpsb_host *host)
host->csr.state &= ~0x100;
}
host->csr.topology_map[1] =
host->csr.topology_map[1] =
cpu_to_be32(be32_to_cpu(host->csr.topology_map[1]) + 1);
host->csr.topology_map[2] = cpu_to_be32(host->node_count << 16
host->csr.topology_map[2] = cpu_to_be32(host->node_count << 16
| host->selfid_count);
host->csr.topology_map[0] =
host->csr.topology_map[0] =
cpu_to_be32((host->selfid_count + 2) << 16
| csr_crc16(host->csr.topology_map + 1,
host->selfid_count + 2));
host->csr.speed_map[1] =
host->csr.speed_map[1] =
cpu_to_be32(be32_to_cpu(host->csr.speed_map[1]) + 1);
host->csr.speed_map[0] = cpu_to_be32(0x3f1 << 16
host->csr.speed_map[0] = cpu_to_be32(0x3f1 << 16
| csr_crc16(host->csr.speed_map+1,
0x3f1));
}
/*
/*
* HI == seconds (bits 0:2)
* LO == fraction units of 1/8000 of a second, as per 1394 (bits 19:31)
*
......@@ -161,7 +161,7 @@ static void host_reset(struct hpsb_host *host)
static inline void calculate_expire(struct csr_control *csr)
{
unsigned long units;
/* Take the seconds, and convert to units */
units = (unsigned long)(csr->split_timeout_hi & 0x07) << 13;
......@@ -288,7 +288,7 @@ static void remove_host(struct hpsb_host *host)
}
int hpsb_update_config_rom(struct hpsb_host *host, const quadlet_t *new_rom,
int hpsb_update_config_rom(struct hpsb_host *host, const quadlet_t *new_rom,
size_t buffersize, unsigned char rom_version)
{
unsigned long flags;
......@@ -296,7 +296,7 @@ int hpsb_update_config_rom(struct hpsb_host *host, const quadlet_t *new_rom,
HPSB_NOTICE("hpsb_update_config_rom() is deprecated");
spin_lock_irqsave(&host->csr.lock, flags);
spin_lock_irqsave(&host->csr.lock, flags);
if (rom_version != host->csr.generation)
ret = -1;
else if (buffersize > host->csr.rom->cache_head->size)
......@@ -329,10 +329,10 @@ static int read_maps(struct hpsb_host *host, int nodeid, quadlet_t *buffer,
int csraddr = addr - CSR_REGISTER_BASE;
const char *src;
spin_lock_irqsave(&host->csr.lock, flags);
spin_lock_irqsave(&host->csr.lock, flags);
if (csraddr < CSR_SPEED_MAP) {
src = ((char *)host->csr.topology_map) + csraddr
src = ((char *)host->csr.topology_map) + csraddr
- CSR_TOPOLOGY_MAP;
} else {
src = ((char *)host->csr.speed_map) + csraddr - CSR_SPEED_MAP;
......@@ -352,7 +352,7 @@ static int read_regs(struct hpsb_host *host, int nodeid, quadlet_t *buf,
int csraddr = addr - CSR_REGISTER_BASE;
int oldcycle;
quadlet_t ret;
if ((csraddr | length) & 0x3)
return RCODE_TYPE_ERROR;
......@@ -404,7 +404,7 @@ static int read_regs(struct hpsb_host *host, int nodeid, quadlet_t *buf,
/* cycle time wrapped around */
host->csr.bus_time += (1 << 7);
}
*(buf++) = cpu_to_be32(host->csr.bus_time
*(buf++) = cpu_to_be32(host->csr.bus_time
| (host->csr.cycle_time >> 25));
out;
......@@ -464,7 +464,7 @@ static int write_regs(struct hpsb_host *host, int nodeid, int destid,
quadlet_t *data, u64 addr, size_t length, u16 flags)
{
int csraddr = addr - CSR_REGISTER_BASE;
if ((csraddr | length) & 0x3)
return RCODE_TYPE_ERROR;
......@@ -494,12 +494,12 @@ static int write_regs(struct hpsb_host *host, int nodeid, int destid,
return RCODE_ADDRESS_ERROR;
case CSR_SPLIT_TIMEOUT_HI:
host->csr.split_timeout_hi =
host->csr.split_timeout_hi =
be32_to_cpu(*(data++)) & 0x00000007;
calculate_expire(&host->csr);
out;
case CSR_SPLIT_TIMEOUT_LO:
host->csr.split_timeout_lo =
host->csr.split_timeout_lo =
be32_to_cpu(*(data++)) & 0xfff80000;
calculate_expire(&host->csr);
out;
......
/*
* csr1212.c -- IEEE 1212 Control and Status Register support for Linux
*
*
* Copyright (C) 2003 Francois Retief <fgretief@sun.ac.za>
* Steve Kinneberg <kinnebergsteve@acmsystems.com>
*
......@@ -173,7 +173,7 @@ struct csr1212_csr *csr1212_create_csr(struct csr1212_bus_ops *ops,
if (!csr)
return NULL;
csr->cache_head =
csr->cache_head =
csr1212_rom_cache_malloc(CSR1212_CONFIG_ROM_SPACE_OFFSET,
CSR1212_CONFIG_ROM_SPACE_SIZE);
if (!csr->cache_head) {
......@@ -238,7 +238,7 @@ static struct csr1212_keyval *csr1212_new_keyval(u_int8_t type, u_int8_t key)
struct csr1212_keyval *csr1212_new_immediate(u_int8_t key, u_int32_t value)
{
struct csr1212_keyval *kv = csr1212_new_keyval(CSR1212_KV_TYPE_IMMEDIATE, key);
if (!kv)
return NULL;
......@@ -253,11 +253,10 @@ struct csr1212_keyval *csr1212_new_leaf(u_int8_t key, const void *data, size_t d
if (!kv)
return NULL;
if (data_len > 0) {
kv->value.leaf.data = CSR1212_MALLOC(data_len);
if (!kv->value.leaf.data)
{
if (!kv->value.leaf.data) {
CSR1212_FREE(kv);
return NULL;
}
......@@ -572,7 +571,7 @@ struct csr1212_keyval *csr1212_new_modifiable_descriptor_leaf(u_int16_t max_size
CSR1212_MODIFIABLE_DESCRIPTOR_SET_MAX_SIZE(kv, max_size);
CSR1212_MODIFIABLE_DESCRIPTOR_SET_ADDRESS_HI(kv, address);
CSR1212_MODIFIABLE_DESCRIPTOR_SET_ADDRESS_LO(kv, address);
return kv;
}
......@@ -621,7 +620,7 @@ struct csr1212_keyval *csr1212_new_keyword_leaf(int strc, const char *strv[])
/* make sure last quadlet is zeroed out */
*((u_int32_t*)&(buffer[(data_len - 1) & ~0x3])) = 0;
/* Copy keyword(s) into leaf data buffer */
for (i = 0; i < strc; i++) {
int len = strlen(strv[i]) + 1;
......@@ -643,7 +642,7 @@ void csr1212_detach_keyval_from_directory(struct csr1212_keyval *dir,
return;
dentry = csr1212_find_keyval(dir, kv);
if (!dentry)
return;
......@@ -788,8 +787,7 @@ static int csr1212_append_new_cache(struct csr1212_csr *csr, size_t romsize)
return CSR1212_ENOMEM;
}
if (csr1212_attach_keyval_to_directory(csr->root_kv, cache->ext_rom) != CSR1212_SUCCESS)
{
if (csr1212_attach_keyval_to_directory(csr->root_kv, cache->ext_rom) != CSR1212_SUCCESS) {
csr1212_release_keyval(cache->ext_rom);
csr->ops->release_addr(csr_addr, csr->private);
CSR1212_FREE(cache);
......@@ -1119,12 +1117,11 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr)
/* Remove unused, excess cache regions */
while (cache) {
struct csr1212_csr_rom_cache *oc = cache;
cache = cache->next;
csr1212_remove_cache(csr, oc);
}
/* Go through the list backward so that when done, the correct CRC
* will be calculated for the Extended ROM areas. */
for(cache = csr->cache_tail; cache; cache = cache->prev) {
......@@ -1263,7 +1260,7 @@ static inline int csr1212_parse_dir_entry(struct csr1212_keyval *dir,
ret = CSR1212_ENOMEM;
goto fail;
}
k->refcnt = 0; /* Don't keep local reference when parsing. */
break;
......@@ -1450,7 +1447,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
newcr = CSR1212_MALLOC(sizeof(struct csr1212_cache_region));
if (!newcr)
return CSR1212_ENOMEM;
newcr->offset_start = cache_index & ~(csr->max_rom - 1);
newcr->offset_end = newcr->offset_start;
newcr->next = cr;
......@@ -1474,7 +1471,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
newcr = CSR1212_MALLOC(sizeof(struct csr1212_cache_region));
if (!newcr)
return CSR1212_ENOMEM;
newcr->offset_start = cache_index & ~(csr->max_rom - 1);
newcr->offset_end = newcr->offset_start;
newcr->prev = cr;
......
/*
* csr1212.h -- IEEE 1212 Control and Status Register support for Linux
*
*
* Copyright (C) 2003 Francois Retief <fgretief@sun.ac.za>
* Steve Kinneberg <kinnebergsteve@acmsystems.com>
*
......@@ -37,6 +37,7 @@
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/sched.h>
#define CSR1212_MALLOC(size) kmalloc((size), in_interrupt() ? GFP_ATOMIC : GFP_KERNEL)
#define CSR1212_FREE(ptr) kfree(ptr)
......@@ -440,7 +441,7 @@ static inline u_int32_t *CSR1212_ICON_DESCRIPTOR_LEAF_PIXELS(struct csr1212_keyv
static const int pd[4] = { 0, 4, 16, 256 };
static const int cs[16] = { 4, 2 };
int ps = pd[CSR1212_ICON_DESCRIPTOR_LEAF_PALETTE_DEPTH(kv)];
return &kv->value.leaf.data[5 +
(ps * cs[CSR1212_ICON_DESCRIPTOR_LEAF_COLOR_SPACE(kv)]) /
sizeof(u_int32_t)];
......@@ -705,7 +706,7 @@ static inline void csr1212_release_keyval(struct csr1212_keyval *kv)
* _kv is a struct csr1212_keyval * that'll point to the current keyval (loop index).
* _dir is a struct csr1212_keyval * that points to the directory to be looped.
* _pos is a struct csr1212_dentry * that is used internally for indexing.
*
*
* kv will be NULL upon exit of the loop.
*/
#define csr1212_for_each_dir_entry(_csr, _kv, _dir, _pos) \
......
......@@ -96,7 +96,7 @@ int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_d
/* fill scatter/gather list with pages */
for (i = 0; i < dma->n_pages; i++) {
unsigned long va = (unsigned long) dma->kvirt + (i << PAGE_SHIFT);
dma->sglist[i].page = vmalloc_to_page((void *)va);
dma->sglist[i].length = PAGE_SIZE;
}
......@@ -196,6 +196,8 @@ void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset, un
pci_dma_sync_sg_for_device(dma->dev, &dma->sglist[first], last - first + 1, dma->direction);
}
#ifdef CONFIG_MMU
/* nopage() handler for mmap access */
static struct page*
......@@ -251,3 +253,12 @@ int dma_region_mmap(struct dma_region *dma, struct file *file, struct vm_area_st
return 0;
}
#else /* CONFIG_MMU */
int dma_region_mmap(struct dma_region *dma, struct file *file, struct vm_area_struct *vma)
{
return -EINVAL;
}
#endif /* CONFIG_MMU */
......@@ -14,7 +14,7 @@
#include <asm/scatterlist.h>
/* struct dma_prog_region
a small, physically-contiguous DMA buffer with random-access,
synchronous usage characteristics
*/
......@@ -37,7 +37,7 @@ static inline dma_addr_t dma_prog_region_offset_to_bus(struct dma_prog_region *p
}
/* struct dma_region
a large, non-physically-contiguous DMA buffer with streaming,
asynchronous usage characteristics
*/
......
......@@ -34,11 +34,11 @@
/* none of this is exposed to user-space */
/*
/*
the 8-byte CIP (Common Isochronous Packet) header that precedes
each packet of DV data.
See the IEC 61883 standard.
See the IEC 61883 standard.
*/
struct CIP_header { unsigned char b[8]; };
......@@ -71,10 +71,10 @@ static inline void fill_cip_header(struct CIP_header *cip,
/*
/*
DMA commands used to program the OHCI's DMA engine
See the Texas Instruments OHCI 1394 chipset documentation.
See the Texas Instruments OHCI 1394 chipset documentation.
*/
struct output_more_immediate { u32 q[8]; };
......@@ -95,17 +95,17 @@ static inline void fill_output_more_immediate(struct output_more_immediate *omi,
omi->q[1] = 0;
omi->q[2] = 0;
omi->q[3] = 0;
/* IT packet header */
omi->q[4] = cpu_to_le32( (0x0 << 16) /* IEEE1394_SPEED_100 */
| (tag << 14)
| (channel << 8)
| (TCODE_ISO_DATA << 4)
| (TCODE_ISO_DATA << 4)
| (sync_tag) );
/* reserved field; mimic behavior of my Sony DSR-40 */
omi->q[5] = cpu_to_le32((payload_size << 16) | (0x7F << 8) | 0xA0);
omi->q[6] = 0;
omi->q[7] = 0;
}
......@@ -186,11 +186,11 @@ static inline void fill_input_last(struct input_last *il,
/*
/*
A "DMA descriptor block" consists of several contiguous DMA commands.
struct DMA_descriptor_block encapsulates all of the commands necessary
to send one packet of DV data.
struct DMA_descriptor_block encapsulates all of the commands necessary
to send one packet of DV data.
There are three different types of these blocks:
1) command to send an empty packet (CIP header only, no DV data):
......@@ -225,44 +225,44 @@ struct DMA_descriptor_block {
union {
struct {
/* iso header, common to all output block types */
struct output_more_immediate omi;
struct output_more_immediate omi;
union {
/* empty packet */
struct {
struct output_last ol; /* CIP header */
} empty;
/* full packet */
struct {
struct output_more om; /* CIP header */
union {
/* payload does not cross page boundary */
struct {
struct output_last ol; /* data payload */
} nocross;
/* payload crosses page boundary */
struct {
struct output_more om; /* data payload */
struct output_last ol; /* data payload */
} cross;
} u;
} full;
} u;
} out;
struct {
struct input_last il;
struct input_last il;
} in;
} u;
/* ensure that PAGE_SIZE % sizeof(struct DMA_descriptor_block) == 0
/* ensure that PAGE_SIZE % sizeof(struct DMA_descriptor_block) == 0
by padding out to 128 bytes */
u32 __pad__[12];
u32 __pad__[12];
};
......@@ -281,7 +281,7 @@ struct frame {
/* index of this frame in video_card->frames[] */
unsigned int frame_num;
/* FRAME_CLEAR - DMA program not set up, waiting for data
/* FRAME_CLEAR - DMA program not set up, waiting for data
FRAME_READY - DMA program written, ready to transmit
Changes to these should be locked against the interrupt
......@@ -290,7 +290,7 @@ struct frame {
FRAME_CLEAR = 0,
FRAME_READY
} state;
/* whether this frame has been DMA'ed already; used only from
the IRQ handler to determine whether the frame can be reset */
int done;
......@@ -299,7 +299,7 @@ struct frame {
/* kernel virtual pointer to the start of this frame's data in
the user ringbuffer. Use only for CPU access; to get the DMA
bus address you must go through the video->user_dma mapping */
unsigned long data;
unsigned long data;
/* Max # of packets per frame */
#define MAX_PACKETS 500
......@@ -310,7 +310,7 @@ struct frame {
struct CIP_header *header_pool;
dma_addr_t header_pool_dma;
/* a physically contiguous memory pool for allocating DMA
descriptor blocks; usually around 64KB in size
!descriptor_pool must be aligned to PAGE_SIZE! */
......@@ -338,7 +338,7 @@ struct frame {
/* pointer to the first packet's CIP header (where the timestamp goes) */
struct CIP_header *cip_syt1;
/* pointer to the second packet's CIP header
(only set if the first packet was empty) */
struct CIP_header *cip_syt2;
......@@ -384,7 +384,7 @@ static void frame_delete(struct frame *f);
static void frame_reset(struct frame *f);
/* struct video_card contains all data associated with one instance
of the dv1394 driver
of the dv1394 driver
*/
enum modes {
MODE_RECEIVE,
......@@ -411,7 +411,7 @@ struct video_card {
u32 ohci_IsoXmitContextControlSet;
u32 ohci_IsoXmitContextControlClear;
u32 ohci_IsoXmitCommandPtr;
/* OHCI card IR DMA context number, -1 if not in use */
struct ohci1394_iso_tasklet ir_tasklet;
int ohci_ir_ctx;
......@@ -421,10 +421,10 @@ struct video_card {
u32 ohci_IsoRcvContextControlClear;
u32 ohci_IsoRcvCommandPtr;
u32 ohci_IsoRcvContextMatch;
/* CONCURRENCY CONTROL */
/* there are THREE levels of locking associated with video_card. */
/*
......@@ -435,7 +435,7 @@ struct video_card {
*/
unsigned long open;
/*
/*
2) the spinlock - this provides mutual exclusion between the interrupt
handler and process-context operations. Generally you must take the
spinlock under the following conditions:
......@@ -458,7 +458,7 @@ struct video_card {
/* flag to prevent spurious interrupts (which OHCI seems to
generate a lot :) from accessing the struct */
int dma_running;
/*
3) the sleeping semaphore 'sem' - this is used from process context only,
to serialize various operations on the video_card. Even though only one
......@@ -477,24 +477,24 @@ struct video_card {
/* support asynchronous I/O signals (SIGIO) */
struct fasync_struct *fasync;
/* the large, non-contiguous (rvmalloc()) ringbuffer for DV
data, exposed to user-space via mmap() */
unsigned long dv_buf_size;
struct dma_region dv_buf;
/* next byte in the ringbuffer that a write() call will fill */
size_t write_off;
struct frame *frames[DV1394_MAX_FRAMES];
/* n_frames also serves as an indicator that this struct video_card is
initialized and ready to run DMA buffers */
int n_frames;
/* this is the frame that is currently "owned" by the OHCI DMA controller
(set to -1 iff DMA is not running)
(set to -1 iff DMA is not running)
! must lock against the interrupt handler when accessing it !
......@@ -511,7 +511,6 @@ struct video_card {
The interrupt handler will NEVER advance active_frame to a
frame that is not READY.
*/
int active_frame;
int first_run;
......@@ -521,10 +520,10 @@ struct video_card {
/* altered ONLY from process context. Must check first_clear_frame->state;
if it's READY, that means the ringbuffer is full with READY frames;
if it's CLEAR, that means one or more ringbuffer frames are CLEAR */
unsigned int first_clear_frame;
unsigned int first_clear_frame;
/* altered both by process and interrupt */
unsigned int n_clear_frames;
unsigned int n_clear_frames;
/* only altered by the interrupt */
unsigned int dropped_frames;
......@@ -548,17 +547,17 @@ struct video_card {
/* the isochronous channel to use, -1 if video card is inactive */
int channel;
/* physically contiguous packet ringbuffer for receive */
struct dma_region packet_buf;
unsigned long packet_buf_size;
unsigned int current_packet;
int first_frame; /* received first start frame marker? */
enum modes mode;
};
/*
/*
if the video_card is not initialized, then the ONLY fields that are valid are:
ohci
open
......@@ -575,7 +574,7 @@ static int do_dv1394_init_default(struct video_card *video);
static void do_dv1394_shutdown(struct video_card *video, int free_user_buf);
/* NTSC empty packet rate accurate to within 0.01%,
/* NTSC empty packet rate accurate to within 0.01%,
calibrated against a Sony DSR-40 DVCAM deck */
#define CIP_N_NTSC 68000000
......
This diff is collapsed.
......@@ -49,7 +49,7 @@
To set the DV output parameters (e.g. whether you want NTSC or PAL
video), use the DV1394_INIT ioctl, passing in the parameters you
want in a struct dv1394_init.
Example 1:
To play a raw .DV file: cat foo.DV > /dev/dv1394
(cat will use write() internally)
......@@ -72,9 +72,9 @@
2)
For more control over buffering, and to avoid unnecessary copies
of the DV data, you can use the more sophisticated the mmap() interface.
First, call the DV1394_INIT ioctl to specify your parameters,
including the number of frames in the ringbuffer. Then, calling mmap()
of the DV data, you can use the more sophisticated the mmap() interface.
First, call the DV1394_INIT ioctl to specify your parameters,
including the number of frames in the ringbuffer. Then, calling mmap()
on the dv1394 device will give you direct access to the ringbuffer
from which the DV card reads your frame data.
......@@ -99,7 +99,7 @@
*--------------------------------------*
| CLEAR | DV data | DV data | CLEAR |
*--------------------------------------*
<ACTIVE>
<ACTIVE>
transmission goes in this direction --->>>
......@@ -110,10 +110,10 @@
will continue to transmit frame 2, and will increase the dropped_frames
counter each time it repeats the transmission).
If you called DV1394_GET_STATUS at this instant, you would
receive the following values:
n_frames = 4
active_frame = 1
first_clear_frame = 3
......@@ -144,9 +144,9 @@
(checks of system call return values omitted for brevity; always
check return values in your code!)
while ( frames left ) {
struct pollfd *pfd = ...;
pfd->fd = dv1394_fd;
......@@ -154,12 +154,12 @@
pfd->events = POLLOUT | POLLIN; (OUT for transmit, IN for receive)
(add other sources of I/O here)
poll(pfd, 1, -1); (or select(); add a timeout if you want)
if (pfd->revents) {
struct dv1394_status status;
ioctl(dv1394_fd, DV1394_GET_STATUS, &status);
if (status.dropped_frames > 0) {
......@@ -183,7 +183,7 @@
should close the dv1394 file descriptor (and munmap() all
ringbuffer mappings, if you are using them), then re-open the
dv1394 device (and re-map the ringbuffer).
*/
......@@ -215,7 +215,7 @@ enum pal_or_ntsc {
struct dv1394_init {
/* DV1394_API_VERSION */
unsigned int api_version;
/* isochronous transmission channel to use */
unsigned int channel;
......@@ -227,7 +227,7 @@ struct dv1394_init {
enum pal_or_ntsc format;
/* the following are used only for transmission */
/* set these to zero unless you want a
non-default empty packet rate (see below) */
unsigned long cip_n;
......@@ -244,7 +244,7 @@ struct dv1394_init {
would imply a different size for the ringbuffer). If you need a
different buffer size, simply close and re-open the device, then
initialize it with your new settings. */
/* Q: What are cip_n and cip_d? */
/*
......@@ -261,13 +261,13 @@ struct dv1394_init {
The default empty packet insertion rate seems to work for many people; if
your DV output is stable, you can simply ignore this discussion. However,
we have exposed the empty packet rate as a parameter to support devices that
do not work with the default rate.
do not work with the default rate.
The decision to insert an empty packet is made with a numerator/denominator
algorithm. Empty packets are produced at an average rate of CIP_N / CIP_D.
You can alter the empty packet rate by passing non-zero values for cip_n
and cip_d to the INIT ioctl.
*/
......
/*
* eth1394.c -- Ethernet driver for Linux IEEE-1394 Subsystem
*
*
* Copyright (C) 2001-2003 Ben Collins <bcollins@debian.org>
* 2000 Bonin Franck <boninf@free.fr>
* 2003 Steve Kinneberg <kinnebergsteve@acmsystems.com>
......@@ -89,7 +89,7 @@
#define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__)
static char version[] __devinitdata =
"$Rev: 1175 $ Ben Collins <bcollins@debian.org>";
"$Rev: 1198 $ Ben Collins <bcollins@debian.org>";
struct fragment_info {
struct list_head list;
......@@ -216,7 +216,7 @@ static struct hpsb_highlevel eth1394_highlevel = {
/* This is called after an "ifup" */
static int ether1394_open (struct net_device *dev)
{
struct eth1394_priv *priv = (struct eth1394_priv *)dev->priv;
struct eth1394_priv *priv = dev->priv;
int ret = 0;
/* Something bad happened, don't even try */
......@@ -278,7 +278,7 @@ static void ether1394_tx_timeout (struct net_device *dev)
static int ether1394_change_mtu(struct net_device *dev, int new_mtu)
{
struct eth1394_priv *priv = (struct eth1394_priv *)dev->priv;
struct eth1394_priv *priv = dev->priv;
if ((new_mtu < 68) ||
(new_mtu > min(ETH1394_DATA_LEN,
......@@ -479,7 +479,7 @@ static void ether1394_reset_priv (struct net_device *dev, int set_mtu)
{
unsigned long flags;
int i;
struct eth1394_priv *priv = (struct eth1394_priv *)dev->priv;
struct eth1394_priv *priv = dev->priv;
struct hpsb_host *host = priv->host;
u64 guid = *((u64*)&(host->csr.rom->bus_info_data[3]));
u16 maxpayload = 1 << (host->csr.max_rec + 1);
......@@ -652,7 +652,7 @@ static void ether1394_add_host (struct hpsb_host *host)
static void ether1394_remove_host (struct hpsb_host *host)
{
struct eth1394_host_info *hi;
hi = hpsb_get_hostinfo(&eth1394_highlevel, host);
if (hi != NULL) {
struct eth1394_priv *priv = (struct eth1394_priv *)hi->dev->priv;
......@@ -660,7 +660,7 @@ static void ether1394_remove_host (struct hpsb_host *host)
hpsb_unregister_addrspace(&eth1394_highlevel, host,
priv->local_fifo);
if (priv->iso != NULL)
if (priv->iso != NULL)
hpsb_iso_shutdown(priv->iso);
if (hi->dev) {
......@@ -731,18 +731,16 @@ static int ether1394_header(struct sk_buff *skb, struct net_device *dev,
eth->h_proto = htons(type);
if (dev->flags & (IFF_LOOPBACK|IFF_NOARP))
{
if (dev->flags & (IFF_LOOPBACK|IFF_NOARP)) {
memset(eth->h_dest, 0, dev->addr_len);
return(dev->hard_header_len);
}
if (daddr)
{
if (daddr) {
memcpy(eth->h_dest,daddr,dev->addr_len);
return dev->hard_header_len;
}
return -dev->hard_header_len;
}
......@@ -760,15 +758,15 @@ static int ether1394_rebuild_header(struct sk_buff *skb)
struct eth1394hdr *eth = (struct eth1394hdr *)skb->data;
struct net_device *dev = skb->dev;
switch (eth->h_proto)
{
switch (eth->h_proto) {
#ifdef CONFIG_INET
case __constant_htons(ETH_P_IP):
return arp_find((unsigned char*)&eth->h_dest, skb);
#endif
#endif
default:
ETH1394_PRINT(KERN_DEBUG, dev->name,
"unable to resolve type %04x addresses.\n",
"unable to resolve type %04x addresses.\n",
eth->h_proto);
break;
}
......@@ -797,7 +795,7 @@ static int ether1394_header_cache(struct neighbour *neigh, struct hh_cache *hh)
eth->h_proto = type;
memcpy(eth->h_dest, neigh->ha, dev->addr_len);
hh->hh_len = ETH1394_HLEN;
return 0;
}
......@@ -867,7 +865,7 @@ static inline u16 ether1394_parse_encap(struct sk_buff *skb,
nodeid_t srcid, nodeid_t destid,
u16 ether_type)
{
struct eth1394_priv *priv = (struct eth1394_priv *)dev->priv;
struct eth1394_priv *priv = dev->priv;
u64 dest_hw;
unsigned short ret = 0;
......@@ -1010,7 +1008,7 @@ static inline int new_fragment(struct list_head *frag_info, int offset, int len)
}
new = kmalloc(sizeof(struct fragment_info), GFP_ATOMIC);
if (!new)
if (!new)
return -ENOMEM;
new->offset = offset;
......@@ -1192,7 +1190,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
purge_partial_datagram(pdgl->prev);
pdg->sz--;
}
retval = new_partial_datagram(dev, pdgl, dgl, dg_size,
buf + hdr_len, fg_off,
fg_len);
......@@ -1374,7 +1372,7 @@ static void ether1394_iso(struct hpsb_iso *iso)
* arphdr) is the same format as the ip1394 header, so they overlap. The rest
* needs to be munged a bit. The remainder of the arphdr is formatted based
* on hwaddr len and ipaddr len. We know what they'll be, so it's easy to
* judge.
* judge.
*
* Now that the EUI is used for the hardware address all we need to do to make
* this work for 1394 is to insert 2 quadlets that contain max_rec size,
......@@ -1452,7 +1450,7 @@ static inline unsigned int ether1394_encapsulate(struct sk_buff *skb,
hdr->common.lf = ETH1394_HDR_LF_IF;
hdr->sf.fg_off = 0;
break;
default:
hdr->sf.fg_off += adj_max_payload;
bufhdr = (union eth1394_hdr *)skb_pull(skb, adj_max_payload);
......@@ -1499,7 +1497,7 @@ static inline int ether1394_prep_write_packet(struct hpsb_packet *p,
ETH1394_PRINT_G(KERN_ERR, "No more tlabels left while sending "
"to node " NODE_BUS_FMT "\n", NODE_BUS_ARGS(host, node));
return -1;
}
}
p->header[0] = (p->node_id << 16) | (p->tlabel << 10)
| (1 << 8) | (TCODE_WRITEB << 4);
......@@ -1538,7 +1536,6 @@ static inline void ether1394_free_packet(struct hpsb_packet *packet)
{
if (packet->tcode != TCODE_STREAM_DATA)
hpsb_free_tlabel(packet);
packet->data = NULL;
hpsb_free_packet(packet);
}
......@@ -1583,9 +1580,9 @@ static inline void ether1394_dg_complete(struct packet_task *ptask, int fail)
{
struct sk_buff *skb = ptask->skb;
struct net_device *dev = skb->dev;
struct eth1394_priv *priv = (struct eth1394_priv *)dev->priv;
struct eth1394_priv *priv = dev->priv;
unsigned long flags;
/* Statistics */
spin_lock_irqsave(&priv->lock, flags);
if (fail) {
......@@ -1616,8 +1613,7 @@ static void ether1394_complete_cb(void *__ptask)
ether1394_free_packet(packet);
ptask->outstanding_pkts--;
if (ptask->outstanding_pkts > 0 && !fail)
{
if (ptask->outstanding_pkts > 0 && !fail) {
int tx_len;
/* Add the encapsulation header to the fragment */
......@@ -1637,7 +1633,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
{
int kmflags = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
struct eth1394hdr *eth;
struct eth1394_priv *priv = (struct eth1394_priv *)dev->priv;
struct eth1394_priv *priv = dev->priv;
int proto;
unsigned long flags;
nodeid_t dest_node;
......@@ -1797,7 +1793,7 @@ static int ether1394_ethtool_ioctl(struct net_device *dev, void *useraddr)
case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
strcpy (info.driver, driver_name);
strcpy (info.version, "$Rev: 1175 $");
strcpy (info.version, "$Rev: 1198 $");
/* FIXME XXX provide sane businfo */
strcpy (info.bus_info, "ieee1394");
if (copy_to_user (useraddr, &info, sizeof (info)))
......
......@@ -493,7 +493,7 @@ int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
return 0;
}
void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
unsigned int channel)
{
if (channel > 63) {
......
......@@ -5,7 +5,7 @@
struct hpsb_address_serve {
struct list_head host_list; /* per host list */
struct list_head hl_list; /* hpsb_highlevel list */
struct hpsb_address_ops *op;
......@@ -19,7 +19,7 @@ struct hpsb_address_serve {
/*
* The above structs are internal to highlevel driver handling. Only the
* following structures are of interest to actual highlevel drivers.
* following structures are of interest to actual highlevel drivers.
*/
struct hpsb_highlevel {
......@@ -68,8 +68,8 @@ struct hpsb_highlevel {
struct hpsb_address_ops {
/*
* Null function pointers will make the respective operation complete
* with RCODE_TYPE_ERROR. Makes for easy to implement read-only
* Null function pointers will make the respective operation complete
* with RCODE_TYPE_ERROR. Makes for easy to implement read-only
* registers (just leave everything but read NULL).
*
* All functions shall return appropriate IEEE 1394 rcodes.
......@@ -77,7 +77,7 @@ struct hpsb_address_ops {
/* These functions have to implement block reads for themselves. */
/* These functions either return a response code
or a negative number. In the first case a response will be generated; in the
or a negative number. In the first case a response will be generated; in the
later case, no response will be sent and the driver, that handled the request
will send the response itself
*/
......@@ -104,7 +104,7 @@ void highlevel_host_reset(struct hpsb_host *host);
a packet arrives. The flags argument contains the second word of the first header
quadlet of the incoming packet (containing transaction label, retry code,
transaction code and priority). These functions either return a response code
or a negative number. In the first case a response will be generated; in the
or a negative number. In the first case a response will be generated; in the
later case, no response will be sent and the driver, that handled the request
will send the response itself.
*/
......@@ -155,7 +155,7 @@ int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
* Enable or disable receving a certain isochronous channel through the
* iso_receive op.
*/
int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
unsigned int channel);
void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
unsigned int channel);
......
......@@ -126,9 +126,7 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
h->hostdata = h + 1;
h->driver = drv;
INIT_LIST_HEAD(&h->pending_packets);
spin_lock_init(&h->pending_pkt_lock);
skb_queue_head_init(&h->pending_packet_queue);
INIT_LIST_HEAD(&h->addr_space);
init_timer(&h->delayed_reset);
......
......@@ -5,6 +5,8 @@
#include <linux/wait.h>
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/skbuff.h>
#include <asm/semaphore.h>
#include "ieee1394_types.h"
......@@ -21,8 +23,8 @@ struct hpsb_host {
atomic_t generation;
struct list_head pending_packets;
spinlock_t pending_pkt_lock;
struct sk_buff_head pending_packet_queue;
struct timer_list timeout;
unsigned long timeout_interval;
......@@ -164,7 +166,7 @@ struct hpsb_host_driver {
* called. Return 0 on success, negative errno on failure.
* NOTE: The function must be callable in interrupt context.
*/
int (*transmit_packet) (struct hpsb_host *host,
int (*transmit_packet) (struct hpsb_host *host,
struct hpsb_packet *packet);
/* This function requests miscellanous services from the driver, see
......
......@@ -39,7 +39,7 @@
#define ACK_TARDY 0xb
#define ACK_CONFLICT_ERROR 0xc
#define ACK_DATA_ERROR 0xd
#define ACK_TYPE_ERROR 0xe
#define ACK_TYPE_ERROR 0xe
#define ACK_ADDRESS_ERROR 0xf
/* Non-standard "ACK codes" for internal use */
......@@ -74,7 +74,7 @@ extern const char *hpsb_speedto_str[];
#define SELFID_PORT_CHILD 0x3
#define SELFID_PORT_PARENT 0x2
#define SELFID_PORT_NCONN 0x1
#define SELFID_PORT_NONE 0x0
#define SELFID_PORT_NONE 0x0
#include <asm/byteorder.h>
......
This diff is collapsed.
......@@ -12,9 +12,13 @@
struct hpsb_packet {
/* This struct is basically read-only for hosts with the exception of
* the data buffer contents and xnext - see below. */
struct list_head list;
/* This can be used for host driver internal linking. */
/* This can be used for host driver internal linking.
*
* NOTE: This must be left in init state when the driver is done
* with it (e.g. by using list_del_init()), since the core does
* some sanity checks to make sure the packet is not on a
* driver_list when free'ing it. */
struct list_head driver_list;
nodeid_t node_id;
......@@ -27,10 +31,9 @@ struct hpsb_packet {
* queued = queued for sending
* pending = sent, waiting for response
* complete = processing completed, successful or not
* incoming = incoming packet
*/
enum {
hpsb_unused, hpsb_queued, hpsb_pending, hpsb_complete, hpsb_incoming
enum {
hpsb_unused, hpsb_queued, hpsb_pending, hpsb_complete
} __attribute__((packed)) state;
/* These are core internal. */
......@@ -67,6 +70,9 @@ struct hpsb_packet {
void (*complete_routine)(void *);
void *complete_data;
/* XXX This is just a hack at the moment */
struct sk_buff *skb;
/* Store jiffies for implementing bus timeouts. */
unsigned long sendtime;
......@@ -141,7 +147,7 @@ int hpsb_bus_reset(struct hpsb_host *host);
*/
void hpsb_selfid_received(struct hpsb_host *host, quadlet_t sid);
/*
/*
* Notify completion of SelfID stage to the core and report new physical ID
* and whether host is root now.
*/
......
......@@ -67,7 +67,7 @@ static void fill_async_writeblock(struct hpsb_packet *packet, u64 addr, int leng
packet->data_size = length + (length % 4 ? 4 - (length % 4) : 0);
}
static void fill_async_lock(struct hpsb_packet *packet, u64 addr, int extcode,
static void fill_async_lock(struct hpsb_packet *packet, u64 addr, int extcode,
int length)
{
PREP_ASYNC_HEAD_ADDRESS(TCODE_LOCK_REQUEST);
......@@ -89,10 +89,10 @@ static void fill_iso_packet(struct hpsb_packet *packet, int length, int channel,
packet->tcode = TCODE_ISO_DATA;
}
static void fill_phy_packet(struct hpsb_packet *packet, quadlet_t data)
{
static void fill_phy_packet(struct hpsb_packet *packet, quadlet_t data)
{
packet->header[0] = data;
packet->header[1] = ~data;
packet->header[1] = ~data;
packet->header_size = 8;
packet->data_size = 0;
packet->expect_response = 0;
......@@ -145,7 +145,7 @@ int hpsb_get_tlabel(struct hpsb_packet *packet)
}
spin_lock_irqsave(&tp->lock, flags);
packet->tlabel = find_next_zero_bit(tp->pool, 64, tp->next);
if (packet->tlabel > 63)
packet->tlabel = find_first_zero_bit(tp->pool, 64);
......@@ -158,7 +158,7 @@ int hpsb_get_tlabel(struct hpsb_packet *packet)
return 0;
}
/**
/**
* hpsb_free_tlabel - free an allocated transaction label
* @packet: packet whos tlabel/tpool needs to be cleared
*
......@@ -173,7 +173,7 @@ void hpsb_free_tlabel(struct hpsb_packet *packet)
{
unsigned long flags;
struct hpsb_tlabel_pool *tp;
tp = &packet->host->tpool[packet->node_id & NODE_MASK];
BUG_ON(packet->tlabel > 63 || packet->tlabel < 0);
......@@ -204,7 +204,7 @@ int hpsb_packet_success(struct hpsb_packet *packet)
return -EINVAL;
default:
HPSB_ERR("received reserved rcode %d from node %d",
(packet->header[1] >> 12) & 0xf,
(packet->header[1] >> 12) & 0xf,
packet->node_id);
return -EAGAIN;
}
......@@ -268,7 +268,7 @@ struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node,
if (length == 0)
return NULL;
packet = hpsb_alloc_packet((length + 3) & ~3);
packet = hpsb_alloc_packet(length);
if (!packet)
return NULL;
......@@ -296,7 +296,7 @@ struct hpsb_packet *hpsb_make_writepacket (struct hpsb_host *host, nodeid_t node
if (length == 0)
return NULL;
packet = hpsb_alloc_packet((length + 3) & ~3);
packet = hpsb_alloc_packet(length);
if (!packet)
return NULL;
......@@ -330,7 +330,7 @@ struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, i
if (length == 0)
return NULL;
packet = hpsb_alloc_packet((length + 3) & ~3);
packet = hpsb_alloc_packet(length);
if (!packet)
return NULL;
......@@ -338,7 +338,7 @@ struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, i
packet->data[length >> 2] = 0;
}
packet->host = host;
if (hpsb_get_tlabel(packet)) {
hpsb_free_packet(packet);
return NULL;
......@@ -430,17 +430,17 @@ struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host, nodeid_t node
}
struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host,
quadlet_t data)
quadlet_t data)
{
struct hpsb_packet *p;
struct hpsb_packet *p;
p = hpsb_alloc_packet(0);
if (!p) return NULL;
p = hpsb_alloc_packet(0);
if (!p) return NULL;
p->host = host;
fill_phy_packet(p, data);
p->host = host;
fill_phy_packet(p, data);
return p;
return p;
}
struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host,
......@@ -470,7 +470,7 @@ int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation,
{
struct hpsb_packet *packet;
int retval = 0;
if (length == 0)
return -EINVAL;
......@@ -544,7 +544,7 @@ int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation,
BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet
packet = hpsb_make_lockpacket(host, node, addr, extcode, data, arg);
packet = hpsb_make_lockpacket(host, node, addr, extcode, data, arg);
if (!packet)
return -ENOMEM;
......@@ -607,7 +607,7 @@ int hpsb_send_gasp(struct hpsb_host *host, int channel, unsigned int generation,
HPSB_VERBOSE("Send GASP: channel = %d, length = %Zd", channel, length);
length += 8;
packet = hpsb_make_streampacket(host, NULL, length, channel, 3, 0);
if (!packet)
return -ENOMEM;
......
......@@ -274,7 +274,7 @@ int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync)
cycle %= 8000;
isoctl_args[0] = cycle;
if (tag_mask < 0)
/* match all tags */
tag_mask = 0xF;
......@@ -358,7 +358,7 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag
}
}
out:
out:
spin_unlock_irqrestore(&iso->lock, flags);
return rv;
}
......
......@@ -88,7 +88,7 @@ static struct csr1212_bus_ops nodemgr_csr_ops = {
};
/*
/*
* Basically what we do here is start off retrieving the bus_info block.
* From there will fill in some info about the node, verify it is of IEEE
* 1394 type, and that the crc checks out ok. After that we start off with
......@@ -102,7 +102,7 @@ static struct csr1212_bus_ops nodemgr_csr_ops = {
* that's easy to parse by the protocol interface.
*/
/*
/*
* The nodemgr relies heavily on the Driver Model for device callbacks and
* driver/device mappings. The old nodemgr used to handle all this itself,
* but now we are much simpler because of the LDM.
......@@ -273,7 +273,7 @@ static ssize_t fw_show_ne_bus_options(struct device *dev, char *buf)
ne->busopt.irmc,
ne->busopt.cmc, ne->busopt.isc, ne->busopt.bmc,
ne->busopt.pmc, ne->busopt.generation, ne->busopt.lnkspd,
ne->busopt.max_rec,
ne->busopt.max_rec,
ne->busopt.max_rom,
ne->busopt.cyc_clk_acc);
}
......@@ -328,7 +328,7 @@ static ssize_t fw_get_ignore_driver(struct device *dev, char *buf)
struct unit_directory *ud = container_of(dev, struct unit_directory, device);
return sprintf(buf, "%d\n", ud->ignore_driver);
}
}
static DEVICE_ATTR(ignore_driver, S_IWUSR | S_IRUGO, fw_get_ignore_driver, fw_set_ignore_driver);
......@@ -356,7 +356,6 @@ static int nodemgr_rescan_bus_thread(void *__unused)
{
/* No userlevel access needed */
daemonize("kfwrescan");
allow_signal(SIGTERM);
bus_rescan_devices(&ieee1394_bus_type);
......@@ -726,7 +725,7 @@ static void nodemgr_update_bus_options(struct node_entry *ne)
ne->busopt.max_rom = (busoptions >> 8) & 0x3;
ne->busopt.generation = (busoptions >> 4) & 0xf;
ne->busopt.lnkspd = busoptions & 0x7;
HPSB_VERBOSE("NodeMgr: raw=0x%08x irmc=%d cmc=%d isc=%d bmc=%d pmc=%d "
"cyc_clk_acc=%d max_rec=%d max_rom=%d gen=%d lspd=%d",
busoptions, ne->busopt.irmc, ne->busopt.cmc,
......@@ -1012,7 +1011,7 @@ static void nodemgr_process_root_directory(struct host_info *hi, struct node_ent
case CSR1212_KV_ID_UNIT:
nodemgr_process_unit_directory(hi, ne, kv, &ud_id, NULL);
break;
break;
case CSR1212_KV_ID_DESCRIPTOR:
if (last_key_id == CSR1212_KV_ID_VENDOR) {
......@@ -1056,13 +1055,14 @@ static int nodemgr_hotplug(struct class_device *cdev, char **envp, int num_envp,
#define PUT_ENVP(fmt,val) \
do { \
int printed; \
envp[i++] = buffer; \
length += snprintf(buffer, buffer_size - length, \
printed = snprintf(buffer, buffer_size - length, \
fmt, val); \
if ((buffer_size - length <= 0) || (i >= num_envp)) \
if ((buffer_size - (length+printed) <= 0) || (i >= num_envp)) \
return -ENOMEM; \
++length; \
buffer += length; \
length += printed+1; \
buffer += printed+1; \
} while (0)
PUT_ENVP("VENDOR_ID=%06x", ud->vendor_id);
......@@ -1084,7 +1084,7 @@ static int nodemgr_hotplug(struct class_device *cdev, char **envp, int num_envp,
char *buffer, int buffer_size)
{
return -ENODEV;
}
}
#endif /* CONFIG_HOTPLUG */
......@@ -1150,7 +1150,6 @@ static void nodemgr_update_node(struct node_entry *ne, struct csr1212_csr *csr,
ne->generation = generation;
}
static void nodemgr_node_scan_one(struct host_info *hi,
......@@ -1381,8 +1380,9 @@ static void nodemgr_node_probe(struct host_info *hi, int generation)
static int nodemgr_do_irm_duties(struct hpsb_host *host, int cycles)
{
quadlet_t bc;
if (!host->is_irm)
/* if irm_id == -1 then there is no IRM on this bus */
if (!host->is_irm || host->irm_id == (nodeid_t)-1)
return 1;
host->csr.broadcast_channel |= 0x40000000; /* set validity bit */
......@@ -1467,7 +1467,6 @@ static int nodemgr_host_thread(void *__hi)
/* No userlevel access needed */
daemonize(hi->daemon_name);
allow_signal(SIGTERM);
/* Setup our device-model entries */
nodemgr_create_host_dev_files(host);
......@@ -1611,7 +1610,7 @@ int hpsb_node_read(struct node_entry *ne, u64 addr,
addr, buffer, length);
}
int hpsb_node_write(struct node_entry *ne, u64 addr,
int hpsb_node_write(struct node_entry *ne, u64 addr,
quadlet_t *buffer, size_t length)
{
unsigned int generation = ne->generation;
......@@ -1621,7 +1620,7 @@ int hpsb_node_write(struct node_entry *ne, u64 addr,
addr, buffer, length);
}
int hpsb_node_lock(struct node_entry *ne, u64 addr,
int hpsb_node_lock(struct node_entry *ne, u64 addr,
int extcode, quadlet_t *data, quadlet_t arg)
{
unsigned int generation = ne->generation;
......
......@@ -169,7 +169,7 @@ struct hpsb_host *hpsb_get_host_by_ne(struct node_entry *ne);
/*
* This will fill in the given, pre-initialised hpsb_packet with the current
* information from the node entry (host, node ID, generation number). It will
* return false if the node owning the GUID is not accessible (and not modify the
* return false if the node owning the GUID is not accessible (and not modify the
* hpsb_packet) and return true otherwise.
*
* Note that packet sending may still fail in hpsb_send_packet if a bus reset
......@@ -181,9 +181,9 @@ void hpsb_node_fill_packet(struct node_entry *ne, struct hpsb_packet *pkt);
int hpsb_node_read(struct node_entry *ne, u64 addr,
quadlet_t *buffer, size_t length);
int hpsb_node_write(struct node_entry *ne, u64 addr,
int hpsb_node_write(struct node_entry *ne, u64 addr,
quadlet_t *buffer, size_t length);
int hpsb_node_lock(struct node_entry *ne, u64 addr,
int hpsb_node_lock(struct node_entry *ne, u64 addr,
int extcode, quadlet_t *data, quadlet_t arg);
......
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.
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