linux1394-cvslog Mailing List for IEEE 1394 for Linux (Page 14)
Brought to you by:
aeb,
bencollins
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(10) |
Jul
(12) |
Aug
(8) |
Sep
(9) |
Oct
(4) |
Nov
(5) |
Dec
(5) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(7) |
Feb
(3) |
Mar
(15) |
Apr
(12) |
May
(5) |
Jun
(9) |
Jul
(32) |
Aug
(39) |
Sep
(42) |
Oct
(22) |
Nov
(28) |
Dec
(8) |
2002 |
Jan
(37) |
Feb
(47) |
Mar
(6) |
Apr
(29) |
May
(33) |
Jun
(9) |
Jul
(28) |
Aug
(30) |
Sep
(15) |
Oct
(75) |
Nov
(37) |
Dec
(31) |
2003 |
Jan
|
Feb
(89) |
Mar
(41) |
Apr
(13) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: SVN U. <ben...@li...> - 2002-08-07 15:06:25
|
Author: bencollins Date: 2002-08-07 19:55:20 -0400 (Wed, 07 Aug 2002) New Revision: 543 Modified: trunk/nodemgr.c Log: Fix bug in nodemgr_host_reset for when verbose debug is enabled. Noted by imacat AT mail.imacat.idv.tw Modified: trunk/nodemgr.c ============================================================================== --- trunk/nodemgr.c (original) +++ trunk/nodemgr.c 2002-08-07 19:55:20.000000000 -0400 @@ -1299,12 +1299,12 @@ } } - if (hi != NULL) + if (hi != NULL) { #ifdef CONFIG_IEEE1394_VERBOSEDEBUG - HPSB_DEBUG ("NodeMgr: Processing host reset for %s", host->driver->name); + HPSB_DEBUG ("NodeMgr: Processing host reset for %s", host->driver->name); #endif up(&hi->reset_sem); - else + } else HPSB_ERR ("NodeMgr: could not process reset of non-existent host"); spin_unlock_irqrestore (&host_info_lock, flags); |
From: SVN U. <ben...@li...> - 2002-08-07 00:15:37
|
Author: bencollins Date: 2002-08-07 05:05:13 -0400 (Wed, 07 Aug 2002) New Revision: 542 Modified: trunk/sbp2.c trunk/sbp2.h Log: Change s/kdev_t/struct block_device */ for argument to bios_param in Scsi_Host_Template. This is fro anything >= 2.5.28. Modified: trunk/sbp2.c ============================================================================== --- trunk/sbp2.c (original) +++ trunk/sbp2.c 2002-08-07 05:05:14.000000000 -0400 @@ -3135,7 +3135,11 @@ /* * Called by scsi stack to get bios parameters (used by fdisk, and at boot). */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28) static int sbp2scsi_biosparam (Scsi_Disk *disk, kdev_t dev, int geom[]) +#else +static int sbp2scsi_biosparam (Scsi_Disk *disk, struct block_device *dev, int geom[]) +#endif { int heads, sectors, cylinders; Modified: trunk/sbp2.h ============================================================================== --- trunk/sbp2.h (original) +++ trunk/sbp2.h 2002-08-07 05:05:14.000000000 -0400 @@ -549,7 +549,11 @@ static int sbp2scsi_detect (Scsi_Host_Template *tpnt); static const char *sbp2scsi_info (struct Scsi_Host *host); void sbp2scsi_setup(char *str, int *ints); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,28) static int sbp2scsi_biosparam (Scsi_Disk *disk, kdev_t dev, int geom[]); +#else +static int sbp2scsi_biosparam (Scsi_Disk *disk, struct block_device *dev, int geom[]); +#endif static int sbp2scsi_abort (Scsi_Cmnd *SCpnt); static int sbp2scsi_reset (Scsi_Cmnd *SCpnt); static int sbp2scsi_queuecommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)); |
From: SVN U. <ben...@li...> - 2002-08-07 00:03:26
|
Author: bencollins Date: 2002-08-07 04:53:00 -0400 (Wed, 07 Aug 2002) New Revision: 541 Modified: trunk/eth1394.c Log: Merge in changes from 2.4.20-pre1. Changes "int" to "unsigned long" for flags var to spinlock's. Modified: trunk/eth1394.c ============================================================================== --- trunk/eth1394.c (original) +++ trunk/eth1394.c 2002-08-07 04:53:00.000000000 -0400 @@ -276,7 +276,7 @@ static void ether1394_reset_priv (struct net_device *dev, int set_mtu) { - int flags; + unsigned long flags; struct eth1394_priv *priv = (struct eth1394_priv *)dev->priv; int phy_id = priv->host->node_id & NODE_MASK; @@ -477,7 +477,7 @@ * use of some of the fields, since they tell us a little bit * about the sending machine. */ if (hdr->uf.ether_type == __constant_htons (ETH_P_ARP)) { - int flags; + unsigned long flags; u16 phy_id = srcid & NODE_MASK; struct eth1394_priv *priv = (struct eth1394_priv *)dev->priv; @@ -525,7 +525,7 @@ { struct sk_buff *skb; char *buf = (char *)data; - int flags; + unsigned long flags; struct net_device *dev = ether1394_find_dev (host); struct eth1394_priv *priv; @@ -596,7 +596,7 @@ struct sk_buff *skb = ptask->skb; struct net_device *dev = ptask->skb->dev; struct eth1394_priv *priv = (struct eth1394_priv *)dev->priv; - int flags; + unsigned long flags; /* Statistics */ spin_lock_irqsave (&priv->lock, flags); @@ -627,7 +627,8 @@ int kmflags = in_interrupt () ? GFP_ATOMIC : GFP_KERNEL; struct ethhdr *eth; struct eth1394_priv *priv = (struct eth1394_priv *)dev->priv; - int proto, flags; + int proto; + unsigned long flags; nodeid_t dest_node; u64 addr; struct packet_task *ptask = NULL; |
From: SVN U. <dm...@li...> - 2002-08-06 23:19:35
|
Author: dmaas Date: 2002-08-07 04:09:13 -0400 (Wed, 07 Aug 2002) New Revision: 540 Modified: trunk/ieee1394_core.c Log: make ieee1394_dispatch_open safer against module unload races using try_inc_mod_count() Modified: trunk/ieee1394_core.c ============================================================================== --- trunk/ieee1394_core.c (original) +++ trunk/ieee1394_core.c 2002-08-07 04:09:14.000000000 -0400 @@ -862,19 +862,57 @@ write_unlock(&ieee1394_chardevs_lock); } +/* + ieee1394_get_chardev() - look up and acquire a character device + driver that has previously registered using ieee1394_register_chardev() + + On success, returns 1 and sets module and file_ops to the driver. + The module will have an incremented reference count. + + On failure, returns 0. + The module will NOT have an incremented reference count. +*/ + +static int ieee1394_get_chardev(int blocknum, + struct module **module, + struct file_operations **file_ops) +{ + int ret = 0; + + if( (blocknum < 0) || (blocknum > 15) ) + return ret; + + read_lock(&ieee1394_chardevs_lock); + + *module = ieee1394_chardevs[blocknum].module; + *file_ops = ieee1394_chardevs[blocknum].file_ops; + + if(*file_ops == NULL) + goto out; + + /* don't need try_inc_mod_count if the driver is non-modular */ + if(*module && (try_inc_mod_count(*module) == 0)) + goto out; + + /* success! */ + ret = 1; + +out: + read_unlock(&ieee1394_chardevs_lock); + return ret; +} + /* the point of entry for open() on any ieee1394 character device */ static int ieee1394_dispatch_open(struct inode *inode, struct file *file) { struct file_operations *file_ops; struct module *module; int blocknum; - int retval = -ENODEV; + int retval; /* Maintaining correct module reference counts is tricky here! - For Linux v2.4 and later: - The key thing to remember is that the VFS increments the reference count of ieee1394 before it calls ieee1394_dispatch_open(). @@ -887,16 +925,7 @@ If the open() fails, then the VFS will drop the reference count of whatever module file->f_op->owner points to, immediately after this function returns. - - The comments below refer to the 2.4 case, since the 2.2 - case is trivial. - */ - -#define INCREF(mod_) do { struct module *mod = (struct module*) mod_; \ - if(mod != NULL) __MOD_INC_USE_COUNT(mod); } while(0) -#define DECREF(mod_) do { struct module *mod = (struct module*) mod_; \ - if(mod != NULL) __MOD_DEC_USE_COUNT(mod); } while(0) /* shift away lower four bits of the minor to get the index of the ieee1394_driver @@ -904,20 +933,10 @@ blocknum = (minor(inode->i_rdev) >> 4) & 0xF; - /* printk("ieee1394_dispatch_open(%d)", blocknum); */ + /* look up the driver */ - read_lock(&ieee1394_chardevs_lock); - module = ieee1394_chardevs[blocknum].module; - /* bump the reference count of the driver that - will receive the open() */ - INCREF(module); - file_ops = ieee1394_chardevs[blocknum].file_ops; - read_unlock(&ieee1394_chardevs_lock); - - if(file_ops == NULL) { - DECREF(module); - goto out_fail; - } + if(ieee1394_get_chardev(blocknum, &module, &file_ops) == 0) + return -ENODEV; /* redirect all subsequent requests to the driver's own file_operations */ @@ -929,42 +948,42 @@ /* follow through with the open() */ retval = file_ops->open(inode, file); - if(retval) { + if(retval == 0) { - /* if the open() failed, then we need to drop the - extra reference we gave to the task-specific - driver */ + /* If the open() succeeded, then ieee1394 will be left + with an extra module reference, so we discard it here. - DECREF(module); - goto out_fail; + The task-specific driver still has the extra + reference given to it by ieee1394_get_chardev(). + This extra reference prevents the module from + unloading while the file is open, and will be + dropped by the VFS when the file is released. + */ - } else { - - /* if the open() succeeded, then ieee1394 will be left - with an extra module reference, so we discard it here.*/ + if(THIS_MODULE) + __MOD_DEC_USE_COUNT((struct module*) THIS_MODULE); + + /* note that if ieee1394 is compiled into the kernel, + THIS_MODULE will be (void*) NULL, hence the if and + the cast are necessary */ - DECREF(THIS_MODULE); + } else { - /* the task-specific driver still has the extra - reference we gave it. This extra reference prevents - the module from unloading while the file is open, - and will be dropped by the VFS when the file is - released. */ + /* if the open() failed, then we need to drop the + extra reference we gave to the task-specific + driver */ - return 0; - } - -out_fail: - /* point the file's f_ops back to ieee1394. The VFS will then - decrement ieee1394's reference count immediately after this - function returns. */ + if(module) + __MOD_DEC_USE_COUNT(module); - file->f_op = &ieee1394_chardev_ops; - return retval; + /* point the file's f_ops back to ieee1394. The VFS will then + decrement ieee1394's reference count immediately after this + function returns. */ + + file->f_op = &ieee1394_chardev_ops; + } -#undef INCREF -#undef DECREF - + return retval; } struct proc_dir_entry *ieee1394_procfs_entry; |
From: SVN U. <dm...@li...> - 2002-08-06 22:48:48
|
Author: dmaas Date: 2002-08-07 03:38:21 -0400 (Wed, 07 Aug 2002) New Revision: 539 Modified: trunk/dv1394-private.h trunk/dv1394.c Log: dv1394 updates: - make DMA programs little-endian, regardless of CPU endianness - use plain vmalloc_32() to avoid a memory leak with mem_map_reserve() - add a missing spin_unlock to dv1394_devfs_find (thanks to Baum Peter Georg for spotting this) Modified: trunk/dv1394-private.h ============================================================================== --- trunk/dv1394-private.h (original) +++ trunk/dv1394-private.h 2002-08-07 03:38:22.000000000 -0400 @@ -91,20 +91,20 @@ unsigned char sync_tag, unsigned int payload_size) { - omi->q[0] = 0x02000000 | 8 ; /* OUTPUT_MORE_IMMEDIATE; 8 is the size of the IT header */ + omi->q[0] = cpu_to_le32(0x02000000 | 8); /* OUTPUT_MORE_IMMEDIATE; 8 is the size of the IT header */ omi->q[1] = 0; omi->q[2] = 0; omi->q[3] = 0; /* IT packet header */ - omi->q[4] = (0x0 << 16) /* DMA_SPEED_100 */ - | (tag << 14) - | (channel << 8) - | (TCODE_ISO_DATA << 4) - | (sync_tag); + omi->q[4] = cpu_to_le32( (0x0 << 16) /* DMA_SPEED_100 */ + | (tag << 14) + | (channel << 8) + | (TCODE_ISO_DATA << 4) + | (sync_tag) ); - omi->q[5] = payload_size << 16; - omi->q[5] |= (0x7F << 8) | 0xA0; /* 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[6] = 0; omi->q[7] = 0; @@ -114,10 +114,8 @@ unsigned int data_size, unsigned long data_phys_addr) { - om->q[0] = 0; /* OUTPUT_MORE */ - om->q[0] |= data_size; - - om->q[1] = data_phys_addr; + om->q[0] = cpu_to_le32(data_size); + om->q[1] = cpu_to_le32(data_phys_addr); om->q[2] = 0; om->q[3] = 0; } @@ -128,19 +126,20 @@ unsigned int data_size, unsigned long data_phys_addr) { - ol->q[0] = 0; - ol->q[0] |= 1 << 28; /* OUTPUT_LAST */ + u32 temp = 0; + temp |= 1 << 28; /* OUTPUT_LAST */ if(want_timestamp) /* controller will update timestamp at DMA time */ - ol->q[0] |= 1 << 27; + temp |= 1 << 27; if(want_interrupt) - ol->q[0] |= 3 << 20; + temp |= 3 << 20; - ol->q[0] |= 3 << 18; /* must take branch */ - ol->q[0] |= data_size; - - ol->q[1] = data_phys_addr; + temp |= 3 << 18; /* must take branch */ + temp |= data_size; + + ol->q[0] = cpu_to_le32(temp); + ol->q[1] = cpu_to_le32(data_phys_addr); ol->q[2] = 0; ol->q[3] = 0; } @@ -152,15 +151,16 @@ unsigned int data_size, unsigned long data_phys_addr) { - im->q[0] = 2 << 28; /* INPUT_MORE */ - im->q[0] |= 8 << 24; /* s = 1, update xferStatus and resCount */ + u32 temp = 2 << 28; /* INPUT_MORE */ + temp |= 8 << 24; /* s = 1, update xferStatus and resCount */ if (want_interrupt) - im->q[0] |= 0 << 20; /* interrupts, i=0 in packet-per-buffer mode */ - im->q[0] |= 0x0 << 16; /* disable branch to address for packet-per-buffer mode */ + temp |= 0 << 20; /* interrupts, i=0 in packet-per-buffer mode */ + temp |= 0x0 << 16; /* disable branch to address for packet-per-buffer mode */ /* disable wait on sync field, not used in DV :-( */ - im->q[0] |= data_size; + temp |= data_size; - im->q[1] = data_phys_addr; + im->q[0] = cpu_to_le32(temp); + im->q[1] = cpu_to_le32(data_phys_addr); im->q[2] = 0; /* branchAddress and Z not use in packet-per-buffer mode */ im->q[3] = 0; /* xferStatus & resCount, resCount must be initialize to data_size */ } @@ -169,16 +169,17 @@ unsigned int data_size, unsigned long data_phys_addr) { - il->q[0] = 3 << 28; /* INPUT_LAST */ - il->q[0] |= 8 << 24; /* s = 1, update xferStatus and resCount */ - il->q[0] |= 3 << 20; /* enable interrupts */ - il->q[0] |= 0xC << 16; /* enable branch to address */ + u32 temp = 3 << 28; /* INPUT_LAST */ + temp |= 8 << 24; /* s = 1, update xferStatus and resCount */ + temp |= 3 << 20; /* enable interrupts */ + temp |= 0xC << 16; /* enable branch to address */ /* disable wait on sync field, not used in DV :-( */ - il->q[0] |= data_size; + temp |= data_size; - il->q[1] = data_phys_addr; - il->q[2] = 1; /* branchAddress (filled in later) and Z = 1 descriptor in next block */ - il->q[3] = data_size; /* xferStatus & resCount, resCount must be initialize to data_size */ + il->q[0] = cpu_to_le32(temp); + il->q[1] = cpu_to_le32(data_phys_addr); + il->q[2] = cpu_to_le32(1); /* branchAddress (filled in later) and Z = 1 descriptor in next block */ + il->q[3] = cpu_to_le32(data_size); /* xferStatus & resCount, resCount must be initialize to data_size */ } Modified: trunk/dv1394.c ============================================================================== --- trunk/dv1394.c (original) +++ trunk/dv1394.c 2002-08-07 03:38:22.000000000 -0400 @@ -188,42 +188,29 @@ } -/* Taken from bttv.c */ /*******************************/ /* Memory management functions */ /*******************************/ +/* note: we no longer use mem_map_reserve, because it causes a memory + leak, and setting vma->vm_flags to VM_RESERVED should be sufficient + to pin the pages in memory anyway. */ + static void * rvmalloc(unsigned long size) { void * mem; - unsigned long adr; - size = PAGE_ALIGN(size); - mem=vmalloc_32(size); - if (mem) { + mem = vmalloc_32(size); + + if(mem) memset(mem, 0, size); /* Clear the ram out, no junk to the user */ - adr=(unsigned long) mem; - while (size > 0) { - mem_map_reserve(vmalloc_to_page((void *)adr)); - adr+=PAGE_SIZE; - size-=PAGE_SIZE; - } - } return mem; } static void rvfree(void * mem, unsigned long size) { - unsigned long adr; - if (mem) { - adr=(unsigned long) mem; - while (size > 0) { - mem_map_unreserve(vmalloc_to_page((void *)adr)); - adr+=PAGE_SIZE; - size-=PAGE_SIZE; - } vfree(mem); } } @@ -594,7 +581,7 @@ /* note: we are not linked into the active DMA chain yet */ if(last_branch_address) { - *(last_branch_address) = block_dma | n_descriptors; + *(last_branch_address) = cpu_to_le32(block_dma | n_descriptors); } last_branch_address = branch_address; @@ -606,7 +593,7 @@ /* when we first assemble a new frame, set the final branch to loop back up to the top */ - *(f->frame_end_branch) = f->descriptor_pool_dma | f->first_n_descriptors; + *(f->frame_end_branch) = cpu_to_le32(f->descriptor_pool_dma | f->first_n_descriptors); /* make the latest version of the frame buffer visible to the PCI card */ @@ -643,15 +630,18 @@ /* if DMA is already active, we are almost done */ /* just link us onto the active DMA chain */ if(video->frames[last_frame]->frame_end_branch) { + u32 temp; /* point the previous frame's tail to this frame's head */ - *(video->frames[last_frame]->frame_end_branch) = f->descriptor_pool_dma | f->first_n_descriptors; + *(video->frames[last_frame]->frame_end_branch) = cpu_to_le32(f->descriptor_pool_dma | f->first_n_descriptors); /* this write MUST precede the next one, or we could silently drop frames */ wmb(); /* disable the want_status semaphore on the last packet */ - *(video->frames[last_frame]->frame_end_branch - 2) &= 0xF7CFFFFF; + temp = le32_to_cpu(*(video->frames[last_frame]->frame_end_branch - 2)); + temp &= 0xF7CFFFFF; + *(video->frames[last_frame]->frame_end_branch - 2) = cpu_to_le32(temp); /* flush these writes to memory ASAP */ flush_pci_write(video->ohci); @@ -914,14 +904,14 @@ last_branch_address = f->frame_end_branch; if (last_branch_address) - *(last_branch_address) = block_dma | 1; /* set Z=1 */ + *(last_branch_address) = cpu_to_le32(block_dma | 1); /* set Z=1 */ f->frame_end_branch = &(block->u.in.il.q[2]); } /* loop tail to head */ if (f->frame_end_branch) - *(f->frame_end_branch) = f->descriptor_pool_dma | 1; /* set Z=1 */ + *(f->frame_end_branch) = cpu_to_le32(f->descriptor_pool_dma | 1); /* set Z=1 */ spin_unlock_irqrestore(&video->spinlock, irq_flags); @@ -2392,13 +2382,15 @@ /* see if we need to set the timestamp for the next frame */ if( *(f->mid_frame_timestamp) ) { struct frame *next_frame; - u32 ts_cyc, ts_off; + u32 begin_ts, ts_cyc, ts_off; *(f->mid_frame_timestamp) = 0; + begin_ts = le32_to_cpu(*(f->frame_begin_timestamp)); + irq_printk(" MIDDLE - first packet was sent at cycle %4u (%2u), assigned timestamp was (%2u) %4u\n", - *(f->frame_begin_timestamp) & 0x1FFF, *(f->frame_begin_timestamp) & 0xF, - f->assigned_timestamp >> 12, f->assigned_timestamp & 0xFFF); + begin_ts & 0x1FFF, begin_ts & 0xF, + f->assigned_timestamp >> 12, f->assigned_timestamp & 0xFFF); /* prepare next frame and assign timestamp */ next_frame = video->frames[ (frame+1) % video->n_frames ]; @@ -2412,7 +2404,7 @@ /* set the timestamp to the timestamp of the last frame sent, plus the length of the last frame sent, plus the syt latency */ - ts_cyc = *(f->frame_begin_timestamp) & 0xF; + ts_cyc = begin_ts & 0xF; /* advance one frame, plus syt latency (typically 2-3) */ ts_cyc += f->n_packets + video->syt_offset ; @@ -2459,17 +2451,21 @@ int sof=0; /* start-of-frame flag */ struct frame *f; - + u16 packet_length, packet_time; + spin_lock(&video->spinlock); + packet_length = le16_to_cpu(video->packet_buffer[video->current_packet].data_length); + packet_time = le16_to_cpu(video->packet_buffer[video->current_packet].timestamp); + irq_printk("received packet %02d, timestamp=%04x, length=%04x, sof=%02x%02x\n", video->current_packet, - video->packet_buffer[video->current_packet].timestamp, video->packet_buffer[video->current_packet].data_length, + packet_time, packet_length, video->packet_buffer[video->current_packet].data[0], video->packet_buffer[video->current_packet].data[1]); f = video->frames[video->active_frame]; /* exclude empty packet */ - if (video->packet_buffer[video->current_packet].data_length > 8) { + if (packet_length > 8) { /* check for start of frame */ sof = (video->packet_buffer[video->current_packet].data[0] == 0x1f && @@ -2572,12 +2568,15 @@ list_for_each(lh, &dv1394_devfs) { p = list_entry(lh, struct dv1394_devfs_entry, list); if(!strncmp(p->name, name, sizeof(p->name))) { - spin_unlock( &dv1394_devfs_lock); - return p; + goto found; } } } - return NULL; + p = NULL; + +found: + spin_unlock( &dv1394_devfs_lock); + return p; } static int dv1394_devfs_add_entry(struct video_card *video) @@ -2763,7 +2762,7 @@ if (format == DV1394_NTSC) video->id |= mode; else video->id |= 2 + mode; - + #ifdef CONFIG_DEVFS_FS if (dv1394_devfs_add_entry(video) < 0) goto err_free; |
From: SVN U. <ben...@li...> - 2002-08-03 06:27:12
|
Author: bencollins Date: 2002-08-03 11:20:10 -0400 (Sat, 03 Aug 2002) New Revision: 538 Modified: trunk/amdtp.c Log: Must include asm/byteorder.h if you are going to use the __BIG_ENDIAN_BITFIELD define. Also, added big-endian bitfield struct for iso_packet. Modified: trunk/amdtp.c ============================================================================== --- trunk/amdtp.c (original) +++ trunk/amdtp.c 2002-08-03 11:20:10.000000000 -0400 @@ -121,17 +121,40 @@ dma_addr_t payload_bus; }; -#ifdef __BIG_ENDIAN_BITFIELD +#include <asm/byteorder.h> -#error Big endian bitfields not tested +#if defined __BIG_ENDIAN_BITFIELD -#else +struct iso_packet { + /* First quadlet */ + unsigned int dbs : 8; + unsigned int eoh0 : 2; + unsigned int sid : 6; + + unsigned int dbc : 8; + unsigned int fn : 2; + unsigned int qpc : 3; + unsigned int sph : 1; + unsigned int reserved : 2; + + /* Second quadlet */ + unsigned int fdf : 8; + unsigned int eoh1 : 2; + unsigned int fmt : 6; + + unsigned int syt : 16; + + quadlet_t data[0]; +}; + +#elif defined __LITTLE_ENDIAN_BITFIELD struct iso_packet { /* First quadlet */ unsigned int sid : 6; unsigned int eoh0 : 2; unsigned int dbs : 8; + unsigned int reserved : 2; unsigned int sph : 1; unsigned int qpc : 3; @@ -142,11 +165,16 @@ unsigned int fmt : 6; unsigned int eoh1 : 2; unsigned int fdf : 8; + unsigned int syt : 16; quadlet_t data[0]; }; +#else + +#error Unknown bitfield type + #endif struct fraction { |
From: SVN U. <hog...@li...> - 2002-07-31 01:42:37
|
Author: hogsberg Date: 2002-07-30 17:41:12 -0400 (Tue, 30 Jul 2002) New Revision: 537 Modified: trunk/csr.c trunk/highlevel.c trunk/hosts.c trunk/hosts.h trunk/ieee1394_core.c trunk/ohci1394.c trunk/pcilynx.c Log: Remove redundant tracking of lowlevel drivers (hpsb_register_lowlevel etc.) and combine hpsb_host_driver and hpsb_host_operations structs. Modified: trunk/ieee1394_core.c ============================================================================== --- trunk/ieee1394_core.c (original) +++ trunk/ieee1394_core.c Tue Jul 30 21:43:51 2002 @@ -142,7 +142,7 @@ int hpsb_reset_bus(struct hpsb_host *host, int type) { if (!host->in_bus_reset) { - host->ops->devctl(host, RESET_BUS, type); + host->driver->devctl(host, RESET_BUS, type); return 0; } else { return 1; @@ -355,7 +355,7 @@ } host->reset_retries = 0; - if (isroot) host->ops->devctl(host, ACT_CYCLE_MASTER, 1); + if (isroot) host->driver->devctl(host, ACT_CYCLE_MASTER, 1); atomic_inc(&host->generation); host->in_bus_reset = 0; highlevel_host_reset(host); @@ -441,7 +441,7 @@ } #endif - return host->ops->transmit_packet(host, packet); + return host->driver->transmit_packet(host, packet); } static void send_packet_nocare(struct hpsb_packet *packet) @@ -737,7 +737,7 @@ struct list_head *lh; LIST_HEAD(llist); - host->ops->devctl(host, CANCEL_REQUESTS, 0); + host->driver->devctl(host, CANCEL_REQUESTS, 0); spin_lock_irqsave(&host->pending_pkt_lock, flags); list_splice(&host->pending_packets, &llist); @@ -1025,8 +1025,6 @@ module_exit(ieee1394_cleanup); /* Exported symbols */ -EXPORT_SYMBOL(hpsb_register_lowlevel); -EXPORT_SYMBOL(hpsb_unregister_lowlevel); EXPORT_SYMBOL(hpsb_alloc_host); EXPORT_SYMBOL(hpsb_add_host); EXPORT_SYMBOL(hpsb_remove_host); Modified: trunk/ohci1394.c ============================================================================== --- trunk/ohci1394.c (original) +++ trunk/ohci1394.c Tue Jul 30 21:43:52 2002 @@ -2028,15 +2028,14 @@ return reg_read(ohci, OHCI1394_CSRData); } -static struct hpsb_host_operations ohci1394_ops = { +static struct hpsb_host_driver ohci1394_driver = { + .name = OHCI1394_DRIVER_NAME, .get_rom = ohci_get_rom, .transmit_packet = ohci_transmit, .devctl = ohci_devctl, .hw_csr_reg = ohci_hw_csr_reg, }; -static struct hpsb_host_driver *ohci1394_driver; - /*********************************** @@ -2069,7 +2068,7 @@ card_id_counter++); pci_set_master(dev); - host = hpsb_alloc_host(ohci1394_driver, sizeof(struct ti_ohci)); + host = hpsb_alloc_host(&ohci1394_driver, sizeof(struct ti_ohci)); if (!host) FAIL(-ENOMEM, "Failed to allocate host structure"); ohci = host->hostdata; @@ -2427,27 +2426,11 @@ static void __exit ohci1394_cleanup (void) { pci_unregister_driver(&ohci1394_pci_driver); - hpsb_unregister_lowlevel(ohci1394_driver); } static int __init ohci1394_init(void) { - int ret; - - ohci1394_driver = hpsb_register_lowlevel(&ohci1394_ops, - OHCI1394_DRIVER_NAME); - if (!ohci1394_driver) { - PRINT_G(KERN_ERR, "hpsb_register_lowlevel failed"); - return -ENOMEM; - } - - ret = pci_module_init(&ohci1394_pci_driver); - if (ret < 0) { - PRINT_G(KERN_ERR, "pci_module_init failed"); - hpsb_unregister_lowlevel(ohci1394_driver); - return ret; - } - return ret; + return pci_module_init(&ohci1394_pci_driver); } module_init(ohci1394_init); Modified: trunk/hosts.c ============================================================================== --- trunk/hosts.c (original) +++ trunk/hosts.c Tue Jul 30 21:43:52 2002 @@ -38,7 +38,7 @@ return -1; } -static struct hpsb_host_operations dummy_ops = { +static struct hpsb_host_driver dummy_driver = { .transmit_packet = dummy_transmit_packet, .devctl = dummy_devctl }; @@ -63,7 +63,7 @@ spin_lock_irqsave(&hosts_lock, flags); list_for_each(lh, &hosts) { if (host == list_entry(lh, struct hpsb_host, host_list)) { - host->ops->devctl(host, MODIFY_USAGE, 1); + host->driver->devctl(host, MODIFY_USAGE, 1); host->refcount++; retval = 1; break; @@ -87,7 +87,7 @@ { unsigned long flags; - host->ops->devctl(host, MODIFY_USAGE, 0); + host->driver->devctl(host, MODIFY_USAGE, 0); spin_lock_irqsave(&hosts_lock, flags); host->refcount--; @@ -128,7 +128,6 @@ h->hostdata = h + 1; h->driver = drv; - h->ops = drv->ops; h->refcount = 1; INIT_LIST_HEAD(&h->pending_packets); @@ -152,62 +151,25 @@ unsigned long flags; spin_lock_irqsave(&hosts_lock, flags); - host->driver->number_of_hosts++; - list_add_tail(&host->driver_list, &host->driver->hosts); list_add_tail(&host->host_list, &hosts); spin_unlock_irqrestore(&hosts_lock, flags); highlevel_add_host(host); - host->ops->devctl(host, RESET_BUS, 0); + host->driver->devctl(host, RESET_BUS, 0); } void hpsb_remove_host(struct hpsb_host *host) { - struct hpsb_host_driver *drv = host->driver; unsigned long flags; host->is_shutdown = 1; - host->ops = &dummy_ops; + host->driver = &dummy_driver; highlevel_remove_host(host); spin_lock_irqsave(&hosts_lock, flags); - list_del(&host->driver_list); list_del(&host->host_list); - drv->number_of_hosts--; spin_unlock_irqrestore(&hosts_lock, flags); } - - -struct hpsb_host_driver *hpsb_register_lowlevel(struct hpsb_host_operations *op, - const char *name) -{ - struct hpsb_host_driver *drv; - - drv = kmalloc(sizeof(struct hpsb_host_driver), SLAB_KERNEL); - if (!drv) return NULL; - - INIT_LIST_HEAD(&drv->list); - INIT_LIST_HEAD(&drv->hosts); - drv->number_of_hosts = 0; - drv->name = name; - drv->ops = op; - - spin_lock(&host_drivers_lock); - list_add_tail(&drv->list, &host_drivers); - spin_unlock(&host_drivers_lock); - - return drv; -} - -void hpsb_unregister_lowlevel(struct hpsb_host_driver *drv) -{ - spin_lock(&host_drivers_lock); - list_del(&drv->list); - spin_unlock(&host_drivers_lock); - - kfree(drv); -} - /* * This function calls the given function for every host currently registered. Modified: trunk/hosts.h ============================================================================== --- trunk/hosts.h (original) +++ trunk/hosts.h Tue Jul 30 21:43:53 2002 @@ -15,7 +15,6 @@ struct hpsb_host { struct list_head host_list; - struct hpsb_host_operations *ops; void *hostdata; atomic_t generation; @@ -59,7 +58,6 @@ struct csr_control csr; struct hpsb_host_driver *driver; - struct list_head driver_list; struct pci_dev *pdev; }; @@ -113,7 +111,9 @@ SHORT_RESET }; -struct hpsb_host_operations { +struct hpsb_host_driver { + const char *name; + /* This function must store a pointer to the configuration ROM into the * location referenced to by pointer and return the size of the ROM. It * may not fail. If any allocation is required, it must be done @@ -149,18 +149,6 @@ quadlet_t data, quadlet_t compare); }; -struct hpsb_host_driver { - struct list_head list; - - struct list_head hosts; - - int number_of_hosts; - const char *name; - - struct hpsb_host_operations *ops; -}; - - /* core internal use */ void register_builtin_lowlevels(void); @@ -183,9 +171,5 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra); void hpsb_add_host(struct hpsb_host *host); void hpsb_remove_host(struct hpsb_host *h); - -struct hpsb_host_driver *hpsb_register_lowlevel(struct hpsb_host_operations *op, - const char *name); -void hpsb_unregister_lowlevel(struct hpsb_host_driver *drv); #endif /* _IEEE1394_HOSTS_H */ Modified: trunk/highlevel.c ============================================================================== --- trunk/highlevel.c (original) +++ trunk/highlevel.c Tue Jul 30 21:43:53 2002 @@ -139,7 +139,7 @@ } if (host->iso_listen_count[channel]++ == 0) { - host->ops->devctl(host, ISO_LISTEN_CHANNEL, channel); + host->driver->devctl(host, ISO_LISTEN_CHANNEL, channel); } } @@ -152,7 +152,7 @@ } if (--host->iso_listen_count[channel] == 0) { - host->ops->devctl(host, ISO_UNLISTEN_CHANNEL, channel); + host->driver->devctl(host, ISO_UNLISTEN_CHANNEL, channel); } } Modified: trunk/pcilynx.c ============================================================================== --- trunk/pcilynx.c (original) +++ trunk/pcilynx.c Tue Jul 30 21:43:53 2002 @@ -65,7 +65,7 @@ static int skip_eeprom = 0; -static struct hpsb_host_driver *lynx_driver; +static struct hpsb_host_driver lynx_driver; static unsigned int card_id; @@ -1327,7 +1327,7 @@ error = -ENOMEM; - host = hpsb_alloc_host(lynx_driver, sizeof(struct ti_lynx)); + host = hpsb_alloc_host(&lynx_driver, sizeof(struct ti_lynx)); if (!host) FAIL("failed to allocate control structure memory"); lynx = host->hostdata; @@ -1697,7 +1697,8 @@ .remove = __devexit_p(remove_card), }; -static struct hpsb_host_operations lynx_ops = { +static struct hpsb_host_driver lynx_driver = { + .name = PCILYNX_DRIVER_NAME, .get_rom = get_lynx_rom, .transmit_packet = lynx_transmit, .devctl = lynx_devctl, @@ -1721,22 +1722,14 @@ } #endif - lynx_driver = hpsb_register_lowlevel(&lynx_ops, PCILYNX_DRIVER_NAME); - if (!lynx_driver) { - ret = -ENOMEM; - goto free_char_dev; - } - ret = pci_module_init(&lynx_pci_driver); if (ret < 0) { PRINT_G(KERN_ERR, "PCI module init failed"); - goto unregister_lowlevel; + goto free_char_dev; } return 0; - unregister_lowlevel: - hpsb_unregister_lowlevel(lynx_driver); free_char_dev: #ifdef CONFIG_IEEE1394_PCILYNX_PORTS unregister_chrdev(PCILYNX_MAJOR, PCILYNX_DRIVER_NAME); @@ -1748,7 +1741,6 @@ static void __exit pcilynx_cleanup(void) { pci_unregister_driver(&lynx_pci_driver); - hpsb_unregister_lowlevel(lynx_driver); #ifdef CONFIG_IEEE1394_PCILYNX_PORTS unregister_chrdev(PCILYNX_MAJOR, PCILYNX_DRIVER_NAME); Modified: trunk/csr.c ============================================================================== --- trunk/csr.c (original) +++ trunk/csr.c Tue Jul 30 21:43:54 2002 @@ -70,7 +70,7 @@ { host->csr.lock = SPIN_LOCK_UNLOCKED; - host->csr.rom_size = host->ops->get_rom(host, &host->csr.rom); + host->csr.rom_size = host->driver->get_rom(host, &host->csr.rom); host->csr.state = 0; host->csr.node_ids = 0; @@ -152,7 +152,7 @@ case CSR_CYCLE_TIME: oldcycle = host->csr.cycle_time; host->csr.cycle_time = - host->ops->devctl(host, GET_CYCLE_COUNTER, 0); + host->driver->devctl(host, GET_CYCLE_COUNTER, 0); if (oldcycle > host->csr.cycle_time) { /* cycle time wrapped around */ @@ -163,7 +163,7 @@ case CSR_BUS_TIME: oldcycle = host->csr.cycle_time; host->csr.cycle_time = - host->ops->devctl(host, GET_CYCLE_COUNTER, 0); + host->driver->devctl(host, GET_CYCLE_COUNTER, 0); if (oldcycle > host->csr.cycle_time) { /* cycle time wrapped around */ @@ -181,32 +181,32 @@ return RCODE_ADDRESS_ERROR; case CSR_BUS_MANAGER_ID: - if (host->ops->hw_csr_reg) - ret = host->ops->hw_csr_reg(host, 0, 0, 0); + if (host->driver->hw_csr_reg) + ret = host->driver->hw_csr_reg(host, 0, 0, 0); else ret = host->csr.bus_manager_id; *(buf++) = cpu_to_be32(ret); out; case CSR_BANDWIDTH_AVAILABLE: - if (host->ops->hw_csr_reg) - ret = host->ops->hw_csr_reg(host, 1, 0, 0); + if (host->driver->hw_csr_reg) + ret = host->driver->hw_csr_reg(host, 1, 0, 0); else ret = host->csr.bandwidth_available; *(buf++) = cpu_to_be32(ret); out; case CSR_CHANNELS_AVAILABLE_HI: - if (host->ops->hw_csr_reg) - ret = host->ops->hw_csr_reg(host, 2, 0, 0); + if (host->driver->hw_csr_reg) + ret = host->driver->hw_csr_reg(host, 2, 0, 0); else ret = host->csr.channels_available_hi; *(buf++) = cpu_to_be32(ret); out; case CSR_CHANNELS_AVAILABLE_LO: - if (host->ops->hw_csr_reg) - ret = host->ops->hw_csr_reg(host, 3, 0, 0); + if (host->driver->hw_csr_reg) + ret = host->driver->hw_csr_reg(host, 3, 0, 0); else ret = host->csr.channels_available_lo; @@ -244,7 +244,7 @@ host->csr.node_ids &= NODE_MASK << 16; host->csr.node_ids |= be32_to_cpu(*(data++)) & (BUS_MASK << 16); host->node_id = host->csr.node_ids >> 16; - host->ops->devctl(host, SET_BUS_ID, host->node_id >> 6); + host->driver->devctl(host, SET_BUS_ID, host->node_id >> 6); out; case CSR_RESET_START: @@ -269,7 +269,7 @@ case CSR_CYCLE_TIME: /* should only be set by cycle start packet, automatically */ host->csr.cycle_time = be32_to_cpu(*data); - host->ops->devctl(host, SET_CYCLE_COUNTER, + host->driver->devctl(host, SET_CYCLE_COUNTER, be32_to_cpu(*(data++))); out; case CSR_BUS_TIME: @@ -318,10 +318,10 @@ data = be32_to_cpu(data); arg = be32_to_cpu(arg); - if (host->ops->hw_csr_reg) { + if (host->driver->hw_csr_reg) { quadlet_t old; - old = host->ops-> + old = host->driver-> hw_csr_reg(host, (csraddr - CSR_BUS_MANAGER_ID) >> 2, data, arg); |
From: SVN U. <hog...@li...> - 2002-07-30 21:40:02
|
Author: hogsberg Date: 2002-07-30 17:41:12 -0400 (Tue, 30 Jul 2002) New Revision: 537 Modified: Log: Remove redundant tracking of lowlevel drivers (hpsb_register_lowlevel etc.) and combine hpsb_host_driver and hpsb_host_operations structs. /home/svn/hooks/commit-email.pl: /usr/bin/svnlook /home/svn rev 537 diff failed with this output: svn_error: #21090 : <Berkeley DB error> Berkeley DB error while opening environment for filesystem /home/svn/db: DB_RUNRECOVERY: Fatal error, run database recovery |
From: SVN U. <ben...@li...> - 2002-07-28 02:38:27
|
Author: bencollins Date: Sat, 27 Jul 2002 21:23:40 -0400 New Revision: 535 Added: tags/v2.4/2.4.19-pre5/ tags/v2.4/2.4.19-rc2/ tags/v2.4/2.4.19-rc3/ tags/v2.5/2.5.26/ tags/v2.5/2.5.29/ tags/v2.5/2.5.8-pre1/ Removed: tags/2.4.19-pre5/ tags/2.4.19-rc2/ tags/2.4.19-rc3/ tags/2.5.26/ tags/2.5.29/ tags/2.5.8-pre1/ Log: Move tags to appropriate subdir Copied: 2.4.19-rc2 (from rev 534, tags/2.4.19-rc2) Copied: 2.4.19-rc3 (from rev 534, tags/2.4.19-rc3) Copied: 2.4.19-pre5 (from rev 534, tags/2.4.19-pre5) Copied: 2.5.8-pre1 (from rev 534, tags/2.5.8-pre1) Copied: 2.5.26 (from rev 534, tags/2.5.26) Copied: 2.5.29 (from rev 534, tags/2.5.29) |
From: SVN U. <ben...@li...> - 2002-07-28 02:37:42
|
Author: bencollins Date: Sat, 27 Jul 2002 21:12:17 -0400 New Revision: 533 Added: tags/2.5.29/ Removed: tags/2.5.28/ Log: Update tags to reflect reality Copied: 2.5.29 (from rev 532, tags/2.5.28) |
From: SVN U. <ben...@li...> - 2002-07-28 02:37:42
|
Author: bencollins Date: Sat, 27 Jul 2002 21:20:42 -0400 New Revision: 534 Added: tags/v2.4/ tags/v2.5/ Log: Let's start using subdirs for the kernel tags |
From: SVN U. <ben...@us...> - 2002-07-26 15:25:48
|
Author: bencollins Date: Fri, 26 Jul 2002 11:25:22 -0400 New Revision: 532 Added: tags/2.4.19-rc3/ tags/2.5.28/ Log: Tag new merges to Linus and Marcelo Copied: 2.4.19-rc3 (from rev 531, trunk) Copied: 2.5.28 (from rev 531, trunk) |
From: SVN U. <ben...@us...> - 2002-07-26 04:06:44
|
Author: bencollins Date: Fri, 26 Jul 2002 00:06:33 -0400 New Revision: 531 Modified: trunk/Makefile Log: Oops, that wasn't meant to go through Modified: trunk/Makefile ============================================================================== --- trunk/Makefile (original) +++ trunk/Makefile Fri Jul 26 00:06:41 2002 @@ -6,7 +6,7 @@ export-objs := ieee1394_core.o ohci1394.o cmp.o -#list-multi := ieee1394.o +list-multi := ieee1394.o ieee1394-objs := ieee1394_core.o ieee1394_transactions.o hosts.o \ highlevel.o csr.o nodemgr.o @@ -23,5 +23,5 @@ include $(TOPDIR)/Rules.make -#ieee1394.o: $(ieee1394-objs) -# $(LD) -r -o $(LDFLAGS) $@ $(ieee1394-objs) +ieee1394.o: $(ieee1394-objs) + $(LD) $(LDFLAGS) -r -o $@ $(ieee1394-objs) |
From: SVN U. <ben...@us...> - 2002-07-26 03:38:57
|
Author: bencollins Date: Thu, 25 Jul 2002 23:21:18 -0400 New Revision: 530 Modified: trunk/Makefile trunk/amdtp.c trunk/cmp.c trunk/csr.c trunk/dv1394.c trunk/eth1394.c trunk/hosts.c trunk/ieee1394_core.c trunk/nodemgr.c trunk/ohci1394.c trunk/pcilynx.c trunk/raw1394.c trunk/sbp2.c trunk/video1394.c Log: Switch to using ISO C style designated initializers. Based on a submitted patch. Modified: trunk/ieee1394_core.c ============================================================================== --- trunk/ieee1394_core.c (original) +++ trunk/ieee1394_core.c Thu Jul 25 23:21:44 2002 @@ -811,8 +811,8 @@ static int ieee1394_dispatch_open(struct inode *inode, struct file *file); static struct file_operations ieee1394_chardev_ops = { - owner: THIS_MODULE, - open: ieee1394_dispatch_open, + .owner =THIS_MODULE, + .open = ieee1394_dispatch_open, }; devfs_handle_t ieee1394_devfs_handle; Modified: trunk/ohci1394.c ============================================================================== --- trunk/ohci1394.c (original) +++ trunk/ohci1394.c Thu Jul 25 23:21:45 2002 @@ -2029,10 +2029,10 @@ } static struct hpsb_host_operations ohci1394_ops = { - get_rom: ohci_get_rom, - transmit_packet: ohci_transmit, - devctl: ohci_devctl, - hw_csr_reg: ohci_hw_csr_reg, + .get_rom = ohci_get_rom, + .transmit_packet = ohci_transmit, + .devctl = ohci_devctl, + .hw_csr_reg = ohci_hw_csr_reg, }; static struct hpsb_host_driver *ohci1394_driver; @@ -2308,12 +2308,12 @@ static struct pci_device_id ohci1394_pci_tbl[] __devinitdata = { { - class: PCI_CLASS_FIREWIRE_OHCI, - class_mask: 0x00ffffff, - vendor: PCI_ANY_ID, - device: PCI_ANY_ID, - subvendor: PCI_ANY_ID, - subdevice: PCI_ANY_ID, + .class = PCI_CLASS_FIREWIRE_OHCI, + .class_mask = 0x00ffffff, + .vendor = PCI_ANY_ID, + .device = PCI_ANY_ID, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, }, { 0, }, }; @@ -2321,10 +2321,10 @@ MODULE_DEVICE_TABLE(pci, ohci1394_pci_tbl); static struct pci_driver ohci1394_pci_driver = { - name: OHCI1394_DRIVER_NAME, - id_table: ohci1394_pci_tbl, - probe: ohci1394_pci_probe, - remove: ohci1394_pci_remove, + .name = OHCI1394_DRIVER_NAME, + .id_table = ohci1394_pci_tbl, + .probe = ohci1394_pci_probe, + .remove = ohci1394_pci_remove, }; Modified: trunk/amdtp.c ============================================================================== --- trunk/amdtp.c (original) +++ trunk/amdtp.c Thu Jul 25 23:21:47 2002 @@ -1191,11 +1191,11 @@ static struct file_operations amdtp_fops = { - owner: THIS_MODULE, - write: amdtp_write, - ioctl: amdtp_ioctl, - open: amdtp_open, - release: amdtp_release + .owner = THIS_MODULE, + .write = amdtp_write, + .ioctl = amdtp_ioctl, + .open = amdtp_open, + .release = amdtp_release }; /* IEEE1394 Subsystem functions */ @@ -1243,8 +1243,8 @@ } static struct hpsb_highlevel_ops amdtp_highlevel_ops = { - add_host: amdtp_add_host, - remove_host: amdtp_remove_host, + .add_host = amdtp_add_host, + .remove_host = amdtp_remove_host, }; /* Module interface */ Modified: trunk/raw1394.c ============================================================================== --- trunk/raw1394.c (original) +++ trunk/raw1394.c Thu Jul 25 23:21:48 2002 @@ -985,20 +985,20 @@ } static struct hpsb_highlevel_ops hl_ops = { - add_host: add_host, - remove_host: remove_host, - host_reset: host_reset, - iso_receive: iso_receive, - fcp_request: fcp_request, + .add_host = add_host, + .remove_host = remove_host, + .host_reset = host_reset, + .iso_receive = iso_receive, + .fcp_request = fcp_request, }; static struct file_operations file_ops = { - owner: THIS_MODULE, - read: raw1394_read, - write: raw1394_write, - poll: raw1394_poll, - open: raw1394_open, - release: raw1394_release, + .owner = THIS_MODULE, + .read = raw1394_read, + .write = raw1394_write, + .poll = raw1394_poll, + .open = raw1394_open, + .release = raw1394_release, }; static int __init init_raw1394(void) Modified: trunk/nodemgr.c ============================================================================== --- trunk/nodemgr.c (original) +++ trunk/nodemgr.c Thu Jul 25 23:21:49 2002 @@ -1358,9 +1358,9 @@ } static struct hpsb_highlevel_ops nodemgr_ops = { - add_host: nodemgr_add_host, - host_reset: nodemgr_host_reset, - remove_host: nodemgr_remove_host, + .add_host = nodemgr_add_host, + .host_reset = nodemgr_host_reset, + .remove_host = nodemgr_remove_host, }; static struct hpsb_highlevel *hl; Modified: trunk/Makefile ============================================================================== --- trunk/Makefile (original) +++ trunk/Makefile Thu Jul 25 23:21:50 2002 @@ -6,7 +6,7 @@ export-objs := ieee1394_core.o ohci1394.o cmp.o -list-multi := ieee1394.o +#list-multi := ieee1394.o ieee1394-objs := ieee1394_core.o ieee1394_transactions.o hosts.o \ highlevel.o csr.o nodemgr.o @@ -23,5 +23,5 @@ include $(TOPDIR)/Rules.make -ieee1394.o: $(ieee1394-objs) - $(LD) -r -o $@ $(ieee1394-objs) +#ieee1394.o: $(ieee1394-objs) +# $(LD) -r -o $(LDFLAGS) $@ $(ieee1394-objs) Modified: trunk/hosts.c ============================================================================== --- trunk/hosts.c (original) +++ trunk/hosts.c Thu Jul 25 23:21:50 2002 @@ -39,8 +39,8 @@ } static struct hpsb_host_operations dummy_ops = { - transmit_packet: dummy_transmit_packet, - devctl: dummy_devctl + .transmit_packet = dummy_transmit_packet, + .devctl = dummy_devctl }; /** Modified: trunk/eth1394.c ============================================================================== --- trunk/eth1394.c (original) +++ trunk/eth1394.c Thu Jul 25 23:21:51 2002 @@ -702,14 +702,14 @@ /* Function for incoming 1394 packets */ static struct hpsb_address_ops addr_ops = { - write: ether1394_write, + .write = ether1394_write, }; /* Ieee1394 highlevel driver functions */ static struct hpsb_highlevel_ops hl_ops = { - add_host: ether1394_add_host, - remove_host: ether1394_remove_host, - host_reset: ether1394_host_reset, + .add_host = ether1394_add_host, + .remove_host = ether1394_remove_host, + .host_reset = ether1394_host_reset, }; static int __init ether1394_init_module (void) Modified: trunk/sbp2.c ============================================================================== --- trunk/sbp2.c (original) +++ trunk/sbp2.c Thu Jul 25 23:21:52 2002 @@ -438,10 +438,10 @@ */ static struct ieee1394_device_id sbp2_id_table[] = { { - match_flags: IEEE1394_MATCH_SPECIFIER_ID | + .match_flags =IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION, - specifier_id: SBP2_UNIT_SPEC_ID_ENTRY & 0xffffff, - version: SBP2_SW_VERSION_ENTRY & 0xffffff + .specifier_id = SBP2_UNIT_SPEC_ID_ENTRY & 0xffffff, + .version = SBP2_SW_VERSION_ENTRY & 0xffffff }, { } }; @@ -528,27 +528,27 @@ static struct hpsb_highlevel *sbp2_hl_handle = NULL; static struct hpsb_highlevel_ops sbp2_hl_ops = { - add_host: sbp2_add_host, - remove_host: sbp2_remove_host, + .add_host = sbp2_add_host, + .remove_host = sbp2_remove_host, }; static struct hpsb_address_ops sbp2_ops = { - write: sbp2_handle_status_write + .write = sbp2_handle_status_write }; #ifdef CONFIG_IEEE1394_SBP2_PHYS_DMA static struct hpsb_address_ops sbp2_physdma_ops = { - read: sbp2_handle_physdma_read, - write: sbp2_handle_physdma_write, + .read = sbp2_handle_physdma_read, + .write = sbp2_handle_physdma_write, }; #endif static struct hpsb_protocol_driver sbp2_driver = { - name: "SBP2 Driver", - id_table: sbp2_id_table, - probe: sbp2_probe, - disconnect: sbp2_disconnect, - update: sbp2_update + .name = "SBP2 Driver", + .id_table = sbp2_id_table, + .probe = sbp2_probe, + .disconnect = sbp2_disconnect, + .update = sbp2_update }; /* List of device firmware's that require a forced 36 byte inquiry. Note @@ -3224,23 +3224,23 @@ /* SCSI host template */ static Scsi_Host_Template scsi_driver_template = { - name: "IEEE-1394 SBP-2 protocol driver", - info: sbp2scsi_info, - detect: sbp2scsi_detect, - queuecommand: sbp2scsi_queuecommand, - eh_abort_handler: sbp2scsi_abort, - eh_device_reset_handler:sbp2scsi_reset, - eh_bus_reset_handler: sbp2scsi_reset, - eh_host_reset_handler: sbp2scsi_reset, - bios_param: sbp2scsi_biosparam, - this_id: -1, - sg_tablesize: SBP2_MAX_SG_ELEMENTS, - use_clustering: SBP2_CLUSTERING, + .name = "IEEE-1394 SBP-2 protocol driver", + .info = sbp2scsi_info, + .detect = sbp2scsi_detect, + .queuecommand = sbp2scsi_queuecommand, + .eh_abort_handler = sbp2scsi_abort, + .eh_device_reset_handler =sbp2scsi_reset, + .eh_bus_reset_handler = sbp2scsi_reset, + .eh_host_reset_handler =sbp2scsi_reset, + .bios_param = sbp2scsi_biosparam, + .this_id = -1, + .sg_tablesize = SBP2_MAX_SG_ELEMENTS, + .use_clustering = SBP2_CLUSTERING, #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) - use_new_eh_code: TRUE, + .use_new_eh_code = TRUE, #endif - emulated: 1, - proc_name: SBP2_DEVICE_NAME, + .emulated = 1, + .proc_name = SBP2_DEVICE_NAME, }; static int sbp2_module_init(void) Modified: trunk/cmp.c ============================================================================== --- trunk/cmp.c (original) +++ trunk/cmp.c Thu Jul 25 23:21:53 2002 @@ -299,14 +299,14 @@ static struct hpsb_highlevel_ops cmp_highlevel_ops = { - add_host: cmp_add_host, - remove_host: cmp_remove_host, - host_reset: cmp_host_reset, + .add_host = cmp_add_host, + .remove_host = cmp_remove_host, + .host_reset = cmp_host_reset, }; static struct hpsb_address_ops pcr_ops = { - read: pcr_read, - lock: pcr_lock, + .read = pcr_read, + .lock = pcr_lock, }; /* Module interface */ Modified: trunk/pcilynx.c ============================================================================== --- trunk/pcilynx.c (original) +++ trunk/pcilynx.c Thu Jul 25 23:21:53 2002 @@ -693,13 +693,13 @@ static struct file_operations aux_ops = { - owner: THIS_MODULE, - read: mem_read, - write: mem_write, - poll: aux_poll, - llseek: mem_llseek, - open: mem_open, - release: mem_release, + .owner = THIS_MODULE, + .read = mem_read, + .write = mem_write, + .poll = aux_poll, + .llseek = mem_llseek, + .open = mem_open, + .release = mem_release, }; @@ -1682,25 +1682,25 @@ static struct pci_device_id pci_table[] __devinitdata = { { - vendor: PCI_VENDOR_ID_TI, - device: PCI_DEVICE_ID_TI_PCILYNX, - subvendor: PCI_ANY_ID, - subdevice: PCI_ANY_ID, + .vendor = PCI_VENDOR_ID_TI, + .device = PCI_DEVICE_ID_TI_PCILYNX, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, }, { } /* Terminating entry */ }; static struct pci_driver lynx_pci_driver = { - name: PCILYNX_DRIVER_NAME, - id_table: pci_table, - probe: add_card, - remove: __devexit_p(remove_card), + .name = PCILYNX_DRIVER_NAME, + .id_table = pci_table, + .probe = add_card, + .remove = __devexit_p(remove_card), }; static struct hpsb_host_operations lynx_ops = { - get_rom: get_lynx_rom, - transmit_packet: lynx_transmit, - devctl: lynx_devctl, + .get_rom = get_lynx_rom, + .transmit_packet = lynx_transmit, + .devctl = lynx_devctl, }; MODULE_AUTHOR("Andreas E. Bombe <and...@mu...>"); Modified: trunk/csr.c ============================================================================== --- trunk/csr.c (original) +++ trunk/csr.c Thu Jul 25 23:21:55 2002 @@ -402,23 +402,23 @@ static struct hpsb_highlevel_ops csr_ops = { - add_host: add_host, - host_reset: host_reset, + .add_host = add_host, + .host_reset = host_reset, }; static struct hpsb_address_ops map_ops = { - read: read_maps, + .read = read_maps, }; static struct hpsb_address_ops fcp_ops = { - write: write_fcp, + .write = write_fcp, }; static struct hpsb_address_ops reg_ops = { - read: read_regs, - write: write_regs, - lock: lock_regs, + .read = read_regs, + .write = write_regs, + .lock = lock_regs, }; static struct hpsb_highlevel *hl; Modified: trunk/video1394.c ============================================================================== --- trunk/video1394.c (original) +++ trunk/video1394.c Thu Jul 25 23:21:56 2002 @@ -1368,11 +1368,11 @@ static struct file_operations video1394_fops= { - owner: THIS_MODULE, - ioctl: video1394_ioctl, - mmap: video1394_mmap, - open: video1394_open, - release: video1394_release + .owner = THIS_MODULE, + .ioctl = video1394_ioctl, + .mmap = video1394_mmap, + .open = video1394_open, + .release = video1394_release }; static int video1394_init(struct ti_ohci *ohci) @@ -1460,8 +1460,8 @@ } static struct hpsb_highlevel_ops hl_ops = { - add_host: video1394_add_host, - remove_host: video1394_remove_host, + .add_host = video1394_add_host, + .remove_host = video1394_remove_host, }; MODULE_AUTHOR("Sebastien Rougeaux <seb...@an...>"); Modified: trunk/dv1394.c ============================================================================== --- trunk/dv1394.c (original) +++ trunk/dv1394.c Thu Jul 25 23:21:58 2002 @@ -1467,7 +1467,7 @@ } static struct vm_operations_struct dv1394_vm_ops = { - nopage: dv1394_nopage + .nopage = dv1394_nopage }; /* @@ -2547,15 +2547,15 @@ static struct file_operations dv1394_fops= { - owner: THIS_MODULE, - poll: dv1394_poll, - ioctl: dv1394_ioctl, - mmap: dv1394_mmap, - open: dv1394_open, - write: dv1394_write, - read: dv1394_read, - release: dv1394_release, - fasync: dv1394_fasync, + .owner = THIS_MODULE, + .poll = dv1394_poll, + .ioctl = dv1394_ioctl, + .mmap = dv1394_mmap, + .open = dv1394_open, + .write = dv1394_write, + .read = dv1394_read, + .release = dv1394_release, + .fasync = dv1394_fasync, }; @@ -3009,9 +3009,9 @@ } static struct hpsb_highlevel_ops hl_ops = { - add_host: dv1394_add_host, - remove_host: dv1394_remove_host, - host_reset: dv1394_host_reset, + .add_host = dv1394_add_host, + .remove_host = dv1394_remove_host, + .host_reset = dv1394_host_reset, }; |
From: SVN U. <hog...@us...> - 2002-07-25 00:15:54
|
Author: hogsberg Date: Wed, 24 Jul 2002 20:15:24 -0400 New Revision: 529 Modified: trunk/nodemgr.c trunk/sbp2.c Log: Remove spinlock madness from nodemgr.c and replace with simple semaphore locking scheme. Add more #ifdef cruft to sbp2.c to lift the io_request_lock during sbp2_init, which do all sorts of blocking stuff. Modified: trunk/nodemgr.c ============================================================================== --- trunk/nodemgr.c (original) +++ trunk/nodemgr.c Wed Jul 24 20:15:34 2002 @@ -45,18 +45,21 @@ * a way that's easy to parse by the protocol interface. */ -static LIST_HEAD(node_list); -static rwlock_t node_lock = RW_LOCK_UNLOCKED; +/* The nodemgr maintains a number of data structures: the node list, + * the driver list, unit directory list and the host info list. The + * first three lists are accessed from process context only: /proc + * readers, insmod and rmmod, and the nodemgr thread. Access to these + * lists are serialized by means of the nodemgr_serialize mutex, which + * must be taken before accessing the structures and released + * afterwards. The host info list is only accessed during insmod, + * rmmod and from interrupt and allways only for a short period of + * time, so a spinlock is used to protect this list. + */ +static DECLARE_MUTEX(nodemgr_serialize); +static LIST_HEAD(node_list); static LIST_HEAD(driver_list); -static rwlock_t driver_lock = RW_LOCK_UNLOCKED; - -/* The rwlock unit_directory_lock is always held when manipulating the - * global unit_directory_list, but this also protects access to the - * lists of unit directories stored in the protocol drivers. - */ static LIST_HEAD(unit_directory_list); -static rwlock_t unit_directory_lock = RW_LOCK_UNLOCKED; static LIST_HEAD(host_info_list); static spinlock_t host_info_lock = SPIN_LOCK_UNLOCKED; @@ -84,6 +87,9 @@ int len; char *out = page; + if (down_interruptible(&nodemgr_serialize)) + return -EINTR; + list_for_each(lh, &node_list) { struct list_head *l; int ud_count = 0; @@ -148,6 +154,8 @@ } + up(&nodemgr_serialize); + len = out - page; len -= off; if (len < count) { @@ -306,7 +314,6 @@ nodeid_t nodeid, unsigned int generation) { struct node_entry *ne; - unsigned long flags; ne = nodemgr_scan_root_directory (host, nodeid, generation); if (!ne) return NULL; @@ -318,9 +325,7 @@ ne->guid = guid; ne->generation = generation; - write_lock_irqsave(&node_lock, flags); list_add_tail(&ne->list, &node_list); - write_unlock_irqrestore(&node_lock, flags); nodemgr_process_config_rom (ne, busoptions); @@ -758,11 +763,9 @@ void hpsb_release_unit_directory(struct unit_directory *ud) { - unsigned long flags; - - write_lock_irqsave(&unit_directory_lock, flags); + down(&nodemgr_serialize); nodemgr_release_unit_directory(ud); - write_unlock_irqrestore(&unit_directory_lock, flags); + up(&nodemgr_serialize); } static void nodemgr_free_unit_directories(struct node_entry *ne) @@ -852,13 +855,12 @@ { struct unit_directory *ud; struct list_head *lh; - unsigned long flags; - write_lock_irqsave(&driver_lock, flags); + if (down_interruptible(&nodemgr_serialize)) + return -EINTR; + list_add_tail(&driver->list, &driver_list); - write_unlock_irqrestore(&driver_lock, flags); - write_lock_irqsave(&unit_directory_lock, flags); INIT_LIST_HEAD(&driver->unit_directories); lh = unit_directory_list.next; while (lh != &unit_directory_list) { @@ -867,7 +869,8 @@ if (nodemgr_match_driver(driver, ud) && driver->probe(ud) == 0) nodemgr_claim_unit_directory(ud, driver); } - write_unlock_irqrestore(&unit_directory_lock, flags); + + up(&nodemgr_serialize); /* * Right now registration always succeeds, but maybe we should @@ -881,13 +884,10 @@ { struct list_head *lh; struct unit_directory *ud; - unsigned long flags; - write_lock_irqsave(&driver_lock, flags); - list_del(&driver->list); - write_unlock_irqrestore(&driver_lock, flags); + down(&nodemgr_serialize); - write_lock_irqsave(&unit_directory_lock, flags); + list_del(&driver->list); lh = driver->unit_directories.next; while (lh != &driver->unit_directories) { ud = list_entry(lh, struct unit_directory, driver_list); @@ -896,14 +896,13 @@ ud->driver->disconnect(ud); nodemgr_release_unit_directory(ud); } - write_unlock_irqrestore(&unit_directory_lock, flags); + + up(&nodemgr_serialize); } static void nodemgr_process_config_rom(struct node_entry *ne, quadlet_t busoptions) { - unsigned long flags; - ne->busopt.irmc = (busoptions >> 31) & 1; ne->busopt.cmc = (busoptions >> 30) & 1; ne->busopt.isc = (busoptions >> 29) & 1; @@ -929,11 +928,9 @@ * thing. If this was a new device, the call to * nodemgr_disconnect_drivers is a no-op and all is well. */ - write_lock_irqsave(&unit_directory_lock, flags); nodemgr_free_unit_directories(ne); nodemgr_process_root_directory(ne); nodemgr_bind_drivers(ne); - write_unlock_irqrestore(&unit_directory_lock, flags); } /* @@ -1032,16 +1029,12 @@ static void nodemgr_remove_node(struct node_entry *ne) { - unsigned long flags; - HPSB_DEBUG("%s removed: Node[" NODE_BUS_FMT "] GUID[%016Lx] [%s]", (ne->host->node_id == ne->nodeid) ? "Host" : "Device", NODE_BUS_ARGS(ne->nodeid), (unsigned long long)ne->guid, ne->vendor_name ?: "Unknown"); - write_lock_irqsave(&unit_directory_lock, flags); nodemgr_free_unit_directories(ne); - write_unlock_irqrestore(&unit_directory_lock, flags); list_del(&ne->list); kfree(ne); @@ -1077,7 +1070,7 @@ } guid = ((u64)buffer[3] << 32) | buffer[4]; - ne = hpsb_guid_get_entry(guid); + ne = find_entry_by_guid(guid); if (!ne) nodemgr_create_node(guid, buffer[2], host, nodeid, generation); @@ -1089,13 +1082,11 @@ static void nodemgr_node_probe_cleanup(struct hpsb_host *host, unsigned int generation) { - unsigned long flags; struct list_head *lh, *next; struct node_entry *ne; /* Now check to see if we have any nodes that aren't referenced * any longer. */ - write_lock_irqsave(&node_lock, flags); list_for_each_safe(lh, next, &node_list) { ne = list_entry(lh, struct node_entry, list); @@ -1110,7 +1101,6 @@ if (ne->generation != generation) nodemgr_remove_node(ne); } - write_unlock_irqrestore(&node_lock, flags); return; } @@ -1169,12 +1159,14 @@ daemonize(); strcpy(current->comm, "knodemgrd"); - + /* Sit and wait for a signal to probe the nodes on the bus. This * happens when we get a bus reset. */ - while (!down_interruptible(&hi->reset_sem)) + while (!down_interruptible(&hi->reset_sem) && + !down_interruptible(&nodemgr_serialize)) { nodemgr_node_probe(hi->host); - + up(&nodemgr_serialize); + } #ifdef CONFIG_IEEE1394_VERBOSEDEBUG HPSB_DEBUG ("NodeMgr: Exiting thread for %s", hi->host->driver->name); #endif @@ -1184,24 +1176,22 @@ struct node_entry *hpsb_guid_get_entry(u64 guid) { - unsigned long flags; struct node_entry *ne; - read_lock_irqsave(&node_lock, flags); + down(&nodemgr_serialize); ne = find_entry_by_guid(guid); - read_unlock_irqrestore(&node_lock, flags); + up(&nodemgr_serialize); return ne; } struct node_entry *hpsb_nodeid_get_entry(nodeid_t nodeid) { - unsigned long flags; struct node_entry *ne; - read_lock_irqsave(&node_lock, flags); + down(&nodemgr_serialize); ne = find_entry_by_nodeid(nodeid); - read_unlock_irqrestore(&node_lock, flags); + up(&nodemgr_serialize); return ne; } @@ -1309,17 +1299,14 @@ } } - if (hi == NULL) { - HPSB_ERR ("NodeMgr: could not process reset of non-existent host"); - goto done_reset_host; - } - + if (hi != NULL) #ifdef CONFIG_IEEE1394_VERBOSEDEBUG HPSB_DEBUG ("NodeMgr: Processing host reset for %s", host->driver->name); #endif - up(&hi->reset_sem); + up(&hi->reset_sem); + else + HPSB_ERR ("NodeMgr: could not process reset of non-existent host"); -done_reset_host: spin_unlock_irqrestore (&host_info_lock, flags); return; @@ -1341,30 +1328,31 @@ break; } } - - if (!hi) - HPSB_ERR ("NodeMgr: host %s does not exist, cannot remove", - host->driver->name); spin_unlock_irqrestore (&host_info_lock, flags); + if (hi) { + if (hi->pid >= 0) { + kill_proc(hi->pid, SIGTERM, 1); + wait_for_completion(&hi->exited); + } + kfree(hi); + } + else + HPSB_ERR("NodeMgr: host %s does not exist, cannot remove", + host->driver->name); + + down(&nodemgr_serialize); + /* Even if we fail the host_info part, remove all the node * entries. */ - write_lock_irqsave(&node_lock, flags); list_for_each_safe(lh, next, &node_list) { ne = list_entry(lh, struct node_entry, list); if (ne->host == host) nodemgr_remove_node(ne); } - write_unlock_irqrestore(&node_lock, flags); - if (hi) { - if (hi->pid >= 0) { - kill_proc(hi->pid, SIGTERM, 1); - wait_for_completion(&hi->exited); - } - kfree(hi); - } + up(&nodemgr_serialize); return; } Modified: trunk/sbp2.c ============================================================================== --- trunk/sbp2.c (original) +++ trunk/sbp2.c Wed Jul 24 20:15:36 2002 @@ -320,6 +320,7 @@ #include <linux/blk.h> #include <linux/smp_lock.h> #include <linux/init.h> +#include <linux/blk.h> #include <asm/current.h> #include <asm/uaccess.h> #include <asm/io.h> @@ -3170,7 +3171,14 @@ * host controller currently registered, and for each of those * we register a scsi host with the scsi stack. */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) + spin_unlock_irq(&io_request_lock); sbp2_init(); + spin_lock_irq(&io_request_lock); +#else + sbp2_init(); +#endif /* We return the number of hosts registered. */ return scsi_driver_template.present; |
From: SVN U. <dde...@us...> - 2002-07-22 05:10:37
|
Author: ddennedy Date: Mon, 22 Jul 2002 01:10:16 -0400 New Revision: 528 Modified: trunk/dv1394-private.h trunk/dv1394.c Log: make dv1394 work without devfs, correct logic of empty packet insertion per intended meaning of cip_n and cip_d Modified: trunk/dv1394-private.h ============================================================================== --- trunk/dv1394-private.h (original) +++ trunk/dv1394-private.h Mon Jul 22 01:10:27 2002 @@ -602,7 +602,7 @@ calibrated against a Sony DSR-40 DVCAM deck */ #define CIP_N_NTSC 68000000 -#define CIP_D_NTSC 1000000000 +#define CIP_D_NTSC 1068000000 #define CIP_N_PAL 1 #define CIP_D_PAL 16 Modified: trunk/dv1394.c ============================================================================== --- trunk/dv1394.c (original) +++ trunk/dv1394.c Mon Jul 22 01:10:28 2002 @@ -382,10 +382,10 @@ /* is this an empty packet? */ - if(video->cip_accum > video->cip_d) { + if(video->cip_accum > (video->cip_d - video->cip_n)) { empty_packet = 1; payload_size = 8; - video->cip_accum -= video->cip_d; + video->cip_accum -= (video->cip_d - video->cip_n); } else { payload_size = 488; video->cip_accum += video->cip_n; @@ -2764,8 +2764,10 @@ video->id |= mode; else video->id |= 2 + mode; +#ifdef CONFIG_DEVFS_FS if (dv1394_devfs_add_entry(video) < 0) goto err_free; +#endif debug_printk("dv1394: dv1394_init() OK on ID %d\n", video->id); @@ -2788,7 +2790,9 @@ (video->pal_or_ntsc == DV1394_NTSC ? "NTSC" : "PAL"), (video->mode == MODE_RECEIVE ? "in" : "out") ); +#ifdef CONFIG_DEVFS_FS dv1394_devfs_del(buf); +#endif #ifdef CONFIG_PROC_FS dv1394_procfs_del(buf); #endif @@ -2825,12 +2829,14 @@ spin_unlock_irqrestore(&dv1394_cards_lock, flags); n = (video->id >> 2); +#ifdef CONFIG_DEVFS_FS snprintf(buf, sizeof(buf), "dv/host%d/NTSC", n); dv1394_devfs_del(buf); snprintf(buf, sizeof(buf), "dv/host%d/PAL", n); dv1394_devfs_del(buf); snprintf(buf, sizeof(buf), "dv/host%d", n); dv1394_devfs_del(buf); +#endif #ifdef CONFIG_PROC_FS snprintf(buf, sizeof(buf), "dv/host%d/NTSC", n); @@ -2867,6 +2873,7 @@ } #endif +#ifdef CONFIG_DEVFS_FS devfs_entry = dv1394_devfs_find("dv"); if (devfs_entry != NULL) { snprintf(buf, sizeof(buf), "host%d", ohci->id); @@ -2874,6 +2881,7 @@ dv1394_devfs_add_dir("NTSC", devfs_entry, NULL); dv1394_devfs_add_dir("PAL", devfs_entry, NULL); } +#endif dv1394_init(ohci, DV1394_NTSC, MODE_RECEIVE); dv1394_init(ohci, DV1394_NTSC, MODE_TRANSMIT); @@ -3018,7 +3026,9 @@ { hpsb_unregister_highlevel (hl_handle); ieee1394_unregister_chardev(IEEE1394_MINOR_BLOCK_DV1394); +#ifdef CONFIG_DEVFS_FS dv1394_devfs_del("dv"); +#endif #ifdef CONFIG_PROC_FS dv1394_procfs_del("dv"); #endif @@ -3032,17 +3042,21 @@ return -EIO; } +#ifdef CONFIG_DEVFS_FS if (dv1394_devfs_add_dir("dv", NULL, NULL) < 0) { printk(KERN_ERR "dv1394: unable to create /dev/ieee1394/dv\n"); ieee1394_unregister_chardev(IEEE1394_MINOR_BLOCK_DV1394); return -ENOMEM; } +#endif #ifdef CONFIG_PROC_FS if (dv1394_procfs_add_dir("dv",NULL,NULL) < 0) { printk(KERN_ERR "dv1394: unable to create /proc/bus/ieee1394/dv\n"); ieee1394_unregister_chardev(IEEE1394_MINOR_BLOCK_DV1394); +#ifdef CONFIG_DEVFS_FS dv1394_devfs_del("dv"); +#endif return -ENOMEM; } #endif @@ -3051,7 +3065,9 @@ if (hl_handle == NULL) { printk(KERN_ERR "dv1394: hpsb_register_highlevel failed\n"); ieee1394_unregister_chardev(IEEE1394_MINOR_BLOCK_DV1394); +#ifdef CONFIG_DEVFS_FS dv1394_devfs_del("dv"); +#endif #ifdef CONFIG_PROC_FS dv1394_procfs_del("dv"); #endif |
From: SVN U. <hog...@us...> - 2002-07-17 18:42:43
|
Author: hogsberg Date: Wed, 17 Jul 2002 14:42:20 -0400 New Revision: 527 Modified: trunk/amdtp.c Log: Fix bug in start-on-cycle logic. Modified: trunk/amdtp.c ============================================================================== --- trunk/amdtp.c (original) +++ trunk/amdtp.c Wed Jul 17 14:42:29 2002 @@ -333,18 +333,23 @@ static void stream_start_dma(struct stream *s, struct packet_list *pl) { - u32 syt, cycle_count; + u32 syt_cycle, cycle_count, start_cycle; cycle_count = reg_read(s->host->host->hostdata, OHCI1394_IsochronousCycleTimer) >> 12; - syt = be16_to_cpu(pl->packets[0].payload->syt) & 0x0f; - cycle_count = (cycle_count & ~0x0f) + 32 + syt; - if ((cycle_count & 0x1fff) >= 8000) - cycle_count = cycle_count - 8000 + 0x2000; + syt_cycle = (pl->last_cycle_count - PACKET_LIST_SIZE + 1) & 0x0f; + + /* We program the DMA controller to start transmission at + * least 17 cycles from now - this happens when the lower four + * bits of cycle_count is 0x0f and syt_cycle is 0, in this + * case the start cycle is cycle_count - 15 + 32. */ + start_cycle = (cycle_count & ~0x0f) + 32 + syt_cycle; + if ((start_cycle & 0x1fff) >= 8000) + start_cycle = start_cycle - 8000 + 0x2000; ohci1394_start_it_ctx(s->host->ohci, s->iso_context, pl->packets[0].db_bus, 3, - cycle_count & 0x7fff); + start_cycle & 0x7fff); } static void stream_put_dma_packet_list(struct stream *s, @@ -744,13 +749,12 @@ s->cycle_offset.integer) & 0xffff; fraction_add(&s->cycle_offset, &s->cycle_offset, &s->ticks_per_syt_offset); - if (s->cycle_offset.integer >= 3072) { - /* This next addition should be modulo 8000 - * (0x1f40), but we only use the lower 4 bits - * of cycle_count, so we dont need the modulo. */ - atomic_add(s->cycle_offset.integer / 3072, &s->cycle_count); - s->cycle_offset.integer %= 3072; - } + + /* This next addition should be modulo 8000 (0x1f40), + * but we only use the lower 4 bits of cycle_count, so + * we dont need the modulo. */ + atomic_add(s->cycle_offset.integer / 3072, &s->cycle_count); + s->cycle_offset.integer %= 3072; } else syt = 0xffff; @@ -891,7 +895,7 @@ static int stream_configure(struct stream *s, int cmd, struct amdtp_ioctl *cfg) { - const int transfer_delay = 3000; + const int transfer_delay = 9000; if (cfg->format <= AMDTP_FORMAT_IEC958_AC3) s->format = cfg->format; |
From: SVN U. <ben...@us...> - 2002-07-16 17:41:07
|
Author: bencollins Date: Tue, 16 Jul 2002 13:40:34 -0400 New Revision: 526 Added: tags/2.4.19-rc2/ Removed: tags/2.4.19/ Log: Got confirmation that this was applied to -rc2 Copied: 2.4.19-rc2 (from rev 524, tags/2.4.19) |
From: SVN U. <ben...@us...> - 2002-07-15 16:38:18
|
Author: bencollins Date: Sun, 14 Jul 2002 17:26:38 -0400 New Revision: 524 Modified: trunk/sbp2.c Log: Fix sbp2_broken_inquiry_list list. Also, output better defug messages for workaround Modified: trunk/sbp2.c ============================================================================== --- trunk/sbp2.c (original) +++ trunk/sbp2.c Mon Jul 15 12:38:03 2002 @@ -550,9 +550,10 @@ update: sbp2_update }; -/* List of device firmware's that require a forced 36 byte inquiry */ +/* List of device firmware's that require a forced 36 byte inquiry. Note + * the final 0x0 needs to be there for denoting end of list. */ static u32 sbp2_broken_inquiry_list[] = { - 0x00002800 + 0x00002800, 0x0 }; /************************************** @@ -1937,8 +1938,9 @@ if ((scsi_id->sbp2_firmware_revision & 0xffff00) == SBP2_128KB_BROKEN_FIRMWARE && (sbp2_max_sectors * 512) > (128 * 1024)) { - SBP2_WARN("Bridge only supports 128KB max transfer size."); - SBP2_WARN("WARNING: Current sbp2_max_sectors setting is larger than 128k (%d sectors)!", + SBP2_WARN("Node " NODE_BUS_FMT ": Bridge only supports 128KB max transfer size.", + NODE_BUS_ARGS(scsi_id->ne->nodeid)); + SBP2_WARN("WARNING: Current sbp2_max_sectors setting is larger than 128KB (%d sectors)!", sbp2_max_sectors); scsi_id->workarounds |= SBP2_BREAKAGE_128K_MAX_TRANSFER; } @@ -1953,8 +1955,12 @@ * linux1394-devel mailing list. */ for (i = 0; sbp2_broken_inquiry_list[i]; i++) { if ((scsi_id->sbp2_firmware_revision & 0xffff00) == - sbp2_broken_inquiry_list[i]) + sbp2_broken_inquiry_list[i]) { + SBP2_WARN("Node " NODE_BUS_FMT ": Using 36byte inquiry workaround", + NODE_BUS_ARGS(scsi_id->ne->nodeid)); scsi_id->workarounds |= SBP2_BREAKAGE_INQUIRY_HACK; + break; // No need to continue. + } } } |
From: SVN U. <ben...@us...> - 2002-07-15 16:38:04
|
Author: bencollins Date: Sun, 14 Jul 2002 17:14:33 -0400 New Revision: 523 Modified: trunk/sbp2.c trunk/sbp2.h Log: Add a scsi_id->workarounds to list detected brokeness in some devices. Added detection of firmware revisions for a black list of devices that require 36byte inquiry. Modified: trunk/sbp2.c ============================================================================== --- trunk/sbp2.c (original) +++ trunk/sbp2.c Mon Jul 15 12:37:49 2002 @@ -427,7 +427,7 @@ * is not properly handling the SCSI inquiry command. This hack makes the inquiry look more * like a typical MS Windows inquiry. */ -MODULE_PARM(sbp2_force_inquiry_hack,"i") +MODULE_PARM(sbp2_force_inquiry_hack,"i"); MODULE_PARM_DESC(sbp2_force_inquiry_hack, "Force SCSI inquiry hack (default = 0)"); static int sbp2_force_inquiry_hack = 0; @@ -550,6 +550,10 @@ update: sbp2_update }; +/* List of device firmware's that require a forced 36 byte inquiry */ +static u32 sbp2_broken_inquiry_list[] = { + 0x00002800 +}; /************************************** * General utility functions @@ -1905,27 +1909,53 @@ break; case SBP2_FIRMWARE_REVISION_KEY: - /* - * Firmware revision (used to find broken - * devices). If the vendor id is 0xa0b8 - * (Symbios vendor id), then we have a - * bridge with 128KB max transfer size - * limitation. - */ + /* Firmware revision */ scsi_id->sbp2_firmware_revision = CONFIG_ROM_VALUE(ud->quadlets[i]); SBP2_DEBUG("sbp2_firmware_revision = %x", (unsigned int) scsi_id->sbp2_firmware_revision); - if ((scsi_id->sbp2_firmware_revision & 0xffff00) == - SBP2_128KB_BROKEN_FIRMWARE) { - SBP2_WARN("warning: Bridge chipset supports 128KB max transfer size"); - } break; default: break; } } + + /* This is the start of our broken device checking. We try to hack + * around oddities and known defects. */ + scsi_id->workarounds = 0x0; + + /* If the vendor id is 0xa0b8 (Symbios vendor id), then we have a + * bridge with 128KB max transfer size limitation. For sanity, we + * only voice this when the current sbp2_max_sectors setting + * exceeds the 128k limit. By default, that is not the case. + * + * It would be really nice if we could detect this before the scsi + * host gets initialized. That way we can down-force the + * sbp2_max_sectors to account for it. That is not currently + * possible. */ + if ((scsi_id->sbp2_firmware_revision & 0xffff00) == + SBP2_128KB_BROKEN_FIRMWARE && + (sbp2_max_sectors * 512) > (128 * 1024)) { + SBP2_WARN("Bridge only supports 128KB max transfer size."); + SBP2_WARN("WARNING: Current sbp2_max_sectors setting is larger than 128k (%d sectors)!", + sbp2_max_sectors); + scsi_id->workarounds |= SBP2_BREAKAGE_128K_MAX_TRANSFER; + } + + /* Check for a blacklisted set of devices that require us to force + * a 36 byte host inquiry. This can be overriden as a module param + * (to force all hosts). + * + * XXX If this does not detect your firmware as being defective, + * but using the sbp2_force_inquiry_hack allows your device to + * work, please submit the value of your firmware revision to the + * linux1394-devel mailing list. */ + for (i = 0; sbp2_broken_inquiry_list[i]; i++) { + if ((scsi_id->sbp2_firmware_revision & 0xffff00) == + sbp2_broken_inquiry_list[i]) + scsi_id->workarounds |= SBP2_BREAKAGE_INQUIRY_HACK; + } } /* @@ -2402,7 +2432,7 @@ * reject this inquiry command. Fix the request_bufflen. */ if (*cmd == INQUIRY) { - if (sbp2_force_inquiry_hack) + if (sbp2_force_inquiry_hack || scsi_id->workarounds & SBP2_BREAKAGE_INQUIRY_HACK) request_bufflen = cmd[4] = 0x24; else request_bufflen = cmd[4]; Modified: trunk/sbp2.h ============================================================================== --- trunk/sbp2.h (original) +++ trunk/sbp2.h Mon Jul 15 12:37:52 2002 @@ -357,6 +357,10 @@ }; +/* A list of flags for detected oddities and brokeness. */ +#define SBP2_BREAKAGE_128K_MAX_TRANSFER 0x1 +#define SBP2_BREAKAGE_INQUIRY_HACK 0x2 + /* * Information needed on a per scsi id basis (one for each sbp2 device) */ @@ -412,6 +416,9 @@ /* Node entry, as retrieved from NodeMgr entries */ struct node_entry *ne; + + /* Device specific workarounds/brokeness */ + u32 workarounds; }; /* |
From: SVN U. <hog...@us...> - 2002-07-15 16:37:50
|
Author: hogsberg Date: Sun, 14 Jul 2002 16:19:40 -0400 New Revision: 522 Modified: trunk/amdtp.c trunk/amdtp.h Log: New amdtp features: blocking transmission mode, sample rates up to 192kHz. Modified: trunk/amdtp.c ============================================================================== --- trunk/amdtp.c (original) +++ trunk/amdtp.c Mon Jul 15 12:37:37 2002 @@ -32,7 +32,7 @@ * That is outside the scope of this driver, and furthermore it is not * really standardized yet. * - * The Audio and Music Data Tranmission Protocol is avaiable at + * The Audio and Music Data Tranmission Protocol is available at * * http://www.1394ta.org/Download/Technology/Specifications/2001/AM20Final-jf2.pdf * @@ -89,9 +89,13 @@ #define FMT_AMDTP 0x10 #define FDF_AM824 0x00 -#define FDF_SFC_32KHZ 0x00 /* 32kHz */ -#define FDF_SFC_44K1HZ 0x01 /* 44.1kHz */ -#define FDF_SFC_48KHZ 0x02 /* 44.1kHz */ +#define FDF_SFC_32KHZ 0x00 +#define FDF_SFC_44K1HZ 0x01 +#define FDF_SFC_48KHZ 0x02 +#define FDF_SFC_88K2HZ 0x03 +#define FDF_SFC_96KHZ 0x04 +#define FDF_SFC_176K4HZ 0x05 +#define FDF_SFC_192KHZ 0x06 struct descriptor_block { struct output_more_immediate { @@ -113,15 +117,42 @@ struct packet { struct descriptor_block *db; dma_addr_t db_bus; - quadlet_t *payload; + struct iso_packet *payload; dma_addr_t payload_bus; }; +#ifdef __BIG_ENDIAN_BITFIELD + +#error Big endian bitfields not tested + +#else + +struct iso_packet { + /* First quadlet */ + unsigned int sid : 6; + unsigned int eoh0 : 2; + unsigned int dbs : 8; + unsigned int reserved : 2; + unsigned int sph : 1; + unsigned int qpc : 3; + unsigned int fn : 2; + unsigned int dbc : 8; + + /* Second quadlet */ + unsigned int fmt : 6; + unsigned int eoh1 : 2; + unsigned int fdf : 8; + unsigned int syt : 16; + + quadlet_t data[0]; +}; + +#endif + struct fraction { int integer; int numerator; int denominator; - int counter; }; #define PACKET_LIST_SIZE 256 @@ -148,6 +179,8 @@ int rate; int dimension; int fdf; + int mode; + int sample_format; struct cmp_pcr *opcr; /* Input samples are copied here. */ @@ -157,7 +190,7 @@ unsigned char dbc; struct packet_list *current_packet_list; int current_packet; - struct fraction packet_size_fraction; + struct fraction ready_samples, samples_per_cycle; /* We use these to generate control bits when we are packing * iec958 data. @@ -176,8 +209,7 @@ * written back in the dma programs. */ atomic_t cycle_count, cycle_count2; - int cycle_offset; - struct fraction syt_fraction; + struct fraction cycle_offset, ticks_per_syt_offset; int syt_interval; int stale_count; @@ -255,7 +287,7 @@ OHCI1394_CONTEXT_WAKE); } -void ohci1394_stop_it_ctx(struct ti_ohci *ohci, int ctx) +void ohci1394_stop_it_ctx(struct ti_ohci *ohci, int ctx, int synchronous) { u32 control; int wait; @@ -265,13 +297,15 @@ OHCI1394_CONTEXT_RUN); wmb(); - for (wait = 0; wait < 5; wait++) { - control = reg_read(ohci, OHCI1394_IsoXmitContextControlSet + ctx * 16); - if ((control & OHCI1394_CONTEXT_ACTIVE) == 0) - break; - - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(1); + if (synchronous) { + for (wait = 0; wait < 5; wait++) { + control = reg_read(ohci, OHCI1394_IsoXmitContextControlSet + ctx * 16); + if ((control & OHCI1394_CONTEXT_ACTIVE) == 0) + break; + + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(1); + } } } @@ -297,6 +331,22 @@ return pl; } +static void stream_start_dma(struct stream *s, struct packet_list *pl) +{ + u32 syt, cycle_count; + + cycle_count = reg_read(s->host->host->hostdata, + OHCI1394_IsochronousCycleTimer) >> 12; + syt = be16_to_cpu(pl->packets[0].payload->syt) & 0x0f; + cycle_count = (cycle_count & ~0x0f) + 32 + syt; + if ((cycle_count & 0x1fff) >= 8000) + cycle_count = cycle_count - 8000 + 0x2000; + + ohci1394_start_it_ctx(s->host->ohci, s->iso_context, + pl->packets[0].db_bus, 3, + cycle_count & 0x7fff); +} + static void stream_put_dma_packet_list(struct stream *s, struct packet_list *pl) { @@ -317,20 +367,8 @@ last->db->payload_desc.branch = pl->packets[0].db_bus | 3; ohci1394_wake_it_ctx(s->host->ohci, s->iso_context); } - else { - u32 syt, cycle_count; - - cycle_count = reg_read(s->host->host->hostdata, - OHCI1394_IsochronousCycleTimer) >> 12; - syt = (pl->packets[0].payload[1] >> 12) & 0x0f; - cycle_count = (cycle_count & ~0x0f) + 32 + syt; - if ((cycle_count & 0x1fff) >= 8000) - cycle_count = cycle_count - 8000 + 0x2000; - - ohci1394_start_it_ctx(s->host->ohci, s->iso_context, - pl->packets[0].db_bus, 3, - cycle_count & 0x7fff); - } + else + stream_start_dma(s, pl); } static void stream_shift_packet_lists(struct stream *s) @@ -430,17 +468,42 @@ f->integer = numerator / denominator; f->numerator = numerator % denominator; f->denominator = denominator; - f->counter = 0; } -static int fraction_next_size(struct fraction *f) +static __inline__ void fraction_add(struct fraction *dst, + struct fraction *src1, + struct fraction *src2) +{ + /* assert: src1->denominator == src2->denominator */ + + int sum, denom; + + /* We use these two local variables to allow gcc to optimize + * the division and the modulo into only one division. */ + + sum = src1->numerator + src2->numerator; + denom = src1->denominator; + dst->integer = src1->integer + src2->integer + sum / denom; + dst->numerator = sum % denom; + dst->denominator = denom; +} + +static __inline__ void fraction_sub_int(struct fraction *dst, + struct fraction *src, int integer) { - return f->integer + ((f->counter + f->numerator) / f->denominator); + dst->integer = src->integer - integer; + dst->numerator = src->numerator; + dst->denominator = src->denominator; } -static void fraction_inc(struct fraction *f) +static __inline__ int fraction_floor(struct fraction *frac) { - f->counter = (f->counter + f->numerator) % f->denominator; + return frac->integer; +} + +static __inline__ int fraction_ceil(struct fraction *frac) +{ + return frac->integer + (frac->numerator > 0 ? 1 : 0); } static void amdtp_irq_handler(int card, quadlet_t isoRecvIntEvent, @@ -633,17 +696,33 @@ } } +static void fill_payload_le16(struct stream *s, quadlet_t *data, int nevents) +{ + quadlet_t *event, sample, bits; + unsigned char *p; + int i, j; + + for (i = 0, event = data; i < nevents; i++) { + + for (j = 0; j < s->dimension; j++) { + p = buffer_get_bytes(s->input, 2); + sample = (p[1] << 16) | (p[0] << 8); + bits = get_header_bits(s, j, sample); + event[j] = cpu_to_be32((bits << 24) | sample); + } + + event += s->dimension; + if (++s->iec958_frame_count == 192) + s->iec958_frame_count = 0; + } +} static void fill_packet(struct stream *s, struct packet *packet, int nevents) { - int size, node_id, i, j; - quadlet_t *event; - unsigned char *p; - u32 control, sample, bits; - int syt_index, syt, next; + int syt_index, syt, size; + u32 control; size = (nevents * s->dimension + 2) * sizeof(quadlet_t); - node_id = s->host->host->node_id & 0x3f; /* Update DMA descriptors */ packet->db->payload_desc.status = 0; @@ -656,41 +735,46 @@ (s->iso_channel << 8) | (TCODE_ISO_DATA << 4); packet->db->header_desc.header[1] = size << 16; - /* Fill cip header */ - syt_index = s->dbc & (s->syt_interval - 1); - if (syt_index == 0 || syt_index + nevents > s->syt_interval) { + /* Calculate synchronization timestamp (syt). First we + * determine syt_index, that is, the index in the packet of + * the sample for which the timestamp is valid. */ + syt_index = (s->syt_interval - s->dbc) & (s->syt_interval - 1); + if (syt_index < nevents) { syt = ((atomic_read(&s->cycle_count) << 12) | - s->cycle_offset) & 0xffff; - next = fraction_next_size(&s->syt_fraction) + s->cycle_offset; - /* This next addition should be modulo 8000 (0x1f40), - * but we only use the lower 4 bits of cycle_count, so - * we dont need the modulo. */ - atomic_add(next / 3072, &s->cycle_count); - s->cycle_offset = next % 3072; - fraction_inc(&s->syt_fraction); + s->cycle_offset.integer) & 0xffff; + fraction_add(&s->cycle_offset, + &s->cycle_offset, &s->ticks_per_syt_offset); + if (s->cycle_offset.integer >= 3072) { + /* This next addition should be modulo 8000 + * (0x1f40), but we only use the lower 4 bits + * of cycle_count, so we dont need the modulo. */ + atomic_add(s->cycle_offset.integer / 3072, &s->cycle_count); + s->cycle_offset.integer %= 3072; + } } - else { + else syt = 0xffff; - next = 0; - } - atomic_inc(&s->cycle_count2); - - packet->payload[0] = cpu_to_be32((node_id << 24) | (s->dimension << 16) | s->dbc); - packet->payload[1] = cpu_to_be32((1 << 31) | (FMT_AMDTP << 24) | (s->fdf << 16) | syt); - - /* Fill payload */ - for (i = 0, event = &packet->payload[2]; i < nevents; i++) { - for (j = 0; j < s->dimension; j++) { - p = buffer_get_bytes(s->input, 2); - sample = (p[1] << 16) | (p[0] << 8); - bits = get_header_bits(s, j, sample); - event[j] = cpu_to_be32((bits << 24) | sample); - } - - event += s->dimension; - if (++s->iec958_frame_count == 192) - s->iec958_frame_count = 0; + atomic_inc(&s->cycle_count2); + + /* Fill cip header */ + packet->payload->eoh0 = 0; + packet->payload->sid = s->host->host->node_id & 0x3f; + packet->payload->dbs = s->dimension; + packet->payload->fn = 0; + packet->payload->qpc = 0; + packet->payload->sph = 0; + packet->payload->reserved = 0; + packet->payload->dbc = s->dbc; + packet->payload->eoh1 = 2; + packet->payload->fmt = FMT_AMDTP; + packet->payload->fdf = s->fdf; + packet->payload->syt = cpu_to_be16(syt); + + switch (s->sample_format) { + case AMDTP_INPUT_LE16: + fill_payload_le16(s, packet->payload->data, nevents); + break; } s->dbc += nevents; @@ -700,13 +784,44 @@ { struct packet *p; int nevents; + struct fraction next; + + /* The AMDTP specifies two transmission modes: blocking and + * non-blocking. In blocking mode you always transfer + * syt_interval or zero samples, whereas in non-blocking mode + * you send as many samples as you have available at transfer + * time. + * + * The fraction samples_per_cycle specifies the number of + * samples that become available per cycle. We add this to + * the fraction ready_samples, which specifies the number of + * leftover samples from the previous transmission. The sum, + * stored in the fraction next, specifies the number of + * samples available for transmission, and from this we + * determine the number of samples to actually transmit. + */ + + while (1) { + fraction_add(&next, &s->ready_samples, &s->samples_per_cycle); + if (s->mode == AMDTP_MODE_BLOCKING) { + if (fraction_floor(&next) >= s->syt_interval) + nevents = s->syt_interval; + else + nevents = 0; + } + else + nevents = fraction_floor(&next); + + p = stream_current_packet(s); + if (s->input->length < nevents * s->dimension * 2 || p == NULL) + break; - while (nevents = fraction_next_size(&s->packet_size_fraction), - p = stream_current_packet(s), - nevents * s->dimension * 2 <= s->input->length && p != NULL) { fill_packet(s, p, nevents); - fraction_inc(&s->packet_size_fraction); stream_queue_packet(s); + + /* Now that we have successfully queued the packet for + * transmission, we update the fraction ready_samples. */ + fraction_sub_int(&s->ready_samples, &next, nevents); } } @@ -714,9 +829,10 @@ { int max_nevents, max_packet_size, i; - max_nevents = s->packet_size_fraction.integer; - if (s->packet_size_fraction.numerator > 0) - max_nevents++; + if (s->mode == AMDTP_MODE_BLOCKING) + max_nevents = s->syt_interval; + else + max_nevents = fraction_ceil(&s->samples_per_cycle); max_packet_size = max_nevents * s->dimension * 4 + 8; s->packet_pool = pci_pool_create("packet pool", s->host->ohci->dev, @@ -763,15 +879,20 @@ plug->p2p_count, plug->channel); s->iso_channel = plug->channel; if (plug->p2p_count > 0) { - /* start streaming */ + struct packet_list *pl; + + pl = list_entry(s->dma_packet_lists.next, struct packet_list, link); + stream_start_dma(s, pl); } else { - /* stop streaming */ + ohci1394_stop_it_ctx(s->host->ohci, s->iso_context, 0); } } static int stream_configure(struct stream *s, int cmd, struct amdtp_ioctl *cfg) { + const int transfer_delay = 3000; + if (cfg->format <= AMDTP_FORMAT_IEC958_AC3) s->format = cfg->format; else @@ -782,32 +903,59 @@ s->syt_interval = 8; s->fdf = FDF_SFC_32KHZ; s->iec958_rate_code = 0x0c; - s->rate = cfg->rate; break; case 44100: s->syt_interval = 8; s->fdf = FDF_SFC_44K1HZ; s->iec958_rate_code = 0x00; - s->rate = cfg->rate; break; case 48000: s->syt_interval = 8; s->fdf = FDF_SFC_48KHZ; s->iec958_rate_code = 0x04; - s->rate = cfg->rate; break; + case 88200: + s->syt_interval = 16; + s->fdf = FDF_SFC_88K2HZ; + s->iec958_rate_code = 0x00; + break; + case 96000: + s->syt_interval = 16; + s->fdf = FDF_SFC_96KHZ; + s->iec958_rate_code = 0x00; + break; + case 176400: + s->syt_interval = 32; + s->fdf = FDF_SFC_176K4HZ; + s->iec958_rate_code = 0x00; + break; + case 192000: + s->syt_interval = 32; + s->fdf = FDF_SFC_192KHZ; + s->iec958_rate_code = 0x00; + break; + default: return -EINVAL; } - fraction_init(&s->packet_size_fraction, s->rate, 8000); + s->rate = cfg->rate; + fraction_init(&s->samples_per_cycle, s->rate, 8000); + fraction_init(&s->ready_samples, 0, 8000); - /* The syt_fraction is initialized to the number of ticks - * between syt_interval events. The number of ticks per + /* The ticks_per_syt_offset is initialized to the number of + * ticks between syt_interval events. The number of ticks per * second is 24.576e6, so the number of ticks between * syt_interval events is 24.576e6 * syt_interval / rate. */ - fraction_init(&s->syt_fraction, 24576000 * s->syt_interval, s->rate); + fraction_init(&s->ticks_per_syt_offset, + 24576000 * s->syt_interval, s->rate); + fraction_init(&s->cycle_offset, (transfer_delay % 3072) * s->rate, s->rate); + atomic_set(&s->cycle_count, transfer_delay / 3072); + atomic_set(&s->cycle_count2, 0); + + s->mode = cfg->mode; + s->sample_format = AMDTP_INPUT_LE16; /* When using the AM824 raw subformat we can stream signals of * any dimension. The IEC958 subformat, however, only @@ -858,7 +1006,6 @@ { struct stream *s; unsigned long flags; - const int transfer_delay = 8651; /* approx 352 us */ s = kmalloc(sizeof(struct stream), SLAB_KERNEL); if (s == NULL) @@ -873,10 +1020,6 @@ return NULL; } - s->cycle_offset = transfer_delay % 3072; - atomic_set(&s->cycle_count, transfer_delay / 3072); - atomic_set(&s->cycle_count2, 0); - s->descriptor_pool = pci_pool_create("descriptor pool", host->ohci->dev, sizeof(struct descriptor_block), 16, 0, SLAB_KERNEL); @@ -920,7 +1063,7 @@ wait_event_interruptible(s->packet_list_wait, list_empty(&s->dma_packet_lists)); - ohci1394_stop_it_ctx(s->host->ohci, s->iso_context); + ohci1394_stop_it_ctx(s->host->ohci, s->iso_context, 1); ohci1394_free_it_ctx(s->host->ohci, s->iso_context); if (s->opcr != NULL) @@ -996,8 +1139,8 @@ case AMDTP_IOC_PING: HPSB_INFO("ping: offsetting timpestamps %ld ticks", arg); - new = s->cycle_offset + arg; - s->cycle_offset = new % 3072; + new = s->cycle_offset.integer + arg; + s->cycle_offset.integer = new % 3072; atomic_add(new / 3072, &s->cycle_count); return 0; Modified: trunk/amdtp.h ============================================================================== --- trunk/amdtp.h (original) +++ trunk/amdtp.h Mon Jul 15 12:37:38 2002 @@ -19,13 +19,24 @@ * AMDTP_FORMAT_IEC958_AC3 will transmit the samples with the data bit * set, suitable for transmitting compressed AC-3 audio. * - * The rate field specifies the transmission rate; supported values are - * AMDTP_RATE_32KHZ, AMDTP_RATE_44K1HZ and AMDTP_RATE_48KHZ. + * The rate field specifies the transmission rate; supported values + * are 32000, 44100, 48000, 88200, 96000, 176400 and 192000. * * The dimension field specifies the dimension of the signal, that is, * the number of audio channels. Only AMDTP_FORMAT_RAW supports * settings greater than 2. * + * The mode field specifies which transmission mode to use. The AMDTP + * specifies two different transmission modes: blocking and + * non-blocking. The blocking transmission mode always send a fixed + * number of samples, typically 8, 16 or 32. To exactly match the + * transmission rate, the driver alternates between sending empty and + * non-empty packets. In non-blocking mode, the driver transmits as + * small packets as possible. For example, for a transmission rate of + * 44100Hz, the driver should send 5 41/80 samples in every cycle, but + * this is not possible so instead the driver alternates between + * sending 5 and 6 samples. + * * The last thing to specify is either the isochronous channel to use * or the output plug to connect to. If you know what channel the * destination device will listen on, you can specify the channel @@ -60,15 +71,20 @@ }; enum { - AMDTP_RATE_32KHZ, - AMDTP_RATE_44K1HZ, - AMDTP_RATE_48KHZ, + AMDTP_MODE_BLOCKING, + AMDTP_MODE_NON_BLOCKING, +}; + +enum { + AMDTP_INPUT_LE16, + AMDTP_INPUT_BE16, }; struct amdtp_ioctl { __u32 format; __u32 rate; __u32 dimension; + __u32 mode; union { __u32 channel; __u32 plug; } u; }; |
From: SVN U. <ben...@us...> - 2002-07-15 16:37:38
|
Author: bencollins Date: Sun, 14 Jul 2002 15:38:46 -0400 New Revision: 521 Modified: trunk/sbp2.c Log: Make the SCSI inquiry hack a module load option Modified: trunk/sbp2.c ============================================================================== --- trunk/sbp2.c (original) +++ trunk/sbp2.c Mon Jul 15 12:37:25 2002 @@ -422,6 +422,15 @@ MODULE_PARM_DESC(sbp2_exclusive_login, "Exclusive login to sbp2 device (default = 1)"); static int sbp2_exclusive_login = 1; +/* + * SCSI inquiry hack for really badly behaved sbp2 devices. Turn this on if your sbp2 device + * is not properly handling the SCSI inquiry command. This hack makes the inquiry look more + * like a typical MS Windows inquiry. + */ +MODULE_PARM(sbp2_force_inquiry_hack,"i") +MODULE_PARM_DESC(sbp2_force_inquiry_hack, "Force SCSI inquiry hack (default = 0)"); +static int sbp2_force_inquiry_hack = 0; + /* * Export information about protocols/devices supported by this driver. @@ -506,14 +515,6 @@ #endif /* - * SCSI inquiry hack for really badly behaved sbp2 devices. Turn this on if your sbp2 device - * is not properly handling the SCSI inquiry command. This hack makes the inquiry look more - * like a typical MS Windows inquiry. - */ - -/* #define SBP2_FORCE_36_BYTE_INQUIRY */ - -/* * Globals */ @@ -2401,11 +2402,10 @@ * reject this inquiry command. Fix the request_bufflen. */ if (*cmd == INQUIRY) { -#ifdef SBP2_FORCE_36_BYTE_INQUIRY - request_bufflen = cmd[4] = 0x24; -#else - request_bufflen = cmd[4]; -#endif + if (sbp2_force_inquiry_hack) + request_bufflen = cmd[4] = 0x24; + else + request_bufflen = cmd[4]; } /* |
From: SVN U. <ben...@us...> - 2002-07-15 16:37:24
|
Author: bencollins Date: Sun, 14 Jul 2002 13:19:55 -0400 New Revision: 520 Removed: branch-points/ Log: Remove branch-point directory |
From: SVN U. <ben...@us...> - 2002-07-15 16:37:19
|
Author: bencollins Date: Sun, 14 Jul 2002 13:17:21 -0400 New Revision: 519 Removed: branch-points/weihs/ Modified: branches/weihs/ Log: Convert weihs to new branch-point tracking via props |
From: SVN U. <ben...@us...> - 2002-07-15 16:37:08
|
Author: bencollins Date: Sun, 14 Jul 2002 13:13:58 -0400 New Revision: 518 Removed: branch-points/mpeg1394/ Modified: branches/ Log: Convert mpeg1394 to new branch-point tracking via props |