You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
(2) |
Oct
(43) |
Nov
(4) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(78) |
Feb
(97) |
Mar
(29) |
Apr
(2) |
May
(22) |
Jun
(38) |
Jul
(11) |
Aug
(27) |
Sep
(40) |
Oct
(2) |
Nov
(17) |
Dec
(8) |
2002 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
(480) |
May
(456) |
Jun
(12) |
Jul
|
Aug
(1) |
Sep
|
Oct
(18) |
Nov
(3) |
Dec
(6) |
2003 |
Jan
|
Feb
(18) |
Mar
(1) |
Apr
|
May
(6) |
Jun
(147) |
Jul
(7) |
Aug
(3) |
Sep
(235) |
Oct
(10) |
Nov
(2) |
Dec
(1) |
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Dave A. <ai...@us...> - 2002-10-25 17:35:42
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/vax/bus In directory usw-pr-cvs1:/tmp/cvs-serv25791/bus Log Message: Directory /cvsroot/linux-vax/kernel-2.4/drivers/vax/bus added to the repository |
From: Dave A. <ai...@us...> - 2002-10-25 17:35:39
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/vax In directory usw-pr-cvs1:/tmp/cvs-serv27297 Added Files: Makefile Log Message: DA: backport from 2.5 of Kenns qbus/delqa work - delqa/qbus works iprcons is not working.. needed for SIMH emu --- NEW FILE --- # # Makefile for the Linux/VAX kernel device drivers. # subdir-y := bus char net include $(TOPDIR)/Rules.make |
From: Dave A. <ai...@us...> - 2002-10-25 17:25:46
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-vax In directory usw-pr-cvs1:/tmp/cvs-serv1902 Modified Files: dma.h Log Message: DA: backport 2.5 qbus support to 2.4 for SIMH Index: dma.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/dma.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- dma.h 16 Jun 2001 14:05:30 -0000 1.2 +++ dma.h 25 Oct 2002 14:09:09 -0000 1.3 @@ -1,6 +1,19 @@ #ifndef _VAX_DMA_H #define _VAX_DMA_H 1 + +/* This structure is used to keep track of bug map register + * allocations. You get one from a bus driver's alloc_mapreg + * function and release it by calling the bus driver's unmap + * function. */ + +struct vax_dmamap { + unsigned int reg; + unsigned int pagelets; + void *virtaddr; + unsigned int busaddr; +}; + /* Some peripherals are limited by their PC/ISA designs/heritage. */ /* max dma address is 16mb used in mm/init.c*/ |
From: Dave A. <ai...@us...> - 2002-10-25 17:25:40
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-vax/bus In directory usw-pr-cvs1:/tmp/cvs-serv28668/bus Log Message: Directory /cvsroot/linux-vax/kernel-2.4/include/asm-vax/bus added to the repository |
From: Dave A. <ai...@us...> - 2002-10-25 17:25:38
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/vax/net In directory usw-pr-cvs1:/tmp/cvs-serv27297/net Added Files: Makefile delqa-regs.h delqa.c Log Message: DA: backport from 2.5 of Kenns qbus/delqa work - delqa/qbus works iprcons is not working.. needed for SIMH emu --- NEW FILE --- # # Makefile for the Linux/VAX network device drivers. # O_TARGET := vaxnet.o obj-y := obj-m := obj-n := obj-$(CONFIG_DELQA) += delqa.o include $(TOPDIR)/Rules.make --- NEW FILE --- /* Register offsets */ #define DELQA_ADDR1 0 #define DELQA_ADDR2 2 #define DELQA_RCLL 4 /* loword of first RX descriptor addr */ #define DELQA_RCLH 6 /* hiword of first RX descriptor addr */ #define DELQA_XMTL 8 /* loword of first TX descriptor addr */ #define DELQA_XMTH 10 /* hiword of first TX descriptor addr */ #define DELQA_VECTOR 12 /* Q-bus interrupt vector */ #define DELQA_CSR 14 /* control & status */ /* Bits in CSR */ #define DELQA_CSR_RCV_ENABLE 0x0001 /* Receiver enable */ #define DELQA_CSR_RESET 0x0002 /* Software reset */ #define DELQA_CSR_NEX_MEM_INT 0x0004 /* Non-existent memory interrupt */ #define DELQA_CSR_LOAD_ROM 0x0008 /* Load boot/diag from rom */ #define DELQA_CSR_XL_INVALID 0x0010 /* Transmit list invalid */ #define DELQA_CSR_RL_INVALID 0x0020 /* Receive list invalid */ #define DELQA_CSR_INT_ENABLE 0x0040 /* Interrupt enable */ #define DELQA_CSR_XMIT_INT 0x0080 /* Transmit interrupt */ #define DELQA_CSR_ILOOP 0x0100 /* Internal loopback */ #define DELQA_CSR_ELOOP 0x0200 /* External loopback */ #define DELQA_CSR_STIM_ENABLE 0x0400 /* Sanity timer enable */ #define DELQA_CSR_POWERUP 0x1000 /* Transceiver power on */ #define DELQA_CSR_CARRIER 0x2000 /* Carrier detect */ #define DELQA_CSR_RCV_INT 0x8000 /* Receiver interrupt */ /* Bits in ADDR_HI field in descriptors */ #define DELQA_ADDRHI_VALID 0x8000 /* ADDRHI/LO are valid */ #define DELQA_ADDRHI_CHAIN 0x4000 /* ADDRHI/LO points to next descriptor */ #define DELQA_ADDRHI_EOMSG 0x2000 /* Buffer contains last byte of frame */ #define DELQA_ADDRHI_SETUP 0x1000 /* Buffer contains a setup frame */ #define DELQA_ADDRHI_ODDEND 0x0080 /* last byte not on word boundary */ #define DELQA_ADDRHI_ODDBEGIN 0x0040 /* first byte not on word boundary */ /* Bits in buffer descriptor field STATUS1 for transmit */ #define DELQA_TXSTS1_LASTNOT 0x8000 #define DELQA_TXSTS1_ERRORUSED 0x4000 #define DELQA_TXSTS1_LOSS 0x1000 #define DELQA_TXSTS1_NOCARRIER 0x0800 #define DELQA_TXSTS1_STE16 0x0400 #define DELQA_TXSTS1_ABORT 0x0200 #define DELQA_TXSTS1_FAIL 0x0100 #define DELQA_TXSTS1_COUNT_MASK 0x00f0 #define DELQA_TXSTS1_COUNT_SHIFT 4 /* Special value that signifies that descriptor is not yet used by DELQA. The descriptor FLAG and STATUS1 fields both get initialized to this value. */ #define DELQA_NOTYET 0x8000 /* Bits in buffer descriptor field STATUS1 for transmit */ #define DELQA_TXSTS2_TDR_MASK 0x3fff #define DELQA_TXSTS2_TDR_SHIFT 0 /* Bits in buffer descriptor field STATUS1 for receive */ #define DELQA_RXSTS1_LASTNOT 0x8000 #define DELQA_RXSTS1_ERRORUSED 0x4000 #define DELQA_RXSTS1_ESETUP 0x2000 #define DELQA_RXSTS1_DISCARD 0x1000 #define DELQA_RXSTS1_RUNT 0x0800 #define DELQA_RXSTS1_LEN_HI_MASK 0x0700 #define DELQA_RXSTS1_LEN_HI_SHIFT 8 #define DELQA_RXSTS1_FRAME 0x0004 #define DELQA_RXSTS1_CRCERR 0x0002 #define DELQA_RXSTS1_OVF 0x0001 /* Bits in buffer descriptor field STATUS2 for receive */ #define DELQA_RXSTS2_LEN_LO1_MASK 0x00ff #define DELQA_RXSTS2_LEN_LO1_SHIFT 0 #define DELQA_RXSTS2_LEN_LO2_MASK 0xff00 #define DELQA_RXSTS2_LEN_LO2_SHIFT 8 --- NEW FILE --- /* $Id: delqa.c,v 1.1 2002/10/25 14:04:35 airlied Exp $ Quick-and-dirty driver for DELQA/DESQA (Q-bus ethernet adapters) (C) 2002, Kenn Humborg TODO: Pre-allocate the Q-bus mapping registers for TX at init time and re-use them, rather than allocating them for each packet. This would remove the only failure possibility from delqa_start_xmit(). TODO: Don't hard-code the interrupt vector. Add an API to the Q-bus driver to allocate a vector instead. TODO: Allow multiple DELQAs at different base addresses. TODO: Reset BELQA on q-bus memory access error (is this the right thing to do?). TODO: Implement delqa_tx_timeout(). TODO: Handle multicast addresses and PROMISC flag in format_setup_frame(). TODO: Implement delqa_close(). */ #include <linux/init.h> #include <linux/netdevice.h> #include <linux/delay.h> #include <linux/etherdevice.h> #include <asm/system.h> #include <asm/bus/qbus.h> #include "delqa-regs.h" #define DELQA_DEBUG_REGWR 0 #define DELQA_DEBUG_CSR 0 #define DELQA_DEBUG_DESC 0 #define DELQA_DEBUG_PKT 0 #define DELQA_BASE 0x20001920 #define DELQA_QBUS_VECTOR 4 /* FIXME: Are these numbers OK? These are what NetBSD uses. */ #define RXDESCS 30 #define TXDESCS 60 #define RXBUFSIZE 2048 struct delqa_bufdesc { unsigned short flag; unsigned short addr_hi; unsigned short addr_lo; signed short buflen; unsigned short status1; unsigned short status2; }; struct delqa_descs { struct delqa_bufdesc rxdesc[RXDESCS+1]; struct delqa_bufdesc txdesc[TXDESCS+1]; }; struct delqa_private { unsigned char *base; unsigned int qbus_vector; struct net_device_stats stats; struct delqa_descs *descs; struct vax_dmamap *desc_map; /* DMA mapping for delqa_descs structure */ struct vax_dmamap *rx_map[RXDESCS]; /* DMA mappings for each RX buffer */ struct vax_dmamap *tx_map[TXDESCS]; /* DMA mappings for each TX buffer */ struct sk_buff *tx_skb[TXDESCS]; /* We TX direct from the SKB */ unsigned char setup_frame[128]; unsigned char setup_frame_len; unsigned int next_tx_free; /* Only written by mainline code */ unsigned int next_tx_pending; /* Only written by init and interrupt code */ unsigned int next_rx; unsigned int last_tdr; /* Last Time Domain Reflectometer value on TX */ spinlock_t lock; }; #define LOWORD(x) ((int)(x) & 0xffff) #define HIWORD(x) (((int)(x)>>16) & 0xffff) static unsigned short int read_reg(struct delqa_private *priv, unsigned int offset) { volatile unsigned short int *p; p = (volatile unsigned short *)(priv->base + offset); return *p; } static void write_reg(struct delqa_private *priv, unsigned int offset, unsigned short int value) { volatile unsigned short int *p; #if DELQA_DEBUG_REGWR char *reg[8] = { "ADDR1", "ADDR2", "RCCL", "RCLH", "XMTL", "XMTH", "VECTOR", "CSR"}; printk("delqa write_reg: offset %02d(%s) value %04x\n", offset, reg[offset/2], value); #endif p = (volatile unsigned short *)(priv->base + offset); *p = value; } static void dump_csr(char *msg, struct net_device *dev) { struct delqa_private *priv = (struct delqa_private *)dev->priv; unsigned short csr = read_reg(priv, DELQA_CSR); printk("%s: %s: CSR %04x: %s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", dev->name, msg == NULL ? "" : msg, csr, (csr & DELQA_CSR_RCV_INT) ? " RI" : "", (csr & DELQA_CSR_CARRIER) ? " CA" : "", (csr & DELQA_CSR_POWERUP) ? " OK" : "", (csr & DELQA_CSR_STIM_ENABLE) ? " SE" : "", (csr & DELQA_CSR_ELOOP) ? " EL" : "", (csr & DELQA_CSR_ILOOP) ? "" : " IL", /* active low */ (csr & DELQA_CSR_XMIT_INT) ? " XI" : "", (csr & DELQA_CSR_INT_ENABLE) ? " IE" : "", (csr & DELQA_CSR_RL_INVALID) ? " RL" : "", (csr & DELQA_CSR_XL_INVALID) ? " XL" : "", (csr & DELQA_CSR_LOAD_ROM) ? " BD" : "", (csr & DELQA_CSR_NEX_MEM_INT) ? " NI" : "", (csr & DELQA_CSR_RESET) ? " SR" : "", (csr & DELQA_CSR_RCV_ENABLE) ? " RE" : ""); } /* . -> Invalid + -> Valid, not yet used by DELQA * -> Valid, owned by DELQA (in progress) - -> Valid, processed by DELQA - no errors x -> Valid, processed by DELQA - with errors c -> Valid, chain descriptor */ static void dump_descs(struct net_device *dev) { unsigned int i; struct delqa_private *priv = (struct delqa_private *)dev->priv; struct delqa_bufdesc *desc; printk("%s: TX free=%02d pending=%02d ", dev->name, priv->next_tx_free, priv->next_tx_pending); for (i=0; i<TXDESCS+1; i++) { desc = priv->descs->txdesc + i; if (desc->addr_hi & DELQA_ADDRHI_CHAIN) { printk("c"); } else if (desc->addr_hi & DELQA_ADDRHI_VALID) { /* VALID bit set */ switch (desc->status1 & (DELQA_TXSTS1_LASTNOT|DELQA_TXSTS1_ERRORUSED)) { case 0: printk("-"); break; case DELQA_TXSTS1_ERRORUSED: printk("x"); break; case DELQA_TXSTS1_LASTNOT: if (desc->flag & 0x4000) { printk("*"); } else { printk("+"); } break; case DELQA_TXSTS1_LASTNOT|DELQA_TXSTS1_ERRORUSED: /* Don't expect this, since we never break packets across buffers */ printk("?"); break; } } else { printk("."); } } printk("\n"); printk("%s: RX next=%02d ", dev->name, priv->next_rx); for (i=0; i<RXDESCS+1; i++) { desc = priv->descs->rxdesc + i; if (desc->addr_hi & DELQA_ADDRHI_CHAIN) { printk("c"); } else if (desc->addr_hi & DELQA_ADDRHI_VALID) { /* VALID bit set */ switch (desc->status1 & (DELQA_RXSTS1_LASTNOT|DELQA_RXSTS1_ERRORUSED)) { case 0: printk("-"); break; case DELQA_RXSTS1_ERRORUSED: printk("x"); break; case DELQA_RXSTS1_LASTNOT: if (desc->flag & 0x4000) { printk("*"); } else { printk("+"); } break; case DELQA_RXSTS1_LASTNOT|DELQA_RXSTS1_ERRORUSED: /* Don't expect this, since we never break packets across buffers */ printk("?"); break; } } else { printk("."); } } printk("\n"); } static void delqa_tx_interrupt(struct net_device *dev, struct delqa_private *priv) { struct delqa_bufdesc *desc; int desc_freed = 0; unsigned int tdr; unsigned int collisions; /* Get first descriptor waiting to be "taken back" from the DELQA */ desc = priv->descs->txdesc + priv->next_tx_pending; while (desc->status1 != DELQA_NOTYET) { #if DELQA_DEBUG_PKT printk("TX desc %d, status1=%04x, status2=%04x\n", priv->next_tx_pending, desc->status1, desc->status2); #endif tdr = (desc->status2 & DELQA_TXSTS2_TDR_MASK) >> DELQA_TXSTS2_TDR_SHIFT; collisions = (desc->status1 & DELQA_TXSTS1_COUNT_MASK) >> DELQA_TXSTS1_COUNT_SHIFT; if (desc->status1 & DELQA_TXSTS1_ERRORUSED) { priv->stats.tx_errors++; if (desc->status1 & DELQA_TXSTS1_LOSS) { printk("%s: carrier lost on transmit - " "ethernet cable problem?", dev->name); } if (desc->status1 & DELQA_TXSTS1_NOCARRIER) { printk("%s: no carrier on transmit - " "transceiver or transceiver cable problem?", dev->name); } if (desc->status1 & DELQA_TXSTS1_ABORT) { if (tdr == priv->last_tdr) { printk("%s: excessive collisions on transmit", dev->name); } else { printk("%s: excessive collisions on transmit - " "cable fault at TDR=%d\n", dev->name, tdr); } if (collisions == 0) { /* Collision counter overflowed */ priv->stats.collisions += 16; } } } else { if (desc->addr_hi & DELQA_ADDRHI_SETUP) { /* Don't count setup frames in stats */ } else { /* Packet got onto the wire */ priv->stats.tx_packets++; priv->stats.tx_bytes += desc->buflen * 2; } } priv->stats.collisions += collisions; priv->last_tdr = tdr; if (desc->addr_hi & DELQA_ADDRHI_SETUP) { /* Setup frame - no associated skb */ } else { dev_kfree_skb_irq(priv->tx_skb[priv->next_tx_pending]); } /* clear VALID bit */ desc->addr_hi = 0; /* reclaim descriptor */ desc->flag = DELQA_NOTYET; desc->status1 = DELQA_NOTYET; desc->status2 = 0; /* Free the mapping registers */ qbus_unmap(priv->tx_map[priv->next_tx_pending]); /* At least one descriptor freed up */ desc_freed = 1; priv->next_tx_pending++; if (priv->next_tx_pending == TXDESCS) { priv->next_tx_pending = 0; } desc = priv->descs->txdesc + priv->next_tx_pending; } if (netif_queue_stopped(dev) && desc_freed) { netif_wake_queue(dev); } } static void delqa_rx_interrupt(struct net_device *dev, struct delqa_private *priv) { struct delqa_bufdesc *desc; unsigned int len; struct sk_buff *skb; unsigned int busaddr; /* Get first descriptor waiting to be "taken back" from the DELQA */ desc = priv->descs->rxdesc + priv->next_rx; while (desc->status1 != DELQA_NOTYET) { #if DELQA_DEBUG_PKT printk("RX desc %d, status1=%04x, status2=%04x, len=%d\n", priv->next_rx, desc->status1, desc->status2, len); #endif if (desc->status1 & DELQA_RXSTS1_ESETUP) { /* This is the loopback of a setup frame - ignore */ } if (desc->status1 & DELQA_RXSTS1_ERRORUSED) { /* Error while receiving */ priv->stats.rx_errors++; } else { /* Good frame received */ unsigned int len_hi; unsigned int len_lo1; unsigned int len_lo2; len_hi = (desc->status1 & DELQA_RXSTS1_LEN_HI_MASK) >> DELQA_RXSTS1_LEN_HI_SHIFT; len_lo1 = (desc->status2 & DELQA_RXSTS2_LEN_LO1_MASK) >> DELQA_RXSTS2_LEN_LO1_SHIFT; len_lo2 = (desc->status2 & DELQA_RXSTS2_LEN_LO2_MASK) >> DELQA_RXSTS2_LEN_LO2_SHIFT; if (len_lo1 != len_lo2) { printk("%s: DELQA status2 bytes don't match\n", dev->name); } len = (len_hi << 8) + len_lo1 + 60; skb = dev_alloc_skb(len + 2); if (skb == NULL) { printk("%s: cannot allocate skb, dropping packet\n", dev->name); priv->stats.rx_dropped++; } else { priv->stats.rx_packets++; priv->stats.rx_bytes += len; skb->dev = dev; skb_reserve(skb, 2); skb_put(skb, len); memcpy(skb->data, priv->rx_map[priv->next_rx]->virtaddr, len); skb->protocol = eth_type_trans(skb, dev); netif_rx(skb); } } /* reclaim descriptor */ desc->flag = DELQA_NOTYET; desc->status1 = DELQA_NOTYET; desc->status2 = 1; /* High and low bytes must be different */ priv->next_rx++; if (priv->next_rx == RXDESCS) { priv->next_rx = 0; } desc = priv->descs->rxdesc + priv->next_rx; } /* DEQNA manual errata sheet states that we must check for an invalid receive list before leaving the ISR and reset the buffer list if it is invalid */ if (read_reg(priv, DELQA_CSR) & DELQA_CSR_RL_INVALID) { printk("%s: receive list invalid - resetting\n", dev->name); /* The descriptor pointed to by next_rx must be the first available descriptor. This is because: o The DELQA doesn't touch the receive list when RL_INVALID is set. o The while() loop above stops when next_rx points to a 'NOTYET' descriptor. */ busaddr = priv->desc_map->busaddr + offsetof(struct delqa_descs, rxdesc[priv->next_rx]); write_reg(priv, DELQA_RCLL, LOWORD(busaddr)); write_reg(priv, DELQA_RCLH, HIWORD(busaddr)); } } static void delqa_interrupt(const int irq, void *dev_id, struct pt_regs *regs) { struct net_device *dev = (struct net_device *)dev_id; struct delqa_private *priv = (struct delqa_private *)dev->priv; unsigned int csr; unsigned int newcsr; spin_lock(&priv->lock); csr = read_reg(priv, DELQA_CSR); #if DELQA_DEBUG_CSR dump_csr("delqa_interrupt entry", dev); #endif #if DELQA_DEBUG_DESC dump_descs(dev); #endif newcsr = DELQA_CSR_ILOOP | DELQA_CSR_RCV_ENABLE | DELQA_CSR_INT_ENABLE; if (csr & DELQA_CSR_XMIT_INT) { /* Either memory read error or tx interrupt */ if (csr & DELQA_CSR_NEX_MEM_INT) { dump_csr("Q-bus memory error", dev); dump_descs(dev); qbus_dumpmap(); /* FIXME: what should we do here? */ panic("DELQA bus memory access error"); } else { newcsr |= DELQA_CSR_XMIT_INT; delqa_tx_interrupt(dev, priv); } } if (csr & DELQA_CSR_RCV_INT) { newcsr |= DELQA_CSR_RCV_INT; delqa_rx_interrupt(dev, priv); } /* Clear RX and TX interrupt bits to allow further interrupts. We also enable the receiver and turn off the internal loopback at this point. */ write_reg(priv, DELQA_CSR, newcsr); #if DELQA_DEBUG_CSR dump_csr("delqa_interrupt exit", dev); #endif spin_unlock(&priv->lock); } static int delqa_start_xmit(struct sk_buff *skb, struct net_device *dev) { struct delqa_private *priv = (struct delqa_private *)dev->priv; struct delqa_bufdesc *desc; unsigned int len; unsigned int i; unsigned int busaddr; unsigned int csr; unsigned int flags; if (skb->len < ETH_ZLEN) { struct sk_buff *new_skb; new_skb = skb_copy_expand(skb, 0, ETH_ZLEN - skb->len, GFP_ATOMIC); if (new_skb == NULL) { return -ENOMEM; } memset(skb_put(new_skb, ETH_ZLEN - skb->len), 0, ETH_ZLEN - skb->len); dev_kfree_skb(skb); /* We must not return a failure after this point, since that would result in the caller trying to free the skb that we've just freed. */ skb = new_skb; } spin_lock_irqsave(&priv->lock, flags); i = priv->next_tx_free; priv->next_tx_free++; if (priv->next_tx_free == TXDESCS) { priv->next_tx_free = 0; } spin_unlock_irqrestore(&priv->lock, flags); desc = priv->descs->txdesc + i; /* FIXME: These mapping registers MUST be allocated at init time to prevent any possibility of failure here - see above comment */ priv->tx_map[i] = qbus_alloc_mapregs(skb->data, skb->len); if (priv->tx_map[i] == NULL) { /* FIXME: What should I do here? */ panic("delqa_start_xmit: no map reg"); } priv->tx_skb[i] = skb; busaddr = priv->tx_map[i]->busaddr; desc->addr_lo = LOWORD(busaddr); desc->addr_hi = HIWORD(busaddr) | DELQA_ADDRHI_EOMSG; desc->flag = DELQA_NOTYET; desc->status1 = DELQA_NOTYET; desc->status2 = 0; /* Work out the length and alignment stuff */ len = skb->len; if ((len & 1) || ((unsigned long)(skb->data) & 1)) { len += 2; } if ((unsigned long)(skb->data) & 1) { desc->addr_hi |= DELQA_ADDRHI_ODDBEGIN; } if ((unsigned long)(skb->data + len) & 1) { desc->addr_hi |= DELQA_ADDRHI_ODDEND; } desc->buflen = -(len/2); /* Set the "go" bit on this descriptor */ desc->addr_hi |= DELQA_ADDRHI_VALID; #if DELQA_DEBUG_DESC dump_descs(dev); #endif spin_lock_irqsave(&priv->lock, flags); csr = read_reg(priv, DELQA_CSR); if (csr & DELQA_CSR_XL_INVALID) { /* Get Q-bus address of first TX descriptor */ busaddr = priv->desc_map->busaddr + offsetof(struct delqa_descs, txdesc[i]); write_reg(priv, DELQA_XMTL, LOWORD(busaddr)); write_reg(priv, DELQA_XMTH, HIWORD(busaddr)); } /* Check if the 'next' descriptor is actually free */ desc = priv->descs->txdesc + priv->next_tx_free; if (desc->addr_hi & DELQA_ADDRHI_VALID) { /* All descriptors in use - stop tx queue */ netif_stop_queue(dev); } spin_unlock_irqrestore(&priv->lock, flags); return 0; } /* FIXME: implement this */ static void delqa_tx_timeout(struct net_device *dev) { printk("delqa_tx_timeout not implemented\n"); HALT; } static void store_setup_address(unsigned int index, unsigned char *addr, unsigned char *setup_frame) { unsigned int start; unsigned int i; if (index < 6) { start = index + 1; } else { start = index + 65; } for (i=0; i<6; i++) { setup_frame[start + i * 8] = addr[i]; } } static void format_setup_frame(struct net_device *dev) { struct delqa_private *priv = (struct delqa_private *)dev->priv; /* Fill in hardware, broadcast and multicast addresses here */ /* Pre-fill with all FF (has side effect of setting all addresses to the broadcast address) */ memset(priv->setup_frame, 0xff, sizeof(priv->setup_frame)); /* First address will be our unicast address */ store_setup_address(0, dev->dev_addr, priv->setup_frame); /* FIXME: Store multicast addresses here */ /* FIXME: Use MULTICAST and PROMISC flags to tweak setup_len */ priv->setup_frame_len = 128; } /* FIXME: pre-allocate mapping registers for this at init time. Then this would be a no-fail function */ static void queue_setup_frame(struct net_device *dev) { struct delqa_private *priv = (struct delqa_private *)dev->priv; struct delqa_bufdesc *desc; unsigned int busaddr; unsigned int csr; unsigned int i; /* Point the first available TX descriptor at the setup frame and enable the transmitter */ spin_lock(&priv->lock); i = priv->next_tx_free; priv->next_tx_free++; if (priv->next_tx_free == TXDESCS) { priv->next_tx_free = 0; } spin_unlock(&priv->lock); desc = priv->descs->txdesc + i; priv->tx_map[i] = qbus_alloc_mapregs(priv->setup_frame, priv->setup_frame_len); if (priv->tx_map[i] == NULL) { panic("delqa queue_setup_frame: dma mapping failed"); } busaddr = priv->tx_map[i]->busaddr; desc->addr_lo = LOWORD(busaddr); desc->addr_hi = HIWORD(busaddr) | DELQA_ADDRHI_SETUP | DELQA_ADDRHI_EOMSG; desc->flag = DELQA_NOTYET; desc->status1 = DELQA_NOTYET; desc->status2 = 0; desc->buflen = -priv->setup_frame_len/2; /* (maybe) bytes, not words like all other uses */ desc->addr_hi |= DELQA_ADDRHI_VALID; #if DELQA_DEBUG_DESC dump_descs(dev); #endif spin_lock(&priv->lock); csr = read_reg(priv, DELQA_CSR); if (csr & DELQA_CSR_XL_INVALID) { /* Get Q-bus address of first TX descriptor */ busaddr = priv->desc_map->busaddr + offsetof(struct delqa_descs, txdesc[i]); write_reg(priv, DELQA_XMTL, LOWORD(busaddr)); write_reg(priv, DELQA_XMTH, HIWORD(busaddr)); } spin_unlock(&priv->lock); } static void delqa_reset(struct net_device *dev) { struct delqa_private *priv = (struct delqa_private *)dev->priv; unsigned int csr; printk("%s: resetting DELQA... ", dev->name); write_reg(priv, DELQA_CSR, DELQA_CSR_RESET); udelay(1000); csr = read_reg(priv, DELQA_CSR); write_reg(priv, DELQA_CSR, csr & ~DELQA_CSR_RESET); write_reg(priv, DELQA_VECTOR, priv->qbus_vector); printk("done\n"); } static int delqa_open(struct net_device *dev) { struct delqa_private *priv = (struct delqa_private *)dev->priv; struct delqa_bufdesc *desc; int i; unsigned int busaddr; /* Reset the hardware before hooking the interrupt vector to guarantee that we won't get any interrupts until we enable them. */ delqa_reset(dev); if (qbus_request_irq(priv->qbus_vector, delqa_interrupt, 0, "delqa", dev)) { printk("delqa_open: cannot get qbus irq %d\n", priv->qbus_vector); return -EAGAIN; } /* Mark the transmit descriptors as not yet owned by the DELQA (and also not VALID). */ for (i=0; i<TXDESCS; i++) { desc = priv->descs->txdesc + i; /* Clear VALID bit */ desc->addr_hi = 0; desc->flag = DELQA_NOTYET; desc->status1 = DELQA_NOTYET; desc->status2 = 0; } /* Mark the receive descriptors as not yet owned by the DELQA. */ for (i=0; i<RXDESCS; i++) { desc = priv->descs->rxdesc + i; desc->flag = DELQA_NOTYET; desc->status1 = DELQA_NOTYET; desc->status2 = 1; } /* Tell the DELQA where the receive descriptors live (i.e. which Q-bus addresses are mapped to the descriptor addresses by the mapping registers. There is no point in setting the transmit descriptor address, since there are no valid transmit descriptors yet. When the card hits an invalid transmit descriptor, it stops the transmit logic, which can only be restarted by setting the transmit descriptor address again. */ busaddr = priv->desc_map->busaddr + offsetof(struct delqa_descs, rxdesc[0]); write_reg(priv, DELQA_RCLL, LOWORD(busaddr)); write_reg(priv, DELQA_RCLH, HIWORD(busaddr)); write_reg(priv, DELQA_CSR, DELQA_CSR_INT_ENABLE | DELQA_CSR_XMIT_INT | DELQA_CSR_RCV_INT); format_setup_frame(dev); queue_setup_frame(dev); return 0; } /* FIXME: implement delqa_close */ static int delqa_close(struct net_device *dev) { printk("delqa_close not implemented\n"); HALT; return 0; } static void delqa_set_multicast(struct net_device *dev) { format_setup_frame(dev); queue_setup_frame(dev); } static struct net_device_stats *delqa_get_stats(struct net_device *dev) { struct delqa_private *priv = (struct delqa_private *) dev->priv; return &priv->stats; } /* This function allocates the receive buffers, allocates and maps QBUS mapping registers for these buffers, initializes the receive descriptors to point to these buffers, and sets up the chain descriptors at the end of the descriptor lists */ static int init_desc_rings(struct net_device *dev) { struct delqa_private *priv = (struct delqa_private *)dev->priv; struct delqa_bufdesc *desc; unsigned int busaddr; int i; for (i=0; i<RXDESCS; i++) { unsigned char *buf; buf = kmalloc(RXBUFSIZE, GFP_KERNEL); if (buf == NULL) { printk("delqa: Cannot allocate RX buf"); goto cleanup; } priv->rx_map[i] = qbus_alloc_mapregs(buf, RXBUFSIZE); if (priv->rx_map[i] == NULL) { printk("delqa init_desc_rings: dma mapping failed"); kfree(buf); goto cleanup; } busaddr = priv->rx_map[i]->busaddr; desc = priv->descs->rxdesc + i; desc->addr_lo = LOWORD(busaddr); desc->addr_hi = HIWORD(busaddr); desc->flag = DELQA_NOTYET; desc->status1 = DELQA_NOTYET; desc->status2 = 1; desc->buflen = - (RXBUFSIZE / 2); /* words, not bytes */ desc->addr_hi |= DELQA_ADDRHI_VALID; } /* Remember that we've allocated one more descriptor than we need. This one is used to chain the end of the descriptor list back to the beginning. */ /* Last receive descriptor contains bus address of first desc */ desc = priv->descs->rxdesc + RXDESCS; busaddr = priv->desc_map->busaddr + offsetof(struct delqa_descs, rxdesc[0]); desc->addr_lo = LOWORD(busaddr); desc->addr_hi = HIWORD(busaddr) | DELQA_ADDRHI_VALID | DELQA_ADDRHI_CHAIN; desc->flag = DELQA_NOTYET; desc->status1 = DELQA_NOTYET; /* Last transmit descriptor contains bus address of first desc */ desc = priv->descs->txdesc + TXDESCS; busaddr = priv->desc_map->busaddr + offsetof(struct delqa_descs, txdesc[0]); desc->addr_lo = LOWORD(busaddr); desc->addr_hi = HIWORD(busaddr) | DELQA_ADDRHI_VALID | DELQA_ADDRHI_CHAIN; desc->flag = DELQA_NOTYET; desc->status1 = DELQA_NOTYET; priv->next_tx_free = 0; priv->next_tx_pending = 0; priv->next_rx = 0; return 0; cleanup: for (i=0; i<RXDESCS; i++) { if (priv->rx_map[i] != NULL) { kfree(priv->rx_map[i]->virtaddr); qbus_unmap(priv->rx_map[i]); priv->rx_map[i] = NULL; } } return -ENOMEM; } static int delqa_init(struct net_device *dev) { struct delqa_private *priv; int i; int status = 0; dev->priv = kmalloc(sizeof(struct delqa_private), GFP_KERNEL); if (dev->priv == NULL) { return -ENOMEM; } memset(dev->priv, 0, sizeof(struct delqa_private)); priv = (struct delqa_private *) dev->priv; spin_lock_init(&priv->lock); priv->base = ioremap(DELQA_BASE, 16); if (priv->base == NULL) { status = -ENOMEM; goto cleanup0; } priv->descs = kmalloc(sizeof(struct delqa_descs), GFP_KERNEL); if (priv->descs == NULL) { status = -ENOMEM; goto cleanup1; } dev->mem_start = (unsigned int)priv->descs; dev->mem_end = (unsigned int)priv->descs + sizeof(*(priv->descs)); /* FIXME: get the vector from the q-bus adapter driver */ write_reg(priv, DELQA_VECTOR, DELQA_QBUS_VECTOR); priv->qbus_vector = DELQA_QBUS_VECTOR; printk("delqa qbus vector: %d (0%03o, 0x%04x)\n", priv->qbus_vector, priv->qbus_vector, priv->qbus_vector); dev->irq = qbus_vector_to_irq(priv->qbus_vector); printk("Ethernet address in ROM: "); for (i = 0; i < 6; i++) { dev->dev_addr[i] = priv->base[i*2] & 0xff; printk("%2.2x%c", dev->dev_addr[i], i == 5 ? '\n' : ':'); } /* Here we need to setup qbus mapping registers so that the DELQA can DMA to and from our buffers */ priv->desc_map = qbus_alloc_mapregs(priv->descs, sizeof(struct delqa_descs)); if (priv->desc_map == NULL) { status = -ENOMEM; goto cleanup2; } status = init_desc_rings(dev); if (status < 0) { goto cleanup3; } dev->open = delqa_open; dev->stop = delqa_close; dev->hard_start_xmit = delqa_start_xmit; dev->tx_timeout = delqa_tx_timeout; dev->watchdog_timeo = 5*HZ; dev->get_stats = &delqa_get_stats; dev->set_multicast_list = &delqa_set_multicast; dev->dma = 0; ether_setup(dev); return status; cleanup3: qbus_unmap(priv->desc_map); cleanup2: kfree(priv->descs); cleanup1: iounmap(priv->base); cleanup0: kfree(dev->priv); dev->priv = NULL; return status; } struct net_device delqa_dev = { init: delqa_init }; int __init delqa_probe(void) { return register_netdev(&delqa_dev); } __initcall(delqa_probe); |
From: Dave A. <ai...@us...> - 2002-10-25 17:25:33
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/vax/bus In directory usw-pr-cvs1:/tmp/cvs-serv27297/bus Added Files: Makefile qbus.c Log Message: DA: backport from 2.5 of Kenns qbus/delqa work - delqa/qbus works iprcons is not working.. needed for SIMH emu --- NEW FILE --- # # Makefile for the Linux/VAX bus device drivers. # O_TARGET := vaxbus.o obj-y := obj-m := obj-n := obj-$(CONFIG_QBUS) += qbus.o include $(TOPDIR)/Rules.make --- NEW FILE --- /* Very dumb map register allocator - does linear searches for available registers. Need a better way to do this. My first thought was to use bits 30:0 in invalid map registers to contain forward and backward links to maintain a list of free registers. However, bits 30:20 are reserved (read as zero and should be written as zero), so that only leaves us with 20 bits for links. This would be OK if we allow the allocation granularity to be 8 registers. - KPH */ #include <asm/io.h> #include <linux/sched.h> #include <linux/init.h> #include <linux/slab.h> #include <asm/bus/qbus.h> #define QBUS_DEBUG 0 #define CQBIC_MAPREGPHYS 0x20088000 #define CQBIC_NUMMAPREGS 8192 static unsigned int *cqbic_mapregbase; /* Given a (start, len), how many pagelets does this span? */ static unsigned int num_pagelets(void *start, unsigned int len) { unsigned int start_pagelet; unsigned int end_pagelet; start_pagelet = (unsigned int)start >> PAGELET_SHIFT; end_pagelet = ((unsigned int)start + len - 1) >> PAGELET_SHIFT; return end_pagelet - start_pagelet + 1; } __init static int qbus_init(void) { int i; if (cqbic_mapregbase == NULL) { cqbic_mapregbase = (unsigned int *)ioremap(CQBIC_MAPREGPHYS, CQBIC_NUMMAPREGS * sizeof(unsigned int)); #if QBUS_DEBUG printk("CQBIC map registers mapped at %p\n", cqbic_mapregbase); #endif } for (i=0; i<CQBIC_NUMMAPREGS; i++) { cqbic_mapregbase[i] = 0; } return 0; } static int find_n_free(unsigned int n) { int i; int j; i = 0; while (i < (8192 - n)) { for (j=0; j<n; j++) { if (cqbic_mapregbase[i+j]) { /* This reg in use */ break; } } if (j == n) { /* Found N contiguous free entries at offset I */ return i; } i += j+1; } return -1; } /* Allocate a bunch of map registers sufficient to map 'len' bytes at address 'start'. */ struct vax_dmamap *qbus_alloc_mapregs(void *start, unsigned int len) { struct vax_dmamap *map; map = kmalloc(sizeof(struct vax_dmamap), GFP_KERNEL); if (map != NULL) { int reg; unsigned int pagelets; pagelets = num_pagelets(start, len); reg = find_n_free(pagelets); if (reg != -1) { unsigned int pfn; unsigned int reg_value; int i; pfn = virt_to_phys(start) >> PAGELET_SHIFT; reg_value = (pfn & 0xfffff) | 0x80000000; for (i = reg; i < reg + pagelets; i++, reg_value++) { cqbic_mapregbase[i] = reg_value; } map->reg = reg; map->pagelets = pagelets; map->virtaddr = start; map->busaddr = (reg * PAGELET_SIZE) + ((unsigned int)start & ~PAGELET_MASK); #if QBUS_DEBUG printk("Using map registers 0x%04x to 0x%04x to map virt %p to %p (bus %08x)\n", reg, reg + pagelets - 1, start, (char *)start + len - 1, map->busaddr); #endif } else { kfree(map); map = NULL; } } return map; } void qbus_unmap(struct vax_dmamap *map) { #if QBUS_DEBUG printk("Zapping map registers 0x%04x to 0x%04x\n", map->reg, map->reg + map->pagelets - 1); #endif while (map->pagelets--) { cqbic_mapregbase[map->reg] = 0; map->reg++; } kfree(map); } void qbus_dumpmap(void) { int i; for (i=0; i<CQBIC_NUMMAPREGS; i++) { if (cqbic_mapregbase[i] != 0) { printk("CQBIC map reg %04x = %08x (-> %08x)\n", i, cqbic_mapregbase[i], (cqbic_mapregbase[i] & 0xfffff) << PAGELET_SHIFT); } } } int qbus_vector_to_irq(unsigned int vector) { return (vector / 4) + 128; } int qbus_request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *), unsigned long irqflags, const char * devname, void *dev_id) { return request_irq(irq / 4 + 128, handler, irqflags, devname, dev_id); } __initcall(qbus_init); |
From: Dave A. <ai...@us...> - 2002-10-25 17:25:29
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/vax/char In directory usw-pr-cvs1:/tmp/cvs-serv25791/char Log Message: Directory /cvsroot/linux-vax/kernel-2.4/drivers/vax/char added to the repository |
From: Dave A. <ai...@us...> - 2002-10-25 17:25:28
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/vax In directory usw-pr-cvs1:/tmp/cvs-serv25518/vax Log Message: Directory /cvsroot/linux-vax/kernel-2.4/drivers/vax added to the repository |
From: Hao j. <hj...@ma...> - 2002-08-07 03:31:05
|
d2hhdCByb2xlcyBkb2VzIHRoZSAibmV0L2NvcmUvc2NtLmMiIHRha2UgaW4gbGludXg/DQpBbmQg d2hlcmUgY2FuIEkgZmluZCB0aGUgZGV0YWlsZWQgaW5mb3JtYXRpb24gYWJvdXRlIHRoZSByb2xl cyBldmVyeSBmaWxlIHRha2VzIHVuZGVyIHRoZSBuZXQvY29yZSBhbmQgb3RoZXJzPw0K |
From: Richard B. <rb...@us...> - 2002-06-12 07:57:32
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/scsi In directory usw-pr-cvs1:/tmp/cvs-serv22878/drivers/scsi Modified Files: vax_esp.c vax_esp.h Log Message: Just a few updates for "safe keeping". Still trying to get my head around DMA Index: vax_esp.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/scsi/vax_esp.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- vax_esp.c 4 Jun 2002 07:20:28 -0000 1.2 +++ vax_esp.c 12 Jun 2002 07:57:26 -0000 1.3 @@ -1,16 +1,8 @@ /* - * vax_esp.c: Driver for SCSI chips on VAXStation 4000/200 and uVax3100/85 + * vax_esp.c: Driver for NCR53C94 SCSI chip on uVax3100/85 * - * based on dec_esp.c: - * VAX support by David Airlie & Richard Banks + * by David Airlie & Richard Banks * - * TURBOchannel changes by Harald Koerfgen - * PMAZ-A support by David Airlie - * - * based on jazz_esp.c: - * Copyright (C) 1997 Thomas Bogendoerfer (tsb...@al...) - * - * jazz_esp is based on David S. Miller's ESP driver and cyber_esp */ #include <linux/kernel.h> @@ -29,6 +21,9 @@ #include <asm/irq.h> #include <asm/dma.h> +#include <asm/pgalloc.h> +#include <asm/vsa.h> +#include <asm/mv.h> #include <asm/pgtable.h> @@ -47,20 +42,11 @@ static void dma_mmu_get_scsi_sgl(struct NCR_ESP *esp, Scsi_Cmnd * sp); static void dma_advance_sg(Scsi_Cmnd * sp); -#if 0 -volatile unsigned char *scsi_pmaz_dma_ptrs_tc[ESP_NCMD]; -unsigned char scsi_pmaz_dma_buff_used[ESP_NCMD]; -#endif unsigned char scsi_cur_buff = 1; /* Leave space for command buffer */ __u32 esp_virt_buffer; int scsi_current_length = 0; volatile unsigned char cmd_buffer[16]; -volatile unsigned char pmaz_cmd_buffer[16]; - /* This is where all commands are put - * before they are trasfered to the ESP chip - * via PIO. - */ volatile unsigned long *scsi_dma_ptr; volatile unsigned long *scsi_next_ptr; @@ -69,6 +55,12 @@ volatile unsigned long *scsi_sdr0; volatile unsigned long *scsi_sdr1; +volatile unsigned long *scsi_dma_address; +volatile unsigned long *scsi_dma_direction; + +struct vax_scsi_pte *esp_pte; +unsigned long esp_pte_offset; + static void scsi_dma_int(int, void *, struct pt_regs *); /***************************************************************** Detection */ @@ -77,15 +69,23 @@ struct NCR_ESP *esp; struct ConfigDev *esp_dev; unsigned long scsi_base; + struct vax_scsi_pte *pte; + unsigned long l; scsi_base = 0x200c0080; + + /* On the 3100/85 the SCSI DMA registers are at 0x25c00000 (address & direction + * The SCSI DMA Map registers are at 0x27000000-27007FFF (8K) + * The SCSI controller registers are at0X26000080-BF + */ + scsi_base = 0x26000080; /* hardcode for 3100/85 for now */ esp_dev = 0; esp = esp_allocate(tpnt, (void *) esp_dev); /* Do command transfer with programmed I/O */ - esp->do_pio_cmds = 1; + esp->do_pio_cmds = 0; /* Required functions */ esp->dma_bytes_sent = &dma_bytes_sent; @@ -133,10 +133,29 @@ /* Set the command buffer */ esp->esp_command = (volatile unsigned char *) cmd_buffer; + + /* Now we have to create and initialise our DMA area. + * Initially we need to allocate the memory and clear the page table entries for the device + */ + esp_pte = pte = (struct vax_scsi_pte *)ioremap (0x27000000,32767); + for (l=0; l<8192; l++){ + ((unsigned long *)pte)[l] = 0; /* can't use bzero as access must be via longword */ + } + esp_pte_offset = 0; + + /* now we need to create the dma area + * As we use memory we will map the PTE for this memory into the PTE's for the device + */ + esp->esp_command_dvma = (__u32) kmalloc (VAX_SCSI_MAX_TRANSFER,GFP_ATOMIC); - /* get virtual dma address for command buffer */ - // esp->esp_command_dvma = (__u32) KSEG1ADDR((volatile unsigned char *) cmd_buffer); - + + + /* need to find address and direction scsi registers. + * on the KA55 they're just offsets from the base register location. + * -- ugly code -- should set this inside vsbus.c somewhere + */ + scsi_dma_address = (unsigned long *)ioremap(VSA_KA55_BASE_REGS,1); + scsi_dma_direction = (unsigned long *)((unsigned long)&scsi_dma_address + VAX_SCSI_DMA_DIRECTION); /* add offset */ // esp->irq = SCSI_INT; esp->irq = 255; @@ -169,30 +188,6 @@ unsigned int dummy; printk ("dma_int called\n"); -#if 0 - if (*isr & SCSI_PTR_LOADED) { - /* next page */ - *scsi_next_ptr = ((*scsi_dma_ptr + PAGE_SIZE) & PAGE_MASK) << 3; - *isr &= ~SCSI_PTR_LOADED; - } else { - if (*isr & SCSI_PAGOVRRUN) - *isr &= ~SCSI_PAGOVRRUN; - if (*isr & SCSI_DMA_MEMRDERR) { - printk("Got unexpected SCSI DMA Interrupt! < "); - printk("SCSI_DMA_MEMRDERR "); - printk(">\n"); - *isr &= ~SCSI_DMA_MEMRDERR; - } - } - - /* - * This routine will only work on IOASIC machines - * so we can avoid an indirect function call here - * and flush the writeback buffer the fast way - */ -// dummy = *isr; -// dummy = *isr; -#endif } static int dma_bytes_sent(struct NCR_ESP *esp, int fifo_count) @@ -204,31 +199,8 @@ static void dma_drain(struct NCR_ESP *esp) { unsigned long nw = *scsi_scr; - // unsigned short *p = KSEG1ADDR((unsigned short *) ((*scsi_dma_ptr) >> 3)); printk ("dma_drain called\n"); - /* - * Is there something in the dma buffers left? - */ - /* if (nw) { - switch (nw) { - case 1: - *p = (unsigned short) *scsi_sdr0; - break; - case 2: - *p++ = (unsigned short) (*scsi_sdr0); - *p = (unsigned short) ((*scsi_sdr0) >> 16); - break; - case 3: - *p++ = (unsigned short) (*scsi_sdr0); - *p++ = (unsigned short) ((*scsi_sdr0) >> 16); - *p = (unsigned short) (*scsi_sdr1); - break; - default: - printk("Strange: %d words in dma buffer left\n", (int) nw); - break; - } - } */ } static int dma_can_transfer(struct NCR_ESP *esp, Scsi_Cmnd * sp) @@ -240,11 +212,6 @@ static void dma_dump_state(struct NCR_ESP *esp) { printk ("dma_dump_state called\n"); - -/* - ESPLOG(("esp%d: dma -- enable <%08x> residue <%08x\n", - esp->esp_id, vdma_get_enable((int)esp->dregs), vdma_get_resdiue((int)esp->dregs))); - */ } static void dma_init_read(struct NCR_ESP *esp, __u32 vaddress, int length) @@ -254,55 +221,22 @@ printk ("dma_init_read called\n"); -#if 0 - if (vaddress & 3) - panic("dec_efs.c: unable to handle partial word transfers, yet..."); - - dma_cache_wback_inv((unsigned long) phys_to_virt(vaddress), length); - - *ioasic_ssr &= ~SCSI_DMA_EN; - *scsi_scr = 0; - *scsi_dma_ptr = vaddress << 3; - - /* prepare for next page */ - *scsi_next_ptr = ((vaddress + PAGE_SIZE) & PAGE_MASK) << 3; - *ioasic_ssr |= (SCSI_DMA_DIR | SCSI_DMA_EN); - - /* - * see above - */ - dummy = *isr; - dummy = *isr; -#endif } static void dma_init_write(struct NCR_ESP *esp, __u32 vaddress, int length) { - printk ("dma_init_write called\n"); - -#if 0 extern volatile unsigned int *isr; unsigned int dummy; + struct vax_scsi_pte *pte; - if (vaddress & 3) - panic("dec_efs.c: unable to handle partial word transfers, yet..."); - - dma_cache_wback_inv((unsigned long) phys_to_virt(vaddress), length); - - *ioasic_ssr &= ~(SCSI_DMA_DIR | SCSI_DMA_EN); - *scsi_scr = 0; - *scsi_dma_ptr = vaddress << 3; - - /* prepare for next page */ - *scsi_next_ptr = ((vaddress + PAGE_SIZE) & PAGE_MASK) << 3; - *ioasic_ssr |= SCSI_DMA_EN; - - /* - * see above - */ - dummy = *isr; - dummy = *isr; -#endif + printk ("dma_init_write called\n"); + printk (" vaddress = 0x%x, length = %d\n",vaddress,length); + /* need to get the PTE of the buffer and transfer it to the device PTE map */ + printk(" virt_to_page(vaddress) = 0x%x\n",(unsigned long)virt_to_page(vaddress)); + pte = (struct vax_scsi_pte *)virt_to_page(vaddress); + esp_pte[esp_pte_offset++] = pte[0]; + // scsi_dma_direction = scsi_dma_direction | VAX_SCSI_DMA_FROM_MEMORY; + } static void dma_ints_off(struct NCR_ESP *esp) @@ -348,29 +282,18 @@ #endif } -/* - * These aren't used yet - */ static void dma_mmu_get_scsi_one(struct NCR_ESP *esp, Scsi_Cmnd * sp) { - sp->SCp.have_data_in = virt_to_phys(sp->SCp.buffer); - sp->SCp.ptr = (char *) ((unsigned long) sp->SCp.have_data_in); + printk("dma_mmu_get_scsi_one called\n"); + // sp->SCp.have_data_in = virt_to_phys(sp->SCp.buffer); + //sp->SCp.ptr = (char *) ((unsigned long) sp->SCp.have_data_in); } static void dma_mmu_get_scsi_sgl(struct NCR_ESP *esp, Scsi_Cmnd * sp) { int sz = sp->SCp.buffers_residual; struct mmu_sglist *sg = (struct mmu_sglist *) sp->SCp.buffer; - printk ("dma_mmu_get_scsi_sgl called\n"); - /* -#if 0 - while (sz >= 0) { - sg[sz].dvma_addr = virt_to_phys(sg[sz].addr); - sz--; - } - sp->SCp.ptr = (char *) ((unsigned long) sp->SCp.buffer->dvma_addr); -#endif - */ + printk ("dma_mmu_get_scsi_sgl called\n"); } static void dma_advance_sg(Scsi_Cmnd * sp) @@ -378,71 +301,6 @@ printk ("dma_adavnce_sg called\n"); // sp->SCp.ptr = (char *) ((unsigned long) sp->SCp.buffer->dvma_addr); } - -#if 0 - -static void pmaz_dma_drain(struct NCR_ESP *esp) -{ - memcpy((void *) (KSEG0ADDR(esp_virt_buffer)), - (void *) scsi_pmaz_dma_ptrs_tc[scsi_cur_buff], scsi_current_length); -} - -static void pmaz_dma_init_read(struct NCR_ESP *esp, __u32 vaddress, int length) -{ - - if (length > ESP_TGT_DMA_SIZE) - length = ESP_TGT_DMA_SIZE; - - *scsi_pmaz_dma_ptr_tc = TC_ESP_DMA_ADDR(scsi_pmaz_dma_ptrs_tc[scsi_cur_buff]); - esp_virt_buffer = vaddress; - scsi_current_length = length; -} - -static void pmaz_dma_init_write(struct NCR_ESP *esp, __u32 vaddress, int length) -{ - memcpy((void *)scsi_pmaz_dma_ptrs_tc[scsi_cur_buff], KSEG0ADDR((void *) vaddress), length); - - *scsi_pmaz_dma_ptr_tc = TC_ESP_DMAR_WRITE | TC_ESP_DMA_ADDR(scsi_pmaz_dma_ptrs_tc[scsi_cur_buff]); - -} - -static void pmaz_dma_ints_off(struct NCR_ESP *esp) -{ -} - -static void pmaz_dma_ints_on(struct NCR_ESP *esp) -{ -} - -static void pmaz_dma_setup(struct NCR_ESP *esp, __u32 addr, int count, int write) -{ - /* - * On the Sparc, DMA_ST_WRITE means "move data from device to memory" - * so when (write) is true, it actually means READ! - */ - if (write) { - pmaz_dma_init_read(esp, addr, count); - } else { - pmaz_dma_init_write(esp, addr, count); - } -} - -static void pmaz_dma_mmu_release_scsi_one(struct NCR_ESP *esp, Scsi_Cmnd * sp) -{ - int x; - for (x = 1; x < 6; x++) - if (sp->SCp.have_data_in == PHYSADDR(scsi_pmaz_dma_ptrs_tc[x])) - scsi_pmaz_dma_buff_used[x] = 0; -} - -static void pmaz_dma_mmu_get_scsi_one(struct NCR_ESP *esp, Scsi_Cmnd * sp) -{ - sp->SCp.have_data_in = (int) sp->SCp.ptr = - (char *) KSEG0ADDR((sp->request_buffer)); -} - -#endif - static Scsi_Host_Template driver_template = SCSI_VAX_ESP; Index: vax_esp.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/scsi/vax_esp.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- vax_esp.h 4 Jun 2002 07:20:28 -0000 1.2 +++ vax_esp.h 12 Jun 2002 07:57:26 -0000 1.3 @@ -2,12 +2,8 @@ * * VS changes Copyright (C) 2001 David Airlie * - * based on dec_esp.h: - * VAXstation changes Copyright (C) 1998 Harald Koerfgen - * and David Airlie + * Other changes by Richard Banks * - * based on jazz_esp.h: - * Copyright (C) 1997 Thomas Bogendoerfer (tsb...@al...) */ #ifndef VAX_ESP_H @@ -20,6 +16,14 @@ #define VAX_SCSI_SRAM 0x80000 #define VAX_SCSI_DIAG 0xC0000 +#define VAX_SCSI_DMA_ADDRESS 0x00 +#define VAX_SCSI_DMA_DIRECTION 0x04 +#define VAX_SCSI_MAX_TRANSFER 65535 + +#define VAX_SCSI_DMA_FROM_MEMORY 0x00000001 +#define VAX_SCSI_DMA_ACTIVE 0x00000002 +#define VAX_SCSI_DMA_MAP_LOADED 0x00000004 + extern int vax_esp_detect(struct SHT *); extern const char *esp_info(struct Scsi_Host *); extern int esp_queue(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); @@ -29,6 +33,27 @@ extern int esp_proc_info(char *buffer, char **start, off_t offset, int length, int hostno, int inout); +/* according to pg 205 of the VARM devices which use DMA have a slightly different + * page table entry format and use. Below is the extended PTE structure + * + * PTE Types for devices are + * <31><26><22> + * 1 x x Valid PFN + * 0 0 0 Valid PFN + * 0 0 1 Global PT Index + * 0 1 x Invalid PTE, I/O Abort + */ +struct vax_scsi_pte { + unsigned int spte_pfn:21; /* <20:0> Page Frame Number */ + unsigned int spte_unused:1; /* <21> Don't use this bit */ + unsigned int spte_global:1; /* <22> Help for ref simulation */ + unsigned int spte_owner:2; /* <24:23> Owner flag */ + unsigned int spte_resv; /* <25> Reserved */ + unsigned int spte_modify:1; /* <26> Modified */ + unsigned int spte_prot:4; /* <30:27> memory protection */ + unsigned int spte_v:1; /* <31> valid bit */ + }; + #define SCSI_VAX_ESP { \ proc_name: "esp", \ proc_info: &esp_proc_info, \ @@ -49,3 +74,4 @@ // controller id is 6 on the 3100/85 #endif /* VAX_ESP_H */ + |
From: ? <uns...@us...> - 2002-06-09 20:47:28
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/video In directory usw-pr-cvs1:/tmp/cvs-serv13047 Modified Files: Config.in fbmem.c Added Files: vmonofb.c Log Message: First attempt at a driver for the VXT2000 monochrome framebuffer --- NEW FILE --- /* * A driver for the VXT2000's monochrome framebuffer. * * 2002 Uns Lider */ /* * The VMONO is believed to be a "dumb" monochrome framebuffer supporting 1bpp * and 2bpp modes, both of which are palletized. It appears to support * modification of the video timings to some degree, and may have hardware * cursor support. * * There is apparently no documentation available for the VMONO. */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/fb.h> #include <video/fbcon.h> #include <asm/io.h> #define VMONO_FB_PHYS_ADDR 0x21000000 #define VMONO_FB_SIZE 0x80000 #define VMONO_REGS_PHYS_ADDR 0x200b0000 #define VMONO_REGS_SIZE 0x200 /* i think */ struct vmono_regs { u8 voodoo[0x50]; u8 bppthing; u8 morevoodo[0x12f]; u8 bt455_cmap_addr; u8 _padding1[3]; u8 bt455_cmap_data; u8 _padding2[3]; u8 bt455_clr; u8 _padding3[3]; u8 bt455_ovly; }; struct vmono_par { int bpp; }; struct vmono_fb_info { struct fb_info_gen gen; char *fbmem; volatile struct vmono_regs *regs; }; static struct vmono_fb_info the_fb_info; /* * */ /* par is the software's copy of the hardware state. var is the user-modifiable mode information fix is the non-user-modifiable state incurred by setting a mode */ /* par -> fix */ static int encode_fix(struct fb_fix_screeninfo *fix, const void *fb_par, struct fb_info_gen *fbinfo) { struct vmono_fb_info *info = (struct vmono_fb_info *)fbinfo; struct vmono_par *par = (struct vmono_par *)fb_par; strcpy(fix->id, info->gen.info.modename); fix->type = FB_TYPE_PACKED_PIXELS; fix->type_aux = 0; fix->visual = FB_VISUAL_PSEUDOCOLOR; fix->line_length = 1280 / 8; if(par->bpp == 2) fix->line_length *= 2; fix->smem_start = 0x21000000; fix->smem_len = fix->line_length * 1024; fix->xpanstep = fix->ypanstep = fix->ywrapstep = 0; fix->accel = FB_ACCEL_NONE; return 0; } /* var -> par */ static int decode_var(const struct fb_var_screeninfo *var, void *fb_par, struct fb_info_gen *info) { struct vmono_par *par = (struct vmono_par *)fb_par; if (var->xres_virtual != var->xres || var->yres_virtual != var->yres || var->nonstd) return -EINVAL; /* should also check vmode, etc */ if(var->xres != 1280 || var->yres != 1024) return -EINVAL; switch(var->bits_per_pixel) { case 1: case 2: par->bpp=var->bits_per_pixel; default: return -EINVAL; } return 0; } /* par -> var */ static int encode_var(struct fb_var_screeninfo *var, const void *fb_par, struct fb_info_gen *info) { struct vmono_par *par = (struct vmono_par *)fb_par; var->xres = 1280; var->yres = 1024; /* who knows what the other timing parameters are? */ var->xres_virtual = var->xres; var->yres_virtual = var->yres; var->xoffset = 0; var->yoffset = 0; var->red.offset = 0; var->green.offset = 0; var->blue.offset = 0; var->bits_per_pixel = par->bpp; var->grayscale = 1; /* uh. do we need to set red.length, green.length, blue.length? */ var->xoffset = 0; var->yoffset = 0; var->nonstd = 0; var->activate = 0; var->height = -1; var->width = -1; var->accel_flags = 0; return 0; } /* hardware -> par */ static void get_par(void *fb_par, struct fb_info_gen *info) { struct vmono_par *par = (struct vmono_par *)fb_par; /* don't know how to read from the hardware (if it can even be done) */ par->bpp = 1; } /* par -> hardware */ static void set_par(const void *fb_par, struct fb_info_gen *fbinfo) { struct vmono_fb_info *info = (struct vmono_fb_info *)fbinfo; struct vmono_par *par = (struct vmono_par *)fb_par; if(par->bpp == 1) { info->regs->bppthing = 1; } else { /* 2bpp */ info->regs->bppthing = 3; } } static int setcolreg(u_int regno, u_int red, u_int green, u_int blue, u_int transp, struct fb_info *fbinfo) { struct vmono_fb_info *info = (struct vmono_fb_info *)fbinfo; if(regno < 0 || regno > 3) return 1; info->regs->bt455_cmap_addr = regno; info->regs->bt455_cmap_data = 0; info->regs->bt455_cmap_data = green >> 12; return 0; } static int getcolreg(u_int regno, u_int *red, u_int *green, u_int *blue, u_int *transp, struct fb_info *fbinfo) { struct vmono_fb_info *info = (struct vmono_fb_info *)fbinfo; if(regno < 0 || regno > 3) return 1; info->regs->bt455_cmap_addr = regno; info->regs->bt455_cmap_data = 0; *red = 0; *green = (info->regs->bt455_cmap_data & 15) << 12; *blue = 0; return 0; } static int blank(int blank, struct fb_info_gen *info) { /* don't know how yet, so have fbgen blank with the palette */ return 1; } static void set_disp(const void *fb_par, struct display *disp, struct fb_info_gen *fbinfo) { struct vmono_fb_info *info = (struct vmono_fb_info *)fbinfo; disp->screen_base = (char *)info->fbmem; switch(fbinfo->info.var.bits_per_pixel) { #ifdef FBCON_HAS_MFB case 1: disp->dispsw = &fbcon_mfb; break; #endif #ifdef FBCON_HAS_CFB2 case 2: disp->dispsw = &fbcon_cfb2; break; #endif default: disp->dispsw = &fbcon_dummy; } disp->scrollmode = SCROLL_YREDRAW; } /* * Initialization code */ static struct fb_ops vmono_ops = { owner: THIS_MODULE, fb_open: NULL, fb_release: NULL, fb_get_fix: fbgen_get_fix, fb_get_var: fbgen_get_var, fb_set_var: fbgen_set_var, fb_get_cmap: fbgen_get_cmap, fb_set_cmap: fbgen_set_cmap, fb_pan_display: fbgen_pan_display, fb_ioctl: NULL, }; static struct fbgen_hwswitch vmono_hwswitch = { detect: NULL, encode_fix: encode_fix, decode_var: decode_var, encode_var: encode_var, get_par: get_par, set_par: set_par, getcolreg: getcolreg, setcolreg: setcolreg, pan_display: NULL, blank: blank, set_disp: set_disp }; static int __init vmonofb_probe(volatile unsigned char *vmono_fb_mem) { unsigned char a, b, c, d; a = vmono_fb_mem[0]; b = vmono_fb_mem[VMONO_FB_SIZE]; vmono_fb_mem[0] = a ^ 0xa5; c = vmono_fb_mem[0]; d = vmono_fb_mem[VMONO_FB_SIZE]; vmono_fb_mem[0] = a; if(c != (a ^ 0xa5)) { printk("vmonofb: No framebuffer seems to be installed!\n"); return 0; } if(a != b || c != d) { printk("vmonofb: This doesn't look like a VMONO. Using it anyway...\n"); } else { printk("vmonofb: Looks like a VMONO.\n"); } return 1; } static void __init vmonofb_reset(void) { /* erm.. dunno how yet */ } static void init_fb_info(struct fb_info *info) { static struct display disp; strcpy(info->modename, "VMONO"); info->node = -1; info->flags = FBINFO_FLAG_DEFAULT; info->fbops = &vmono_ops; info->disp = &disp; info->changevar = NULL; info->switch_con = fbgen_switch; info->updatevar = fbgen_update_var; info->blank = fbgen_blank; fbgen_get_var(&disp.var, -1, &the_fb_info.gen.info); disp.var.activate = FB_ACTIVATE_NOW; fbgen_do_set_var(&disp.var, 1, &the_fb_info.gen); fbgen_set_disp(-1, &the_fb_info.gen); fbgen_install_cmap(0, &the_fb_info.gen); } static int __init map_fb(struct vmono_fb_info *info) { info->fbmem = ioremap(VMONO_FB_PHYS_ADDR, VMONO_FB_SIZE * 2); if(info->fbmem == NULL) return 1; info->regs = ioremap(VMONO_REGS_PHYS_ADDR, VMONO_REGS_SIZE); if(info->regs == NULL) { iounmap(info->fbmem); return 1; } return 0; } int __init vmonofb_init(void) { if(map_fb(&the_fb_info) != 0) { printk("vmonofb: Unable to map framebuffer!\n"); return -ENODEV; } if(vmonofb_probe(the_fb_info.fbmem) == 0) return -ENODEV; vmonofb_reset(); init_fb_info(&the_fb_info.gen.info); the_fb_info.gen.fbhw = &vmono_hwswitch; if(register_framebuffer(&the_fb_info.gen.info) < 0) { printk("vmonofb: unable to register framebuffer!\n"); return -ENODEV; } printk(KERN_INFO "fb%d: %s frame buffer device\n", GET_FB_IDX(the_fb_info.gen.info.node), the_fb_info.gen.info.modename); MOD_INC_USE_COUNT; return 0; } int __init vmonofb_setup(char *options) { return 0; } Index: Config.in =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/video/Config.in,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Config.in 11 Apr 2002 13:26:51 -0000 1.2 +++ Config.in 9 Jun 2002 20:47:23 -0000 1.3 @@ -196,6 +196,9 @@ if [ "$CONFIG_NINO" = "y" ]; then bool ' TMPTX3912/PR31700 frame buffer support' CONFIG_FB_TX3912 fi + if [ "$ARCH" = "vax" -a "$CONFIG_EXPERIMENTAL" = "y" ]; then + bool ' VXT2000 monochrome framebuffer support (EXPERIMENTAL)' CONFIG_FB_VMONO + fi if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then tristate ' Virtual Frame Buffer support (ONLY FOR TESTING!)' CONFIG_FB_VIRTUAL fi @@ -399,6 +402,15 @@ if [ "$CONFIG_FB_VGA16" = "m" ]; then define_tristate CONFIG_FBCON_VGA_PLANES m fi + fi + if [ "$CONFIG_FB_VMONO" = "y" ]; then + define_tristate CONFIG_FBCON_MFB y + define_tristate CONFIG_FBCON_CFB2 y + else + if [ "$CONFIG_FB_VMONO" = "m" ]; then + define_tristate CONFIG_FBCON_MFB m + define_tristate CONFIG_FBCON_CFB2 m + fi fi if [ "$CONFIG_FB_HGA" = "y" ]; then define_tristate CONFIG_FBCON_HGA y Index: fbmem.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/video/fbmem.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- fbmem.c 11 Apr 2002 13:26:52 -0000 1.2 +++ fbmem.c 9 Jun 2002 20:47:23 -0000 1.3 @@ -126,6 +126,8 @@ extern int pvr2fb_setup(char*); extern int sstfb_init(void); extern int sstfb_setup(char*); +extern int vmonofb_init(void); +extern int vmonofb_setup(char*); static struct { const char *name; @@ -278,6 +280,9 @@ #endif #ifdef CONFIG_FB_VOODOO1 { "sst", sstfb_init, sstfb_setup }, +#endif +#ifdef CONFIG_FB_VMONO + { "vmono", vmonofb_init, vmonofb_setup }, #endif /* * Generic drivers that don't use resource management (yet) |
From: Richard B. <rb...@us...> - 2002-06-04 07:20:33
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/scsi In directory usw-pr-cvs1:/tmp/cvs-serv7347/drivers/scsi Modified Files: vax_esp.c vax_esp.h Log Message: Added extra debugging statements, fixed syntax errors and changed to use new scsi error handling. Index: vax_esp.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/scsi/vax_esp.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- vax_esp.c 15 Dec 2001 12:28:25 -0000 1.1 +++ vax_esp.c 4 Jun 2002 07:20:28 -0000 1.2 @@ -1,8 +1,8 @@ /* - * vax_esp.c: Driver for SCSI chips on VAXStation 4000/200 + * vax_esp.c: Driver for SCSI chips on VAXStation 4000/200 and uVax3100/85 * * based on dec_esp.c: - * VAX support by David Airlie + * VAX support by David Airlie & Richard Banks * * TURBOchannel changes by Harald Koerfgen * PMAZ-A support by David Airlie @@ -77,22 +77,13 @@ struct NCR_ESP *esp; struct ConfigDev *esp_dev; unsigned long scsi_base; - - //#if INTERNAL_SCSI scsi_base = 0x200c0080; - //#endif + scsi_base = 0x26000080; /* hardcode for 3100/85 for now */ esp_dev = 0; esp = esp_allocate(tpnt, (void *) esp_dev); -#if 0 - scsi_dma_ptr = (unsigned long *) (system_base + IOCTL + SCSI_DMA_P); - scsi_next_ptr = (unsigned long *) (system_base + IOCTL + SCSI_DMA_BP); - scsi_scr = (unsigned long *) (system_base + IOCTL + SCSI_SCR); - ioasic_ssr = (unsigned long *) (system_base + IOCTL + SSR); - scsi_sdr0 = (unsigned long *) (system_base + IOCTL + SCSI_SDR0); - scsi_sdr1 = (unsigned long *) (system_base + IOCTL + SCSI_SDR1); -#endif + /* Do command transfer with programmed I/O */ esp->do_pio_cmds = 1; @@ -122,8 +113,8 @@ /* virtual DMA functions */ esp->dma_mmu_get_scsi_one = &dma_mmu_get_scsi_one; esp->dma_mmu_get_scsi_sgl = &dma_mmu_get_scsi_sgl; - esp->dma_mmu_release_scsi_one = 0; - esp->dma_mmu_release_scsi_sgl = 0; + esp->dma_mmu_release_scsi_one = 0; + esp->dma_mmu_release_scsi_sgl = 0; esp->dma_advance_sg = &dma_advance_sg; @@ -138,7 +129,7 @@ esp->dregs = 0; /* ESP register base */ - esp->eregs = (struct ESP_regs *) (scsi_base); + esp->eregs = (struct ESP_regs *) ioremap (scsi_base,sizeof(struct ESP_regs)); /* Set the command buffer */ esp->esp_command = (volatile unsigned char *) cmd_buffer; @@ -156,86 +147,13 @@ // request_irq(SCSI_DMA_INT, scsi_dma_int, SA_INTERRUPT, "JUNKIO SCSI DMA", // NULL); - esp->scsi_id = 7; + esp->scsi_id = 6; /* Check for differential SCSI-bus */ esp->diff = 0; esp_initialize(esp); - } - -#if 0 - if (TURBOCHANNEL) { - while ((slot = search_tc_card("PMAZ_AA")) >= 0) { - claim_tc_card(slot); - mem_start = get_tc_base_addr(slot); - - esp_dev = 0; - esp = esp_allocate(tpnt, (void *) esp_dev); - - esp->dregs = 0; - esp->eregs = (struct ESP_regs *) (mem_start + DEC_SCSI_SREG); - esp->do_pio_cmds = 1; - - /* Set the command buffer */ - esp->esp_command = (volatile unsigned char *) pmaz_cmd_buffer; - - /* get virtual dma address for command buffer */ - esp->esp_command_dvma = (__u32) KSEG0ADDR((volatile unsigned char *) pmaz_cmd_buffer); - - buffer = (volatile unsigned char *) (mem_start + DEC_SCSI_SRAM); - - scsi_pmaz_dma_ptr_tc = (volatile int *) (mem_start + DEC_SCSI_DMAREG); - - for (i = 0; i < ESP_NCMD; i++) { - scsi_pmaz_dma_ptrs_tc[i] = (volatile unsigned char *) (buffer + ESP_TGT_DMA_SIZE * i); - } - - scsi_pmaz_dma_buff_used[0] = 1; - - esp->cfreq = get_tc_speed(); - - esp->irq = get_tc_irq_nr(slot); - - /* Required functions */ - esp->dma_bytes_sent = &dma_bytes_sent; - esp->dma_can_transfer = &dma_can_transfer; - esp->dma_dump_state = &dma_dump_state; - esp->dma_init_read = &pmaz_dma_init_read; - esp->dma_init_write = &pmaz_dma_init_write; - esp->dma_ints_off = &pmaz_dma_ints_off; - esp->dma_ints_on = &pmaz_dma_ints_on; - esp->dma_irq_p = &dma_irq_p; - esp->dma_ports_p = &dma_ports_p; - esp->dma_setup = &pmaz_dma_setup; - - /* Optional functions */ - esp->dma_barrier = 0; - esp->dma_drain = &pmaz_dma_drain; - esp->dma_invalidate = 0; - esp->dma_irq_entry = 0; - esp->dma_irq_exit = 0; - esp->dma_poll = 0; - esp->dma_reset = 0; - esp->dma_led_off = 0; - esp->dma_led_on = 0; - - esp->dma_mmu_get_scsi_one = pmaz_dma_mmu_get_scsi_one; - esp->dma_mmu_get_scsi_sgl = 0; - esp->dma_mmu_release_scsi_one = 0; - esp->dma_mmu_release_scsi_sgl = 0; - esp->dma_advance_sg = 0; - - request_irq(esp->irq, esp_intr, SA_INTERRUPT, "PMAZ_AA", NULL); - esp->scsi_id = 7; - esp->diff = 0; - esp_initialize(esp); - } -#endif - } - - if(nesps) { printk("ESP: Total of %d ESP hosts found, %d actually in use.\n", nesps, esps_in_use); esps_running = esps_in_use; @@ -249,6 +167,8 @@ { extern volatile unsigned int *isr; unsigned int dummy; + + printk ("dma_int called\n"); #if 0 if (*isr & SCSI_PTR_LOADED) { /* next page */ @@ -277,6 +197,7 @@ static int dma_bytes_sent(struct NCR_ESP *esp, int fifo_count) { + printk ("dma_bytes_sent called\n"); return fifo_count; } @@ -284,11 +205,12 @@ { unsigned long nw = *scsi_scr; // unsigned short *p = KSEG1ADDR((unsigned short *) ((*scsi_dma_ptr) >> 3)); + printk ("dma_drain called\n"); /* * Is there something in the dma buffers left? */ - if (nw) { + /* if (nw) { switch (nw) { case 1: *p = (unsigned short) *scsi_sdr0; @@ -306,16 +228,19 @@ printk("Strange: %d words in dma buffer left\n", (int) nw); break; } - } + } */ } static int dma_can_transfer(struct NCR_ESP *esp, Scsi_Cmnd * sp) { + printk ("dma_can_transfer called\n"); return sp->SCp.this_residual;; } static void dma_dump_state(struct NCR_ESP *esp) { + printk ("dma_dump_state called\n"); + /* ESPLOG(("esp%d: dma -- enable <%08x> residue <%08x\n", esp->esp_id, vdma_get_enable((int)esp->dregs), vdma_get_resdiue((int)esp->dregs))); @@ -327,6 +252,8 @@ extern volatile unsigned int *isr; unsigned int dummy; + printk ("dma_init_read called\n"); + #if 0 if (vaddress & 3) panic("dec_efs.c: unable to handle partial word transfers, yet..."); @@ -351,6 +278,8 @@ static void dma_init_write(struct NCR_ESP *esp, __u32 vaddress, int length) { + printk ("dma_init_write called\n"); + #if 0 extern volatile unsigned int *isr; unsigned int dummy; @@ -378,16 +307,19 @@ static void dma_ints_off(struct NCR_ESP *esp) { + printk ("dma_ints_off called\n"); // disable_irq(SCSI_DMA_INT); } static void dma_ints_on(struct NCR_ESP *esp) { + printk ("dma_ints_on called\n"); // enable_irq(SCSI_DMA_INT); } static int dma_irq_p(struct NCR_ESP *esp) { + printk ("dma_irq_p called\n"); return (esp->eregs->esp_status & ESP_STAT_INTR); } @@ -396,6 +328,7 @@ /* * FIXME: what's this good for? */ + printk ("dma_ports_p called\n"); return 1; } @@ -405,6 +338,7 @@ * On the Sparc, DMA_ST_WRITE means "move data from device to memory" * so when (write) is true, it actually means READ! */ + printk ("dma_setup called\n"); #if 0 if (write) { dma_init_read(esp, addr, count); @@ -419,7 +353,7 @@ */ static void dma_mmu_get_scsi_one(struct NCR_ESP *esp, Scsi_Cmnd * sp) { - sp->SCp.have_data_in = PHYSADDR(sp->SCp.buffer); + sp->SCp.have_data_in = virt_to_phys(sp->SCp.buffer); sp->SCp.ptr = (char *) ((unsigned long) sp->SCp.have_data_in); } @@ -427,18 +361,22 @@ { int sz = sp->SCp.buffers_residual; struct mmu_sglist *sg = (struct mmu_sglist *) sp->SCp.buffer; + printk ("dma_mmu_get_scsi_sgl called\n"); + /* #if 0 while (sz >= 0) { - sg[sz].dvma_addr = PHYSADDR(sg[sz].addr); + sg[sz].dvma_addr = virt_to_phys(sg[sz].addr); sz--; } - sp->SCp.ptr = (char *) ((unsigned long) sp->SCp.buffer->dvma_address); + sp->SCp.ptr = (char *) ((unsigned long) sp->SCp.buffer->dvma_addr); #endif + */ } static void dma_advance_sg(Scsi_Cmnd * sp) { - sp->SCp.ptr = (char *) ((unsigned long) sp->SCp.buffer->dvma_address); + printk ("dma_adavnce_sg called\n"); + // sp->SCp.ptr = (char *) ((unsigned long) sp->SCp.buffer->dvma_addr); } #if 0 @@ -504,3 +442,8 @@ } #endif + + +static Scsi_Host_Template driver_template = SCSI_VAX_ESP; + +#include "scsi_module.c" Index: vax_esp.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/scsi/vax_esp.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- vax_esp.h 15 Dec 2001 12:28:25 -0000 1.1 +++ vax_esp.h 4 Jun 2002 07:20:28 -0000 1.2 @@ -40,9 +40,12 @@ abort: esp_abort, \ reset: esp_reset, \ can_queue: 7, \ - this_id: 7, \ + this_id: 6, \ sg_tablesize: SG_ALL, \ cmd_per_lun: 1, \ + use_new_eh_code: 1, \ use_clustering: DISABLE_CLUSTERING, } + +// controller id is 6 on the 3100/85 #endif /* VAX_ESP_H */ |
From: ? <uns...@us...> - 2002-06-03 02:52:46
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/char In directory usw-pr-cvs1:/tmp/cvs-serv30315 Modified Files: sc26c94.c Log Message: Disable a debugging printk Index: sc26c94.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/sc26c94.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- sc26c94.c 3 Jun 2002 02:49:49 -0000 1.3 +++ sc26c94.c 3 Jun 2002 02:52:42 -0000 1.4 @@ -435,7 +435,7 @@ struct sc26c94 *quart = data; u8 cir, size, chan; -#if 1 +#if 0 printk("%%"); #endif |
From: ? <uns...@us...> - 2002-06-03 02:49:52
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/char In directory usw-pr-cvs1:/tmp/cvs-serv29792 Modified Files: sc26c94.c Log Message: Enable Rx interrupts upon device open Index: sc26c94.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/sc26c94.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- sc26c94.c 3 Jun 2002 01:50:14 -0000 1.2 +++ sc26c94.c 3 Jun 2002 02:49:49 -0000 1.3 @@ -654,6 +654,8 @@ chan->gs.session = current->session; chan->gs.pgrp = current->pgrp; + enable_rx_ints(chan); + return 0; } |
From: ? <uns...@us...> - 2002-06-03 02:43:48
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/net In directory usw-pr-cvs1:/tmp/cvs-serv28816/drivers/net Modified Files: vaxsgec.c Log Message: Kludge to share interrupts between VXT serial and network devices Index: vaxsgec.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/net/vaxsgec.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- vaxsgec.c 31 May 2002 03:50:57 -0000 1.13 +++ vaxsgec.c 3 Jun 2002 02:43:45 -0000 1.14 @@ -602,6 +602,10 @@ if (csr5 & SG_NICSR5_TI) sgec_tx(dev); } +#ifdef CONFIG_VXT2694 +extern void (*net_inthandler_func)(int vector, void *data, struct pt_regs *fp); +extern void *net_inthandler_data; +#endif static int sgec_open(struct net_device *dev) { @@ -614,10 +618,15 @@ #endif /* Associate IRQ with sgec_interrupt */ +#ifndef CONFIG_VXT2694 if (request_irq(dev->irq, &sgec_interrupt, 0, lp->name, dev)) { printk("SGEC: Can't get irq %d\n", dev->irq); return -EAGAIN; } +#else + net_inthandler_data = dev; + net_inthandler_func = sgec_interrupt; +#endif /* this is just a hack for now */ #ifdef CONFIG_VSBUS |
From: ? <uns...@us...> - 2002-06-03 02:43:48
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/char In directory usw-pr-cvs1:/tmp/cvs-serv28816/drivers/char Modified Files: vxt2694.c Log Message: Kludge to share interrupts between VXT serial and network devices Index: vxt2694.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/vxt2694.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- vxt2694.c 3 Jun 2002 02:05:21 -0000 1.2 +++ vxt2694.c 3 Jun 2002 02:43:45 -0000 1.3 @@ -161,6 +161,23 @@ } /* + * kludge for interrupt sharing with vaxsgec + */ + +void (*net_inthandler_func)(int vector, void *data, struct pt_regs *fp) = NULL; +void *net_inthandler_data; + +static void vxtserial_interrupt(int vector, void *data, struct pt_regs *fp) +{ + sc29c94_interrupt(vector, data, fp); + if(net_inthandler_func != NULL) { + net_inthandler_func(vector, net_inthandler_data, fp); + } else { + printk("@"); + } +} + +/* * initialization code */ @@ -203,7 +220,7 @@ writereg(&the_quart, SC26C94_REG_IVR, 0x42); irq = 0x42; if(irq!=0) { - request_irq(irq, sc29c94_interrupt, SA_INTERRUPT, "sc29c94", &the_quart); + request_irq(irq, vxtserial_interrupt, SA_INTERRUPT, "sc29c94", &the_quart); } #if 0 |
From: ? <uns...@us...> - 2002-06-03 02:33:11
|
Update of /cvsroot/linux-vax/kernel-2.4/include/linux In directory usw-pr-cvs1:/tmp/cvs-serv25895/include/linux Modified Files: tty.h Log Message: Replace occurrences of "vxt2694" with "vxtserial" Index: tty.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/include/linux/tty.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- tty.h 29 May 2002 03:37:40 -0000 1.3 +++ tty.h 3 Jun 2002 02:33:07 -0000 1.4 @@ -367,7 +367,7 @@ extern int espserial_init(void); extern int macserial_init(void); extern int a2232board_init(void); -extern int vxt2694_init(void); +extern int vxtserial_init(void); extern int tty_paranoia_check(struct tty_struct *tty, kdev_t device, const char *routine); |
From: ? <uns...@us...> - 2002-06-03 02:33:11
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/char In directory usw-pr-cvs1:/tmp/cvs-serv25895/drivers/char Modified Files: tty_io.c Log Message: Replace occurrences of "vxt2694" with "vxtserial" Index: tty_io.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/tty_io.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- tty_io.c 29 May 2002 03:37:39 -0000 1.6 +++ tty_io.c 3 Jun 2002 02:33:07 -0000 1.7 @@ -2379,6 +2379,6 @@ a2232board_init(); #endif #ifdef CONFIG_VXT2694 - vxt2694_init(); + vxtserial_init(); #endif } |
From: ? <uns...@us...> - 2002-06-03 02:05:24
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/char In directory usw-pr-cvs1:/tmp/cvs-serv21997 Modified Files: vxt2694.c Log Message: Replace occurrences of "vxt2694" with "vxtserial" Index: vxt2694.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/vxt2694.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- vxt2694.c 29 May 2002 03:37:39 -0000 1.1 +++ vxt2694.c 3 Jun 2002 02:05:21 -0000 1.2 @@ -31,20 +31,20 @@ #include "sc26c94.h" -#define VXT2694_PHYS_ADDR 0x200A0000 +#define VXT_SERIAL_PHYS_ADDR 0x200A0000 -volatile int *vxt2694_addr = NULL; +volatile int *vxt_serial = NULL; /* * callbacks for sc26c94.c */ static u8 readreg(struct sc26c94 *quart, int reg) { - return vxt2694_addr[reg]; + return vxt_serial[reg]; } static void writereg(struct sc26c94 *quart, int reg, u8 value) { - vxt2694_addr[reg]=value; + vxt_serial[reg]=value; } static void set_handshake(struct sc26c94 *quart, int channel, int ready) { @@ -155,7 +155,7 @@ NULL }; -static int vxt2694_open(struct tty_struct *tty, struct file *filp) +static int vxtserial_open(struct tty_struct *tty, struct file *filp) { return sc26c94_open(&the_quart, tty, filp); } @@ -167,17 +167,17 @@ struct tty_driver tty_driver; struct tty_driver callout_driver; -int vxt2694_init() +int vxtserial_init() { int irq; int error; #if 0 - printk("vxt2694_init\n"); + printk("vxtserial_init\n"); mdelay(1000); /* let TxFIFO drain before messing with UART */ #endif - if(vxt2694_addr == NULL) - vxt2694_addr = ioremap(VXT2694_PHYS_ADDR, 256); + if(vxt_serial == NULL) + vxt_serial = ioremap(VXT_SERIAL_PHYS_ADDR, 256); sc26c94_init_chip(&the_quart); @@ -211,7 +211,7 @@ #endif sc26c94_init_drivers(&tty_driver, &callout_driver); - tty_driver.open = vxt2694_open; + tty_driver.open = vxtserial_open; #if 1 if ((error = tty_register_driver(&tty_driver))) { printk(KERN_ERR "Couldn't register sc29c94 driver, error = %d\n", error); @@ -263,15 +263,15 @@ static int __init vxt_console_setup(struct console *co, char *options) { #if 0 - vxt2694_init(); + vxtserial_init(); co->cflag = CREAD | HUPCL | CLOCAL | B9600 | CS8; writereg(&the_quart, SC26C94_REG_CRa, SC26C94_CR_TX_ON); writereg(&the_quart, SC26C94_REG_CRa, SC26C94_CR_RX_ON); #endif /* this is called really early in kernel initialization, so we can't do - a full vxt2694_init. but that's ok because all we'll be calling is + a full vxtserial_init. but that's ok because all we'll be calling is the _immediate_putc and _immediate_getc */ - vxt2694_addr = ioremap(VXT2694_PHYS_ADDR, 256); + vxt_serial = ioremap(VXT_SERIAL_PHYS_ADDR, 256); return 0; } |
From: ? <uns...@us...> - 2002-06-03 01:50:17
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/char In directory usw-pr-cvs1:/tmp/cvs-serv18720 Modified Files: sc26c94.c Log Message: sc26c94 fixes: Calculate channel number properly in open, re-enable Tx/Rx after reset. Index: sc26c94.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/sc26c94.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- sc26c94.c 29 May 2002 03:37:39 -0000 1.1 +++ sc26c94.c 3 Jun 2002 01:50:14 -0000 1.2 @@ -614,7 +614,7 @@ struct sc26c94_chan *chan; int retval, line; - line = MINOR(tty->device); + line = MINOR(tty->device) - 64; if(line < 0 || line >= 4) return -ENODEV; chan = &(quart->chans[line]); @@ -804,6 +804,7 @@ sc26c94_write_mr(quart, i, 1, 0); sc26c94_write_mr(quart, i, 2, 0); quart->writereg(quart, SC26C94_REGCHAN(SC26C94_REG_BCR, i), 0); + quart->writereg(quart, SC26C94_REGCHAN(SC26C94_REG_CR, i), SC26C94_CR_TX_ON | SC26C94_CR_RX_ON); } /* On the VXT, the counter/timers must be stopped AFTER we have done any |
From: ? <uns...@us...> - 2002-06-03 01:13:03
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/char In directory usw-pr-cvs1:/tmp/cvs-serv12544 Modified Files: sc26c94.h Log Message: Move gs_port to the top of sc26c94_chan. Otherwise generic_serial will crash, because it wants to cast a sc26c94_chan * to a gs_port *. Index: sc26c94.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/char/sc26c94.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- sc26c94.h 29 May 2002 03:37:39 -0000 1.1 +++ sc26c94.h 3 Jun 2002 01:12:59 -0000 1.2 @@ -203,9 +203,9 @@ */ struct sc26c94_chan { + struct gs_port gs; /* MUST come first */ struct sc26c94 *quart; int channel; - struct gs_port gs; char xchar; }; |
From: ? <uns...@us...> - 2002-05-31 19:47:48
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/net In directory usw-pr-cvs1:/tmp/cvs-serv18105 Modified Files: vaxsgec.h Log Message: Oops. RX_RING_MASK should be set to RX_RING_SIZE-1, not TX_RING_SIZE-1. This should fix a problem where it would receive the first 'n' packets OK and then go deaf. Index: vaxsgec.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/net/vaxsgec.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- vaxsgec.h 31 May 2002 03:50:57 -0000 1.5 +++ vaxsgec.h 31 May 2002 19:47:42 -0000 1.6 @@ -194,7 +194,7 @@ #define TX_RING_SIZE 64 #define TX_RING_MASK (TX_RING_SIZE - 1) #define RX_RING_SIZE 32 -#define RX_RING_MASK (TX_RING_SIZE - 1) +#define RX_RING_MASK (RX_RING_SIZE - 1) #define PKT_BUF_SZ 1536 #define RX_BUFF_SIZE PKT_BUF_SZ |
From: Richard B. <rb...@us...> - 2002-05-31 03:51:01
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/net In directory usw-pr-cvs1:/tmp/cvs-serv19042/drivers/net Modified Files: vaxsgec.c vaxsgec.h Log Message: First working version of SGEC driver. Sends and receives packets properly. Index: vaxsgec.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/net/vaxsgec.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- vaxsgec.c 31 May 2002 01:26:01 -0000 1.12 +++ vaxsgec.c 31 May 2002 03:50:57 -0000 1.13 @@ -29,9 +29,9 @@ #include <asm/mv.h> /* use #undef to turn these off */ -#define VAX_SGEC_DEBUG -#define VAX_SGEC_DEBUG_LVL2 -#define VAX_SGEC_DEBUG_BUFFERS +#undef VAX_SGEC_DEBUG +#undef VAX_SGEC_DEBUG_LVL2 +#undef VAX_SGEC_DEBUG_BUFFERS #define VAX_SGEC_AUTOPROBE_IRQ @@ -139,8 +139,10 @@ if ((regs->sg_nicsr5 & SG_NICSR5_TS) != SG_NICSR5_TS_RUN) { #ifdef VAX_SGEC_DEBUG + printk("writing to csr3: lp->rx_new = %d\n",lp->rx_new); printk("writing to csr4: lp->tx_old = %d\n",lp->tx_old); #endif + writereg(®s->sg_nicsr3,virt_to_phys(& lp->rx_ring [lp->rx_new])); writereg(®s->sg_nicsr4,virt_to_phys(& lp->tx_ring [lp->tx_old])); writereg(®s->sg_nicsr1,SG_NICSR1_TXPD); #ifdef VAX_SGEC_DEBUG @@ -380,6 +382,12 @@ #ifdef VAX_SGEC_DEBUG printk("sgec_rx\n"); + printk("%d (rx_flags0=0x%04x, framelen=0x%04x, flags1=0x%04x)\n", + lp->rx_new, + lp->rx_ring [lp->rx_new].flags0, + lp->rx_ring [lp->rx_new].framelen, + lp->rx_ring [lp->rx_new].flags1); + #endif #ifdef VAX_SGEC_DEBUG_BUFFERS @@ -501,7 +509,7 @@ while (! (lp->tx_ring [lp->tx_old].tx_err & SG_TDR_OWN)) { - if (lp->tx_old == lp->tx_new) + if (lp->tx_old == lp->tx_new) { #ifdef VAX_SGEC_DEBUG printk (" old == new\n"); @@ -580,7 +588,7 @@ #endif return; } - writereg(&sg_regs->sg_nicsr5, csr5); /* clear interrupt */ + writereg(&sg_regs->sg_nicsr5, csr5); /* clear interrupts */ #ifdef VAX_SGEC_DEBUG printk("for us!\n"); Index: vaxsgec.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/net/vaxsgec.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- vaxsgec.h 28 May 2002 18:41:37 -0000 1.4 +++ vaxsgec.h 31 May 2002 03:50:57 -0000 1.5 @@ -105,6 +105,7 @@ /* NICSR14: diagnostic breakpoint (v) */ /* NICSR15: monitor command */ +#define SG_NICSR15_INT 0x00010000 /* sets internal level 14 interrupt */ /* Receive descriptor bits */ #define SG_FR_OWN 0x8000 /* We own the descriptor */ @@ -167,7 +168,7 @@ #define VSBUS_NISA_ROM 0x27800000 /* 3100/90 (?) */ #define VXT_NISA_ROM 0x200c4000 /* VXT2000 */ /* The interrupt vector. */ -#define SGECVEC 0x41 /* 3100/85 */ +#define SGECVEC 0x41 /* was 0x41 3100/85 */ #define OTHER_SGECVEC 0x108 /* 4000/60 (?) */ /* register offsets */ |
From: Richard B. <rb...@us...> - 2002-05-31 01:26:05
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/net In directory usw-pr-cvs1:/tmp/cvs-serv28981/drivers/net Modified Files: vaxsgec.c Log Message: Added code to reset csr0 after resetting csr6. Also populate csr0 interupt value correctly. Card is now tramsitting packets. Index: vaxsgec.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/net/vaxsgec.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- vaxsgec.c 30 May 2002 23:26:46 -0000 1.11 +++ vaxsgec.c 31 May 2002 01:26:01 -0000 1.12 @@ -150,6 +150,47 @@ } } +void reset_csr0(struct net_device *dev) +{ + int i; + unsigned long v; + volatile struct sgec_private *lp = (volatile struct sgec_private *)dev->priv; + volatile struct sgec_regs *regs = lp->regs; + +#ifdef VAX_SGEC_DEBUG + printk("writing csr0 interrupt as 0x%x\n",dev->irq); +#endif + /* + * IRQ setup + */ + v = SG_NICSR0_IPL14 | (dev->irq << 2) | SG_NICSR0_MBO; + i = 10; + do + { + if (i-- == 0) + { + printk ("Failing setting CSR0 (0x%08lx)!\n", + regs->sg_nicsr0); + /* further ignore error here XXX CP */ + } + writereg (& regs->sg_nicsr0, v); + } while (v != regs->sg_nicsr0); + if (i <= 0) + { + printk ("SGEC: CSR0 IRQ setup FAILED !\n"); + return -1; + } + + /* check for parity error and clear flags */ + if (regs->sg_nicsr5 & 0x7f) { + printk("reset_csr0 - csr5 value 0x%x\n",regs->sg_nicsr5); + writereg(®s->sg_nicsr5,regs->sg_nicsr5 & 0x7e); + } +#ifdef VAX_SGEC_DEBUG + printk("csr0 is now 0x%x\n",regs->sg_nicsr0); +#endif +} + static int reset_sgec (struct net_device *dev) { struct sgec_private *lp = (struct sgec_private *) dev->priv; @@ -189,41 +230,12 @@ return -1; } -#ifdef VAX_SGEC_DEBUG - printk("writing csr0 interrupt as 0x%x\n",dev->irq); -#endif - /* - * IRQ setup - */ - v = SG_NICSR0_IPL14 | dev->irq | SG_NICSR0_MBO; - i = 10; - do - { - if (i-- == 0) - { - printk ("Failing setting CSR0 (0x%08lx)!\n", - regs->sg_nicsr0); - /* further ignore error here XXX CP */ - } - writereg (& regs->sg_nicsr0, v); - } while (v != regs->sg_nicsr0); - if (i <= 0) - { - printk ("SGEC: CSR0 IRQ setup FAILED !\n"); - return -1; - } - - /* check for error and clear flags */ - if (regs->sg_nicsr5 & 0x7f) { - printk("init - csr5 value 0x%x\n",regs->sg_nicsr5); - writereg(®s->sg_nicsr5,regs->sg_nicsr5 & 0x7e); - } + reset_csr0(dev); writereg(®s->sg_nicsr3, virt_to_phys(& lp->rx_ring [0])); writereg(®s->sg_nicsr4, virt_to_phys(& lp->tx_ring [0])); #ifdef VAX_SGEC_DEBUG - printk ("csr0 interrupt is 0x%x\n",regs->sg_nicsr0 & SG_NICSR0_IV_MASK); printk ("%s: done well\n", __FUNCTION__); #endif @@ -248,6 +260,7 @@ printk("after csr6 stop receiving\n"); printk ("csr0 = 0x%x\n",lp->regs->sg_nicsr0); #endif + reset_csr0(dev); /* generate fix CSR6 part */ csr6 = SG_NICSR6_MBO | SG_NICSR6_IE | SG_NICSR6_BL_8 | SG_NICSR6_ST | SG_NICSR6_SR | SG_NICSR6_DC; @@ -977,35 +990,7 @@ } #endif /* VAX_SGEC_AUTOPROBE_IRQ */ -#ifdef VAX_SGEC_DEBUG - printk("writing csr0 interrupt as 0x%x\n",dev->irq); -#endif - /* - * IRQ setup - */ - v = SG_NICSR0_IPL14 | dev->irq | SG_NICSR0_MBO; - i = 10; - do - { - if (i-- == 0) - { - printk ("Failing setting CSR0 (0x%08lx)!\n", - regs->sg_nicsr0); - /* further ignore error here XXX CP */ - } - writereg (& regs->sg_nicsr0, v); - } while (v != regs->sg_nicsr0); - if (i <= 0) - { - printk ("SGEC: CSR0 IRQ setup FAILED !\n"); - return -1; - } - - /* check for error and clear flags */ - if (regs->sg_nicsr5 & 0x7f) { - printk("init - csr5 value 0x%x\n",regs->sg_nicsr5); - writereg(®s->sg_nicsr5,regs->sg_nicsr5 & 0x7e); - } + reset_csr0(dev); ether_setup(dev); |
From: Richard B. <rb...@us...> - 2002-05-30 23:26:51
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/net In directory usw-pr-cvs1:/tmp/cvs-serv13142 Modified Files: vaxsgec.c Log Message: Add extra debug output, extra reset of csr0 and moved setup_csr6 Index: vaxsgec.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/net/vaxsgec.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- vaxsgec.c 30 May 2002 01:20:24 -0000 1.10 +++ vaxsgec.c 30 May 2002 23:26:46 -0000 1.11 @@ -30,7 +30,7 @@ /* use #undef to turn these off */ #define VAX_SGEC_DEBUG -#undef VAX_SGEC_DEBUG_LVL2 +#define VAX_SGEC_DEBUG_LVL2 #define VAX_SGEC_DEBUG_BUFFERS #define VAX_SGEC_AUTOPROBE_IRQ @@ -130,10 +130,18 @@ static void kick_sgec(volatile struct sgec_private * lp) { volatile struct sgec_regs *regs = lp->regs; +#ifdef VAX_SGEC_DEBUG + printk("Kick sgec: Current CSR5 value 0x%x\n",regs->sg_nicsr5); + printk("Kick sgec: csr0 value 0x%x\n",regs->sg_nicsr0); +#endif + if ((regs->sg_nicsr5 & SG_NICSR5_TS) != SG_NICSR5_TS_RUN) { - writereg(®s->sg_nicsr4, virt_to_phys(& lp->tx_ring [lp->tx_old]) & 0xffffff); +#ifdef VAX_SGEC_DEBUG + printk("writing to csr4: lp->tx_old = %d\n",lp->tx_old); +#endif + writereg(®s->sg_nicsr4,virt_to_phys(& lp->tx_ring [lp->tx_old])); writereg(®s->sg_nicsr1,SG_NICSR1_TXPD); #ifdef VAX_SGEC_DEBUG printk ("%s: retrigger CSR1 (CSR5 is %ld)\n", @@ -182,13 +190,12 @@ } #ifdef VAX_SGEC_DEBUG - printk("SGEC restarted\n"); + printk("writing csr0 interrupt as 0x%x\n",dev->irq); #endif /* * IRQ setup */ - v = SG_NICSR0_IPL14 | - (dev->irq & SG_NICSR0_IV_MASK) | SG_NICSR0_MBO; + v = SG_NICSR0_IPL14 | dev->irq | SG_NICSR0_MBO; i = 10; do { @@ -200,18 +207,23 @@ } writereg (& regs->sg_nicsr0, v); } while (v != regs->sg_nicsr0); - if (i == 0) + if (i <= 0) { printk ("SGEC: CSR0 IRQ setup FAILED !\n"); return -1; } - writereg(®s->sg_nicsr3, - virt_to_phys(& lp->rx_ring [0]) & 0xffffff); - writereg(®s->sg_nicsr4, - virt_to_phys(& lp->tx_ring [0]) & 0xffffff); + /* check for error and clear flags */ + if (regs->sg_nicsr5 & 0x7f) { + printk("init - csr5 value 0x%x\n",regs->sg_nicsr5); + writereg(®s->sg_nicsr5,regs->sg_nicsr5 & 0x7e); + } + + writereg(®s->sg_nicsr3, virt_to_phys(& lp->rx_ring [0])); + writereg(®s->sg_nicsr4, virt_to_phys(& lp->tx_ring [0])); #ifdef VAX_SGEC_DEBUG + printk ("csr0 interrupt is 0x%x\n",regs->sg_nicsr0 & SG_NICSR0_IV_MASK); printk ("%s: done well\n", __FUNCTION__); #endif @@ -226,11 +238,16 @@ #ifdef VAX_SGEC_DEBUG printk ("%s: entry\n", __FUNCTION__); + printk ("csr0 = 0x%x\n",lp->regs->sg_nicsr0); #endif /* for changes of the SG_NICSR6_AF_xxx stop RX */ writecsr6(regs, regs->sg_nicsr6 & ~SG_NICSR6_SR); udelay (20); +#ifdef VAX_SGEC_DEBUG + printk("after csr6 stop receiving\n"); + printk ("csr0 = 0x%x\n",lp->regs->sg_nicsr0); +#endif /* generate fix CSR6 part */ csr6 = SG_NICSR6_MBO | SG_NICSR6_IE | SG_NICSR6_BL_8 | SG_NICSR6_ST | SG_NICSR6_SR | SG_NICSR6_DC; @@ -239,9 +256,17 @@ if (dev->flags & IFF_PROMISC) csr6 |= SG_NICSR6_AF_PROM; +#ifdef VAX_SGEC_DEBUG + printk("now writing csr6\n"); + printk ("csr0 = 0x%x\n",lp->regs->sg_nicsr0); +#endif /* update CSR6 */ writecsr6(regs, csr6); +#ifdef VAX_SGEC_DEBUG + printk ("csr0 = 0x%x\n",lp->regs->sg_nicsr0); +#endif + return 0; } @@ -254,6 +279,7 @@ #ifdef VAX_SGEC_DEBUG printk ("\n\n< SETUP >\n%s: entry\n", __FUNCTION__); + printk ("csr0 = 0x%x\n",lp->regs->sg_nicsr0); #endif spin_lock_irqsave (&lp->lock, flags); @@ -267,7 +293,7 @@ return 1; } - /* create setup buffer */ + /* create setup frame - using perfect filtering */ memset (buf_setup, 0xffu, sizeof (buf_setup)); memcpy (buf_setup, dev->dev_addr, 6); @@ -278,7 +304,7 @@ cp_to_buf ((char *) lp->card_mem->tx_buf[entry], buf_setup, sizeof (buf_setup)); lp->tx_ring[entry].bufsize = sizeof (buf_setup); - lp->tx_ring[entry].flags1 = SG_TD1_DT_SETUP /* | SG_TD1_IC */; + lp->tx_ring[entry].flags1 = SG_TD1_DT_SETUP /*| SG_TD1_IC*/; #ifdef VAX_SGEC_DEBUG_BUFFERS { @@ -315,12 +341,19 @@ /* Now pass frame to transmitter */ lp->tx_ring[entry].tx_err = SG_TDR_OWN; + setup_csr6(dev); /* Kick the SGEC: transmit now */ + kick_sgec (lp); - + spin_unlock_irqrestore (&lp->lock, flags); dev->trans_start = jiffies; + +#ifdef VAX_SGEC_DEBUG + printk("leaving setup_sgec\n"); +#endif + return 0; } @@ -391,14 +424,14 @@ len); skb->protocol = eth_type_trans(skb,dev); #ifdef VAX_SGEC_DEBUG_LVL2 - printk (" passing up to linux\n", __FUNCTION__); + printk ("%s passing up to linux\n", __FUNCTION__); #endif netif_rx(skb); dev->last_rx=jiffies; lp->stats.rx_packets++; } #ifdef VAX_SGEC_DEBUG_LVL2 - printk (" freeing rx frame\n", __FUNCTION__); + printk ("%s freeing rx frame\n", __FUNCTION__); #endif rd->framelen = SG_FR_OWN; lp->rx_new = (lp->rx_new + 1) & RX_RING_MASK; @@ -583,7 +616,7 @@ status = reset_sgec (dev); - setup_csr6 (dev); + // setup_csr6 (dev); //csr6 should be setup after setup packet loaded setup_sgec (dev); /* put packet in queue */ @@ -634,7 +667,7 @@ sgec_init_ring(dev); reset_sgec (dev); - setup_csr6 (dev); + //setup_csr6 (dev); setup_sgec (dev); @@ -796,8 +829,9 @@ */ #endif + // sgec_load_multicast(dev); /* no reset csr6 with the new flag dependent stuff ! */ - setup_csr6 (dev); + // setup_csr6 (dev); setup_sgec (dev); netif_wake_queue(dev); @@ -834,8 +868,9 @@ static unsigned version_printed = 0; struct sgec_private *lp; volatile struct sgec_regs *regs; - int ret; unsigned long sgec_phys_addr=SGECADDR; + unsigned long v; + int i; if (version_printed++ == 0) printk(version); @@ -899,7 +934,7 @@ dev->dev_addr[0],dev->dev_addr[1],dev->dev_addr[2], dev->dev_addr[3],dev->dev_addr[4],dev->dev_addr[5]); - sgec_stop(regs); + // sgec_stop(regs); dev->irq = 0; @@ -917,7 +952,7 @@ vsbus_probe_irq_on(); #endif /* CONFIG_VSBUS */ #endif /* VAX_SGEC_AUTOPROBE_IRQ */ - + /* should do something here to cause an interrupt */ #ifdef VAX_SGEC_AUTOPROBE_IRQ @@ -942,6 +977,36 @@ } #endif /* VAX_SGEC_AUTOPROBE_IRQ */ +#ifdef VAX_SGEC_DEBUG + printk("writing csr0 interrupt as 0x%x\n",dev->irq); +#endif + /* + * IRQ setup + */ + v = SG_NICSR0_IPL14 | dev->irq | SG_NICSR0_MBO; + i = 10; + do + { + if (i-- == 0) + { + printk ("Failing setting CSR0 (0x%08lx)!\n", + regs->sg_nicsr0); + /* further ignore error here XXX CP */ + } + writereg (& regs->sg_nicsr0, v); + } while (v != regs->sg_nicsr0); + if (i <= 0) + { + printk ("SGEC: CSR0 IRQ setup FAILED !\n"); + return -1; + } + + /* check for error and clear flags */ + if (regs->sg_nicsr5 & 0x7f) { + printk("init - csr5 value 0x%x\n",regs->sg_nicsr5); + writereg(®s->sg_nicsr5,regs->sg_nicsr5 & 0x7e); + } + ether_setup(dev); #ifdef MODULE @@ -955,10 +1020,6 @@ return 0; -err_out: - unregister_netdev(dev); - kfree(dev); - return ret; } |