Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

msc.c File Reference

#include <asm/ap1000/apreg.h>
#include <linux/mm.h>
#include <linux/malloc.h>
#include <asm/irq.h>
#include <asm/pgtable.h>
#include <asm/ap1000/pgtapmmu.h>
#include <linux/tasks.h>
#include <linux/sched.h>
#include <linux/interrupt.h>

Include dependency graph for msc.c:

Go to the source code of this file.

Defines

#define _APLIB_
#define DEBUG   0
#define NSENDQUEUES   5
#define NR_RBUFS   MSC_NR_RBUFS
#define CTX_MASK   0xfff
#define NULL_CONTEXT   CTX_MASK
#define QOF_ORDER   3
#define QOF_SIZE   ((1<<QOF_ORDER)*PAGE_SIZE)
#define QOF_ELT_SIZE   8
#define QOF_REDZONE_SZ   8192
#define QOF_NELT   (QOF_SIZE / QOF_ELT_SIZE)
#define QOF_RED_NELT   (QOF_REDZONE_SZ / QOF_ELT_SIZE)
#define QOF_GREEN_NELT   ((QOF_SIZE - QOF_REDZONE_SZ) / QOF_ELT_SIZE)
#define MAKE_QBMPTR(qof, size)
#define QBM_UPDATE_WP(wp)
#define QOF_QUEUE_SH   24
#define QOF_QUEUE_M   0x1f
#define QOF_ENDBIT   1
#define INTR_LIMIT   10000
#define DUMMY_RINGBUF_ORDER   5
#define DUMMY_RINGBUF_SIZE   ((1<<DUMMY_RINGBUF_ORDER)*PAGE_SIZE)
#define SQ_NEW_MODE(mode)
#define REPACK_THRESH   64

Functions

static void msc_interrupt_9 (int irq, void *dev_id, struct pt_regs *regs)
static void msc_interrupt_11 (int irq, void *dev_id, struct pt_regs *regs)
static void msc_set_ringbuf (int context)
static void msc_update_read_ptr (int context, int overflow)
static void fail_write (int context, int intr, unsigned vaddr)
static void fail_read (int context, int intr, unsigned vaddr)
static void msc_switch_from_check (struct task_struct *tsk)
static void msc_status (void)
static void refill_sq (void)
static void repack_qof (void)
static void shuffle_qof (void)
static void async_callback (int, unsigned long, int, int)
static void mask_all_interrupts (void)
static int valid_task (struct task_struct *tsk)
static unsigned long apmmu_get_raw_ctable_ptr (void)
static void mc_tlb_map (unsigned phys_page, unsigned vpage, int context)
static void mc_tlb_unmap (unsigned vpage)
void mc_tlb_init (void)
void ap_msc_init (void)
static void qbmfill_interrupt (void)
static void qbmful_interrupt (void)
void msc_timer (void)
static void handle_signal (int context, unsigned vaddr)
static void msc_write_fault (void)
static void msc_read_fault (void)
void msc_unset_ringbuf (int i)
void exit_msc (struct task_struct *tsk)
static void msc_sq_pause (void)
static void msc_sq_resume (void)
static void msc_switch_to_check (struct task_struct *tsk)
void msc_switch_check (struct task_struct *tsk)
int msc_switch_ok (void)

Variables

static struct send_queues send_queues [NSENDQUEUES]
struct {
   unsigned   rbmbwp
   unsigned   rbmmode
   unsigned   rbmrp
ringbufs [MSC_NR_RBUFS]
static struct qof_eltqof_base = NULL
static unsigned long qof_phys
static struct qof_eltqof_rp
static struct qof_eltqof_new
static int qof_present [NSENDQUEUES]
int msc_blocked = 0
int block_parallel_tasks = 0
static int qbm_full_counter = 0
static int intr_counter = 0
static unsigned intr_mask
ringbuf_struct system_ringbuf = {NULL,NULL,SYSTEM_RINGBUF_ORDER,0,0,0,0}
ringbuf_struct dummy_ringbuf = {NULL,NULL,DUMMY_RINGBUF_ORDER,0,0,0,0}
unsigned system_read_ptr = (SYSTEM_RINGBUF_SIZE>>5)-1
unsigned dummy_read_ptr = (DUMMY_RINGBUF_SIZE>>5)-1
static int log2tbl [32]
static unsigned long direct_queues [NSENDQUEUES][2]


Define Documentation

#define _APLIB_
 

Definition at line 13 of file msc.c.

#define CTX_MASK   0xfff
 

Definition at line 64 of file msc.c.

Referenced by exit_msc(), msc_set_ringbuf(), msc_unset_ringbuf(), and msc_update_read_ptr().

#define DEBUG   0
 

Definition at line 33 of file msc.c.

#define DUMMY_RINGBUF_ORDER   5
 

Definition at line 112 of file msc.c.

Referenced by ap_msc_init().

#define DUMMY_RINGBUF_SIZE   ((1<<DUMMY_RINGBUF_ORDER)*PAGE_SIZE)
 

Definition at line 113 of file msc.c.

Referenced by ap_msc_init().

#define INTR_LIMIT   10000
 

Definition at line 108 of file msc.c.

Referenced by msc_interrupt_11(), and msc_interrupt_9().

#define MAKE_QBMPTR qof,
size   ) 
 

Value:

(MKFIELD((qof) >> 19, MSC_QBMP_BP) \
         + MKFIELD((qof) >> 3, MSC_QBMP_WP) \
         + MKFIELD(((qof) + (size) - 1) >> 13, MSC_QBMP_LIM))

Definition at line 75 of file msc.c.

Referenced by ap_msc_init().

#define NR_RBUFS   MSC_NR_RBUFS
 

Definition at line 52 of file msc.c.

Referenced by exit_msc(), msc_set_ringbuf(), and msc_update_read_ptr().

#define NSENDQUEUES   5
 

Definition at line 39 of file msc.c.

Referenced by ap_msc_init(), qbmful_interrupt(), and refill_sq().

#define NULL_CONTEXT   CTX_MASK
 

Definition at line 65 of file msc.c.

Referenced by ap_msc_init(), msc_set_ringbuf(), and msc_unset_ringbuf().

#define QBM_UPDATE_WP wp   ) 
 

Value:

MSC_OUT(MSC_QBMPTR, INSFIELD(MSC_IN(MSC_QBMPTR), (unsigned)(wp) >> 3, \
                                     MSC_QBMP_WP))

Definition at line 80 of file msc.c.

Referenced by refill_sq(), repack_qof(), and shuffle_qof().

#define QOF_ELT_SIZE   8
 

Definition at line 69 of file msc.c.

#define QOF_ENDBIT   1
 

Definition at line 93 of file msc.c.

Referenced by refill_sq().

#define QOF_GREEN_NELT   ((QOF_SIZE - QOF_REDZONE_SZ) / QOF_ELT_SIZE)
 

Definition at line 73 of file msc.c.

Referenced by qbmful_interrupt().

#define QOF_NELT   (QOF_SIZE / QOF_ELT_SIZE)
 

Definition at line 71 of file msc.c.

#define QOF_ORDER   3
 

Definition at line 67 of file msc.c.

Referenced by ap_msc_init().

#define QOF_QUEUE_M   0x1f
 

Definition at line 92 of file msc.c.

#define QOF_QUEUE_SH   24
 

Definition at line 91 of file msc.c.

Referenced by refill_sq().

#define QOF_RED_NELT   (QOF_REDZONE_SZ / QOF_ELT_SIZE)
 

Definition at line 72 of file msc.c.

#define QOF_REDZONE_SZ   8192
 

Definition at line 70 of file msc.c.

#define QOF_SIZE   ((1<<QOF_ORDER)*PAGE_SIZE)
 

Definition at line 68 of file msc.c.

Referenced by ap_msc_init(), msc_switch_from_check(), and refill_sq().

#define REPACK_THRESH   64
 

Definition at line 131 of file msc.c.

Referenced by qbmful_interrupt().

#define SQ_NEW_MODE mode   ) 
 

Value:

do { \
    MSC_OUT(MSC_SQCTRL, ((MSC_IN(MSC_SQCTRL) & ~MSC_SQC_RMODE) \
                         | MSC_SQC_RMODE_ ## mode)); \
    while ((MSC_IN(MSC_SQCTRL) & MSC_SQC_MODE) != MSC_SQC_MODE_ ## mode) \
        /* hang */ ; \
} while (0)

Definition at line 123 of file msc.c.

Referenced by ap_msc_init(), qbmfill_interrupt(), and qbmful_interrupt().


Function Documentation

void ap_msc_init void   ) 
 

Definition at line 209 of file msc.c.

References __get_free_pages(), AP_CLR_INTR_MASK, APMAS_IRQ, apmmu_get_raw_ctable_ptr(), APMSC_IRQ, bif_add_debug_key(), cli, DUMMY_RINGBUF_ORDER, DUMMY_RINGBUF_SIZE, i, MAKE_QBMPTR, MAP_NR, MC_CTP, MC_IN, MC_OUT, mc_tlb_init(), MC_VERSION, mem_map, MSC_IN, msc_interrupt_11(), msc_interrupt_9(), MSC_INTR, MSC_INTR_QBMFUL_SH, MSC_INTR_RBFULL_SH, MSC_INTR_RBMISS_SH, MSC_INTR_RMASE_SH, MSC_INTR_RMASF_SH, MSC_INTR_SMASE_SH, MSC_INTR_SMASF_SH, MSC_INTR_SQFILL_SH, MSC_MASCTRL, MSC_NR_RBUFS, MSC_OUT, MSC_QBMPTR, MSC_RMASREG, MSC_SMASREG, MSC_SQP_BP_SH, MSC_SQPTR0, MSC_SQPTR1, MSC_SQRAM, msc_status(), MSC_VERSION, NORMAL, NSENDQUEUES, NULL, NULL_CONTEXT, printk, QOF_ORDER, qof_phys, qof_present, QOF_SIZE, rbmmode, request_irq(), res, restore_flags, ringbuf_struct::ringbuf, ringbufs, SA_INTERRUPT, save_flags, set_bit, size, SQ_NEW_MODE, SYSTEM_RINGBUF_ORDER, SYSTEM_RINGBUF_SIZE, and ringbuf_struct::write_ptr.

Referenced by mpp_hw_init().

Here is the call graph for this function:

static unsigned long apmmu_get_raw_ctable_ptr void   )  [inline, static]
 

Definition at line 162 of file msc.c.

References __asm__(), APMMU_CTXTBL_PTR, and ASI_M_MMUREGS.

Referenced by ap_msc_init().

Here is the call graph for this function:

static void async_callback int  ,
unsigned  long,
int  ,
int 
[static]
 

Definition at line 660 of file msc.c.

References AP_CLR_INTR_MASK, AP_CLR_INTR_REQ, AP_INTR_REQ, cli, fail_read(), fail_write(), intr_mask, MPP_TASK_TO_CTX, msc_blocked, MSC_IN, MSC_INTR, MSC_INTR_RMASF_SH, MSC_INTR_SMASF_SH, MSC_MASC_RFEXIT, MSC_MASC_SFEXIT, MSC_MASCTRL, MSC_OUT, restore_flags, and save_flags.

Referenced by msc_read_fault(), and msc_write_fault().

Here is the call graph for this function:

void exit_msc struct task_struct *  tsk  ) 
 

Definition at line 1002 of file msc.c.

References CTX_MASK, exit_ringbuf(), i, MPP_IS_PAR_TASK, MPP_TASK_TO_CTX, MSC_IN, msc_switch_from_check(), msc_unset_ringbuf(), NR_RBUFS, NULL, printk, rbmmode, and ringbufs.

Referenced by do_exit().

Here is the call graph for this function:

static void fail_read int  context,
int  intr,
unsigned  vaddr
[static]
 

Definition at line 635 of file msc.c.

References _NSIG, AP_CLR_INTR_REQ, handle_signal(), mc_tlb_map(), mc_tlb_unmap(), MPP_CTX_TO_TASK, MPP_IS_PAR_CTX, MSC_IN, MSC_INTR, MSC_MASC_SFEXIT, MSC_MASCTRL, MSC_OUT, MSC_REM_SIGNAL, PAGE_SIZE, printk, ringbuf_struct::ringbuf, send_sig(), SIGSEGV, SUBSIG_NOMAPPING, task, and valid_task().

Referenced by async_callback(), and msc_read_fault().

Here is the call graph for this function:

static void fail_write int  context,
int  intr,
unsigned  vaddr
[static]
 

Definition at line 606 of file msc.c.

References _NSIG, AP_CLR_INTR_REQ, handle_signal(), mc_tlb_map(), mc_tlb_unmap(), MPP_CTX_TO_TASK, MPP_IS_PAR_CTX, MSC_IN, MSC_INTR, MSC_MASC_RFEXIT, MSC_MASCTRL, MSC_OUT, MSC_REM_SIGNAL, MSC_RHDERRPROC, MSC_RMASREG, PAGE_SIZE, printk, ringbuf_struct::ringbuf, send_sig(), SIGSEGV, SUBSIG_NOMAPPING, task, and valid_task().

Referenced by async_callback(), and msc_write_fault().

Here is the call graph for this function:

static void handle_signal int  context,
unsigned  vaddr
[inline, static]
 

Definition at line 589 of file msc.c.

References mpp_cid(), MPP_CTX_TO_TASK, MPP_IS_PAR_TASK, MSC_REM_SIGNAL, PAGE_SHIFT, printk, send_sig(), task, and valid_task().

Here is the call graph for this function:

static void mask_all_interrupts void   )  [static]
 

Definition at line 140 of file msc.c.

References AP_SET_INTR_MASK, MSC_INTR, MSC_INTR_QBMFUL_SH, MSC_INTR_RBFULL_SH, MSC_INTR_RBMISS_SH, MSC_INTR_RMASE_SH, MSC_INTR_RMASF_SH, MSC_INTR_SMASE_SH, MSC_INTR_SMASF_SH, MSC_INTR_SQFILL_SH, and MSC_OUT.

Referenced by msc_interrupt_11(), and msc_interrupt_9().

void mc_tlb_init void   ) 
 

Definition at line 196 of file msc.c.

References i, MC_MMU_TLB256K, MC_MMU_TLB256K_SIZE, MC_MMU_TLB4K, and MC_MMU_TLB4K_SIZE.

Referenced by ap_msc_init().

static void mc_tlb_map unsigned  phys_page,
unsigned  vpage,
int  context
[static]
 

Definition at line 173 of file msc.c.

References MC_MMU_TLB4K, and printk.

Referenced by fail_read(), and fail_write().

static void mc_tlb_unmap unsigned  vpage  )  [static]
 

Definition at line 189 of file msc.c.

References MC_MMU_TLB4K.

Referenced by fail_read(), and fail_write().

static void msc_interrupt_11 int  irq,
void *  dev_id,
struct pt_regs regs
[static]
 

Definition at line 362 of file msc.c.

References AP_CLR_INTR_REQ, AP_INTR_REQ, cli, intr(), intr_counter, INTR_LIMIT, mask_all_interrupts(), mpp_cid(), MSC_IN, MSC_INTR, MSC_INTR_QBMFUL_SH, MSC_INTR_RBFULL_SH, MSC_INTR_RBMISS_SH, MSC_INTR_SQFILL_SH, MSC_OUT, MSC_RMASREG, msc_set_ringbuf(), msc_update_read_ptr(), printk, qbmfill_interrupt(), qbmful_interrupt(), restore_flags, and save_flags.

Referenced by ap_msc_init().

Here is the call graph for this function:

static void msc_interrupt_9 int  irq,
void *  dev_id,
struct pt_regs regs
[static]
 

Definition at line 774 of file msc.c.

References AP_CLR_INTR_REQ, AP_INTR_REQ, cli, cnt, EXTFIELD, intr(), intr_counter, INTR_LIMIT, intr_mask, mask_all_interrupts(), mpp_cid(), MSC_HDGERRPROC, MSC_IN, MSC_INTR, MSC_INTR_RMASE_SH, MSC_INTR_RMASF_SH, MSC_INTR_SMASE_SH, MSC_INTR_SMASF_SH, MSC_MASCTRL, MSC_MASR_AVIO, MSC_MASR_CMD, MSC_MASR_CMD_CSI, MSC_MASR_CMD_FOP, MSC_MASR_CMD_XFER, MSC_OUT, msc_read_fault(), MSC_RHDERRPROC, MSC_RMASADR, MSC_RMASREG, MSC_RMASTWP, MSC_SMASADR, MSC_SMASCNT, MSC_SMASREG, MSC_SMASTWP, msc_write_fault(), printk, r, restore_flags, and save_flags.

Referenced by ap_msc_init().

Here is the call graph for this function:

static void msc_read_fault void   )  [inline, static]
 

Definition at line 735 of file msc.c.

References _NSIG, AP_INTR_REQ, AP_SET_INTR_MASK, async_callback(), async_fault(), fail_read(), intr_mask, mpp_cid(), MPP_CTX_TO_TASK, MPP_IS_PAR_CTX, msc_blocked, MSC_IN, MSC_INTR, MSC_INTR_SMASF_SH, MSC_OUT, MSC_REM_SIGNAL, MSC_SMASREG, MSC_SMASTWP, PAGE_SIZE, printk, show_mapping_ctx(), SYSTEM_CONTEXT, task, and valid_task().

Referenced by msc_interrupt_9().

Here is the call graph for this function:

static void msc_set_ringbuf int  context  )  [static]
 

Definition at line 943 of file msc.c.

References CTX_MASK, i, mpp_cid(), MPP_CTX_TO_TASK, MPP_IS_PAR_CTX, MSC_IN, MSC_OUT, msc_unset_ringbuf(), msc_update_read_ptr(), NR_RBUFS, NULL_CONTEXT, ringbuf_struct::order, printk, rbmbwp, rbmmode, rbmrp, ringbuf_struct::ringbuf, ringbufs, SYSTEM_CONTEXT, system_read_ptr, task, valid_task(), and ringbuf_struct::write_ptr.

Referenced by msc_interrupt_11().

Here is the call graph for this function:

static void msc_sq_pause void   )  [static]
 

Definition at line 1027 of file msc.c.

References MSC_IN, MSC_OUT, MSC_SQC_PAUSE, MSC_SQC_STABLE, and MSC_SQCTRL.

Referenced by msc_switch_from_check().

static void msc_sq_resume void   )  [static]
 

Definition at line 1033 of file msc.c.

References MSC_IN, MSC_OUT, MSC_SQC_PAUSE, and MSC_SQCTRL.

Referenced by msc_switch_from_check().

static void msc_status void   )  [static]
 

Definition at line 1226 of file msc.c.

References DMA_GEN, i, MSC_CIDRANGE, MSC_IN, MSC_INTR, MSC_IRL, MSC_MASCTRL, MSC_OPTADR, MSC_PID, MSC_QBMPTR, MSC_QWORDCNT, MSC_RMASADR, MSC_RMASREG, MSC_RMASTWP, MSC_SIMMCHK, MSC_SMASADR, MSC_SMASCNT, MSC_SMASREG, MSC_SMASTWP, MSC_SQCTRL, MSC_SQPTR0, printk, qbm_full_counter, rbmbwp, rbmmode, rbmrp, and ringbufs.

Referenced by ap_msc_init().

void msc_switch_check struct task_struct *  tsk  ) 
 

Definition at line 1199 of file msc.c.

References last_task, MPP_IS_PAR_TASK, msc_switch_from_check(), msc_switch_to_check(), and task.

Referenced by mpp_notify_schedule().

Here is the call graph for this function:

static void msc_switch_from_check struct task_struct *  tsk  )  [static]
 

Definition at line 1038 of file msc.c.

References apmmu_get_context(), apmmu_set_context(), cli, qof_elt::data, EXTFIELD, ringbuf_struct::frag_count, ringbuf_struct::frag_len, i, qof_elt::info, INSFIELD, log2tbl, MPP_TASK_TO_CTX, MSC_IN, MSC_OUT, MSC_QBMPTR, MSC_QWORDCNT, msc_sq_pause(), msc_sq_resume(), MSC_SQC_USERF, MSC_SQCTRL, MSC_SQPTR2, MSC_SQRAM, NULL, printk, qof_present, QOF_SIZE, restore_flags, ringbuf_struct::ringbuf, save_flags, ringbuf_struct::sq_fragment, valid_task(), and wp.

Referenced by exit_msc(), and msc_switch_check().

Here is the call graph for this function:

int msc_switch_ok void   ) 
 

Definition at line 1215 of file msc.c.

References EXTFIELD, MSC_IN, and MSC_QWORDCNT.

Referenced by mpp_weight().

static void msc_switch_to_check struct task_struct *  tsk  )  [static]
 

Definition at line 1139 of file msc.c.

References apmmu_get_context(), apmmu_set_context(), cli, i, INSFIELD, MPP_TASK_TO_CTX, MSC_IN, MSC_OUT, MSC_QWORDCNT, MSC_USER_DIRECT, printk, restore_flags, save_flags, and valid_task().

Referenced by msc_switch_check().

Here is the call graph for this function:

void msc_timer void   ) 
 

Definition at line 408 of file msc.c.

References intr_counter.

Referenced by ap_clear_clock_irq().

void msc_unset_ringbuf int  i  ) 
 

Definition at line 848 of file msc.c.

References CTX_MASK, MPP_CTX_TO_TASK, MPP_IS_PAR_CTX, MSC_IN, MSC_OUT, NULL_CONTEXT, printk, rbmbwp, rbmmode, ringbuf_struct::ringbuf, ringbufs, SYSTEM_CONTEXT, task, valid_task(), and ringbuf_struct::write_ptr.

Referenced by exit_msc(), and msc_set_ringbuf().

Here is the call graph for this function:

static void msc_update_read_ptr int  context,
int  overflow
[static]
 

Definition at line 874 of file msc.c.

References apmmu_get_context(), apmmu_set_context(), CTX_MASK, dummy_read_ptr, i, MPP_CTX_TO_TASK, MPP_IS_PAR_CTX, MSC_IN, MSC_OUT, NR_RBUFS, printk, rbmmode, rbmrp, RBUF_SHARED_PAGE_OFF, RBUF_VBASE, ringbuf_struct::ringbuf, ringbufs, send_sig(), SIGLOST, SYSTEM_CONTEXT, system_read_ptr, task, tnet_check_completion(), and valid_task().

Referenced by msc_interrupt_11(), and msc_set_ringbuf().

Here is the call graph for this function:

static void msc_write_fault void   )  [inline, static]
 

Definition at line 694 of file msc.c.

References _NSIG, AP_INTR_REQ, AP_SET_INTR_MASK, async_callback(), async_fault(), fail_write(), intr_mask, mpp_cid(), MPP_CTX_TO_TASK, MPP_IS_PAR_CTX, msc_blocked, MSC_IN, MSC_INTR, MSC_INTR_RMASF_SH, MSC_OUT, MSC_REM_SIGNAL, MSC_RMASREG, MSC_RMASTWP, PAGE_SIZE, printk, show_mapping_ctx(), SYSTEM_CONTEXT, task, and valid_task().

Referenced by msc_interrupt_9().

Here is the call graph for this function:

static void qbmfill_interrupt void   )  [inline, static]
 

Definition at line 305 of file msc.c.

References AP_CLR_INTR_MASK, AP_CLR_INTR_REQ, AP_INTR_REQ, intr_mask, MSC_INTR, MSC_INTR_QBMFUL_SH, MSC_INTR_SQFILL_SH, MSC_OUT, NORMAL, refill_sq(), and SQ_NEW_MODE.

Referenced by msc_interrupt_11().

Here is the call graph for this function:

static void qbmful_interrupt void   )  [inline, static]
 

Definition at line 317 of file msc.c.

References AP_CLR_INTR_REQ, AP_INTR_REQ, AP_SET_INTR_MASK, block_parallel_tasks, current, intr_mask, mark_bh, MSC_INTR, MSC_INTR_QBMFUL_SH, MSC_OUT, NORMAL, NSENDQUEUES, printk, qbm_full_counter, QOF_GREEN_NELT, qof_present, refill_sq(), repack_qof(), REPACK_THRESH, shuffle_qof(), SQ_NEW_MODE, and TQUEUE_BH.

Referenced by msc_interrupt_11().

Here is the call graph for this function:

static void refill_sq void   )  [static]
 

Definition at line 434 of file msc.c.

References block_parallel_tasks, qof_elt::data, direct_queues, EXTFIELD, qof_elt::info, log2tbl, MSC_IN, MSC_OUT, MSC_QBMPTR, MSC_SQC_SPLF_SH, MSC_SQCTRL, MSC_SQP_MODE, MSC