Thread: [Linux1394-cvslog] rev 671 - trunk
Brought to you by:
aeb,
bencollins
From: SVN U. <ben...@li...> - 2002-11-16 19:19:18
|
Author: bencollins Date: 2002-11-16 14:18:37 -0500 (Sat, 16 Nov 2002) New Revision: 671 Modified: trunk/ trunk/csr.h trunk/ieee1394.h trunk/ieee1394_core.c trunk/ieee1394_transactions.c trunk/ieee1394_transactions.h trunk/ohci1394.c trunk/ohci1394.h trunk/raw1394.c trunk/sbp2.h Log: hpsb_lock64 added from Steve Kinneberg. Reworked hpsb_make_lockpacket and hpsb_make_lock64packet to accept data/arg and fill in the packet. packet_swab and OHCI1394_unrecoverableError changes based on Steve Kinneberg's patch. Modified: trunk/ieee1394_core.c ============================================================================== --- trunk/ieee1394_core.c (original) +++ trunk/ieee1394_core.c 2002-11-16 14:18:39.000000000 -0500 @@ -1226,15 +1226,16 @@ EXPORT_SYMBOL(hpsb_get_tlabel); EXPORT_SYMBOL(hpsb_free_tlabel); EXPORT_SYMBOL(hpsb_make_readpacket); +EXPORT_SYMBOL(hpsb_make_writepacket); EXPORT_SYMBOL(hpsb_make_lockpacket); EXPORT_SYMBOL(hpsb_make_lock64packet); EXPORT_SYMBOL(hpsb_make_phypacket); EXPORT_SYMBOL(hpsb_make_isopacket); -EXPORT_SYMBOL(hpsb_packet_success); -EXPORT_SYMBOL(hpsb_make_writepacket); EXPORT_SYMBOL(hpsb_read); EXPORT_SYMBOL(hpsb_write); EXPORT_SYMBOL(hpsb_lock); +EXPORT_SYMBOL(hpsb_lock64); +EXPORT_SYMBOL(hpsb_packet_success); /** highlevel.c **/ EXPORT_SYMBOL(hpsb_register_highlevel); Modified: trunk/ohci1394.c ============================================================================== --- trunk/ohci1394.c (original) +++ trunk/ohci1394.c 2002-11-16 14:18:39.000000000 -0500 @@ -172,12 +172,6 @@ static void ohci1394_pci_remove(struct pci_dev *pdev); #ifndef __LITTLE_ENDIAN -/* Swap a series of quads inplace. */ -static __inline__ void block_swab32(quadlet_t *data, size_t size) { - while (size--) - data[size] = swab32(data[size]); -} - static unsigned hdr_sizes[] = { 3, /* TCODE_WRITEQ */ @@ -195,16 +189,19 @@ }; /* Swap headers */ -static inline void packet_swab(quadlet_t *data, int tcode, int len) +static inline void packet_swab(quadlet_t *data, int tcode) { + size_t size = hdr_sizes[tcode]; + if (tcode > TCODE_LOCK_RESPONSE || hdr_sizes[tcode] == 0) return; - block_swab32(data, hdr_sizes[tcode]); + + while (size--) + data[size] = swab32(data[size]); } #else /* Don't waste cycles on same sex byte swaps */ -#define packet_swab(w,x,y) -#define block_swab32(x,y) +#define packet_swab(w,x) #endif /* !LITTLE_ENDIAN */ /*********************************** @@ -575,7 +572,8 @@ reg_write(ohci, OHCI1394_HCControlClear, 0x40000000); /* Enable interrupts */ - reg_write(ohci, OHCI1394_IntMaskSet, + reg_write(ohci, OHCI1394_IntMaskSet, + OHCI1394_unrecoverableError | OHCI1394_masterIntEnable | OHCI1394_busReset | OHCI1394_selfIDComplete | @@ -648,8 +646,7 @@ (packet->header[0] & 0xFFFF0000); d->prg_cpu[idx]->data[2] = packet->header[2]; d->prg_cpu[idx]->data[3] = packet->header[3]; - packet_swab(d->prg_cpu[idx]->data, packet->tcode, - packet->header_size>>2); + packet_swab(d->prg_cpu[idx]->data, packet->tcode); } if (packet->data_size) { /* block transmit */ @@ -714,7 +711,7 @@ d->prg_cpu[idx]->data[0] = packet->speed_code<<16 | (packet->header[0] & 0xFFFF); d->prg_cpu[idx]->data[1] = packet->header[0] & 0xFFFF0000; - packet_swab(d->prg_cpu[idx]->data, packet->tcode, packet->header_size>>2); + packet_swab(d->prg_cpu[idx]->data, packet->tcode); d->prg_cpu[idx]->begin.control = cpu_to_le32(DMA_CTL_OUTPUT_MORE | @@ -1768,10 +1765,52 @@ DBGMSG(ohci->id, "IntEvent: %08x", event); - /* Die right here an now */ if (event & OHCI1394_unrecoverableError) { - PRINT(KERN_ERR, ohci->id, "Unrecoverable error, shutting down card!"); - return; + int ctx; + PRINT(KERN_ERR, ohci->id, "Unrecoverable error!"); + + if (reg_read(ohci, OHCI1394_AsReqTrContextControlSet) & 0x800) + PRINT(KERN_ERR, ohci->id, "Async Req Tx Context died: " + "ctrl[%08x] cmdptr[%08x]", + reg_read(ohci, OHCI1394_AsReqTrContextControlSet), + reg_read(ohci, OHCI1394_AsReqTrCommandPtr)); + + if (reg_read(ohci, OHCI1394_AsRspTrContextControlSet) & 0x800) + PRINT(KERN_ERR, ohci->id, "Async Rsp Tx Context died: " + "ctrl[%08x] cmdptr[%08x]", + reg_read(ohci, OHCI1394_AsRspTrContextControlSet), + reg_read(ohci, OHCI1394_AsRspTrCommandPtr)); + + if (reg_read(ohci, OHCI1394_AsReqRcvContextControlSet) & 0x800) + PRINT(KERN_ERR, ohci->id, "Async Req Rcv Context died: " + "ctrl[%08x] cmdptr[%08x]", + reg_read(ohci, OHCI1394_AsReqRcvContextControlSet), + reg_read(ohci, OHCI1394_AsReqRcvCommandPtr)); + + if (reg_read(ohci, OHCI1394_AsRspRcvContextControlSet) & 0x800) + PRINT(KERN_ERR, ohci->id, "Async Rsp Rcv Context died: " + "ctrl[%08x] cmdptr[%08x]", + reg_read(ohci, OHCI1394_AsRspRcvContextControlSet), + reg_read(ohci, OHCI1394_AsRspRcvCommandPtr)); + + for (ctx = 0; ctx < ohci->nb_iso_xmit_ctx; ctx++) { + if (reg_read(ohci, OHCI1394_IsoXmitContextControlSet + (16 * ctx)) & 0x800) + PRINT(KERN_ERR, ohci->id, "Async Iso Xmit %d Context died: " + "ctrl[%08x] cmdptr[%08x]", ctx, + reg_read(ohci, OHCI1394_IsoXmitContextControlSet + (16 * ctx)), + reg_read(ohci, OHCI1394_IsoXmitCommandPtr + (16 * ctx))); + } + + for (ctx = 0; ctx < ohci->nb_iso_rcv_ctx; ctx++) { + if (reg_read(ohci, OHCI1394_IsoRcvContextControlSet + (32 * ctx)) & 0x800) + PRINT(KERN_ERR, ohci->id, "Async Iso Recv %d Context died: " + "ctrl[%08x] cmdptr[%08x] match[%08x]", ctx, + reg_read(ohci, OHCI1394_IsoRcvContextControlSet + (32 * ctx)), + reg_read(ohci, OHCI1394_IsoRcvCommandPtr + (32 * ctx)), + reg_read(ohci, OHCI1394_IsoRcvContextMatch + (32 * ctx))); + } + + event &= ~OHCI1394_unrecoverableError; } if (event & OHCI1394_cycleInconsistent) { @@ -2099,7 +2138,7 @@ * bus reset. We always ignore it. */ if (tcode != OHCI1394_TCODE_PHY) { if (!ohci->no_swap_incoming) - packet_swab(d->spb, tcode, (length - 4) >> 2); + packet_swab(d->spb, tcode); DBGMSG(ohci->id, "Packet received from node" " %d ack=0x%02X spd=%d tcode=0x%X" " length=%d ctx=%d tlabel=%d", Modified: trunk/ohci1394.h ============================================================================== --- trunk/ohci1394.h (original) +++ trunk/ohci1394.h 2002-11-16 14:18:39.000000000 -0500 @@ -294,6 +294,9 @@ #define OHCI1394_IsoRecvIntEventClear 0x0A4 #define OHCI1394_IsoRecvIntMaskSet 0x0A8 #define OHCI1394_IsoRecvIntMaskClear 0x0AC +#define OHCI1394_InitialBandwidthAvailable 0x0B0 +#define OHCI1394_InitialChannelsAvailableHi 0x0B4 +#define OHCI1394_InitialChannelsAvailableLo 0x0B8 #define OHCI1394_FairnessControl 0x0DC #define OHCI1394_LinkControlSet 0x0E0 #define OHCI1394_LinkControlClear 0x0E4 Modified: trunk/raw1394.c ============================================================================== --- trunk/raw1394.c (original) +++ trunk/raw1394.c 2002-11-16 14:18:39.000000000 -0500 @@ -708,7 +708,7 @@ } packet = hpsb_make_lockpacket(fi->host, node, addr, - req->req.misc); + req->req.misc, NULL, 0); if (!packet) return -ENOMEM; if (copy_from_user(packet->data, int2ptr(req->req.sendb), @@ -736,7 +736,7 @@ } } packet = hpsb_make_lock64packet(fi->host, node, addr, - req->req.misc); + req->req.misc, NULL, 0); if (!packet) return -ENOMEM; if (copy_from_user(packet->data, int2ptr(req->req.sendb), Modified: trunk/ieee1394_transactions.c ============================================================================== --- trunk/ieee1394_transactions.c (original) +++ trunk/ieee1394_transactions.c 2002-11-16 14:18:39.000000000 -0500 @@ -305,59 +305,81 @@ } struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node, - u64 addr, int extcode) + u64 addr, int extcode, quadlet_t *data, + quadlet_t arg) { - struct hpsb_packet *p; + struct hpsb_packet *p; + u32 length; - p = alloc_hpsb_packet(8); - if (!p) return NULL; + p = alloc_hpsb_packet(8); + if (!p) return NULL; - p->host = host; - p->node_id = node; + p->host = host; + p->node_id = node; if (hpsb_get_tlabel(p, in_interrupt() ? 0 : 1)) { free_hpsb_packet(p); return NULL; - } + } - switch (extcode) { - case EXTCODE_FETCH_ADD: - case EXTCODE_LITTLE_ADD: - fill_async_lock(p, addr, extcode, 4); - break; - default: - fill_async_lock(p, addr, extcode, 8); - break; - } + switch (extcode) { + case EXTCODE_FETCH_ADD: + case EXTCODE_LITTLE_ADD: + length = 4; + if (data) + p->data[0] = *data; + break; + default: + length = 8; + if (data) { + p->data[0] = arg; + p->data[1] = *data; + } + break; + } + fill_async_lock(p, addr, extcode, length); - return p; + return p; } struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host, nodeid_t node, - u64 addr, int extcode) + u64 addr, int extcode, octlet_t *data, + octlet_t arg) { - struct hpsb_packet *p; + struct hpsb_packet *p; + u32 length; - p = alloc_hpsb_packet(16); - if (!p) return NULL; + p = alloc_hpsb_packet(16); + if (!p) return NULL; - p->host = host; - p->node_id = node; + p->host = host; + p->node_id = node; if (hpsb_get_tlabel(p, in_interrupt() ? 0 : 1)) { free_hpsb_packet(p); return NULL; } - switch (extcode) { - case EXTCODE_FETCH_ADD: - case EXTCODE_LITTLE_ADD: - fill_async_lock(p, addr, extcode, 8); - break; - default: - fill_async_lock(p, addr, extcode, 16); - break; - } + switch (extcode) { + case EXTCODE_FETCH_ADD: + case EXTCODE_LITTLE_ADD: + length = 8; + if (data) { + p->data[0] = *data >> 32; + p->data[1] = *data & 0xffffffff; + } + break; + default: + length = 16; + if (data) { + p->data[0] = arg >> 32; + p->data[1] = arg & 0xffffffff; + p->data[2] = *data >> 32; + p->data[3] = *data & 0xffffffff; + } + break; + } + fill_async_lock(p, addr, extcode, length); - return p; + return p; } struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host, @@ -478,40 +500,13 @@ u64 addr, int extcode, quadlet_t *data, quadlet_t arg) { struct hpsb_packet *packet; - int retval = 0, length; + int retval = 0; BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet - - packet = alloc_hpsb_packet(8); - if (!packet) { - return -ENOMEM; - } - - packet->host = host; - packet->node_id = node; - if (hpsb_get_tlabel(packet, 1)) { - free_hpsb_packet(packet); - return -ENOMEM; - } - switch (extcode) { - case EXTCODE_MASK_SWAP: - case EXTCODE_COMPARE_SWAP: - case EXTCODE_BOUNDED_ADD: - case EXTCODE_WRAP_ADD: - length = 8; - packet->data[0] = arg; - packet->data[1] = *data; - break; - case EXTCODE_FETCH_ADD: - case EXTCODE_LITTLE_ADD: - length = 4; - packet->data[0] = *data; - break; - default: - return -EINVAL; - } - fill_async_lock(packet, addr, extcode, length); + packet = hpsb_make_lockpacket(host, node, addr, extcode, data, arg); + if (!packet) + return -ENOMEM; packet->generation = generation; if (!hpsb_send_packet(packet)) { @@ -532,3 +527,34 @@ return retval; } + +int hpsb_lock64(struct hpsb_host *host, nodeid_t node, unsigned int generation, + u64 addr, int extcode, octlet_t *data, octlet_t arg) +{ + struct hpsb_packet *packet; + int retval = 0; + + BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet + + packet = hpsb_make_lock64packet(host, node, addr, extcode, data, arg); + if (!packet) + return -ENOMEM; + + packet->generation = generation; + if (!hpsb_send_packet(packet)) { + retval = -EINVAL; + goto hpsb_lock64_fail; + } + down(&packet->state_change); + down(&packet->state_change); + retval = hpsb_packet_success(packet); + + if (retval == 0) + *data = (u64)packet->data[1] << 32 | packet->data[0]; + +hpsb_lock64_fail: + hpsb_free_tlabel(packet); + free_hpsb_packet(packet); + + return retval; +} Modified: trunk/ieee1394_transactions.h ============================================================================== --- trunk/ieee1394_transactions.h (original) +++ trunk/ieee1394_transactions.h 2002-11-16 14:18:39.000000000 -0500 @@ -13,9 +13,11 @@ struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node, u64 addr, size_t length); struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node, - u64 addr, int extcode); + u64 addr, int extcode, quadlet_t *data, + quadlet_t arg); struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host, nodeid_t node, - u64 addr, int extcode); + u64 addr, int extcode, octlet_t *data, + octlet_t arg); struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host, quadlet_t data) ; struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host, @@ -51,5 +53,7 @@ u64 addr, quadlet_t *buffer, size_t length); int hpsb_lock(struct hpsb_host *host, nodeid_t node, unsigned int generation, u64 addr, int extcode, quadlet_t *data, quadlet_t arg); +int hpsb_lock64(struct hpsb_host *host, nodeid_t node, unsigned int generation, + u64 addr, int extcode, octlet_t *data, octlet_t arg); #endif /* _IEEE1394_TRANSACTIONS_H */ Modified: trunk/sbp2.h ============================================================================== --- trunk/sbp2.h (original) +++ trunk/sbp2.h 2002-11-16 14:18:39.000000000 -0500 @@ -493,10 +493,10 @@ 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[]); +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,44) +static int sbp2scsi_biosparam (struct scsi_device *sdev, struct block_device *dev, sector_t capacity, int geom[]); #else -static int sbp2scsi_biosparam (Scsi_Disk *disk, struct block_device *dev, int geom[]); +static int sbp2scsi_biosparam (Scsi_Disk *disk, kdev_t dev, int geom[]); #endif static int sbp2scsi_abort (Scsi_Cmnd *SCpnt); static int sbp2scsi_reset (Scsi_Cmnd *SCpnt); Modified: trunk/csr.h ============================================================================== --- trunk/csr.h (original) +++ trunk/csr.h 2002-11-16 14:18:39.000000000 -0500 @@ -16,8 +16,10 @@ #define CSR_BUSY_TIMEOUT 0x210 #define CSR_BUS_MANAGER_ID 0x21c #define CSR_BANDWIDTH_AVAILABLE 0x220 +#define CSR_CHANNELS_AVAILABLE 0x224 #define CSR_CHANNELS_AVAILABLE_HI 0x224 #define CSR_CHANNELS_AVAILABLE_LO 0x228 +#define CSR_BROADCAST_CHANNEL 0x234 #define CSR_CONFIG_ROM 0x400 #define CSR_CONFIG_ROM_END 0x800 #define CSR_FCP_COMMAND 0xB00 Modified: trunk/ieee1394.h ============================================================================== --- trunk/ieee1394.h (original) +++ trunk/ieee1394.h 2002-11-16 14:18:39.000000000 -0500 @@ -15,6 +15,7 @@ #define TCODE_CYCLE_START 0x8 #define TCODE_LOCK_REQUEST 0x9 #define TCODE_ISO_DATA 0xa +#define TCODE_STREAM_DATA 0xa #define TCODE_LOCK_RESPONSE 0xb #define RCODE_COMPLETE 0x0 |