max_nevents = fraction_ceil(&s->samples_per_cycle);
max_packet_size = max_nevents * s->dimension * 4 + 8;
- s->packet_pool = hpsb_pci_pool_create("packet pool", s->host->ohci->dev,
- max_packet_size, 0, 0 ,SLAB_KERNEL);
+ s->packet_pool = pci_pool_create("packet pool", s->host->ohci->dev,
+ max_packet_size, 0, 0);
if (s->packet_pool == NULL)
return -1;
return NULL;
}
- s->descriptor_pool = hpsb_pci_pool_create("descriptor pool", host->ohci->dev,
+ s->descriptor_pool = pci_pool_create("descriptor pool", host->ohci->dev,
sizeof(struct descriptor_block),
- 16, 0 ,SLAB_KERNEL);
+ 16, 0);
if (s->descriptor_pool == NULL) {
kfree(s->input);
#include "ieee1394.h"
#include "ieee1394_types.h"
-#include "ieee1394_hotplug.h"
+#include "nodemgr.h"
#include "hosts.h"
#include "ieee1394_core.h"
#include "highlevel.h"
#include <linux/tcp.h>
#include <linux/skbuff.h>
#include <linux/bitops.h>
+#include <linux/workqueue.h>
#include <asm/delay.h>
#include <asm/semaphore.h>
#include <net/arp.h>
printk(KERN_ERR fmt, ## args)
static char version[] __devinitdata =
- "$Rev: 906 $ Ben Collins <bcollins@debian.org>";
+ "$Rev: 918 $ Ben Collins <bcollins@debian.org>";
/* Our ieee1394 highlevel driver */
#define ETHER1394_DRIVER_NAME "ether1394"
ptask->dest_node = dest_node;
/* TODO: When 2.4 is out of the way, give each of our ethernet
* dev's a workqueue to handle these. */
- HPSB_INIT_WORK(&ptask->tq, hpsb_write_sched, ptask);
- hpsb_schedule_work(&ptask->tq);
+ INIT_WORK(&ptask->tq, hpsb_write_sched, ptask);
+ schedule_work(&ptask->tq);
return 0;
fail:
struct sk_buff *skb; /* Socket buffer we are sending */
nodeid_t dest_node; /* Destination of the packet */
u64 addr; /* Address */
- struct hpsb_queue_struct tq; /* The task */
+ struct work_struct tq; /* The task */
eth1394_tx_type tx_type; /* Send data via GASP or Write Req. */
};
#include <linux/list.h>
#include <linux/init.h>
#include <linux/slab.h>
+#include <linux/workqueue.h>
#include "ieee1394_types.h"
#include "hosts.h"
atomic_set(&h->generation, 0);
- HPSB_INIT_WORK(&h->timeout_tq, (void (*)(void*))abort_timedouts, h);
+ INIT_WORK(&h->timeout_tq, (void (*)(void*))abort_timedouts, h);
h->topology_map = h->csr.topology_map + 3;
h->speed_map = (u8 *)(h->csr.speed_map + 2);
#include <linux/device.h>
#include <linux/wait.h>
#include <linux/list.h>
+#include <linux/workqueue.h>
#include <asm/semaphore.h>
#include "ieee1394_types.h"
struct list_head pending_packets;
spinlock_t pending_pkt_lock;
- struct hpsb_queue_struct timeout_tq;
+ struct work_struct timeout_tq;
unsigned char iso_listen_count[64];
#include <linux/moduleparam.h>
#include <linux/proc_fs.h>
#include <linux/bitops.h>
+#include <linux/workqueue.h>
+#include <linux/kdev_t.h>
#include <asm/byteorder.h>
#include <asm/semaphore.h>
#include "ieee1394_transactions.h"
#include "csr.h"
#include "nodemgr.h"
-#include "ieee1394_hotplug.h"
#include "dma.h"
#include "iso.h"
spin_unlock_irqrestore(&host->pending_pkt_lock, flags);
up(&packet->state_change);
- hpsb_schedule_work(&host->timeout_tq);
+ schedule_work(&host->timeout_tq);
}
/**
}
if (!list_empty(&host->pending_packets))
- hpsb_schedule_work(&host->timeout_tq);
+ schedule_work(&host->timeout_tq);
spin_unlock_irqrestore(&host->pending_pkt_lock, flags);
#ifndef _IEEE1394_HOTPLUG_H
#define _IEEE1394_HOTPLUG_H
-#include <linux/device.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/mod_devicetable.h>
-#include "ieee1394_core.h"
-#include "nodemgr.h"
+/* Unit spec id and sw version entry for some protocols */
+#define AVC_UNIT_SPEC_ID_ENTRY 0x0000A02D
+#define AVC_SW_VERSION_ENTRY 0x00010001
+#define CAMERA_UNIT_SPEC_ID_ENTRY 0x0000A02D
+#define CAMERA_SW_VERSION_ENTRY 0x00000100
+
+/* Check to make sure this all isn't already defined */
+#ifndef IEEE1394_MATCH_VENDOR_ID
#define IEEE1394_MATCH_VENDOR_ID 0x0001
#define IEEE1394_MATCH_MODEL_ID 0x0002
#define IEEE1394_MATCH_SPECIFIER_ID 0x0004
#define IEEE1394_MATCH_VERSION 0x0008
-/*
- * Unit spec id and sw version entry for some protocols
- */
-#define AVC_UNIT_SPEC_ID_ENTRY 0x0000A02D
-#define AVC_SW_VERSION_ENTRY 0x00010001
-#define CAMERA_UNIT_SPEC_ID_ENTRY 0x0000A02D
-#define CAMERA_SW_VERSION_ENTRY 0x00000100
-
struct ieee1394_device_id {
u32 match_flags;
u32 vendor_id;
void *driver_data;
};
-struct hpsb_protocol_driver {
- /* The name of the driver, e.g. SBP2 or IP1394 */
- const char *name;
-
- /*
- * The device id table describing the protocols and/or devices
- * supported by this driver. This is used by the nodemgr to
- * decide if a driver could support a given node, but the
- * probe function below can implement further protocol
- * dependent or vendor dependent checking.
- */
- struct ieee1394_device_id *id_table;
-
- /*
- * The update function is called when the node has just
- * survived a bus reset, i.e. it is still present on the bus.
- * However, it may be necessary to reestablish the connection
- * or login into the node again, depending on the protocol.
- */
- void (*update)(struct unit_directory *ud);
-
-
- /* Our LDM structure */
- struct device_driver driver;
-};
-
-int hpsb_register_protocol(struct hpsb_protocol_driver *driver);
-void hpsb_unregister_protocol(struct hpsb_protocol_driver *driver);
+#endif
#endif /* _IEEE1394_HOTPLUG_H */
#define minor(dev) MINOR(dev)
#endif
-#ifndef __devexit_p
-#define __devexit_p(x) x
-#endif
-
#include <linux/spinlock.h>
-#ifndef list_for_each_safe
-#define list_for_each_safe(pos, n, head) \
- for (pos = (head)->next, n = pos->next; pos != (head); \
- pos = n, n = pos->next)
-
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,5)
-#define pte_offset_kernel pte_offset
-#endif
-
#ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
-#ifndef MAX
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
-
-/* Compatibility for task/work queues */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,42)
-/* Use task queue */
-#include <linux/tqueue.h>
-#define hpsb_queue_struct tq_struct
-#define hpsb_queue_list list
-#define hpsb_schedule_work(x) schedule_task(x)
-#define HPSB_INIT_WORK(x,y,z) INIT_TQUEUE(x,y,z)
-#define HPSB_PREPARE_WORK(x,y,z) PREPARE_TQUEUE(x,y,z)
-#else
-/* Use work queue */
-#include <linux/workqueue.h>
-#define hpsb_queue_struct work_struct
-#define hpsb_queue_list entry
-#define hpsb_schedule_work(x) schedule_work(x)
-#define HPSB_INIT_WORK(x,y,z) INIT_WORK(x,y,z)
-#define HPSB_PREPARE_WORK(x,y,z) PREPARE_WORK(x,y,z)
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,44)
-/* pci_pool_create changed. does not take the flags arg any longer */
-#define hpsb_pci_pool_create(a,b,c,d,e,f) pci_pool_create(a,b,c,d,e,f)
-#else
-#define hpsb_pci_pool_create(a,b,c,d,e,f) pci_pool_create(a,b,c,d,e)
-#endif
-
/* Transaction Label handling */
struct hpsb_tlabel_pool {
DECLARE_BITMAP(pool, 64);
#include "ieee1394_types.h"
#include "ieee1394.h"
+#include "nodemgr.h"
#include "hosts.h"
#include "ieee1394_transactions.h"
-#include "ieee1394_hotplug.h"
#include "highlevel.h"
#include "csr.h"
#include "nodemgr.h"
#define _IEEE1394_NODEMGR_H
#include <linux/device.h>
+#include "ieee1394_core.h"
+#include "ieee1394_hotplug.h"
#define CONFIG_ROM_BUS_INFO_LENGTH(q) ((q) >> 24)
#define CONFIG_ROM_BUS_CRC_LENGTH(q) (((q) >> 16) & 0xff)
quadlet_t quadlets[0];
};
+struct hpsb_protocol_driver {
+ /* The name of the driver, e.g. SBP2 or IP1394 */
+ const char *name;
+
+ /*
+ * The device id table describing the protocols and/or devices
+ * supported by this driver. This is used by the nodemgr to
+ * decide if a driver could support a given node, but the
+ * probe function below can implement further protocol
+ * dependent or vendor dependent checking.
+ */
+ struct ieee1394_device_id *id_table;
+
+ /*
+ * The update function is called when the node has just
+ * survived a bus reset, i.e. it is still present on the bus.
+ * However, it may be necessary to reestablish the connection
+ * or login into the node again, depending on the protocol.
+ */
+ void (*update)(struct unit_directory *ud);
+
+ /* Our LDM structure */
+ struct device_driver driver;
+};
+
+int hpsb_register_protocol(struct hpsb_protocol_driver *driver);
+void hpsb_unregister_protocol(struct hpsb_protocol_driver *driver);
+
static inline int hpsb_node_entry_valid(struct node_entry *ne)
{
return ne->generation == get_hpsb_generation(ne->host);
printk(level "%s_%d: " fmt "\n" , OHCI1394_DRIVER_NAME, card , ## args)
static char version[] __devinitdata =
- "$Rev: 908 $ Ben Collins <bcollins@debian.org>";
+ "$Rev: 921 $ Ben Collins <bcollins@debian.org>";
/* Module Parameters */
static int phys_dma = 1;
u32 cycleTimer;
int idx = d->prg_ind;
- DBGMSG(ohci->id, "Inserting packet for node %d, tlabel=%d, tcode=0x%x, speed=%d",
- packet->node_id, packet->tlabel, packet->tcode, packet->speed_code);
+ DBGMSG(ohci->id, "Inserting packet for node " NODE_BUS_FMT
+ ", tlabel=%d, tcode=0x%x, speed=%d",
+ NODE_BUS_ARGS(packet->node_id), packet->tlabel,
+ packet->tcode, packet->speed_code);
d->prg_cpu[idx]->begin.address = 0;
d->prg_cpu[idx]->begin.branchAddress = 0;
so disable branch and enable interrupt */
next->branchAddress = 0;
next->control |= cpu_to_le32(3 << 20);
+ next->status = cpu_to_le32(recv->buf_stride);
/* link prev to next */
prev->branchAddress = cpu_to_le32(dma_prog_region_offset_to_bus(&recv->prog,
#ifdef OHCI1394_DEBUG
if (datasize)
- DBGMSG(ohci->id,
- "Packet sent to node %d tcode=0x%X tLabel="
- "0x%02X ack=0x%X spd=%d dataLength=%d ctx=%d",
- (le32_to_cpu(d->prg_cpu[d->sent_ind]->data[1])
- >>16)&0x3f,
- (le32_to_cpu(d->prg_cpu[d->sent_ind]->data[0])
- >>4)&0xf,
- (le32_to_cpu(d->prg_cpu[d->sent_ind]->data[0])
- >>10)&0x3f,
- status&0x1f, (status>>5)&0x3,
- le32_to_cpu(d->prg_cpu[d->sent_ind]->data[3])
- >>16,
- d->ctx);
+ if(((le32_to_cpu(d->prg_cpu[d->sent_ind]->data[0])>>4)&0xf) == 0xa)
+ DBGMSG(ohci->id,
+ "Stream packet sent to channel %d tcode=0x%X "
+ "ack=0x%X spd=%d dataLength=%d ctx=%d",
+ (le32_to_cpu(d->prg_cpu[d->sent_ind]->data[0])>>8)&0x3f,
+ (le32_to_cpu(d->prg_cpu[d->sent_ind]->data[0])>>4)&0xf,
+ status&0x1f, (status>>5)&0x3,
+ le32_to_cpu(d->prg_cpu[d->sent_ind]->data[1])>>16,
+ d->ctx);
+ else
+ DBGMSG(ohci->id,
+ "Packet sent to node %d tcode=0x%X tLabel="
+ "0x%02X ack=0x%X spd=%d dataLength=%d ctx=%d",
+ (le32_to_cpu(d->prg_cpu[d->sent_ind]->data[1])>>16)&0x3f,
+ (le32_to_cpu(d->prg_cpu[d->sent_ind]->data[0])>>4)&0xf,
+ (le32_to_cpu(d->prg_cpu[d->sent_ind]->data[0])>>10)&0x3f,
+ status&0x1f, (status>>5)&0x3,
+ le32_to_cpu(d->prg_cpu[d->sent_ind]->data[3])>>16,
+ d->ctx);
else
DBGMSG(ohci->id,
"Packet sent to node %d tcode=0x%X tLabel="
return -ENOMEM;
}
- d->prg_pool = hpsb_pci_pool_create("ohci1394 rcv prg", ohci->dev,
- sizeof(struct dma_cmd), 4, 0, SLAB_KERNEL);
+ d->prg_pool = pci_pool_create("ohci1394 rcv prg", ohci->dev,
+ sizeof(struct dma_cmd), 4, 0);
OHCI_DMA_ALLOC("dma_rcv prg pool");
for (i=0; i<d->num_desc; i++) {
memset(d->prg_cpu, 0, d->num_desc * sizeof(struct at_dma_prg*));
memset(d->prg_bus, 0, d->num_desc * sizeof(dma_addr_t));
- d->prg_pool = hpsb_pci_pool_create("ohci1394 trm prg", ohci->dev,
- sizeof(struct at_dma_prg), 4, 0, SLAB_KERNEL);
+ d->prg_pool = pci_pool_create("ohci1394 trm prg", ohci->dev,
+ sizeof(struct at_dma_prg), 4, 0);
OHCI_DMA_ALLOC("dma_rcv prg pool");
for (i = 0; i < d->num_desc; i++) {
#include <linux/pci.h>
#include <linux/fs.h>
#include <linux/poll.h>
+#include <linux/kdev_t.h>
#include <asm/byteorder.h>
#include <asm/atomic.h>
#include <asm/io.h>
#include "ieee1394.h"
#include "ieee1394_types.h"
#include "ieee1394_core.h"
+#include "nodemgr.h"
#include "hosts.h"
#include "highlevel.h"
#include "iso.h"
#include "ieee1394_transactions.h"
-#include "ieee1394_hotplug.h"
#include "raw1394.h"
#include "raw1394-private.h"
#include "../scsi/scsi.h"
#include "../scsi/hosts.h"
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,47)
-#include "../scsi/sd.h"
-#endif
#include "ieee1394.h"
#include "ieee1394_types.h"
#include "ieee1394_core.h"
+#include "nodemgr.h"
#include "hosts.h"
#include "nodemgr.h"
#include "highlevel.h"
#include "ieee1394_transactions.h"
-#include "ieee1394_hotplug.h"
#include "sbp2.h"
static char version[] __devinitdata =
- "$Rev: 912 $ James Goodwin <jamesg@filanet.com>";
+ "$Rev: 919 $ James Goodwin <jamesg@filanet.com>";
/*
* Module load parameter definitions
/*
* Tell scsi stack that we're done with this command
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
- spin_lock_irqsave(&io_request_lock,flags);
- done (SCpnt);
- spin_unlock_irqrestore(&io_request_lock,flags);
-#else
spin_lock_irqsave(scsi_id->hi->scsi_host->host_lock,flags);
done (SCpnt);
spin_unlock_irqrestore(scsi_id->hi->scsi_host->host_lock,flags);
-#endif
return;
}
#include "ieee1394.h"
#include "ieee1394_types.h"
-#include "ieee1394_hotplug.h"
+#include "nodemgr.h"
#include "hosts.h"
#include "ieee1394_core.h"
#include "highlevel.h"
#include "video1394.h"
+#include "nodemgr.h"
#include "dma.h"
#include "ohci1394.h"
struct video1394_queue_variable qv;
struct dma_iso_ctx *d;
+ qv.packet_sizes = NULL;
+
if(copy_from_user(&v, (void *)arg, sizeof(v)))
return -EFAULT;
}
if (d->flags & VIDEO1394_VARIABLE_PACKET_SIZE) {
+ unsigned int *psizes;
+ int buf_size = d->nb_cmd * sizeof(unsigned int);
+
if (copy_from_user(&qv, (void *)arg, sizeof(qv)))
return -EFAULT;
- if (!access_ok(VERIFY_READ, qv.packet_sizes,
- d->nb_cmd * sizeof(unsigned int))) {
+
+ psizes = kmalloc(buf_size, GFP_KERNEL);
+ if (!psizes)
+ return -ENOMEM;
+
+ if (copy_from_user(psizes, qv.packet_sizes, buf_size)) {
+ kfree(psizes);
return -EFAULT;
}
+
+ qv.packet_sizes = psizes;
}
spin_lock_irqsave(&d->lock,flags);
PRINT(KERN_ERR, ohci->id,
"Buffer %d is already used",v.buffer);
spin_unlock_irqrestore(&d->lock,flags);
+ if (qv.packet_sizes)
+ kfree(qv.packet_sizes);
return -EFAULT;
}
reg_write(ohci, d->ctrlSet, 0x1000);
}
}
+
+ if (qv.packet_sizes)
+ kfree(qv.packet_sizes);
+
return 0;
}