[Linux1394-cvslog] rev 619 - trunk
Brought to you by:
aeb,
bencollins
From: SVN U. <ben...@li...> - 2002-10-20 01:40:55
|
Author: bencollins Date: 2002-10-19 21:40:50 -0400 (Sat, 19 Oct 2002) New Revision: 619 Modified: trunk/Config.in trunk/hosts.c trunk/hosts.h trunk/ieee1394_core.h trunk/ieee1394_transactions.c trunk/nodemgr.c trunk/nodemgr.h Log: Move tlabel pools to the host struct. We just have one large array of 63 pools. No more nodemgr needed now. We still link the nodes tpool from the host into the node entry. In nodemgr.c, use atomic_read() instead of sem_getcount to show tlabel count. Config.in: Fixup logic for PCILYNX option needed I2C. On Sparc64, for example, CONFIG_I2C et al aren't defined, so they are actually "" values, which means that config was letting me build PCILYNX. Modified: trunk/ieee1394_core.h ============================================================================== --- trunk/ieee1394_core.h (original) +++ trunk/ieee1394_core.h 2002-10-19 21:40:51.000000000 -0400 @@ -38,9 +38,6 @@ char ack_code; char tcode; - /* A pointer to the tlabel pool we used for our tlabel */ - struct hpsb_tlabel_pool *tpool; - unsigned expect_response:1; unsigned no_waiter:1; Modified: trunk/ieee1394_transactions.c ============================================================================== --- trunk/ieee1394_transactions.c (original) +++ trunk/ieee1394_transactions.c 2002-10-19 21:40:51.000000000 -0400 @@ -163,7 +163,7 @@ * hpsb_free_tlabel() after the transaction is complete (unless it's reused again for * the same target node). * - * @wait is ignored if in_interrupt() + * @wait cannot be set if in_interrupt() * * Return value: Zero on success, otherwise non-zero. A non-zero return * generally means there are no available tlabels. @@ -172,16 +172,11 @@ { unsigned long flags; struct hpsb_tlabel_pool *tp; - struct node_entry *ne = hpsb_check_nodeid(packet->node_id); - BUG_ON(packet->tpool != NULL); + tp = &packet->host->tpool[packet->node_id & NODE_MASK]; - if (!ne) - tp = &packet->host->tpool; - else - tp = &ne->tpool; - - if (wait && !in_interrupt()) { + if (wait) { + BUG_ON(in_interrupt()); down(&tp->count); } else { if (down_trylock(&tp->count)) @@ -194,7 +189,6 @@ tp->next = (packet->tlabel + 1) % 64; /* Should _never_ happen */ BUG_ON(test_and_set_bit(packet->tlabel, &tp->pool)); - packet->tpool = tp; spin_unlock_irqrestore(&tp->lock, flags); @@ -215,14 +209,14 @@ void hpsb_free_tlabel(struct hpsb_packet *packet) { unsigned long flags; - struct hpsb_tlabel_pool *tp = packet->tpool; + struct hpsb_tlabel_pool *tp; + + tp = &packet->host->tpool[packet->node_id & NODE_MASK]; BUG_ON(packet->tlabel > 63 || packet->tlabel < 0); - BUG_ON(tp == NULL); spin_lock_irqsave(&tp->lock, flags); - packet->tpool = NULL; - clear_bit(packet->tlabel, &tp->pool); + BUG_ON(!test_and_clear_bit(packet->tlabel, &tp->pool)); spin_unlock_irqrestore(&tp->lock, flags); up(&tp->count); Modified: trunk/nodemgr.c ============================================================================== --- trunk/nodemgr.c (original) +++ trunk/nodemgr.c 2002-10-19 21:40:51.000000000 -0400 @@ -19,7 +19,7 @@ #ifdef CONFIG_PROC_FS #include <linux/proc_fs.h> #endif -#include <asm/semaphore.h> +#include <asm/atomic.h> #include <asm/byteorder.h> #include "ieee1394_types.h" @@ -106,7 +106,7 @@ PUTF(" Vendor ID : `%s' [0x%06x]\n", ne->vendor_name ?: "Unknown", ne->vendor_id); PUTF(" Capabilities: 0x%06x\n", ne->capabilities); - PUTF(" Free tlabels: %d\n", sem_getcount(&ne->tpool.count)); + PUTF(" Free tlabels: %d\n", atomic_read(&ne->tpool->count.count) + 1); PUTF(" Bus Options :\n"); PUTF(" IRMC(%d) CMC(%d) ISC(%d) BMC(%d) PMC(%d) GEN(%d)\n" " LSPD(%d) MAX_REC(%d) CYC_CLK_ACC(%d)\n", @@ -121,7 +121,6 @@ PUTF(" Nodes connected : %d\n", ne->host->node_count); PUTF(" Nodes active : %d\n", ne->host->nodes_active); PUTF(" SelfIDs received: %d\n", ne->host->selfid_count); - PUTF(" Backup tlabels : %d\n", sem_getcount(&ne->host->tpool.count)); PUTF(" Irm ID : [" NODE_BUS_FMT "]\n", NODE_BUS_ARGS(ne->host->irm_id)); PUTF(" BusMgr ID : [" NODE_BUS_FMT "]\n", @@ -139,15 +138,21 @@ int printed = 0; // small hack PUTF(" Unit Directory %d:\n", ud_count++); + + if (ud->flags & UNIT_DIRECTORY_VENDOR_ID || + ud->flags & UNIT_DIRECTORY_MODEL_ID) { + PUTF(" Vendor/Model ID : "); + } if (ud->flags & UNIT_DIRECTORY_VENDOR_ID) { - PUTF(" Vendor/Model ID: %s [%06x]", - ud->vendor_name ?: "Unknown", ud->vendor_id); + PUTF("%s [%06x]", ud->vendor_name ?: "Unknown", + ud->vendor_id); printed = 1; } if (ud->flags & UNIT_DIRECTORY_MODEL_ID) { - if (!printed) - PUTF(" Vendor/Model ID: %s [%06x]", - ne->vendor_name ?: "Unknown", ne->vendor_id); + if (!printed) { + PUTF("%s [%06x]", ne->vendor_name ?: "Unknown", + ne->vendor_id); + } PUTF(" / %s [%06x]", ud->model_name ?: "Unknown", ud->model_id); printed = 1; } @@ -155,11 +160,11 @@ PUTF("\n"); if (ud->flags & UNIT_DIRECTORY_SPECIFIER_ID) - PUTF(" Software Specifier ID: %06x\n", ud->specifier_id); + PUTF(" Software Spec ID : %06x\n", ud->specifier_id); if (ud->flags & UNIT_DIRECTORY_VERSION) - PUTF(" Software Version: %06x\n", ud->version); + PUTF(" Software Version : %06x\n", ud->version); if (ud->driver) - PUTF(" Driver: %s\n", ud->driver->name); + PUTF(" Driver : %s\n", ud->driver->name); PUTF(" Length (in quads): %d\n", ud->count); } @@ -339,7 +344,7 @@ INIT_LIST_HEAD(&ne->list); INIT_LIST_HEAD(&ne->unit_directories); - HPSB_TPOOL_INIT(&ne->tpool); + ne->tpool = &host->tpool[nodeid & NODE_MASK]; ne->host = host; ne->nodeid = nodeid; Modified: trunk/nodemgr.h ============================================================================== --- trunk/nodemgr.h (original) +++ trunk/nodemgr.h 2002-10-19 21:40:51.000000000 -0400 @@ -132,7 +132,7 @@ u32 capabilities; struct list_head unit_directories; - struct hpsb_tlabel_pool tpool; + struct hpsb_tlabel_pool *tpool; const char *vendor_name; quadlet_t quadlets[0]; Modified: trunk/hosts.c ============================================================================== --- trunk/hosts.c (original) +++ trunk/hosts.c 2002-10-19 21:40:51.000000000 -0400 @@ -121,6 +121,7 @@ struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra) { struct hpsb_host *h; + int i; h = kmalloc(sizeof(struct hpsb_host) + extra, SLAB_KERNEL); if (!h) return NULL; @@ -133,7 +134,8 @@ INIT_LIST_HEAD(&h->pending_packets); spin_lock_init(&h->pending_pkt_lock); - HPSB_TPOOL_INIT(&h->tpool); + for (i = 0; i < 63; i++) + HPSB_TPOOL_INIT(&h->tpool[i]); atomic_set(&h->generation, 0); Modified: trunk/hosts.h ============================================================================== --- trunk/hosts.h (original) +++ trunk/hosts.h 2002-10-19 21:40:51.000000000 -0400 @@ -57,7 +57,8 @@ u8 *speed_map; struct csr_control csr; - struct hpsb_tlabel_pool tpool; + /* Per node tlabel pool allocation */ + struct hpsb_tlabel_pool tpool[63]; struct hpsb_host_driver *driver; Modified: trunk/Config.in ============================================================================== --- trunk/Config.in (original) +++ trunk/Config.in 2002-10-19 21:40:51.000000000 -0400 @@ -10,10 +10,10 @@ comment "Device Drivers" - if [ "$CONFIG_I2C" = "n" -o "$CONFIG_I2C_ALGOBIT" = "n" ]; then - comment ' Texas Instruments PCILynx requires I2C bit-banging' - else + if [ "$CONFIG_I2C" != "" -a "$CONFIG_I2C_ALGOBIT" != "" -e "$CONFIG_I2C" != "n" -a "$CONFIG_I2C_ALGOBIT" != "n" ]; then dep_tristate ' Texas Instruments PCILynx support' CONFIG_IEEE1394_PCILYNX $CONFIG_IEEE1394 $CONFIG_I2C $CONFIG_I2C_ALGOBIT + else + comment ' Texas Instruments PCILynx requires I2C bit-banging' fi # Non-maintained pcilynx options |