Commit b0e15db0 authored by Ben Collins's avatar Ben Collins

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

into debian.org:/usr/src/kernel/ieee1394-2.6
parents 162ed082 bd6b55b0
...@@ -124,7 +124,7 @@ config IEEE1394_SBP2_PHYS_DMA ...@@ -124,7 +124,7 @@ config IEEE1394_SBP2_PHYS_DMA
config IEEE1394_ETH1394 config IEEE1394_ETH1394
tristate "Ethernet over 1394" tristate "Ethernet over 1394"
depends on IEEE1394 && EXPERIMENTAL depends on IEEE1394 && EXPERIMENTAL && INET
select IEEE1394_CONFIG_ROM_IP1394 select IEEE1394_CONFIG_ROM_IP1394
select IEEE1394_EXTRA_CONFIG_ROMS select IEEE1394_EXTRA_CONFIG_ROMS
help help
......
...@@ -319,7 +319,7 @@ void ohci1394_stop_it_ctx(struct ti_ohci *ohci, int ctx, int synchronous) ...@@ -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); control = reg_read(ohci, OHCI1394_IsoXmitContextControlSet + ctx * 16);
if ((control & OHCI1394_CONTEXT_ACTIVE) == 0) if ((control & OHCI1394_CONTEXT_ACTIVE) == 0)
break; break;
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1); schedule_timeout(1);
} }
...@@ -408,7 +408,7 @@ static void stream_shift_packet_lists(unsigned long l) ...@@ -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 /* Now that we know the list is non-empty, we can get the head
* of the list without locking, because the process context * 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); pl = list_entry(s->dma_packet_lists.next, struct packet_list, link);
last = &pl->packets[PACKET_LIST_SIZE - 1]; last = &pl->packets[PACKET_LIST_SIZE - 1];
...@@ -424,7 +424,7 @@ static void stream_shift_packet_lists(unsigned long l) ...@@ -424,7 +424,7 @@ static void stream_shift_packet_lists(unsigned long l)
if (last->db->payload_desc.status == 0) { if (last->db->payload_desc.status == 0) {
HPSB_INFO("weird interrupt..."); HPSB_INFO("weird interrupt...");
return; return;
} }
/* If the last descriptor block does not specify a branch /* If the last descriptor block does not specify a branch
* address, we have a sample underflow. * address, we have a sample underflow.
...@@ -469,7 +469,7 @@ static struct packet *stream_current_packet(struct stream *s) ...@@ -469,7 +469,7 @@ static struct packet *stream_current_packet(struct stream *s)
return &s->current_packet_list->packets[s->current_packet]; return &s->current_packet_list->packets[s->current_packet];
} }
static void stream_queue_packet(struct stream *s) static void stream_queue_packet(struct stream *s)
{ {
s->current_packet++; s->current_packet++;
...@@ -543,13 +543,13 @@ void packet_initialize(struct packet *p, struct packet *next) ...@@ -543,13 +543,13 @@ void packet_initialize(struct packet *p, struct packet *next)
DMA_CTL_OUTPUT_MORE | DMA_CTL_IMMEDIATE | 8; DMA_CTL_OUTPUT_MORE | DMA_CTL_IMMEDIATE | 8;
if (next) { if (next) {
p->db->payload_desc.control = p->db->payload_desc.control =
DMA_CTL_OUTPUT_LAST | DMA_CTL_BRANCH; DMA_CTL_OUTPUT_LAST | DMA_CTL_BRANCH;
p->db->payload_desc.branch = next->db_bus | 3; p->db->payload_desc.branch = next->db_bus | 3;
p->db->header_desc.skip = next->db_bus | 3; p->db->header_desc.skip = next->db_bus | 3;
} }
else { else {
p->db->payload_desc.control = p->db->payload_desc.control =
DMA_CTL_OUTPUT_LAST | DMA_CTL_BRANCH | DMA_CTL_OUTPUT_LAST | DMA_CTL_BRANCH |
DMA_CTL_UPDATE | DMA_CTL_IRQ; DMA_CTL_UPDATE | DMA_CTL_IRQ;
p->db->payload_desc.branch = 0; p->db->payload_desc.branch = 0;
...@@ -580,7 +580,7 @@ struct packet_list *packet_list_alloc(struct stream *s) ...@@ -580,7 +580,7 @@ struct packet_list *packet_list_alloc(struct stream *s)
for (i = 0; i < PACKET_LIST_SIZE; i++) { for (i = 0; i < PACKET_LIST_SIZE; i++) {
if (i < PACKET_LIST_SIZE - 1) if (i < PACKET_LIST_SIZE - 1)
next = &pl->packets[i + 1]; next = &pl->packets[i + 1];
else else
next = NULL; next = NULL;
packet_initialize(&pl->packets[i], next); packet_initialize(&pl->packets[i], next);
} }
...@@ -695,7 +695,7 @@ static u32 get_header_bits(struct stream *s, int sub_frame, u32 sample) ...@@ -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_PCM:
case AMDTP_FORMAT_IEC958_AC3: case AMDTP_FORMAT_IEC958_AC3:
return get_iec958_header_bits(s, sub_frame, sample); return get_iec958_header_bits(s, sub_frame, sample);
case AMDTP_FORMAT_RAW: case AMDTP_FORMAT_RAW:
return 0x40; return 0x40;
...@@ -739,18 +739,18 @@ static void fill_packet(struct stream *s, struct packet *packet, int nevents) ...@@ -739,18 +739,18 @@ static void fill_packet(struct stream *s, struct packet *packet, int nevents)
/* Fill IEEE1394 headers */ /* Fill IEEE1394 headers */
packet->db->header_desc.header[0] = 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); (s->iso_channel << 8) | (TCODE_ISO_DATA << 4);
packet->db->header_desc.header[1] = size << 16; packet->db->header_desc.header[1] = size << 16;
/* Calculate synchronization timestamp (syt). First we /* Calculate synchronization timestamp (syt). First we
* determine syt_index, that is, the index in the packet of * determine syt_index, that is, the index in the packet of
* the sample for which the timestamp is valid. */ * the sample for which the timestamp is valid. */
syt_index = (s->syt_interval - s->dbc) & (s->syt_interval - 1); syt_index = (s->syt_interval - s->dbc) & (s->syt_interval - 1);
if (syt_index < nevents) { if (syt_index < nevents) {
syt = ((atomic_read(&s->cycle_count) << 12) | syt = ((atomic_read(&s->cycle_count) << 12) |
s->cycle_offset.integer) & 0xffff; s->cycle_offset.integer) & 0xffff;
fraction_add(&s->cycle_offset, fraction_add(&s->cycle_offset,
&s->cycle_offset, &s->ticks_per_syt_offset); &s->cycle_offset, &s->ticks_per_syt_offset);
/* This next addition should be modulo 8000 (0x1f40), /* This next addition should be modulo 8000 (0x1f40),
...@@ -763,7 +763,7 @@ static void fill_packet(struct stream *s, struct packet *packet, int nevents) ...@@ -763,7 +763,7 @@ static void fill_packet(struct stream *s, struct packet *packet, int nevents)
syt = 0xffff; syt = 0xffff;
atomic_inc(&s->cycle_count2); atomic_inc(&s->cycle_count2);
/* Fill cip header */ /* Fill cip header */
packet->payload->eoh0 = 0; packet->payload->eoh0 = 0;
packet->payload->sid = s->host->host->node_id & 0x3f; packet->payload->sid = s->host->host->node_id & 0x3f;
...@@ -1072,7 +1072,7 @@ void stream_free(struct stream *s) ...@@ -1072,7 +1072,7 @@ void stream_free(struct stream *s)
* that sometimes generates an it transmit interrupt if we * that sometimes generates an it transmit interrupt if we
* later re-enable the context. * 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)); list_empty(&s->dma_packet_lists));
ohci1394_stop_it_ctx(s->host->ohci, s->iso_tasklet.context, 1); 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, ...@@ -1102,7 +1102,7 @@ static ssize_t amdtp_write(struct file *file, const char *buffer, size_t count,
unsigned char *p; unsigned char *p;
int i; int i;
size_t length; size_t length;
if (s->packet_pool == NULL) if (s->packet_pool == NULL)
return -EBADFD; return -EBADFD;
...@@ -1123,16 +1123,16 @@ static ssize_t amdtp_write(struct file *file, const char *buffer, size_t count, ...@@ -1123,16 +1123,16 @@ static ssize_t amdtp_write(struct file *file, const char *buffer, size_t count,
return -EFAULT; return -EFAULT;
if (s->input->length < s->input->size) if (s->input->length < s->input->size)
continue; continue;
stream_flush(s); stream_flush(s);
if (s->current_packet_list != NULL) if (s->current_packet_list != NULL)
continue; continue;
if (file->f_flags & O_NONBLOCK) if (file->f_flags & O_NONBLOCK)
return i + length > 0 ? i + length : -EAGAIN; 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))) !list_empty(&s->free_packet_lists)))
return -EINTR; return -EINTR;
} }
...@@ -1152,7 +1152,7 @@ static int amdtp_ioctl(struct inode *inode, struct file *file, ...@@ -1152,7 +1152,7 @@ static int amdtp_ioctl(struct inode *inode, struct file *file,
case AMDTP_IOC_CHANNEL: case AMDTP_IOC_CHANNEL:
if (copy_from_user(&cfg, (struct amdtp_ioctl *) arg, sizeof cfg)) if (copy_from_user(&cfg, (struct amdtp_ioctl *) arg, sizeof cfg))
return -EFAULT; return -EFAULT;
else else
return stream_configure(s, cmd, &cfg); return stream_configure(s, cmd, &cfg);
default: default:
...@@ -1266,6 +1266,7 @@ static int __init amdtp_init_module (void) ...@@ -1266,6 +1266,7 @@ static int __init amdtp_init_module (void)
{ {
cdev_init(&amdtp_cdev, &amdtp_fops); cdev_init(&amdtp_cdev, &amdtp_fops);
amdtp_cdev.owner = THIS_MODULE; amdtp_cdev.owner = THIS_MODULE;
kobject_set_name(&amdtp_cdev.kobj, "amdtp");
if (cdev_add(&amdtp_cdev, IEEE1394_AMDTP_DEV, 16)) { if (cdev_add(&amdtp_cdev, IEEE1394_AMDTP_DEV, 16)) {
HPSB_ERR("amdtp: unable to add char device"); HPSB_ERR("amdtp: unable to add char device");
return -EIO; return -EIO;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* *
* The dimension field specifies the dimension of the signal, that is, * The dimension field specifies the dimension of the signal, that is,
* the number of audio channels. Only AMDTP_FORMAT_RAW supports * 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 * The mode field specifies which transmission mode to use. The AMDTP
* specifies two different transmission modes: blocking and * specifies two different transmission modes: blocking and
......
...@@ -187,14 +187,14 @@ static int pcr_read(struct hpsb_host *host, int nodeid, quadlet_t *buf, ...@@ -187,14 +187,14 @@ static int pcr_read(struct hpsb_host *host, int nodeid, quadlet_t *buf,
int csraddr = addr - CSR_REGISTER_BASE; int csraddr = addr - CSR_REGISTER_BASE;
int plug; int plug;
struct cmp_host *ch; struct cmp_host *ch;
if (length != 4) if (length != 4)
return RCODE_TYPE_ERROR; return RCODE_TYPE_ERROR;
ch = hpsb_get_hostinfo(&cmp_highlevel, host); ch = hpsb_get_hostinfo(&cmp_highlevel, host);
if (csraddr == 0x900) { if (csraddr == 0x900) {
*buf = cpu_to_be32(ch->u.ompr_quadlet); *buf = cpu_to_be32(ch->u.ompr_quadlet);
return RCODE_COMPLETE; return RCODE_COMPLETE;
} }
else if (csraddr < 0x904 + ch->u.ompr.nplugs * 4) { else if (csraddr < 0x904 + ch->u.ompr.nplugs * 4) {
plug = (csraddr - 0x904) / 4; plug = (csraddr - 0x904) / 4;
...@@ -206,7 +206,7 @@ static int pcr_read(struct hpsb_host *host, int nodeid, quadlet_t *buf, ...@@ -206,7 +206,7 @@ static int pcr_read(struct hpsb_host *host, int nodeid, quadlet_t *buf,
} }
else if (csraddr == 0x980) { else if (csraddr == 0x980) {
*buf = cpu_to_be32(ch->v.impr_quadlet); *buf = cpu_to_be32(ch->v.impr_quadlet);
return RCODE_COMPLETE; return RCODE_COMPLETE;
} }
else if (csraddr < 0x984 + ch->v.impr.nplugs * 4) { else if (csraddr < 0x984 + ch->v.impr.nplugs * 4) {
plug = (csraddr - 0x984) / 4; plug = (csraddr - 0x984) / 4;
...@@ -225,10 +225,10 @@ static int pcr_lock(struct hpsb_host *host, int nodeid, quadlet_t *store, ...@@ -225,10 +225,10 @@ static int pcr_lock(struct hpsb_host *host, int nodeid, quadlet_t *store,
struct cmp_host *ch; struct cmp_host *ch;
ch = hpsb_get_hostinfo(&cmp_highlevel, host); ch = hpsb_get_hostinfo(&cmp_highlevel, host);
if (extcode != EXTCODE_COMPARE_SWAP) if (extcode != EXTCODE_COMPARE_SWAP)
return RCODE_TYPE_ERROR; return RCODE_TYPE_ERROR;
if (csraddr == 0x900) { if (csraddr == 0x900) {
/* FIXME: Ignore writes to bits 30-31 and 0-7 */ /* FIXME: Ignore writes to bits 30-31 and 0-7 */
*store = cpu_to_be32(ch->u.ompr_quadlet); *store = cpu_to_be32(ch->u.ompr_quadlet);
......
...@@ -130,23 +130,23 @@ static void host_reset(struct hpsb_host *host) ...@@ -130,23 +130,23 @@ static void host_reset(struct hpsb_host *host)
host->csr.state &= ~0x100; 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); 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->selfid_count);
host->csr.topology_map[0] = host->csr.topology_map[0] =
cpu_to_be32((host->selfid_count + 2) << 16 cpu_to_be32((host->selfid_count + 2) << 16
| csr_crc16(host->csr.topology_map + 1, | csr_crc16(host->csr.topology_map + 1,
host->selfid_count + 2)); 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); 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, | csr_crc16(host->csr.speed_map+1,
0x3f1)); 0x3f1));
} }
/* /*
* HI == seconds (bits 0:2) * HI == seconds (bits 0:2)
* LO == fraction units of 1/8000 of a second, as per 1394 (bits 19:31) * 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) ...@@ -161,7 +161,7 @@ static void host_reset(struct hpsb_host *host)
static inline void calculate_expire(struct csr_control *csr) static inline void calculate_expire(struct csr_control *csr)
{ {
unsigned long units; unsigned long units;
/* Take the seconds, and convert to units */ /* Take the seconds, and convert to units */
units = (unsigned long)(csr->split_timeout_hi & 0x07) << 13; units = (unsigned long)(csr->split_timeout_hi & 0x07) << 13;
...@@ -288,7 +288,7 @@ static void remove_host(struct hpsb_host *host) ...@@ -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) size_t buffersize, unsigned char rom_version)
{ {
unsigned long flags; unsigned long flags;
...@@ -296,7 +296,7 @@ int hpsb_update_config_rom(struct hpsb_host *host, const quadlet_t *new_rom, ...@@ -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"); 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) if (rom_version != host->csr.generation)
ret = -1; ret = -1;
else if (buffersize > host->csr.rom->cache_head->size) 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, ...@@ -329,10 +329,10 @@ static int read_maps(struct hpsb_host *host, int nodeid, quadlet_t *buffer,
int csraddr = addr - CSR_REGISTER_BASE; int csraddr = addr - CSR_REGISTER_BASE;
const char *src; const char *src;
spin_lock_irqsave(&host->csr.lock, flags); spin_lock_irqsave(&host->csr.lock, flags);
if (csraddr < CSR_SPEED_MAP) { if (csraddr < CSR_SPEED_MAP) {
src = ((char *)host->csr.topology_map) + csraddr src = ((char *)host->csr.topology_map) + csraddr
- CSR_TOPOLOGY_MAP; - CSR_TOPOLOGY_MAP;
} else { } else {
src = ((char *)host->csr.speed_map) + csraddr - CSR_SPEED_MAP; 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, ...@@ -352,7 +352,7 @@ static int read_regs(struct hpsb_host *host, int nodeid, quadlet_t *buf,
int csraddr = addr - CSR_REGISTER_BASE; int csraddr = addr - CSR_REGISTER_BASE;
int oldcycle; int oldcycle;
quadlet_t ret; quadlet_t ret;
if ((csraddr | length) & 0x3) if ((csraddr | length) & 0x3)
return RCODE_TYPE_ERROR; return RCODE_TYPE_ERROR;
...@@ -404,7 +404,7 @@ static int read_regs(struct hpsb_host *host, int nodeid, quadlet_t *buf, ...@@ -404,7 +404,7 @@ static int read_regs(struct hpsb_host *host, int nodeid, quadlet_t *buf,
/* cycle time wrapped around */ /* cycle time wrapped around */
host->csr.bus_time += (1 << 7); 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)); | (host->csr.cycle_time >> 25));
out; out;
...@@ -464,7 +464,7 @@ static int write_regs(struct hpsb_host *host, int nodeid, int destid, ...@@ -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) quadlet_t *data, u64 addr, size_t length, u16 flags)
{ {
int csraddr = addr - CSR_REGISTER_BASE; int csraddr = addr - CSR_REGISTER_BASE;
if ((csraddr | length) & 0x3) if ((csraddr | length) & 0x3)
return RCODE_TYPE_ERROR; return RCODE_TYPE_ERROR;
...@@ -494,12 +494,12 @@ static int write_regs(struct hpsb_host *host, int nodeid, int destid, ...@@ -494,12 +494,12 @@ static int write_regs(struct hpsb_host *host, int nodeid, int destid,
return RCODE_ADDRESS_ERROR; return RCODE_ADDRESS_ERROR;
case CSR_SPLIT_TIMEOUT_HI: case CSR_SPLIT_TIMEOUT_HI:
host->csr.split_timeout_hi = host->csr.split_timeout_hi =
be32_to_cpu(*(data++)) & 0x00000007; be32_to_cpu(*(data++)) & 0x00000007;
calculate_expire(&host->csr); calculate_expire(&host->csr);
out; out;
case CSR_SPLIT_TIMEOUT_LO: case CSR_SPLIT_TIMEOUT_LO:
host->csr.split_timeout_lo = host->csr.split_timeout_lo =
be32_to_cpu(*(data++)) & 0xfff80000; be32_to_cpu(*(data++)) & 0xfff80000;
calculate_expire(&host->csr); calculate_expire(&host->csr);
out; out;
......
/* /*
* csr1212.c -- IEEE 1212 Control and Status Register support for Linux * csr1212.c -- IEEE 1212 Control and Status Register support for Linux
* *
* Copyright (C) 2003 Francois Retief <fgretief@sun.ac.za> * Copyright (C) 2003 Francois Retief <fgretief@sun.ac.za>
* Steve Kinneberg <kinnebergsteve@acmsystems.com> * Steve Kinneberg <kinnebergsteve@acmsystems.com>
* *
...@@ -173,7 +173,7 @@ struct csr1212_csr *csr1212_create_csr(struct csr1212_bus_ops *ops, ...@@ -173,7 +173,7 @@ struct csr1212_csr *csr1212_create_csr(struct csr1212_bus_ops *ops,
if (!csr) if (!csr)
return NULL; return NULL;
csr->cache_head = csr->cache_head =
csr1212_rom_cache_malloc(CSR1212_CONFIG_ROM_SPACE_OFFSET, csr1212_rom_cache_malloc(CSR1212_CONFIG_ROM_SPACE_OFFSET,
CSR1212_CONFIG_ROM_SPACE_SIZE); CSR1212_CONFIG_ROM_SPACE_SIZE);
if (!csr->cache_head) { if (!csr->cache_head) {
...@@ -238,7 +238,7 @@ static struct csr1212_keyval *csr1212_new_keyval(u_int8_t type, u_int8_t key) ...@@ -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 *csr1212_new_immediate(u_int8_t key, u_int32_t value)
{ {
struct csr1212_keyval *kv = csr1212_new_keyval(CSR1212_KV_TYPE_IMMEDIATE, key); struct csr1212_keyval *kv = csr1212_new_keyval(CSR1212_KV_TYPE_IMMEDIATE, key);
if (!kv) if (!kv)
return NULL; return NULL;
...@@ -253,11 +253,10 @@ struct csr1212_keyval *csr1212_new_leaf(u_int8_t key, const void *data, size_t d ...@@ -253,11 +253,10 @@ struct csr1212_keyval *csr1212_new_leaf(u_int8_t key, const void *data, size_t d
if (!kv) if (!kv)
return NULL; return NULL;
if (data_len > 0) { if (data_len > 0) {
kv->value.leaf.data = CSR1212_MALLOC(data_len); kv->value.leaf.data = CSR1212_MALLOC(data_len);
if (!kv->value.leaf.data) if (!kv->value.leaf.data) {
{
CSR1212_FREE(kv); CSR1212_FREE(kv);
return NULL; return NULL;
} }
...@@ -572,7 +571,7 @@ struct csr1212_keyval *csr1212_new_modifiable_descriptor_leaf(u_int16_t max_size ...@@ -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_MAX_SIZE(kv, max_size);
CSR1212_MODIFIABLE_DESCRIPTOR_SET_ADDRESS_HI(kv, address); CSR1212_MODIFIABLE_DESCRIPTOR_SET_ADDRESS_HI(kv, address);
CSR1212_MODIFIABLE_DESCRIPTOR_SET_ADDRESS_LO(kv, address); CSR1212_MODIFIABLE_DESCRIPTOR_SET_ADDRESS_LO(kv, address);
return kv; return kv;
} }
...@@ -621,7 +620,7 @@ struct csr1212_keyval *csr1212_new_keyword_leaf(int strc, const char *strv[]) ...@@ -621,7 +620,7 @@ struct csr1212_keyval *csr1212_new_keyword_leaf(int strc, const char *strv[])
/* make sure last quadlet is zeroed out */ /* make sure last quadlet is zeroed out */
*((u_int32_t*)&(buffer[(data_len - 1) & ~0x3])) = 0; *((u_int32_t*)&(buffer[(data_len - 1) & ~0x3])) = 0;
/* Copy keyword(s) into leaf data buffer */ /* Copy keyword(s) into leaf data buffer */
for (i = 0; i < strc; i++) { for (i = 0; i < strc; i++) {
int len = strlen(strv[i]) + 1; int len = strlen(strv[i]) + 1;
...@@ -643,7 +642,7 @@ void csr1212_detach_keyval_from_directory(struct csr1212_keyval *dir, ...@@ -643,7 +642,7 @@ void csr1212_detach_keyval_from_directory(struct csr1212_keyval *dir,
return; return;
dentry = csr1212_find_keyval(dir, kv); dentry = csr1212_find_keyval(dir, kv);
if (!dentry) if (!dentry)
return; return;
...@@ -788,8 +787,7 @@ static int csr1212_append_new_cache(struct csr1212_csr *csr, size_t romsize) ...@@ -788,8 +787,7 @@ static int csr1212_append_new_cache(struct csr1212_csr *csr, size_t romsize)
return CSR1212_ENOMEM; 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); csr1212_release_keyval(cache->ext_rom);
csr->ops->release_addr(csr_addr, csr->private); csr->ops->release_addr(csr_addr, csr->private);
CSR1212_FREE(cache); CSR1212_FREE(cache);
...@@ -1119,12 +1117,11 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr) ...@@ -1119,12 +1117,11 @@ int csr1212_generate_csr_image(struct csr1212_csr *csr)
/* Remove unused, excess cache regions */ /* Remove unused, excess cache regions */
while (cache) { while (cache) {
struct csr1212_csr_rom_cache *oc = cache; struct csr1212_csr_rom_cache *oc = cache;
cache = cache->next; cache = cache->next;
csr1212_remove_cache(csr, oc); csr1212_remove_cache(csr, oc);
} }
/* Go through the list backward so that when done, the correct CRC /* Go through the list backward so that when done, the correct CRC
* will be calculated for the Extended ROM areas. */ * will be calculated for the Extended ROM areas. */
for(cache = csr->cache_tail; cache; cache = cache->prev) { for(cache = csr->cache_tail; cache; cache = cache->prev) {
...@@ -1263,7 +1260,7 @@ static inline int csr1212_parse_dir_entry(struct csr1212_keyval *dir, ...@@ -1263,7 +1260,7 @@ static inline int csr1212_parse_dir_entry(struct csr1212_keyval *dir,
ret = CSR1212_ENOMEM; ret = CSR1212_ENOMEM;
goto fail; goto fail;
} }
k->refcnt = 0; /* Don't keep local reference when parsing. */ k->refcnt = 0; /* Don't keep local reference when parsing. */
break; break;
...@@ -1450,7 +1447,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) ...@@ -1450,7 +1447,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
newcr = CSR1212_MALLOC(sizeof(struct csr1212_cache_region)); newcr = CSR1212_MALLOC(sizeof(struct csr1212_cache_region));
if (!newcr) if (!newcr)
return CSR1212_ENOMEM; return CSR1212_ENOMEM;
newcr->offset_start = cache_index & ~(csr->max_rom - 1); newcr->offset_start = cache_index & ~(csr->max_rom - 1);
newcr->offset_end = newcr->offset_start; newcr->offset_end = newcr->offset_start;
newcr->next = cr; newcr->next = cr;
...@@ -1474,7 +1471,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv) ...@@ -1474,7 +1471,7 @@ int _csr1212_read_keyval(struct csr1212_csr *csr, struct csr1212_keyval *kv)
newcr = CSR1212_MALLOC(sizeof(struct csr1212_cache_region)); newcr = CSR1212_MALLOC(sizeof(struct csr1212_cache_region));
if (!newcr) if (!newcr)
return CSR1212_ENOMEM; return CSR1212_ENOMEM;
newcr->offset_start = cache_index & ~(csr->max_rom - 1); newcr->offset_start = cache_index & ~(csr->max_rom - 1);
newcr->offset_end = newcr->offset_start; newcr->offset_end = newcr->offset_start;
newcr->prev = cr; newcr->prev = cr;
......
/* /*
* csr1212.h -- IEEE 1212 Control and Status Register support for Linux * csr1212.h -- IEEE 1212 Control and Status Register support for Linux
* *
* Copyright (C) 2003 Francois Retief <fgretief@sun.ac.za> * Copyright (C) 2003 Francois Retief <fgretief@sun.ac.za>
* Steve Kinneberg <kinnebergsteve@acmsystems.com> * Steve Kinneberg <kinnebergsteve@acmsystems.com>
* *
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/sched.h>
#define CSR1212_MALLOC(size) kmalloc((size), in_interrupt() ? GFP_ATOMIC : GFP_KERNEL) #define CSR1212_MALLOC(size) kmalloc((size), in_interrupt() ? GFP_ATOMIC : GFP_KERNEL)
#define CSR1212_FREE(ptr) kfree(ptr) #define CSR1212_FREE(ptr) kfree(ptr)
...@@ -440,7 +441,7 @@ static inline u_int32_t *CSR1212_ICON_DESCRIPTOR_LEAF_PIXELS(struct csr1212_keyv ...@@ -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 pd[4] = { 0, 4, 16, 256 };
static const int cs[16] = { 4, 2 }; static const int cs[16] = { 4, 2 };
int ps = pd[CSR1212_ICON_DESCRIPTOR_LEAF_PALETTE_DEPTH(kv)]; int ps = pd[CSR1212_ICON_DESCRIPTOR_LEAF_PALETTE_DEPTH(kv)];
return &kv->value.leaf.data[5 + return &kv->value.leaf.data[5 +
(ps * cs[CSR1212_ICON_DESCRIPTOR_LEAF_COLOR_SPACE(kv)]) / (ps * cs[CSR1212_ICON_DESCRIPTOR_LEAF_COLOR_SPACE(kv)]) /
sizeof(u_int32_t)]; sizeof(u_int32_t)];
...@@ -705,7 +706,7 @@ static inline void csr1212_release_keyval(struct csr1212_keyval *kv) ...@@ -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). * _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. * _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. * _pos is a struct csr1212_dentry * that is used internally for indexing.
* *
* kv will be NULL upon exit of the loop. * kv will be NULL upon exit of the loop.
*/ */
#define csr1212_for_each_dir_entry(_csr, _kv, _dir, _pos) \ #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 ...@@ -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 */ /* fill scatter/gather list with pages */
for (i = 0; i < dma->n_pages; i++) { for (i = 0; i < dma->n_pages; i++) {
unsigned long va = (unsigned long) dma->kvirt + (i << PAGE_SHIFT); unsigned long va = (unsigned long) dma->kvirt + (i << PAGE_SHIFT);
dma->sglist[i].page = vmalloc_to_page((void *)va); dma->sglist[i].page = vmalloc_to_page((void *)va);
dma->sglist[i].length = PAGE_SIZE; dma->sglist[i].length = PAGE_SIZE;
} }
...@@ -196,6 +196,8 @@ void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset, un ...@@ -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); pci_dma_sync_sg_for_device(dma->dev, &dma->sglist[first], last - first + 1, dma->direction);
} }
#ifdef CONFIG_MMU
/* nopage() handler for mmap access */ /* nopage() handler for mmap access */
static struct page* static struct page*
...@@ -251,3 +253,12 @@ int dma_region_mmap(struct dma_region *dma, struct file *file, struct vm_area_st ...@@ -251,3 +253,12 @@ int dma_region_mmap(struct dma_region *dma, struct file *file, struct vm_area_st
return 0; 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 @@ ...@@ -14,7 +14,7 @@
#include <asm/scatterlist.h> #include <asm/scatterlist.h>
/* struct dma_prog_region /* struct dma_prog_region
a small, physically-contiguous DMA buffer with random-access, a small, physically-contiguous DMA buffer with random-access,
synchronous usage characteristics synchronous usage characteristics
*/ */
...@@ -37,7 +37,7 @@ static inline dma_addr_t dma_prog_region_offset_to_bus(struct dma_prog_region *p ...@@ -37,7 +37,7 @@ static inline dma_addr_t dma_prog_region_offset_to_bus(struct dma_prog_region *p
} }
/* struct dma_region /* struct dma_region
a large, non-physically-contiguous DMA buffer with streaming, a large, non-physically-contiguous DMA buffer with streaming,
asynchronous usage characteristics asynchronous usage characteristics
*/ */
......
...@@ -34,11 +34,11 @@ ...@@ -34,11 +34,11 @@
/* none of this is exposed to user-space */ /* none of this is exposed to user-space */
/* /*
the 8-byte CIP (Common Isochronous Packet) header that precedes the 8-byte CIP (Common Isochronous Packet) header that precedes
each packet of DV data. each packet of DV data.
See the IEC 61883 standard. See the IEC 61883 standard.
*/ */
struct CIP_header { unsigned char b[8]; }; struct CIP_header { unsigned char b[8]; };
...@@ -71,10 +71,10 @@ static inline void fill_cip_header(struct CIP_header *cip, ...@@ -71,10 +71,10 @@ static inline void fill_cip_header(struct CIP_header *cip,
/* /*
DMA commands used to program the OHCI's DMA engine 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]; }; struct output_more_immediate { u32 q[8]; };
...@@ -95,17 +95,17 @@ static inline void fill_output_more_immediate(struct output_more_immediate *omi, ...@@ -95,17 +95,17 @@ static inline void fill_output_more_immediate(struct output_more_immediate *omi,
omi->q[1] = 0; omi->q[1] = 0;
omi->q[2] = 0; omi->q[2] = 0;
omi->q[3] = 0; omi->q[3] = 0;
/* IT packet header */ /* IT packet header */
omi->q[4] = cpu_to_le32( (0x0 << 16) /* IEEE1394_SPEED_100 */ omi->q[4] = cpu_to_le32( (0x0 << 16) /* IEEE1394_SPEED_100 */
| (tag << 14) | (tag << 14)
| (channel << 8) | (channel << 8)
| (TCODE_ISO_DATA << 4) | (TCODE_ISO_DATA << 4)
| (sync_tag) ); | (sync_tag) );
/* reserved field; mimic behavior of my Sony DSR-40 */ /* reserved field; mimic behavior of my Sony DSR-40 */
omi->q[5] = cpu_to_le32((payload_size << 16) | (0x7F << 8) | 0xA0); omi->q[5] = cpu_to_le32((payload_size << 16) | (0x7F << 8) | 0xA0);
omi->q[6] = 0; omi->q[6] = 0;
omi->q[7] = 0; omi->q[7] = 0;
} }
...@@ -186,11 +186,11 @@ static inline void fill_input_last(struct input_last *il, ...@@ -186,11 +186,11 @@ static inline void fill_input_last(struct input_last *il,
/* /*
A "DMA descriptor block" consists of several contiguous DMA commands. A "DMA descriptor block" consists of several contiguous DMA commands.
struct DMA_descriptor_block encapsulates all of the commands necessary struct DMA_descriptor_block encapsulates all of the commands necessary
to send one packet of DV data. to send one packet of DV data.
There are three different types of these blocks: There are three different types of these blocks:
1) command to send an empty packet (CIP header only, no DV data): 1) command to send an empty packet (CIP header only, no DV data):
...@@ -225,44 +225,44 @@ struct DMA_descriptor_block { ...@@ -225,44 +225,44 @@ struct DMA_descriptor_block {
union { union {
struct { struct {
/* iso header, common to all output block types */ /* iso header, common to all output block types */
struct output_more_immediate omi; struct output_more_immediate omi;
union { union {
/* empty packet */ /* empty packet */
struct { struct {
struct output_last ol; /* CIP header */ struct output_last ol; /* CIP header */
} empty; } empty;
/* full packet */ /* full packet */
struct { struct {
struct output_more om; /* CIP header */ struct output_more om; /* CIP header */
union { union {
/* payload does not cross page boundary */ /* payload does not cross page boundary */
struct { struct {
struct output_last ol; /* data payload */ struct output_last ol; /* data payload */
} nocross; } nocross;
/* payload crosses page boundary */ /* payload crosses page boundary */
struct { struct {
struct output_more om; /* data payload */ struct output_more om; /* data payload */
struct output_last ol; /* data payload */ struct output_last ol; /* data payload */
} cross; } cross;
} u; } u;
} full; } full;
} u; } u;
} out; } out;
struct { struct {
struct input_last il; struct input_last il;
} in; } in;
} u; } 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 */ by padding out to 128 bytes */
u32 __pad__[12]; u32 __pad__[12];
}; };
...@@ -281,7 +281,7 @@ struct frame { ...@@ -281,7 +281,7 @@ struct frame {
/* index of this frame in video_card->frames[] */ /* index of this frame in video_card->frames[] */
unsigned int frame_num; 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 FRAME_READY - DMA program written, ready to transmit
Changes to these should be locked against the interrupt Changes to these should be locked against the interrupt
...@@ -290,7 +290,7 @@ struct frame { ...@@ -290,7 +290,7 @@ struct frame {
FRAME_CLEAR = 0, FRAME_CLEAR = 0,
FRAME_READY FRAME_READY
} state; } state;
/* whether this frame has been DMA'ed already; used only from /* whether this frame has been DMA'ed already; used only from
the IRQ handler to determine whether the frame can be reset */ the IRQ handler to determine whether the frame can be reset */
int done; int done;
...@@ -299,7 +299,7 @@ struct frame { ...@@ -299,7 +299,7 @@ struct frame {
/* kernel virtual pointer to the start of this frame's data in /* kernel virtual pointer to the start of this frame's data in
the user ringbuffer. Use only for CPU access; to get the DMA the user ringbuffer. Use only for CPU access; to get the DMA
bus address you must go through the video->user_dma mapping */ bus address you must go through the video->user_dma mapping */
unsigned long data; unsigned long data;
/* Max # of packets per frame */ /* Max # of packets per frame */
#define MAX_PACKETS 500 #define MAX_PACKETS 500
...@@ -310,7 +310,7 @@ struct frame { ...@@ -310,7 +310,7 @@ struct frame {
struct CIP_header *header_pool; struct CIP_header *header_pool;
dma_addr_t header_pool_dma; dma_addr_t header_pool_dma;
/* a physically contiguous memory pool for allocating DMA /* a physically contiguous memory pool for allocating DMA
descriptor blocks; usually around 64KB in size descriptor blocks; usually around 64KB in size
!descriptor_pool must be aligned to PAGE_SIZE! */ !descriptor_pool must be aligned to PAGE_SIZE! */
...@@ -338,7 +338,7 @@ struct frame { ...@@ -338,7 +338,7 @@ struct frame {
/* pointer to the first packet's CIP header (where the timestamp goes) */ /* pointer to the first packet's CIP header (where the timestamp goes) */
struct CIP_header *cip_syt1; struct CIP_header *cip_syt1;
/* pointer to the second packet's CIP header /* pointer to the second packet's CIP header
(only set if the first packet was empty) */ (only set if the first packet was empty) */
struct CIP_header *cip_syt2; struct CIP_header *cip_syt2;
...@@ -384,7 +384,7 @@ static void frame_delete(struct frame *f); ...@@ -384,7 +384,7 @@ static void frame_delete(struct frame *f);
static void frame_reset(struct frame *f); static void frame_reset(struct frame *f);
/* struct video_card contains all data associated with one instance /* struct video_card contains all data associated with one instance
of the dv1394 driver of the dv1394 driver
*/ */
enum modes { enum modes {
MODE_RECEIVE, MODE_RECEIVE,
...@@ -411,7 +411,7 @@ struct video_card { ...@@ -411,7 +411,7 @@ struct video_card {
u32 ohci_IsoXmitContextControlSet; u32 ohci_IsoXmitContextControlSet;
u32 ohci_IsoXmitContextControlClear; u32 ohci_IsoXmitContextControlClear;
u32 ohci_IsoXmitCommandPtr; u32 ohci_IsoXmitCommandPtr;
/* OHCI card IR DMA context number, -1 if not in use */ /* OHCI card IR DMA context number, -1 if not in use */
struct ohci1394_iso_tasklet ir_tasklet; struct ohci1394_iso_tasklet ir_tasklet;
int ohci_ir_ctx; int ohci_ir_ctx;
...@@ -421,10 +421,10 @@ struct video_card { ...@@ -421,10 +421,10 @@ struct video_card {
u32 ohci_IsoRcvContextControlClear; u32 ohci_IsoRcvContextControlClear;
u32 ohci_IsoRcvCommandPtr; u32 ohci_IsoRcvCommandPtr;
u32 ohci_IsoRcvContextMatch; u32 ohci_IsoRcvContextMatch;
/* CONCURRENCY CONTROL */ /* CONCURRENCY CONTROL */
/* there are THREE levels of locking associated with video_card. */ /* there are THREE levels of locking associated with video_card. */
/* /*
...@@ -435,7 +435,7 @@ struct video_card { ...@@ -435,7 +435,7 @@ struct video_card {
*/ */
unsigned long open; unsigned long open;
/* /*
2) the spinlock - this provides mutual exclusion between the interrupt 2) the spinlock - this provides mutual exclusion between the interrupt
handler and process-context operations. Generally you must take the handler and process-context operations. Generally you must take the
spinlock under the following conditions: spinlock under the following conditions:
...@@ -458,7 +458,7 @@ struct video_card { ...@@ -458,7 +458,7 @@ struct video_card {
/* flag to prevent spurious interrupts (which OHCI seems to /* flag to prevent spurious interrupts (which OHCI seems to
generate a lot :) from accessing the struct */ generate a lot :) from accessing the struct */
int dma_running; int dma_running;
/* /*
3) the sleeping semaphore 'sem' - this is used from process context only, 3) the sleeping semaphore 'sem' - this is used from process context only,
to serialize various operations on the video_card. Even though only one to serialize various operations on the video_card. Even though only one
...@@ -477,24 +477,24 @@ struct video_card { ...@@ -477,24 +477,24 @@ struct video_card {
/* support asynchronous I/O signals (SIGIO) */ /* support asynchronous I/O signals (SIGIO) */
struct fasync_struct *fasync; struct fasync_struct *fasync;
/* the large, non-contiguous (rvmalloc()) ringbuffer for DV /* the large, non-contiguous (rvmalloc()) ringbuffer for DV
data, exposed to user-space via mmap() */ data, exposed to user-space via mmap() */
unsigned long dv_buf_size; unsigned long dv_buf_size;
struct dma_region dv_buf; struct dma_region dv_buf;
/* next byte in the ringbuffer that a write() call will fill */ /* next byte in the ringbuffer that a write() call will fill */
size_t write_off; size_t write_off;
struct frame *frames[DV1394_MAX_FRAMES]; struct frame *frames[DV1394_MAX_FRAMES];
/* n_frames also serves as an indicator that this struct video_card is /* n_frames also serves as an indicator that this struct video_card is
initialized and ready to run DMA buffers */ initialized and ready to run DMA buffers */
int n_frames; int n_frames;
/* this is the frame that is currently "owned" by the OHCI DMA controller /* 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 ! ! must lock against the interrupt handler when accessing it !
...@@ -511,7 +511,6 @@ struct video_card { ...@@ -511,7 +511,6 @@ struct video_card {
The interrupt handler will NEVER advance active_frame to a The interrupt handler will NEVER advance active_frame to a
frame that is not READY. frame that is not READY.
*/ */
int active_frame; int active_frame;
int first_run; int first_run;
...@@ -521,10 +520,10 @@ struct video_card { ...@@ -521,10 +520,10 @@ struct video_card {
/* altered ONLY from process context. Must check first_clear_frame->state; /* 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 READY, that means the ringbuffer is full with READY frames;
if it's CLEAR, that means one or more ringbuffer frames are CLEAR */ 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 */ /* altered both by process and interrupt */
unsigned int n_clear_frames; unsigned int n_clear_frames;
/* only altered by the interrupt */ /* only altered by the interrupt */
unsigned int dropped_frames; unsigned int dropped_frames;
...@@ -548,17 +547,17 @@ struct video_card { ...@@ -548,17 +547,17 @@ struct video_card {
/* the isochronous channel to use, -1 if video card is inactive */ /* the isochronous channel to use, -1 if video card is inactive */
int channel; int channel;
/* physically contiguous packet ringbuffer for receive */ /* physically contiguous packet ringbuffer for receive */
struct dma_region packet_buf; struct dma_region packet_buf;
unsigned long packet_buf_size; unsigned long packet_buf_size;
unsigned int current_packet; unsigned int current_packet;
int first_frame; /* received first start frame marker? */ int first_frame; /* received first start frame marker? */
enum modes mode; enum modes mode;
}; };
/* /*
if the video_card is not initialized, then the ONLY fields that are valid are: if the video_card is not initialized, then the ONLY fields that are valid are:
ohci ohci
open open
...@@ -575,7 +574,7 @@ static int do_dv1394_init_default(struct video_card *video); ...@@ -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); 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 */ calibrated against a Sony DSR-40 DVCAM deck */
#define CIP_N_NTSC 68000000 #define CIP_N_NTSC 68000000
......
This diff is collapsed.
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
To set the DV output parameters (e.g. whether you want NTSC or PAL 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 video), use the DV1394_INIT ioctl, passing in the parameters you
want in a struct dv1394_init. want in a struct dv1394_init.
Example 1: Example 1:
To play a raw .DV file: cat foo.DV > /dev/dv1394 To play a raw .DV file: cat foo.DV > /dev/dv1394
(cat will use write() internally) (cat will use write() internally)
...@@ -72,9 +72,9 @@ ...@@ -72,9 +72,9 @@
2) 2)
For more control over buffering, and to avoid unnecessary copies For more control over buffering, and to avoid unnecessary copies
of the DV data, you can use the more sophisticated the mmap() interface. of the DV data, you can use the more sophisticated the mmap() interface.
First, call the DV1394_INIT ioctl to specify your parameters, First, call the DV1394_INIT ioctl to specify your parameters,
including the number of frames in the ringbuffer. Then, calling mmap() including the number of frames in the ringbuffer. Then, calling mmap()
on the dv1394 device will give you direct access to the ringbuffer on the dv1394 device will give you direct access to the ringbuffer
from which the DV card reads your frame data. from which the DV card reads your frame data.
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
*--------------------------------------* *--------------------------------------*
| CLEAR | DV data | DV data | CLEAR | | CLEAR | DV data | DV data | CLEAR |
*--------------------------------------* *--------------------------------------*
<ACTIVE> <ACTIVE>
transmission goes in this direction --->>> transmission goes in this direction --->>>
...@@ -110,10 +110,10 @@ ...@@ -110,10 +110,10 @@
will continue to transmit frame 2, and will increase the dropped_frames will continue to transmit frame 2, and will increase the dropped_frames
counter each time it repeats the transmission). counter each time it repeats the transmission).
If you called DV1394_GET_STATUS at this instant, you would If you called DV1394_GET_STATUS at this instant, you would
receive the following values: receive the following values:
n_frames = 4 n_frames = 4
active_frame = 1 active_frame = 1
first_clear_frame = 3 first_clear_frame = 3
...@@ -144,9 +144,9 @@ ...@@ -144,9 +144,9 @@
(checks of system call return values omitted for brevity; always (checks of system call return values omitted for brevity; always
check return values in your code!) check return values in your code!)
while ( frames left ) { while ( frames left ) {
struct pollfd *pfd = ...; struct pollfd *pfd = ...;
pfd->fd = dv1394_fd; pfd->fd = dv1394_fd;
...@@ -154,12 +154,12 @@ ...@@ -154,12 +154,12 @@
pfd->events = POLLOUT | POLLIN; (OUT for transmit, IN for receive) pfd->events = POLLOUT | POLLIN; (OUT for transmit, IN for receive)
(add other sources of I/O here) (add other sources of I/O here)
poll(pfd, 1, -1); (or select(); add a timeout if you want) poll(pfd, 1, -1); (or select(); add a timeout if you want)
if (pfd->revents) { if (pfd->revents) {
struct dv1394_status status; struct dv1394_status status;
ioctl(dv1394_fd, DV1394_GET_STATUS, &status); ioctl(dv1394_fd, DV1394_GET_STATUS, &status);
if (status.dropped_frames > 0) { if (status.dropped_frames > 0) {
...@@ -183,7 +183,7 @@ ...@@ -183,7 +183,7 @@
should close the dv1394 file descriptor (and munmap() all should close the dv1394 file descriptor (and munmap() all
ringbuffer mappings, if you are using them), then re-open the ringbuffer mappings, if you are using them), then re-open the
dv1394 device (and re-map the ringbuffer). dv1394 device (and re-map the ringbuffer).
*/ */
...@@ -215,7 +215,7 @@ enum pal_or_ntsc { ...@@ -215,7 +215,7 @@ enum pal_or_ntsc {
struct dv1394_init { struct dv1394_init {
/* DV1394_API_VERSION */ /* DV1394_API_VERSION */
unsigned int api_version; unsigned int api_version;
/* isochronous transmission channel to use */ /* isochronous transmission channel to use */
unsigned int channel; unsigned int channel;
...@@ -227,7 +227,7 @@ struct dv1394_init { ...@@ -227,7 +227,7 @@ struct dv1394_init {
enum pal_or_ntsc format; enum pal_or_ntsc format;
/* the following are used only for transmission */ /* the following are used only for transmission */
/* set these to zero unless you want a /* set these to zero unless you want a
non-default empty packet rate (see below) */ non-default empty packet rate (see below) */
unsigned long cip_n; unsigned long cip_n;
...@@ -244,7 +244,7 @@ struct dv1394_init { ...@@ -244,7 +244,7 @@ struct dv1394_init {
would imply a different size for the ringbuffer). If you need a would imply a different size for the ringbuffer). If you need a
different buffer size, simply close and re-open the device, then different buffer size, simply close and re-open the device, then
initialize it with your new settings. */ initialize it with your new settings. */
/* Q: What are cip_n and cip_d? */ /* Q: What are cip_n and cip_d? */
/* /*
...@@ -261,13 +261,13 @@ struct dv1394_init { ...@@ -261,13 +261,13 @@ struct dv1394_init {
The default empty packet insertion rate seems to work for many people; if 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, 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 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 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. 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 You can alter the empty packet rate by passing non-zero values for cip_n
and cip_d to the INIT ioctl. and cip_d to the INIT ioctl.
*/ */
......
/* /*
* eth1394.c -- Ethernet driver for Linux IEEE-1394 Subsystem * eth1394.c -- Ethernet driver for Linux IEEE-1394 Subsystem
* *
* Copyright (C) 2001-2003 Ben Collins <bcollins@debian.org> * Copyright (C) 2001-2003 Ben Collins <bcollins@debian.org>
* 2000 Bonin Franck <boninf@free.fr> * 2000 Bonin Franck <boninf@free.fr>
* 2003 Steve Kinneberg <kinnebergsteve@acmsystems.com> * 2003 Steve Kinneberg <kinnebergsteve@acmsystems.com>
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
#define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__) #define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__)
static char version[] __devinitdata = static char version[] __devinitdata =
"$Rev: 1175 $ Ben Collins <bcollins@debian.org>"; "$Rev: 1198 $ Ben Collins <bcollins@debian.org>";
struct fragment_info { struct fragment_info {
struct list_head list; struct list_head list;
...@@ -216,7 +216,7 @@ static struct hpsb_highlevel eth1394_highlevel = { ...@@ -216,7 +216,7 @@ static struct hpsb_highlevel eth1394_highlevel = {
/* This is called after an "ifup" */ /* This is called after an "ifup" */
static int ether1394_open (struct net_device *dev) 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; int ret = 0;
/* Something bad happened, don't even try */ /* Something bad happened, don't even try */
...@@ -278,7 +278,7 @@ static void ether1394_tx_timeout (struct net_device *dev) ...@@ -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) 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) || if ((new_mtu < 68) ||
(new_mtu > min(ETH1394_DATA_LEN, (new_mtu > min(ETH1394_DATA_LEN,
...@@ -479,7 +479,7 @@ static void ether1394_reset_priv (struct net_device *dev, int set_mtu) ...@@ -479,7 +479,7 @@ static void ether1394_reset_priv (struct net_device *dev, int set_mtu)
{ {
unsigned long flags; unsigned long flags;
int i; int i;
struct eth1394_priv *priv = (struct eth1394_priv *)dev->priv; struct eth1394_priv *priv = dev->priv;
struct hpsb_host *host = priv->host; struct hpsb_host *host = priv->host;
u64 guid = *((u64*)&(host->csr.rom->bus_info_data[3])); u64 guid = *((u64*)&(host->csr.rom->bus_info_data[3]));
u16 maxpayload = 1 << (host->csr.max_rec + 1); u16 maxpayload = 1 << (host->csr.max_rec + 1);
...@@ -652,7 +652,7 @@ static void ether1394_add_host (struct hpsb_host *host) ...@@ -652,7 +652,7 @@ static void ether1394_add_host (struct hpsb_host *host)
static void ether1394_remove_host (struct hpsb_host *host) static void ether1394_remove_host (struct hpsb_host *host)
{ {
struct eth1394_host_info *hi; struct eth1394_host_info *hi;
hi = hpsb_get_hostinfo(&eth1394_highlevel, host); hi = hpsb_get_hostinfo(&eth1394_highlevel, host);
if (hi != NULL) { if (hi != NULL) {
struct eth1394_priv *priv = (struct eth1394_priv *)hi->dev->priv; struct eth1394_priv *priv = (struct eth1394_priv *)hi->dev->priv;
...@@ -660,7 +660,7 @@ static void ether1394_remove_host (struct hpsb_host *host) ...@@ -660,7 +660,7 @@ static void ether1394_remove_host (struct hpsb_host *host)
hpsb_unregister_addrspace(&eth1394_highlevel, host, hpsb_unregister_addrspace(&eth1394_highlevel, host,
priv->local_fifo); priv->local_fifo);
if (priv->iso != NULL) if (priv->iso != NULL)
hpsb_iso_shutdown(priv->iso); hpsb_iso_shutdown(priv->iso);
if (hi->dev) { if (hi->dev) {
...@@ -731,18 +731,16 @@ static int ether1394_header(struct sk_buff *skb, struct net_device *dev, ...@@ -731,18 +731,16 @@ static int ether1394_header(struct sk_buff *skb, struct net_device *dev,
eth->h_proto = htons(type); 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); memset(eth->h_dest, 0, dev->addr_len);
return(dev->hard_header_len); return(dev->hard_header_len);
} }
if (daddr) if (daddr) {
{
memcpy(eth->h_dest,daddr,dev->addr_len); memcpy(eth->h_dest,daddr,dev->addr_len);
return dev->hard_header_len; return dev->hard_header_len;
} }
return -dev->hard_header_len; return -dev->hard_header_len;
} }
...@@ -760,15 +758,15 @@ static int ether1394_rebuild_header(struct sk_buff *skb) ...@@ -760,15 +758,15 @@ static int ether1394_rebuild_header(struct sk_buff *skb)
struct eth1394hdr *eth = (struct eth1394hdr *)skb->data; struct eth1394hdr *eth = (struct eth1394hdr *)skb->data;
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
switch (eth->h_proto) switch (eth->h_proto) {
{
#ifdef CONFIG_INET #ifdef CONFIG_INET
case __constant_htons(ETH_P_IP): case __constant_htons(ETH_P_IP):
return arp_find((unsigned char*)&eth->h_dest, skb); return arp_find((unsigned char*)&eth->h_dest, skb);
#endif #endif
default: default:
ETH1394_PRINT(KERN_DEBUG, dev->name, ETH1394_PRINT(KERN_DEBUG, dev->name,
"unable to resolve type %04x addresses.\n", "unable to resolve type %04x addresses.\n",
eth->h_proto); eth->h_proto);
break; break;
} }
...@@ -797,7 +795,7 @@ static int ether1394_header_cache(struct neighbour *neigh, struct hh_cache *hh) ...@@ -797,7 +795,7 @@ static int ether1394_header_cache(struct neighbour *neigh, struct hh_cache *hh)
eth->h_proto = type; eth->h_proto = type;
memcpy(eth->h_dest, neigh->ha, dev->addr_len); memcpy(eth->h_dest, neigh->ha, dev->addr_len);
hh->hh_len = ETH1394_HLEN; hh->hh_len = ETH1394_HLEN;
return 0; return 0;
} }
...@@ -867,7 +865,7 @@ static inline u16 ether1394_parse_encap(struct sk_buff *skb, ...@@ -867,7 +865,7 @@ static inline u16 ether1394_parse_encap(struct sk_buff *skb,
nodeid_t srcid, nodeid_t destid, nodeid_t srcid, nodeid_t destid,
u16 ether_type) u16 ether_type)
{ {
struct eth1394_priv *priv = (struct eth1394_priv *)dev->priv; struct eth1394_priv *priv = dev->priv;
u64 dest_hw; u64 dest_hw;
unsigned short ret = 0; unsigned short ret = 0;
...@@ -1010,7 +1008,7 @@ static inline int new_fragment(struct list_head *frag_info, int offset, int len) ...@@ -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); new = kmalloc(sizeof(struct fragment_info), GFP_ATOMIC);
if (!new) if (!new)
return -ENOMEM; return -ENOMEM;
new->offset = offset; new->offset = offset;
...@@ -1192,7 +1190,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid, ...@@ -1192,7 +1190,7 @@ static int ether1394_data_handler(struct net_device *dev, int srcid, int destid,
purge_partial_datagram(pdgl->prev); purge_partial_datagram(pdgl->prev);
pdg->sz--; pdg->sz--;
} }
retval = new_partial_datagram(dev, pdgl, dgl, dg_size, retval = new_partial_datagram(dev, pdgl, dgl, dg_size,
buf + hdr_len, fg_off, buf + hdr_len, fg_off,
fg_len); fg_len);
...@@ -1374,7 +1372,7 @@ static void ether1394_iso(struct hpsb_iso *iso) ...@@ -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 * 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 * 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 * 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 * 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, * 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, ...@@ -1452,7 +1450,7 @@ static inline unsigned int ether1394_encapsulate(struct sk_buff *skb,
hdr->common.lf = ETH1394_HDR_LF_IF; hdr->common.lf = ETH1394_HDR_LF_IF;
hdr->sf.fg_off = 0; hdr->sf.fg_off = 0;
break; break;
default: default:
hdr->sf.fg_off += adj_max_payload; hdr->sf.fg_off += adj_max_payload;
bufhdr = (union eth1394_hdr *)skb_pull(skb, 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, ...@@ -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 " ETH1394_PRINT_G(KERN_ERR, "No more tlabels left while sending "
"to node " NODE_BUS_FMT "\n", NODE_BUS_ARGS(host, node)); "to node " NODE_BUS_FMT "\n", NODE_BUS_ARGS(host, node));
return -1; return -1;
} }
p->header[0] = (p->node_id << 16) | (p->tlabel << 10) p->header[0] = (p->node_id << 16) | (p->tlabel << 10)
| (1 << 8) | (TCODE_WRITEB << 4); | (1 << 8) | (TCODE_WRITEB << 4);
...@@ -1538,7 +1536,6 @@ static inline void ether1394_free_packet(struct hpsb_packet *packet) ...@@ -1538,7 +1536,6 @@ static inline void ether1394_free_packet(struct hpsb_packet *packet)
{ {
if (packet->tcode != TCODE_STREAM_DATA) if (packet->tcode != TCODE_STREAM_DATA)
hpsb_free_tlabel(packet); hpsb_free_tlabel(packet);
packet->data = NULL;
hpsb_free_packet(packet); hpsb_free_packet(packet);
} }
...@@ -1583,9 +1580,9 @@ static inline void ether1394_dg_complete(struct packet_task *ptask, int fail) ...@@ -1583,9 +1580,9 @@ static inline void ether1394_dg_complete(struct packet_task *ptask, int fail)
{ {
struct sk_buff *skb = ptask->skb; struct sk_buff *skb = ptask->skb;
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
struct eth1394_priv *priv = (struct eth1394_priv *)dev->priv; struct eth1394_priv *priv = dev->priv;
unsigned long flags; unsigned long flags;
/* Statistics */ /* Statistics */
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->lock, flags);
if (fail) { if (fail) {
...@@ -1616,8 +1613,7 @@ static void ether1394_complete_cb(void *__ptask) ...@@ -1616,8 +1613,7 @@ static void ether1394_complete_cb(void *__ptask)
ether1394_free_packet(packet); ether1394_free_packet(packet);
ptask->outstanding_pkts--; ptask->outstanding_pkts--;
if (ptask->outstanding_pkts > 0 && !fail) if (ptask->outstanding_pkts > 0 && !fail) {
{
int tx_len; int tx_len;
/* Add the encapsulation header to the fragment */ /* Add the encapsulation header to the fragment */
...@@ -1637,7 +1633,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev) ...@@ -1637,7 +1633,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
{ {
int kmflags = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL; int kmflags = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
struct eth1394hdr *eth; struct eth1394hdr *eth;
struct eth1394_priv *priv = (struct eth1394_priv *)dev->priv; struct eth1394_priv *priv = dev->priv;
int proto; int proto;
unsigned long flags; unsigned long flags;
nodeid_t dest_node; nodeid_t dest_node;
...@@ -1797,7 +1793,7 @@ static int ether1394_ethtool_ioctl(struct net_device *dev, void *useraddr) ...@@ -1797,7 +1793,7 @@ static int ether1394_ethtool_ioctl(struct net_device *dev, void *useraddr)
case ETHTOOL_GDRVINFO: { case ETHTOOL_GDRVINFO: {
struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO }; struct ethtool_drvinfo info = { ETHTOOL_GDRVINFO };
strcpy (info.driver, driver_name); strcpy (info.driver, driver_name);
strcpy (info.version, "$Rev: 1175 $"); strcpy (info.version, "$Rev: 1198 $");
/* FIXME XXX provide sane businfo */ /* FIXME XXX provide sane businfo */
strcpy (info.bus_info, "ieee1394"); strcpy (info.bus_info, "ieee1394");
if (copy_to_user (useraddr, &info, sizeof (info))) if (copy_to_user (useraddr, &info, sizeof (info)))
......
...@@ -493,7 +493,7 @@ int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host, ...@@ -493,7 +493,7 @@ int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
return 0; 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) unsigned int channel)
{ {
if (channel > 63) { if (channel > 63) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
struct hpsb_address_serve { struct hpsb_address_serve {
struct list_head host_list; /* per host list */ struct list_head host_list; /* per host list */
struct list_head hl_list; /* hpsb_highlevel list */ struct list_head hl_list; /* hpsb_highlevel list */
struct hpsb_address_ops *op; struct hpsb_address_ops *op;
...@@ -19,7 +19,7 @@ struct hpsb_address_serve { ...@@ -19,7 +19,7 @@ struct hpsb_address_serve {
/* /*
* The above structs are internal to highlevel driver handling. Only the * 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 { struct hpsb_highlevel {
...@@ -68,8 +68,8 @@ struct hpsb_highlevel { ...@@ -68,8 +68,8 @@ struct hpsb_highlevel {
struct hpsb_address_ops { struct hpsb_address_ops {
/* /*
* Null function pointers will make the respective operation complete * Null function pointers will make the respective operation complete
* with RCODE_TYPE_ERROR. Makes for easy to implement read-only * with RCODE_TYPE_ERROR. Makes for easy to implement read-only
* registers (just leave everything but read NULL). * registers (just leave everything but read NULL).
* *
* All functions shall return appropriate IEEE 1394 rcodes. * All functions shall return appropriate IEEE 1394 rcodes.
...@@ -77,7 +77,7 @@ struct hpsb_address_ops { ...@@ -77,7 +77,7 @@ struct hpsb_address_ops {
/* These functions have to implement block reads for themselves. */ /* These functions have to implement block reads for themselves. */
/* These functions either return a response code /* 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 later case, no response will be sent and the driver, that handled the request
will send the response itself will send the response itself
*/ */
...@@ -104,7 +104,7 @@ void highlevel_host_reset(struct hpsb_host *host); ...@@ -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 a packet arrives. The flags argument contains the second word of the first header
quadlet of the incoming packet (containing transaction label, retry code, quadlet of the incoming packet (containing transaction label, retry code,
transaction code and priority). These functions either return a response 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 later case, no response will be sent and the driver, that handled the request
will send the response itself. will send the response itself.
*/ */
...@@ -155,7 +155,7 @@ int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host, ...@@ -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 * Enable or disable receving a certain isochronous channel through the
* iso_receive op. * 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); unsigned int channel);
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); unsigned int channel);
......
...@@ -126,9 +126,7 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra, ...@@ -126,9 +126,7 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
h->hostdata = h + 1; h->hostdata = h + 1;
h->driver = drv; h->driver = drv;
INIT_LIST_HEAD(&h->pending_packets); skb_queue_head_init(&h->pending_packet_queue);
spin_lock_init(&h->pending_pkt_lock);
INIT_LIST_HEAD(&h->addr_space); INIT_LIST_HEAD(&h->addr_space);
init_timer(&h->delayed_reset); init_timer(&h->delayed_reset);
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/skbuff.h>
#include <asm/semaphore.h> #include <asm/semaphore.h>
#include "ieee1394_types.h" #include "ieee1394_types.h"
...@@ -21,8 +23,8 @@ struct hpsb_host { ...@@ -21,8 +23,8 @@ struct hpsb_host {
atomic_t generation; atomic_t generation;
struct list_head pending_packets; struct sk_buff_head pending_packet_queue;
spinlock_t pending_pkt_lock;
struct timer_list timeout; struct timer_list timeout;
unsigned long timeout_interval; unsigned long timeout_interval;
...@@ -164,7 +166,7 @@ struct hpsb_host_driver { ...@@ -164,7 +166,7 @@ struct hpsb_host_driver {
* called. Return 0 on success, negative errno on failure. * called. Return 0 on success, negative errno on failure.
* NOTE: The function must be callable in interrupt context. * 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); struct hpsb_packet *packet);
/* This function requests miscellanous services from the driver, see /* This function requests miscellanous services from the driver, see
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#define ACK_TARDY 0xb #define ACK_TARDY 0xb
#define ACK_CONFLICT_ERROR 0xc #define ACK_CONFLICT_ERROR 0xc
#define ACK_DATA_ERROR 0xd #define ACK_DATA_ERROR 0xd
#define ACK_TYPE_ERROR 0xe #define ACK_TYPE_ERROR 0xe
#define ACK_ADDRESS_ERROR 0xf #define ACK_ADDRESS_ERROR 0xf
/* Non-standard "ACK codes" for internal use */ /* Non-standard "ACK codes" for internal use */
...@@ -74,7 +74,7 @@ extern const char *hpsb_speedto_str[]; ...@@ -74,7 +74,7 @@ extern const char *hpsb_speedto_str[];
#define SELFID_PORT_CHILD 0x3 #define SELFID_PORT_CHILD 0x3
#define SELFID_PORT_PARENT 0x2 #define SELFID_PORT_PARENT 0x2
#define SELFID_PORT_NCONN 0x1 #define SELFID_PORT_NCONN 0x1
#define SELFID_PORT_NONE 0x0 #define SELFID_PORT_NONE 0x0
#include <asm/byteorder.h> #include <asm/byteorder.h>
......
This diff is collapsed.
...@@ -12,9 +12,13 @@ ...@@ -12,9 +12,13 @@
struct hpsb_packet { struct hpsb_packet {
/* This struct is basically read-only for hosts with the exception of /* This struct is basically read-only for hosts with the exception of
* the data buffer contents and xnext - see below. */ * 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; struct list_head driver_list;
nodeid_t node_id; nodeid_t node_id;
...@@ -27,10 +31,9 @@ struct hpsb_packet { ...@@ -27,10 +31,9 @@ struct hpsb_packet {
* queued = queued for sending * queued = queued for sending
* pending = sent, waiting for response * pending = sent, waiting for response
* complete = processing completed, successful or not * complete = processing completed, successful or not
* incoming = incoming packet
*/ */
enum { enum {
hpsb_unused, hpsb_queued, hpsb_pending, hpsb_complete, hpsb_incoming hpsb_unused, hpsb_queued, hpsb_pending, hpsb_complete
} __attribute__((packed)) state; } __attribute__((packed)) state;
/* These are core internal. */ /* These are core internal. */
...@@ -67,6 +70,9 @@ struct hpsb_packet { ...@@ -67,6 +70,9 @@ struct hpsb_packet {
void (*complete_routine)(void *); void (*complete_routine)(void *);
void *complete_data; void *complete_data;
/* XXX This is just a hack at the moment */
struct sk_buff *skb;
/* Store jiffies for implementing bus timeouts. */ /* Store jiffies for implementing bus timeouts. */
unsigned long sendtime; unsigned long sendtime;
...@@ -141,7 +147,7 @@ int hpsb_bus_reset(struct hpsb_host *host); ...@@ -141,7 +147,7 @@ int hpsb_bus_reset(struct hpsb_host *host);
*/ */
void hpsb_selfid_received(struct hpsb_host *host, quadlet_t sid); void hpsb_selfid_received(struct hpsb_host *host, quadlet_t sid);
/* /*
* Notify completion of SelfID stage to the core and report new physical ID * Notify completion of SelfID stage to the core and report new physical ID
* and whether host is root now. * and whether host is root now.
*/ */
......
...@@ -67,7 +67,7 @@ static void fill_async_writeblock(struct hpsb_packet *packet, u64 addr, int leng ...@@ -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); 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) int length)
{ {
PREP_ASYNC_HEAD_ADDRESS(TCODE_LOCK_REQUEST); PREP_ASYNC_HEAD_ADDRESS(TCODE_LOCK_REQUEST);
...@@ -89,10 +89,10 @@ static void fill_iso_packet(struct hpsb_packet *packet, int length, int channel, ...@@ -89,10 +89,10 @@ static void fill_iso_packet(struct hpsb_packet *packet, int length, int channel,
packet->tcode = TCODE_ISO_DATA; 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[0] = data;
packet->header[1] = ~data; packet->header[1] = ~data;
packet->header_size = 8; packet->header_size = 8;
packet->data_size = 0; packet->data_size = 0;
packet->expect_response = 0; packet->expect_response = 0;
...@@ -145,7 +145,7 @@ int hpsb_get_tlabel(struct hpsb_packet *packet) ...@@ -145,7 +145,7 @@ int hpsb_get_tlabel(struct hpsb_packet *packet)
} }
spin_lock_irqsave(&tp->lock, flags); spin_lock_irqsave(&tp->lock, flags);
packet->tlabel = find_next_zero_bit(tp->pool, 64, tp->next); packet->tlabel = find_next_zero_bit(tp->pool, 64, tp->next);
if (packet->tlabel > 63) if (packet->tlabel > 63)
packet->tlabel = find_first_zero_bit(tp->pool, 64); packet->tlabel = find_first_zero_bit(tp->pool, 64);
...@@ -158,7 +158,7 @@ int hpsb_get_tlabel(struct hpsb_packet *packet) ...@@ -158,7 +158,7 @@ int hpsb_get_tlabel(struct hpsb_packet *packet)
return 0; return 0;
} }
/** /**
* hpsb_free_tlabel - free an allocated transaction label * hpsb_free_tlabel - free an allocated transaction label
* @packet: packet whos tlabel/tpool needs to be cleared * @packet: packet whos tlabel/tpool needs to be cleared
* *
...@@ -173,7 +173,7 @@ void hpsb_free_tlabel(struct hpsb_packet *packet) ...@@ -173,7 +173,7 @@ void hpsb_free_tlabel(struct hpsb_packet *packet)
{ {
unsigned long flags; unsigned long flags;
struct hpsb_tlabel_pool *tp; struct hpsb_tlabel_pool *tp;
tp = &packet->host->tpool[packet->node_id & NODE_MASK]; tp = &packet->host->tpool[packet->node_id & NODE_MASK];
BUG_ON(packet->tlabel > 63 || packet->tlabel < 0); BUG_ON(packet->tlabel > 63 || packet->tlabel < 0);
...@@ -204,7 +204,7 @@ int hpsb_packet_success(struct hpsb_packet *packet) ...@@ -204,7 +204,7 @@ int hpsb_packet_success(struct hpsb_packet *packet)
return -EINVAL; return -EINVAL;
default: default:
HPSB_ERR("received reserved rcode %d from node %d", HPSB_ERR("received reserved rcode %d from node %d",
(packet->header[1] >> 12) & 0xf, (packet->header[1] >> 12) & 0xf,
packet->node_id); packet->node_id);
return -EAGAIN; return -EAGAIN;
} }
...@@ -268,7 +268,7 @@ struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node, ...@@ -268,7 +268,7 @@ struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node,
if (length == 0) if (length == 0)
return NULL; return NULL;
packet = hpsb_alloc_packet((length + 3) & ~3); packet = hpsb_alloc_packet(length);
if (!packet) if (!packet)
return NULL; return NULL;
...@@ -296,7 +296,7 @@ struct hpsb_packet *hpsb_make_writepacket (struct hpsb_host *host, nodeid_t node ...@@ -296,7 +296,7 @@ struct hpsb_packet *hpsb_make_writepacket (struct hpsb_host *host, nodeid_t node
if (length == 0) if (length == 0)
return NULL; return NULL;
packet = hpsb_alloc_packet((length + 3) & ~3); packet = hpsb_alloc_packet(length);
if (!packet) if (!packet)
return NULL; return NULL;
...@@ -330,7 +330,7 @@ struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, i ...@@ -330,7 +330,7 @@ struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, i
if (length == 0) if (length == 0)
return NULL; return NULL;
packet = hpsb_alloc_packet((length + 3) & ~3); packet = hpsb_alloc_packet(length);
if (!packet) if (!packet)
return NULL; return NULL;
...@@ -338,7 +338,7 @@ struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, i ...@@ -338,7 +338,7 @@ struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, i
packet->data[length >> 2] = 0; packet->data[length >> 2] = 0;
} }
packet->host = host; packet->host = host;
if (hpsb_get_tlabel(packet)) { if (hpsb_get_tlabel(packet)) {
hpsb_free_packet(packet); hpsb_free_packet(packet);
return NULL; return NULL;
...@@ -430,17 +430,17 @@ struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host, nodeid_t node ...@@ -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, 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); p = hpsb_alloc_packet(0);
if (!p) return NULL; if (!p) return NULL;
p->host = host; p->host = host;
fill_phy_packet(p, data); fill_phy_packet(p, data);
return p; return p;
} }
struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host, 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, ...@@ -470,7 +470,7 @@ int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation,
{ {
struct hpsb_packet *packet; struct hpsb_packet *packet;
int retval = 0; int retval = 0;
if (length == 0) if (length == 0)
return -EINVAL; return -EINVAL;
...@@ -544,7 +544,7 @@ int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation, ...@@ -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 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) if (!packet)
return -ENOMEM; return -ENOMEM;
...@@ -607,7 +607,7 @@ int hpsb_send_gasp(struct hpsb_host *host, int channel, unsigned int generation, ...@@ -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); HPSB_VERBOSE("Send GASP: channel = %d, length = %Zd", channel, length);
length += 8; length += 8;
packet = hpsb_make_streampacket(host, NULL, length, channel, 3, 0); packet = hpsb_make_streampacket(host, NULL, length, channel, 3, 0);
if (!packet) if (!packet)
return -ENOMEM; return -ENOMEM;
......
...@@ -274,7 +274,7 @@ int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync) ...@@ -274,7 +274,7 @@ int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync)
cycle %= 8000; cycle %= 8000;
isoctl_args[0] = cycle; isoctl_args[0] = cycle;
if (tag_mask < 0) if (tag_mask < 0)
/* match all tags */ /* match all tags */
tag_mask = 0xF; tag_mask = 0xF;
...@@ -358,7 +358,7 @@ int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag ...@@ -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); spin_unlock_irqrestore(&iso->lock, flags);
return rv; return rv;
} }
......
...@@ -88,7 +88,7 @@ static struct csr1212_bus_ops nodemgr_csr_ops = { ...@@ -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. * 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 * 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 * 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 = { ...@@ -102,7 +102,7 @@ static struct csr1212_bus_ops nodemgr_csr_ops = {
* that's easy to parse by the protocol interface. * that's easy to parse by the protocol interface.
*/ */
/* /*
* The nodemgr relies heavily on the Driver Model for device callbacks and * The nodemgr relies heavily on the Driver Model for device callbacks and
* driver/device mappings. The old nodemgr used to handle all this itself, * driver/device mappings. The old nodemgr used to handle all this itself,
* but now we are much simpler because of the LDM. * 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) ...@@ -273,7 +273,7 @@ static ssize_t fw_show_ne_bus_options(struct device *dev, char *buf)
ne->busopt.irmc, ne->busopt.irmc,
ne->busopt.cmc, ne->busopt.isc, ne->busopt.bmc, ne->busopt.cmc, ne->busopt.isc, ne->busopt.bmc,
ne->busopt.pmc, ne->busopt.generation, ne->busopt.lnkspd, ne->busopt.pmc, ne->busopt.generation, ne->busopt.lnkspd,
ne->busopt.max_rec, ne->busopt.max_rec,
ne->busopt.max_rom, ne->busopt.max_rom,
ne->busopt.cyc_clk_acc); ne->busopt.cyc_clk_acc);
} }
...@@ -328,7 +328,7 @@ static ssize_t fw_get_ignore_driver(struct device *dev, char *buf) ...@@ -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); struct unit_directory *ud = container_of(dev, struct unit_directory, device);
return sprintf(buf, "%d\n", ud->ignore_driver); 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); 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) ...@@ -356,7 +356,6 @@ static int nodemgr_rescan_bus_thread(void *__unused)
{ {
/* No userlevel access needed */ /* No userlevel access needed */
daemonize("kfwrescan"); daemonize("kfwrescan");
allow_signal(SIGTERM);
bus_rescan_devices(&ieee1394_bus_type); bus_rescan_devices(&ieee1394_bus_type);
...@@ -726,7 +725,7 @@ static void nodemgr_update_bus_options(struct node_entry *ne) ...@@ -726,7 +725,7 @@ static void nodemgr_update_bus_options(struct node_entry *ne)
ne->busopt.max_rom = (busoptions >> 8) & 0x3; ne->busopt.max_rom = (busoptions >> 8) & 0x3;
ne->busopt.generation = (busoptions >> 4) & 0xf; ne->busopt.generation = (busoptions >> 4) & 0xf;
ne->busopt.lnkspd = busoptions & 0x7; ne->busopt.lnkspd = busoptions & 0x7;
HPSB_VERBOSE("NodeMgr: raw=0x%08x irmc=%d cmc=%d isc=%d bmc=%d pmc=%d " 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", "cyc_clk_acc=%d max_rec=%d max_rom=%d gen=%d lspd=%d",
busoptions, ne->busopt.irmc, ne->busopt.cmc, busoptions, ne->busopt.irmc, ne->busopt.cmc,
...@@ -1012,7 +1011,7 @@ static void nodemgr_process_root_directory(struct host_info *hi, struct node_ent ...@@ -1012,7 +1011,7 @@ static void nodemgr_process_root_directory(struct host_info *hi, struct node_ent
case CSR1212_KV_ID_UNIT: case CSR1212_KV_ID_UNIT:
nodemgr_process_unit_directory(hi, ne, kv, &ud_id, NULL); nodemgr_process_unit_directory(hi, ne, kv, &ud_id, NULL);
break; break;
case CSR1212_KV_ID_DESCRIPTOR: case CSR1212_KV_ID_DESCRIPTOR:
if (last_key_id == CSR1212_KV_ID_VENDOR) { 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, ...@@ -1056,13 +1055,14 @@ static int nodemgr_hotplug(struct class_device *cdev, char **envp, int num_envp,
#define PUT_ENVP(fmt,val) \ #define PUT_ENVP(fmt,val) \
do { \ do { \
int printed; \
envp[i++] = buffer; \ envp[i++] = buffer; \
length += snprintf(buffer, buffer_size - length, \ printed = snprintf(buffer, buffer_size - length, \
fmt, val); \ fmt, val); \
if ((buffer_size - length <= 0) || (i >= num_envp)) \ if ((buffer_size - (length+printed) <= 0) || (i >= num_envp)) \
return -ENOMEM; \ return -ENOMEM; \
++length; \ length += printed+1; \
buffer += length; \ buffer += printed+1; \
} while (0) } while (0)
PUT_ENVP("VENDOR_ID=%06x", ud->vendor_id); 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, ...@@ -1084,7 +1084,7 @@ static int nodemgr_hotplug(struct class_device *cdev, char **envp, int num_envp,
char *buffer, int buffer_size) char *buffer, int buffer_size)
{ {
return -ENODEV; return -ENODEV;
} }
#endif /* CONFIG_HOTPLUG */ #endif /* CONFIG_HOTPLUG */
...@@ -1150,7 +1150,6 @@ static void nodemgr_update_node(struct node_entry *ne, struct csr1212_csr *csr, ...@@ -1150,7 +1150,6 @@ static void nodemgr_update_node(struct node_entry *ne, struct csr1212_csr *csr,
ne->generation = generation; ne->generation = generation;
} }
static void nodemgr_node_scan_one(struct host_info *hi, 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) ...@@ -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) static int nodemgr_do_irm_duties(struct hpsb_host *host, int cycles)
{ {
quadlet_t bc; 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; return 1;
host->csr.broadcast_channel |= 0x40000000; /* set validity bit */ host->csr.broadcast_channel |= 0x40000000; /* set validity bit */
...@@ -1467,7 +1467,6 @@ static int nodemgr_host_thread(void *__hi) ...@@ -1467,7 +1467,6 @@ static int nodemgr_host_thread(void *__hi)
/* No userlevel access needed */ /* No userlevel access needed */
daemonize(hi->daemon_name); daemonize(hi->daemon_name);
allow_signal(SIGTERM);
/* Setup our device-model entries */ /* Setup our device-model entries */
nodemgr_create_host_dev_files(host); nodemgr_create_host_dev_files(host);
...@@ -1611,7 +1610,7 @@ int hpsb_node_read(struct node_entry *ne, u64 addr, ...@@ -1611,7 +1610,7 @@ int hpsb_node_read(struct node_entry *ne, u64 addr,
addr, buffer, length); 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) quadlet_t *buffer, size_t length)
{ {
unsigned int generation = ne->generation; unsigned int generation = ne->generation;
...@@ -1621,7 +1620,7 @@ int hpsb_node_write(struct node_entry *ne, u64 addr, ...@@ -1621,7 +1620,7 @@ int hpsb_node_write(struct node_entry *ne, u64 addr,
addr, buffer, length); 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) int extcode, quadlet_t *data, quadlet_t arg)
{ {
unsigned int generation = ne->generation; unsigned int generation = ne->generation;
......
...@@ -169,7 +169,7 @@ struct hpsb_host *hpsb_get_host_by_ne(struct node_entry *ne); ...@@ -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 * 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 * 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. * hpsb_packet) and return true otherwise.
* *
* Note that packet sending may still fail in hpsb_send_packet if a bus reset * 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); ...@@ -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, int hpsb_node_read(struct node_entry *ne, u64 addr,
quadlet_t *buffer, size_t length); 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); 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); int extcode, quadlet_t *data, quadlet_t arg);
......
This diff is collapsed.
...@@ -110,7 +110,7 @@ struct dma_rcv_ctx { ...@@ -110,7 +110,7 @@ struct dma_rcv_ctx {
int ctxtMatch; int ctxtMatch;
}; };
/* DMA transmit context */ /* DMA transmit context */
struct dma_trm_ctx { struct dma_trm_ctx {
struct ti_ohci *ohci; struct ti_ohci *ohci;
enum context_type type; enum context_type type;
...@@ -151,7 +151,7 @@ struct ohci1394_iso_tasklet { ...@@ -151,7 +151,7 @@ struct ohci1394_iso_tasklet {
struct ti_ohci { struct ti_ohci {
struct pci_dev *dev; struct pci_dev *dev;
enum { enum {
OHCI_INIT_ALLOC_HOST, OHCI_INIT_ALLOC_HOST,
OHCI_INIT_HAVE_MEM_REGION, OHCI_INIT_HAVE_MEM_REGION,
OHCI_INIT_HAVE_IOMAPPING, OHCI_INIT_HAVE_IOMAPPING,
...@@ -161,17 +161,17 @@ struct ti_ohci { ...@@ -161,17 +161,17 @@ struct ti_ohci {
OHCI_INIT_HAVE_IRQ, OHCI_INIT_HAVE_IRQ,
OHCI_INIT_DONE, OHCI_INIT_DONE,
} init_state; } init_state;
/* remapped memory spaces */ /* remapped memory spaces */
void *registers; void *registers;
/* dma buffer for self-id packets */ /* dma buffer for self-id packets */
quadlet_t *selfid_buf_cpu; quadlet_t *selfid_buf_cpu;
dma_addr_t selfid_buf_bus; dma_addr_t selfid_buf_bus;
/* buffer for csr config rom */ /* buffer for csr config rom */
quadlet_t *csr_config_rom_cpu; quadlet_t *csr_config_rom_cpu;
dma_addr_t csr_config_rom_bus; dma_addr_t csr_config_rom_bus;
int csr_config_rom_length; int csr_config_rom_length;
unsigned int max_packet_size; unsigned int max_packet_size;
...@@ -198,7 +198,7 @@ struct ti_ohci { ...@@ -198,7 +198,7 @@ struct ti_ohci {
struct dma_rcv_ctx ir_legacy_context; struct dma_rcv_ctx ir_legacy_context;
struct ohci1394_iso_tasklet ir_legacy_tasklet; struct ohci1394_iso_tasklet ir_legacy_tasklet;
/* iso transmit */ /* iso transmit */
int nb_iso_xmit_ctx; int nb_iso_xmit_ctx;
unsigned long it_ctx_usage; /* use test_and_set_bit() for atomicity */ unsigned long it_ctx_usage; /* use test_and_set_bit() for atomicity */
...@@ -260,7 +260,7 @@ static inline u32 reg_read(const struct ti_ohci *ohci, int offset) ...@@ -260,7 +260,7 @@ static inline u32 reg_read(const struct ti_ohci *ohci, int offset)
/* 2 KiloBytes of register space */ /* 2 KiloBytes of register space */
#define OHCI1394_REGISTER_SIZE 0x800 #define OHCI1394_REGISTER_SIZE 0x800
/* Offsets relative to context bases defined below */ /* Offsets relative to context bases defined below */
...@@ -440,9 +440,9 @@ static inline u32 reg_read(const struct ti_ohci *ohci, int offset) ...@@ -440,9 +440,9 @@ static inline u32 reg_read(const struct ti_ohci *ohci, int offset)
#define OHCI1394_TCODE_PHY 0xE #define OHCI1394_TCODE_PHY 0xE
void ohci1394_init_iso_tasklet(struct ohci1394_iso_tasklet *tasklet, void ohci1394_init_iso_tasklet(struct ohci1394_iso_tasklet *tasklet,
int type, int type,
void (*func)(unsigned long), void (*func)(unsigned long),
unsigned long data); unsigned long data);
int ohci1394_register_iso_tasklet(struct ti_ohci *ohci, int ohci1394_register_iso_tasklet(struct ti_ohci *ohci,
struct ohci1394_iso_tasklet *tasklet); struct ohci1394_iso_tasklet *tasklet);
......
This diff is collapsed.
...@@ -47,7 +47,7 @@ struct ti_lynx { ...@@ -47,7 +47,7 @@ struct ti_lynx {
enum { clear, have_intr, have_aux_buf, have_pcl_mem, enum { clear, have_intr, have_aux_buf, have_pcl_mem,
have_1394_buffers, have_iomappings, is_host } state; have_1394_buffers, have_iomappings, is_host } state;
/* remapped memory spaces */ /* remapped memory spaces */
void *registers; void *registers;
void *local_rom; void *local_rom;
...@@ -66,9 +66,9 @@ struct ti_lynx { ...@@ -66,9 +66,9 @@ struct ti_lynx {
#endif #endif
/* /*
* use local RAM of LOCALRAM_SIZE bytes for PCLs, which allows for * use local RAM of LOCALRAM_SIZE bytes for PCLs, which allows for
* LOCALRAM_SIZE * 8 PCLs (each sized 128 bytes); * LOCALRAM_SIZE * 8 PCLs (each sized 128 bytes);
* the following is an allocation bitmap * the following is an allocation bitmap
*/ */
u8 pcl_bmap[LOCALRAM_SIZE / 1024]; u8 pcl_bmap[LOCALRAM_SIZE / 1024];
...@@ -167,7 +167,7 @@ static inline void reg_clear_bits(const struct ti_lynx *lynx, int offset, ...@@ -167,7 +167,7 @@ static inline void reg_clear_bits(const struct ti_lynx *lynx, int offset,
#define SERIAL_EEPROM_CONTROL 0x44 #define SERIAL_EEPROM_CONTROL 0x44
#define PCI_INT_STATUS 0x48 #define PCI_INT_STATUS 0x48
#define PCI_INT_ENABLE 0x4c #define PCI_INT_ENABLE 0x4c
/* status and enable have identical bit numbers */ /* status and enable have identical bit numbers */
#define PCI_INT_INT_PEND (1<<31) #define PCI_INT_INT_PEND (1<<31)
#define PCI_INT_FORCED_INT (1<<30) #define PCI_INT_FORCED_INT (1<<30)
...@@ -199,7 +199,7 @@ static inline void reg_clear_bits(const struct ti_lynx *lynx, int offset, ...@@ -199,7 +199,7 @@ static inline void reg_clear_bits(const struct ti_lynx *lynx, int offset,
#define LBUS_ADDR_SEL_RAM (0x0<<16) #define LBUS_ADDR_SEL_RAM (0x0<<16)
#define LBUS_ADDR_SEL_ROM (0x1<<16) #define LBUS_ADDR_SEL_ROM (0x1<<16)
#define LBUS_ADDR_SEL_AUX (0x2<<16) #define LBUS_ADDR_SEL_AUX (0x2<<16)
#define LBUS_ADDR_SEL_ZV (0x3<<16) #define LBUS_ADDR_SEL_ZV (0x3<<16)
#define GPIO_CTRL_A 0xb8 #define GPIO_CTRL_A 0xb8
#define GPIO_CTRL_B 0xbc #define GPIO_CTRL_B 0xbc
...@@ -208,14 +208,14 @@ static inline void reg_clear_bits(const struct ti_lynx *lynx, int offset, ...@@ -208,14 +208,14 @@ static inline void reg_clear_bits(const struct ti_lynx *lynx, int offset,
#define DMA_BREG(base, chan) (base + chan * 0x20) #define DMA_BREG(base, chan) (base + chan * 0x20)
#define DMA_SREG(base, chan) (base + chan * 0x10) #define DMA_SREG(base, chan) (base + chan * 0x10)
#define DMA0_PREV_PCL 0x100 #define DMA0_PREV_PCL 0x100
#define DMA1_PREV_PCL 0x120 #define DMA1_PREV_PCL 0x120
#define DMA2_PREV_PCL 0x140 #define DMA2_PREV_PCL 0x140
#define DMA3_PREV_PCL 0x160 #define DMA3_PREV_PCL 0x160
#define DMA4_PREV_PCL 0x180 #define DMA4_PREV_PCL 0x180
#define DMA_PREV_PCL(chan) (DMA_BREG(DMA0_PREV_PCL, chan)) #define DMA_PREV_PCL(chan) (DMA_BREG(DMA0_PREV_PCL, chan))
#define DMA0_CURRENT_PCL 0x104 #define DMA0_CURRENT_PCL 0x104
#define DMA1_CURRENT_PCL 0x124 #define DMA1_CURRENT_PCL 0x124
#define DMA2_CURRENT_PCL 0x144 #define DMA2_CURRENT_PCL 0x144
#define DMA3_CURRENT_PCL 0x164 #define DMA3_CURRENT_PCL 0x164
...@@ -237,14 +237,14 @@ static inline void reg_clear_bits(const struct ti_lynx *lynx, int offset, ...@@ -237,14 +237,14 @@ static inline void reg_clear_bits(const struct ti_lynx *lynx, int offset,
#define DMA_CHAN_STAT_SPECIALACK (1<<14) #define DMA_CHAN_STAT_SPECIALACK (1<<14)
#define DMA0_CHAN_CTRL 0x110 #define DMA0_CHAN_CTRL 0x110
#define DMA1_CHAN_CTRL 0x130 #define DMA1_CHAN_CTRL 0x130
#define DMA2_CHAN_CTRL 0x150 #define DMA2_CHAN_CTRL 0x150
#define DMA3_CHAN_CTRL 0x170 #define DMA3_CHAN_CTRL 0x170
#define DMA4_CHAN_CTRL 0x190 #define DMA4_CHAN_CTRL 0x190
#define DMA_CHAN_CTRL(chan) (DMA_BREG(DMA0_CHAN_CTRL, chan)) #define DMA_CHAN_CTRL(chan) (DMA_BREG(DMA0_CHAN_CTRL, chan))
/* CHAN_CTRL registers share bits */ /* CHAN_CTRL registers share bits */
#define DMA_CHAN_CTRL_ENABLE (1<<31) #define DMA_CHAN_CTRL_ENABLE (1<<31)
#define DMA_CHAN_CTRL_BUSY (1<<30) #define DMA_CHAN_CTRL_BUSY (1<<30)
#define DMA_CHAN_CTRL_LINK (1<<29) #define DMA_CHAN_CTRL_LINK (1<<29)
...@@ -353,7 +353,7 @@ static inline void reg_clear_bits(const struct ti_lynx *lynx, int offset, ...@@ -353,7 +353,7 @@ static inline void reg_clear_bits(const struct ti_lynx *lynx, int offset,
#define LINK_INT_GRF_OVERFLOW (1<<5) #define LINK_INT_GRF_OVERFLOW (1<<5)
#define LINK_INT_ITF_UNDERFLOW (1<<4) #define LINK_INT_ITF_UNDERFLOW (1<<4)
#define LINK_INT_ATF_UNDERFLOW (1<<3) #define LINK_INT_ATF_UNDERFLOW (1<<3)
#define LINK_INT_ISOARB_FAILED (1<<0) #define LINK_INT_ISOARB_FAILED (1<<0)
/* PHY specifics */ /* PHY specifics */
#define PHY_VENDORID_TI 0x800028 #define PHY_VENDORID_TI 0x800028
......
...@@ -33,7 +33,7 @@ struct file_info { ...@@ -33,7 +33,7 @@ struct file_info {
spinlock_t reqlists_lock; spinlock_t reqlists_lock;
wait_queue_head_t poll_wait_complete; wait_queue_head_t poll_wait_complete;
struct list_head addr_list; struct list_head addr_list;
u8 *fcp_buffer; u8 *fcp_buffer;
......
This diff is collapsed.
This diff is collapsed.
...@@ -271,7 +271,7 @@ struct sbp2_status_block { ...@@ -271,7 +271,7 @@ struct sbp2_status_block {
#endif #endif
/* /*
* SCSI direction table... * SCSI direction table...
* (now used as a back-up in case the direction passed down from above is "unknown") * (now used as a back-up in case the direction passed down from above is "unknown")
* *
* DIN = IN data direction * DIN = IN data direction
...@@ -285,7 +285,7 @@ struct sbp2_status_block { ...@@ -285,7 +285,7 @@ struct sbp2_status_block {
#define DIN ORB_DIRECTION_READ_FROM_MEDIA #define DIN ORB_DIRECTION_READ_FROM_MEDIA
#define DOU ORB_DIRECTION_WRITE_TO_MEDIA #define DOU ORB_DIRECTION_WRITE_TO_MEDIA
#define DNO ORB_DIRECTION_NO_DATA_TRANSFER #define DNO ORB_DIRECTION_NO_DATA_TRANSFER
#define DUN DIN #define DUN DIN
static unchar sbp2scsi_direction_table[0x100] = { static unchar sbp2scsi_direction_table[0x100] = {
DNO,DNO,DIN,DIN,DOU,DIN,DIN,DOU,DIN,DUN,DOU,DOU,DUN,DUN,DUN,DIN, DNO,DNO,DIN,DIN,DOU,DIN,DIN,DOU,DIN,DUN,DOU,DOU,DUN,DUN,DUN,DIN,
...@@ -316,8 +316,8 @@ enum cmd_dma_types { ...@@ -316,8 +316,8 @@ enum cmd_dma_types {
CMD_DMA_SINGLE CMD_DMA_SINGLE
}; };
/* /*
* Encapsulates all the info necessary for an outstanding command. * Encapsulates all the info necessary for an outstanding command.
*/ */
struct sbp2_command_info { struct sbp2_command_info {
...@@ -386,12 +386,12 @@ struct scsi_id_instance_data { ...@@ -386,12 +386,12 @@ struct scsi_id_instance_data {
u32 sbp2_device_type_and_lun; u32 sbp2_device_type_and_lun;
u32 sbp2_firmware_revision; u32 sbp2_firmware_revision;
/* /*
* Variable used for logins, reconnects, logouts, query logins * Variable used for logins, reconnects, logouts, query logins
*/ */
atomic_t sbp2_login_complete; atomic_t sbp2_login_complete;
/* /*
* Pool of command orbs, so we can have more than overlapped command per id * Pool of command orbs, so we can have more than overlapped command per id
*/ */
spinlock_t sbp2_command_orb_lock; spinlock_t sbp2_command_orb_lock;
...@@ -433,8 +433,8 @@ static int sbp2util_create_command_orb_pool(struct scsi_id_instance_data *scsi_i ...@@ -433,8 +433,8 @@ static int sbp2util_create_command_orb_pool(struct scsi_id_instance_data *scsi_i
static void sbp2util_remove_command_orb_pool(struct scsi_id_instance_data *scsi_id); static void sbp2util_remove_command_orb_pool(struct scsi_id_instance_data *scsi_id);
static struct sbp2_command_info *sbp2util_find_command_for_orb(struct scsi_id_instance_data *scsi_id, dma_addr_t orb); static struct sbp2_command_info *sbp2util_find_command_for_orb(struct scsi_id_instance_data *scsi_id, dma_addr_t orb);
static struct sbp2_command_info *sbp2util_find_command_for_SCpnt(struct scsi_id_instance_data *scsi_id, void *SCpnt); static struct sbp2_command_info *sbp2util_find_command_for_SCpnt(struct scsi_id_instance_data *scsi_id, void *SCpnt);
static struct sbp2_command_info *sbp2util_allocate_command_orb(struct scsi_id_instance_data *scsi_id, static struct sbp2_command_info *sbp2util_allocate_command_orb(struct scsi_id_instance_data *scsi_id,
Scsi_Cmnd *Current_SCpnt, Scsi_Cmnd *Current_SCpnt,
void (*Current_done)(Scsi_Cmnd *)); void (*Current_done)(Scsi_Cmnd *));
static void sbp2util_mark_command_completed(struct scsi_id_instance_data *scsi_id, static void sbp2util_mark_command_completed(struct scsi_id_instance_data *scsi_id,
struct sbp2_command_info *command); struct sbp2_command_info *command);
...@@ -455,8 +455,8 @@ static int sbp2_handle_physdma_read(struct hpsb_host *host, int nodeid, quadlet_ ...@@ -455,8 +455,8 @@ static int sbp2_handle_physdma_read(struct hpsb_host *host, int nodeid, quadlet_
*/ */
static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id); static int sbp2_query_logins(struct scsi_id_instance_data *scsi_id);
static int sbp2_login_device(struct scsi_id_instance_data *scsi_id); static int sbp2_login_device(struct scsi_id_instance_data *scsi_id);
static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id); static int sbp2_reconnect_device(struct scsi_id_instance_data *scsi_id);
static int sbp2_logout_device(struct scsi_id_instance_data *scsi_id); static int sbp2_logout_device(struct scsi_id_instance_data *scsi_id);
static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int destid, static int sbp2_handle_status_write(struct hpsb_host *host, int nodeid, int destid,
quadlet_t *data, u64 addr, size_t length, u16 flags); quadlet_t *data, u64 addr, size_t length, u16 flags);
static int sbp2_agent_reset(struct scsi_id_instance_data *scsi_id, int wait); static int sbp2_agent_reset(struct scsi_id_instance_data *scsi_id, int wait);
...@@ -465,7 +465,7 @@ static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id, ...@@ -465,7 +465,7 @@ static int sbp2_create_command_orb(struct scsi_id_instance_data *scsi_id,
unchar *scsi_cmd, unchar *scsi_cmd,
unsigned int scsi_use_sg, unsigned int scsi_use_sg,
unsigned int scsi_request_bufflen, unsigned int scsi_request_bufflen,
void *scsi_request_buffer, void *scsi_request_buffer,
unsigned char scsi_dir); unsigned char scsi_dir);
static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id, static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
struct sbp2_command_info *command); struct sbp2_command_info *command);
......
This diff is collapsed.
...@@ -42,7 +42,7 @@ struct video1394_mmap { ...@@ -42,7 +42,7 @@ struct video1394_mmap {
unsigned int sync_tag; unsigned int sync_tag;
unsigned int nb_buffers; unsigned int nb_buffers;
unsigned int buf_size; unsigned int buf_size;
unsigned int packet_size; /* For VARIABLE_PACKET_SIZE: unsigned int packet_size; /* For VARIABLE_PACKET_SIZE:
Maximum packet size */ Maximum packet size */
unsigned int fps; unsigned int fps;
unsigned int syt_offset; unsigned int syt_offset;
...@@ -53,7 +53,7 @@ struct video1394_mmap { ...@@ -53,7 +53,7 @@ struct video1394_mmap {
struct video1394_queue_variable { struct video1394_queue_variable {
unsigned int channel; unsigned int channel;
unsigned int buffer; unsigned int buffer;
unsigned int* packet_sizes; /* Buffer of size: unsigned int* packet_sizes; /* Buffer of size:
buf_size / packet_size */ buf_size / packet_size */
}; };
......
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