GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LCBD / V1-5-1 > test_bug / rad750


Interface   Data Structures   File List   Data Fields   Globals  

test_bug.c File Reference

Trys to reproduce the LCBD bug. More...

#include <stdio.h>
#include <string.h>
#include "PBS/TMR.h"
#include "PBS/SPIN.h"
#include "PBS/BSWP.ih"
#include "LCBD/LCBD_drv.h"
#include "LCBD/LCBC.h"
#include "LCBD/LCBD_cr.h"
#include "LCBD/LCB_cr.h"
#include "LCBD/LCBD_pci.h"

Classes

struct  _Transaction
 Captures the features of an LCB transaction needed to submit and check for the completion status. More...
struct  _BugCtl
 Captures the values of the one time initialization. More...
struct  _MarkN_Cl
 Command list for three mark time transactions. More...
struct  _MarkN_Rl
 Result list for three mark time transactions. More...

Defines

#define ALIGN_REQUEST_LIST   __attribute__ ((aligned (0x1000)));
#define ALIGN_RESULT_LIST   __attribute__ ((aligned (0x1000)));
#define NT   28

Typedefs

typedef struct
_Transaction 
Transaction
 Typedef for struct Transaction.
typedef struct _BugCtl BugCtl
 Typedef for struct _BugCtl.
typedef struct _MarkN_Cl MarkN_Cl
 Typedef for struct _MarkN_Cl.
typedef struct _MarkN_Rl MarkN_Rl
 Typedef for struct _MarkN_Rl.

Functions

static void build_markN (Transaction *xcr, int stall, int n, MarkN_Cl *cl, MarkN_Rl *rl_0, MarkN_Rl *rl_1, MarkN_Rl *rlCopy, unsigned int toPci)
 Constructs the command list and initializes both a copy of the result list and the transaction block.
static __inline void submit (volatile unsigned int *request_queue, unsigned int request)
 Submits the specified request list to the LCB for execution.
static __inline
unsigned int 
poll (volatile unsigned int *result_queue, unsigned int ptus, int iterations)
 Polls the RESULT FIFO every nsecs for @ iterations.
static __inline void invalidate_instruction_cache (void)
 Invalidate the instruction cache using the flash invalidate bit in the HID1 register.
static __inline void nop (void)
static __inline void dcbf (void *address)
static __inline void dcbi (void *address)
static __inline void dcbt (void *address)
static __inline void watchdogSet (int ticks)
static __inline
unsigned int 
watchdogGet (void)
void poll_counts (void)
static __inline
unsigned int 
poll_and_tickle (volatile unsigned int *result_queue, unsigned int *probe, int iterations)
 Polls the RESULT FIFO every nsecs for @ iterations.
static unsigned int check (unsigned int rd, const unsigned int *errPtr, unsigned int rla, unsigned int rlb)
int main (int argc, char **argv)
 Dummy main program, this does not do anything except compile on host machines.
unsigned int test_bug_init (int stall)
 Initializes the test control block by loading the driver and preparing the transaction.
int test_xcr_init (int stall)
 Shell callable routine to builds a transaction containing 3 mark time transactions.
unsigned int test_baseline (int iterations, int ptus)
 Baseline test.
unsigned int test_erratum15 (int iterations, int ncache, int which)
 Tests for reaction of deliberatingly trying to tickle Erratum ` 15.
unsigned int test_bug0 (int iterations, int ptus)
 Test for bridge chip hang. This tests invalidates the instruction cache and places 0 NOPs between the poke of the PCI result address into the request list and its submission.
unsigned int test_bug1 (int iterations, int ptus)
 Test for bridge chip hang. This tests flushes the instruction cache and places 1 NOP between the poke of the PCI result address into the request list and its submission.
unsigned int test_bug4 (int iterations, int ptus)
 Test for bridge chip hang. This tests flushes the instruction cache and places 1 NOP between the poke of the PCI result address into the request list and its submission.
unsigned int test_bug8 (int iterations, int ptus)
 Test for bridge chip hang. This tests flushes the instruction cache and places 1 NOP between the poke of the PCI result address into the request list and its submission.
unsigned int test_bug12 (int iterations, int ptus)
unsigned int test_bug_all (int loop, int iterations, int ptus)
 Runs each test iterations times in a loop for loop times.

Variables

int PollCnt = 0
static MarkN_Cl MarkNCl
 Properly aligned command list for three mark time requests.
static MarkN_Rl MarkNRl_0
 Properly aligned result list for three mark time result items.
static MarkN_Rl MarkNRl_1
 Properly aligned result list for three mark time result items.
static MarkN_Rl MarkNRlInit
 Used as a template to initialize the mark time result item This is somewhat unnecessary, but serves to prove that the result item has been written (at least once) by the LCB hardware.
unsigned int WatchdogTicks = 0


Detailed Description

Trys to reproduce the LCBD bug.

Author:
JJRussell -- russell@slac.stanford.edu
  CVS $Id

Function Documentation

static void build_markN ( Transaction xcr,
int  stall,
int  n,
MarkN_Cl cl,
MarkN_Rl rl_0,
MarkN_Rl rl_1,
MarkN_Rl rlInit,
unsigned int  toPci 
) [static]

Constructs the command list and initializes both a copy of the result list and the transaction block.

Parameters:
xcr The command/response transaction block
stall The stall time in LCB clock ticks
n The number of mark times to execute
cl The command list (properly aligned)
rl_0 The result list (properly aligned)
rl_1 The result list (properly aligned)
rlInit A copy of the pre-initialized result list. This will be copied into the result list before a transaction, so that there will be a known pattern in the result list.
toPci Translate to PCI address

int main ( int  argc,
char **  argv 
)

Dummy main program, this does not do anything except compile on host machines.

Parameters:
argc The argument count
argv The argument strings

static __inline unsigned int poll ( volatile unsigned int *  result_queue,
unsigned int  ptus,
int  iterations 
) [static]

Polls the RESULT FIFO every nsecs for @ iterations.

Returns:
The result descriptor
Parameters:
result_queue Address of the result queue
ptus The polling rate
iterations The number of polling iterations
Typical turnaround times (DMA to transfer the list, do the transaction and DMA the result back are around 6.0 usecs. A polling time of around 2.5 usecs is very reasonable. If one is looking to drain the FIFO, one must consider that the longest tranaction could take up to 3 secs. (It would a pretty bizzare list, but it is possible.)

static __inline unsigned int poll_and_tickle ( volatile unsigned int *  result_queue,
unsigned int *  probe,
int  iterations 
) [static]

Polls the RESULT FIFO every nsecs for @ iterations.

Returns:
The result descriptor
Parameters:
result_queue Address of the result queue
probe Address of the cache line to tickle
iterations The number of polling iterations

static __inline void submit ( volatile unsigned int *  request_queue,
unsigned int  request 
) [static]

Submits the specified request list to the LCB for execution.

Parameters:
request_queue The request queue address
request A pointer to a properly built (address | length) request. The transformation for local to PCI space is done in this routine.

unsigned int test_baseline ( int  iterations,
int  ptus 
)

Baseline test.

Returns:
Status
Parameters:
iterations The number of iterations to run
ptus The poll rate in ptus. This effectively sets the submission rate.
This submits a very basic, prebuilt transaction to the LCB in a loop and checks for successful completion. This test is not expected to fail.

It assumes that test_bug_init has been called.

unsigned int test_bug0 ( int  iterations,
int  ptus 
)

Test for bridge chip hang. This tests invalidates the instruction cache and places 0 NOPs between the poke of the PCI result address into the request list and its submission.

Returns:
Status
Parameters:
iterations The number of iterations to run
ptus The poll rate in ptus. This effectively sets the submission rate.
This submits a very basic, prebuilt transaction to the LCB in a loop and checks for successful completion. This test may or may not fail.

It assumes that test_bug_init has been called.

unsigned int test_bug1 ( int  iterations,
int  ptus 
)

Test for bridge chip hang. This tests flushes the instruction cache and places 1 NOP between the poke of the PCI result address into the request list and its submission.

Returns:
Status
Parameters:
iterations The number of iterations to run
ptus The poll rate in ptus. This effectively sets the submission rate.
This submits a very basic, prebuilt transaction to the LCB in a loop and checks for successful completion. This test may or may not fail.

It assumes that test_bug_init has been called.

unsigned int test_bug4 ( int  iterations,
int  ptus 
)

Test for bridge chip hang. This tests flushes the instruction cache and places 1 NOP between the poke of the PCI result address into the request list and its submission.

Returns:
Status
Parameters:
iterations The number of iterations to run
ptus The poll rate in ptus. This effectively sets the submission rate.
This submits a very basic, prebuilt transaction to the LCB in a loop and checks for successful completion. This test may or may not fail.

It assumes that test_bug_init has been called.

unsigned int test_bug8 ( int  iterations,
int  ptus 
)

Test for bridge chip hang. This tests flushes the instruction cache and places 1 NOP between the poke of the PCI result address into the request list and its submission.

Returns:
Status
Parameters:
iterations The number of iterations to run
ptus The poll rate in ptus. This effectively sets the submission rate.
This submits a very basic, prebuilt transaction to the LCB in a loop and checks for successful completion. This test may or may not fail.

It assumes that test_bug_init has been called.

unsigned int test_bug_all ( int  loop,
int  iterations,
int  ptus 
)

Runs each test iterations times in a loop for loop times.

Parameters:
loop The number of major loops (all tests)
iterations The number of iterations for each test
ptus The poll time in PTUs (8000 = 1msec, 800 = .1msec, 100 = 12 usecs)
One can invoke this directly at the WindShell line for testing purposes, but because the shell runs at very high priority, do recommend that the running time be kept small.

Note:
To first order the running time is
  • number of tests * number of loops * number of iterations * poll time
If the poll time is set to 800 ptus, that's 100 usec/iteration. If one picks 1000 iterations and 10 loops, then the running time is

unsigned int test_bug_init ( int  stall  ) 

Initializes the test control block by loading the driver and preparing the transaction.

Parameters:
stall The stall time in LCB clock ticks

unsigned int test_erratum15 ( int  iterations,
int  ncache,
int  which 
)

Tests for reaction of deliberatingly trying to tickle Erratum ` 15.

Returns:
Status
Parameters:
iterations The number of iterations to run
ncache The number of cache lines beyond the end cache line to probe.
which Which list, request or result, to probe
It assumes that test_bug_init has been called.

Experimentally it has been seen that this will hang the bridge chip after around 50 iterations. Because of this the watchdog timer is set for about 10 seconds, deemed to be a reasonable time to wait for recovery.

int test_xcr_init ( int  stall  ) 

Shell callable routine to builds a transaction containing 3 mark time transactions.

Parameters:
stall The stall time, in LCBD clock ticks


Generated on Tue Aug 31 18:56:53 2010 by  doxygen 1.5.3