* vmeUniverse/vmeTsi148.c, vmeUniverse/vmeTsi148.h,

vmeUniverse/vmeUniverse.c, vmeUniverse/vmeUniverse.h,
    vmeUniverse/vme_amd_defs.h: No longer enable posted-writes
    on master windows (creates race-condition on memory-mapped
    devices). A new flag allows for signalling that a window
    maps 'ordinary memory'. Disable VME IRQ level if no
    handler is registered with interrupting vector.
This commit is contained in:
Till Straumann
2006-01-12 00:15:16 +00:00
parent c2fc65bd57
commit 85c005f330
5 changed files with 81 additions and 20 deletions

View File

@@ -1,3 +1,12 @@
2006-01-11 Till Straumann <strauman@slac.stanford.edu>
* vmeUniverse/vmeTsi148.c, vmeUniverse/vmeTsi148.h,
vmeUniverse/vmeUniverse.c, vmeUniverse/vmeUniverse.h,
vmeUniverse/vme_amd_defs.h: No longer enable posted-writes
on master windows (creates race-condition on memory-mapped
devices). A new flag allows for signalling that a window
maps 'ordinary memory'. Disable VME IRQ level if no
handler is registered with interrupting vector.
2006-01-11 Till Straumann <strauman@slac.stanford.edu> 2006-01-11 Till Straumann <strauman@slac.stanford.edu>
* vmeUniverse/vmeTsi148.c, vmeUniverse/vmeTsi148.h: * vmeUniverse/vmeTsi148.c, vmeUniverse/vmeTsi148.h:

View File

@@ -1147,8 +1147,9 @@ int lvl;
if ( !(ip=irqHdlTbl[vector])) { if ( !(ip=irqHdlTbl[vector])) {
/* TODO: log error message - RTEMS has no logger :-( */ /* TODO: log error message - RTEMS has no logger :-( */
printk("vmeTsi148 ISR: ERROR: no handler registered (level %i) IACK 0x%08x\n", vmeTsi148IntDisable(lvl);
lvl, vector); printk("vmeTsi148 ISR: ERROR: no handler registered (level %i) IACK 0x%08x -- DISABING level %i\n",
lvl, vector, lvl);
} else { } else {
/* dispatch handler, it must clear the IRQ at the device */ /* dispatch handler, it must clear the IRQ at the device */
ip->isr(ip->usrData, vecarg); ip->isr(ip->usrData, vecarg);

View File

@@ -290,10 +290,31 @@ static int
am2mode(int ismaster, unsigned long address_space, unsigned long *pmode) am2mode(int ismaster, unsigned long address_space, unsigned long *pmode)
{ {
unsigned long mode=0; unsigned long mode=0;
/* NOTE: reading the CY961 (Echotek ECDR814) with VDW32
* generated bus errors when reading 32-bit words
* - very weird, because the registers are 16-bit
* AFAIK.
* - 32-bit accesses worked fine on vxWorks which
* has the port set to 64-bit.
* ????????
*/
if (!ismaster) { if (!ismaster) {
mode |= UNIV_SCTL_DAT | UNIV_SCTL_PGM; mode |= UNIV_SCTL_DAT | UNIV_SCTL_PGM;
mode |= UNIV_SCTL_USER; mode |= UNIV_SCTL_USER;
if ( VME_AM_IS_MEMORY & address_space )
mode |= UNIV_SCTL_PWEN | UNIV_SCTL_PREN;
mode |= UNIV_SCTL_EN;
} else {
mode |= UNIV_MCTL_VDW64 | UNIV_MCTL_VCT /* enable block transfers */;
if ( VME_AM_IS_MEMORY & address_space )
mode |= UNIV_MCTL_PWEN;
mode |= UNIV_MCTL_EN;
} }
address_space &= ~VME_AM_IS_MEMORY;
switch (address_space) { switch (address_space) {
case VME_AM_STD_SUP_PGM: case VME_AM_STD_SUP_PGM:
case VME_AM_STD_USR_PGM: case VME_AM_STD_USR_PGM:
@@ -456,19 +477,6 @@ unsigned long mode=0;
#else #else
WRITE_LE(offst,preg,12); WRITE_LE(offst,preg,12);
#endif #endif
/* calculate configuration word and enable the port */
/* NOTE: reading the CY961 (Echotek ECDR814) with VDW32
* generated bus errors when reading 32-bit words
* - very weird, because the registers are 16-bit
* AFAIK.
* - 32-bit accesses worked fine on vxWorks which
* has the port set to 64-bit.
* ????????
*/
if (ismaster)
mode |= UNIV_MCTL_EN | UNIV_MCTL_PWEN | UNIV_MCTL_VDW64 | UNIV_MCTL_VCT;
else
mode |= UNIV_SCTL_EN | UNIV_SCTL_PWEN | UNIV_SCTL_PREN;
#ifdef TSILL #ifdef TSILL
uprintf(stderr,"writing 0x%08x to 0x%08x + 0\n",mode,preg); uprintf(stderr,"writing 0x%08x to 0x%08x + 0\n",mode,preg);
@@ -545,12 +553,18 @@ showUniversePort(
uprintf(f,"%s, %s", uprintf(f,"%s, %s",
cntrl&UNIV_MCTL_PGM ? "Pgm" : "Dat", cntrl&UNIV_MCTL_PGM ? "Pgm" : "Dat",
cntrl&UNIV_MCTL_SUPER ? "Sup" : "Usr"); cntrl&UNIV_MCTL_SUPER ? "Sup" : "Usr");
if ( cntrl & UNIV_MCTL_PWEN )
uprintf(f,", PWEN");
} else { } else {
uprintf(f,"%s %s %s %s", uprintf(f,"%s %s %s %s",
cntrl&UNIV_SCTL_PGM ? "Pgm," : " ", cntrl&UNIV_SCTL_PGM ? "Pgm," : " ",
cntrl&UNIV_SCTL_DAT ? "Dat," : " ", cntrl&UNIV_SCTL_DAT ? "Dat," : " ",
cntrl&UNIV_SCTL_SUPER ? "Sup," : " ", cntrl&UNIV_SCTL_SUPER ? "Sup," : " ",
cntrl&UNIV_SCTL_USER ? "Usr" : ""); cntrl&UNIV_SCTL_USER ? "Usr" : "");
if ( cntrl & UNIV_SCTL_PWEN )
uprintf(f,", PWEN");
if ( cntrl & UNIV_SCTL_PREN )
uprintf(f,", PREN");
} }
uprintf(f,"\n"); uprintf(f,"\n");
return 0; return 0;
@@ -590,8 +604,13 @@ unsigned long cntrl, start, bound, offst, mask, x;
l->aspace); l->aspace);
return -1; return -1;
} }
if ( (cntrl & (ismaster ? UNIV_MCTL_AM_MASK : UNIV_SCTL_AM_MASK))
!= offst ) if ( ! (VME_MODE_EXACT_MATCH & l->aspace) ) {
cntrl &= (ismaster ? UNIV_MCTL_AM_MASK : UNIV_SCTL_AM_MASK);
offst &= (ismaster ? UNIV_MCTL_AM_MASK : UNIV_SCTL_AM_MASK);
}
if ( cntrl != offst )
return 0; /* mode doesn't match requested AM */ return 0; /* mode doesn't match requested AM */
/* OK, we found a matching mode, now we must check the address range */ /* OK, we found a matching mode, now we must check the address range */
@@ -1305,10 +1324,20 @@ unsigned long linten;
if (status & UNIV_VIRQ_ERR) { if (status & UNIV_VIRQ_ERR) {
/* TODO: log error message - RTEMS has no logger :-( */ /* TODO: log error message - RTEMS has no logger :-( */
printk("vmeUniverse ISR: error read from STATID register; (level: %i) STATID: 0x%08x\n", lvl, status); #ifdef BSP_PIC_DO_EOI
linten &= ~msk;
#else
vmeUniverseIntDisable(lvl);
#endif
printk("vmeUniverse ISR: error read from STATID register; (level: %i) STATID: 0x%08x -- DISABLING\n", lvl, status);
} else if (!(ip=universeHdlTbl[status & UNIV_VIRQ_STATID_MASK])) { } else if (!(ip=universeHdlTbl[status & UNIV_VIRQ_STATID_MASK])) {
#ifdef BSP_PIC_DO_EOI
linten &= ~msk;
#else
vmeUniverseIntDisable(lvl);
#endif
/* TODO: log error message - RTEMS has no logger :-( */ /* TODO: log error message - RTEMS has no logger :-( */
printk("vmeUniverse ISR: no handler installed for this vector; (level: %i) STATID: 0x%08x\n", lvl, status); printk("vmeUniverse ISR: no handler installed for this vector; (level: %i) STATID: 0x%08x -- DISABLING\n", lvl, status);
} else { } else {
/* dispatch handler, it must clear the IRQ at the device */ /* dispatch handler, it must clear the IRQ at the device */
ip->isr(ip->usrData, status&UNIV_VIRQ_STATID_MASK); ip->isr(ip->usrData, status&UNIV_VIRQ_STATID_MASK);

View File

@@ -74,8 +74,18 @@
#define VME_AM_MASK 0xff #define VME_AM_MASK 0xff
#endif #endif
/* Enables posted writes (and on a VME slave: prefetched reads, too) */
#ifndef VME_AM_IS_MEMORY
#define VME_AM_IS_MEMORY (1<<8)
#endif #endif
#endif
/* When looking for an address translation, ask for a match of VME_MODE_PWEN etc., too */
#define VME_MODE_EXACT_MATCH (1<<31)
#include <stdarg.h> #include <stdarg.h>
typedef unsigned long LERegister; /* emphasize contents are little endian */ typedef unsigned long LERegister; /* emphasize contents are little endian */

View File

@@ -58,10 +58,22 @@
#define VME_AM_IS_SUP(a) ((a) & 4) #define VME_AM_IS_SUP(a) ((a) & 4)
#endif #endif
/* Higher order bits are driver specific */ /* Mask for standard address modifiers */
#ifndef VME_AM_MASK #ifndef VME_AM_MASK
#define VME_AM_MASK 0xff #define VME_AM_MASK 0xff
#endif #endif
/* Hint that the a window is mapping memory; the
* driver may assume it to be safe to enable decoupled
* cycles, caching and the like...
*/
#ifndef VME_AM_IS_MEMORY
#define VME_AM_IS_MEMORY (1<<8)
#endif
/* Flags 1<<11 .. 1<<8 are reserved
* Flags 1<<12 .. 1<<31 are for driver specific options
*/
#endif #endif