* [PATCH 0/4] DPC Removal from services
@ 2010-01-15 23:35 Omar Ramirez Luna
2010-01-15 23:35 ` [PATCH 1/4] DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers Omar Ramirez Luna
2010-01-18 19:15 ` [PATCH 0/4] DPC Removal from services Ramirez Luna, Omar
0 siblings, 2 replies; 6+ messages in thread
From: Omar Ramirez Luna @ 2010-01-15 23:35 UTC (permalink / raw)
To: linux-omap
Cc: Ameya Palande, Hiroshi Doyu, Felipe Contreras, Nishanth Menon,
Omar Ramirez Luna
This patches remove the DPC custom implementation and wrappers.
They should be applied on top of "trivial cleanups" set and are
part of the current patch queue.
Omar Ramirez Luna (4):
DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers
DSPBRIDGE: Remove main DPC wrapper for IO and MMUfault
DSPBRIDGE: Remove DPC module from SERVICES layer
DSPBRIDGE: Remove DPC object structure
arch/arm/plat-omap/include/dspbridge/_chnl_sm.h | 1 -
arch/arm/plat-omap/include/dspbridge/dpc.h | 145 -------------
arch/arm/plat-omap/include/dspbridge/io_sm.h | 2 +-
drivers/dsp/bridge/Makefile | 3 +-
drivers/dsp/bridge/pmgr/chnl.c | 1 -
drivers/dsp/bridge/services/dpc.c | 246 -----------------------
drivers/dsp/bridge/services/services.c | 10 +-
drivers/dsp/bridge/wmd/_deh.h | 5 +-
drivers/dsp/bridge/wmd/io_sm.c | 86 ++++++--
drivers/dsp/bridge/wmd/mmu_fault.c | 12 +-
drivers/dsp/bridge/wmd/mmu_fault.h | 2 +-
drivers/dsp/bridge/wmd/ue_deh.c | 13 +-
12 files changed, 87 insertions(+), 439 deletions(-)
delete mode 100644 arch/arm/plat-omap/include/dspbridge/dpc.h
delete mode 100644 drivers/dsp/bridge/services/dpc.c
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers
2010-01-15 23:35 [PATCH 0/4] DPC Removal from services Omar Ramirez Luna
@ 2010-01-15 23:35 ` Omar Ramirez Luna
2010-01-15 23:35 ` [PATCH 2/4] DSPBRIDGE: Remove main DPC wrapper for IO and MMUfault Omar Ramirez Luna
2010-01-18 19:15 ` [PATCH 0/4] DPC Removal from services Ramirez Luna, Omar
1 sibling, 1 reply; 6+ messages in thread
From: Omar Ramirez Luna @ 2010-01-15 23:35 UTC (permalink / raw)
To: linux-omap
Cc: Ameya Palande, Hiroshi Doyu, Felipe Contreras, Nishanth Menon,
Omar Ramirez Luna
Remove DPC wrappers and replace with direct Linux calls.
These changes apply to IO DPC and MMUfault DPC
Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
---
arch/arm/plat-omap/include/dspbridge/dpc.h | 90 +++--------------
drivers/dsp/bridge/services/dpc.c | 144 +---------------------------
drivers/dsp/bridge/wmd/io_sm.c | 71 +++++++++++++-
drivers/dsp/bridge/wmd/mmu_fault.c | 24 ++++-
drivers/dsp/bridge/wmd/ue_deh.c | 31 ++++++-
5 files changed, 130 insertions(+), 230 deletions(-)
diff --git a/arch/arm/plat-omap/include/dspbridge/dpc.h b/arch/arm/plat-omap/include/dspbridge/dpc.h
index 870a1b2..0c60342 100644
--- a/arch/arm/plat-omap/include/dspbridge/dpc.h
+++ b/arch/arm/plat-omap/include/dspbridge/dpc.h
@@ -19,8 +19,6 @@
#ifndef DPC_
#define DPC_
- struct DPC_OBJECT;
-
/*
* ======== DPC_PROC ========
* Purpose:
@@ -40,64 +38,22 @@
*/
typedef void(*DPC_PROC) (void *pRefData);
-/*
- * ======== DPC_Cancel ========
- * Purpose:
- * Cancel a DPC previously scheduled by DPC_Schedule.
- * Parameters:
- * hDPC: A DPC object handle created in DPC_Create().
- * Returns:
- * DSP_SOK: Scheduled DPC, if any, is cancelled.
- * DSP_SFALSE: No DPC is currently scheduled for execution.
- * DSP_EHANDLE: Invalid hDPC.
- * Requires:
- * Ensures:
- * If the DPC has already executed, is executing, or was not yet
- * scheduled, this function will have no effect.
- */
- extern DSP_STATUS DPC_Cancel(IN struct DPC_OBJECT *hDPC);
+/* The DPC object, passed to our priority event callback routine: */
+struct DPC_OBJECT {
+ u32 dwSignature; /* Used for object validation. */
+ void *pRefData; /* Argument for client's DPC. */
+ DPC_PROC pfnDPC; /* Client's DPC. */
+ u32 numRequested; /* Number of requested DPC's. */
+ u32 numScheduled; /* Number of executed DPC's. */
+ struct tasklet_struct dpc_tasklet;
-/*
- * ======== DPC_Create ========
- * Purpose:
- * Create a DPC object, allowing a client's own DPC procedure to be
- * scheduled for a call with client reference data.
- * Parameters:
- * phDPC: Pointer to location to store DPC object.
- * pfnDPC: Client's DPC procedure.
- * pRefData: Pointer to user-defined reference data.
- * Returns:
- * DSP_SOK: DPC object created.
- * DSP_EPOINTER: phDPC == NULL or pfnDPC == NULL.
- * DSP_EMEMORY: Insufficient memory.
- * Requires:
- * Must not be called at interrupt time.
- * Ensures:
- * DSP_SOK: DPC object is created;
- * else: *phDPC is set to NULL.
- */
- extern DSP_STATUS DPC_Create(OUT struct DPC_OBJECT **phDPC,
- IN DPC_PROC pfnDPC,
- IN void *pRefData);
+#ifdef DEBUG
+ u32 cEntryCount; /* Number of times DPC reentered. */
+ u32 numRequestedMax; /* Keep track of max pending DPC's. */
+#endif
-/*
- * ======== DPC_Destroy ========
- * Purpose:
- * Cancel the last scheduled DPC, and deallocate a DPC object previously
- * allocated with DPC_Create().Frees the Object only if the thread and
- * the events are terminated successfuly.
- * Parameters:
- * hDPC: A DPC object handle created in DPC_Create().
- * Returns:
- * DSP_SOK: Success.
- * DSP_EHANDLE: Invalid hDPC.
- * Requires:
- * All DPC's scheduled for the DPC object must have completed their
- * processing.
- * Ensures:
- * (SUCCESS && hDPC is NULL) or DSP_EFAILED status
- */
- extern DSP_STATUS DPC_Destroy(IN struct DPC_OBJECT *hDPC);
+ spinlock_t dpc_lock;
+};
/*
* ======== DPC_Exit ========
@@ -125,21 +81,7 @@
*/
extern bool DPC_Init(void);
-/*
- * ======== DPC_Schedule ========
- * Purpose:
- * Schedule a deferred procedure call to be executed at a later time.
- * Latency and order of DPC execution is platform specific.
- * Parameters:
- * hDPC: A DPC object handle created in DPC_Create().
- * Returns:
- * DSP_SOK: An event is scheduled for deferred processing.
- * DSP_EHANDLE: Invalid hDPC.
- * Requires:
- * See requirements for DPC_PROC.
- * Ensures:
- * DSP_SOK: The DPC will not be called before this function returns.
- */
- extern DSP_STATUS DPC_Schedule(IN struct DPC_OBJECT *hDPC);
+/* ----------------------------------- Function Prototypes */
+ void DPC_DeferredProcedure(IN unsigned long pDeferredContext);
#endif /* DPC_ */
diff --git a/drivers/dsp/bridge/services/dpc.c b/drivers/dsp/bridge/services/dpc.c
index a6d453c..10bd792 100644
--- a/drivers/dsp/bridge/services/dpc.c
+++ b/drivers/dsp/bridge/services/dpc.c
@@ -37,111 +37,11 @@
/* ----------------------------------- Defines, Data Structures, Typedefs */
#define SIGNATURE 0x5f435044 /* "DPC_" (in reverse). */
-/* The DPC object, passed to our priority event callback routine: */
-struct DPC_OBJECT {
- u32 dwSignature; /* Used for object validation. */
- void *pRefData; /* Argument for client's DPC. */
- DPC_PROC pfnDPC; /* Client's DPC. */
- u32 numRequested; /* Number of requested DPC's. */
- u32 numScheduled; /* Number of executed DPC's. */
- struct tasklet_struct dpc_tasklet;
-
-#ifdef DEBUG
- u32 cEntryCount; /* Number of times DPC reentered. */
- u32 numRequestedMax; /* Keep track of max pending DPC's. */
-#endif
-
- spinlock_t dpc_lock;
-};
-
/* ----------------------------------- Globals */
#if GT_TRACE
static struct GT_Mask DPC_DebugMask = { NULL, NULL }; /* DPC Debug Mask */
#endif
-/* ----------------------------------- Function Prototypes */
-static void DPC_DeferredProcedure(IN unsigned long pDeferredContext);
-
-/*
- * ======== DPC_Create ========
- * Purpose:
- * Create a DPC object, allowing a client's own DPC procedure to be
- * scheduled for a call with client reference data.
- */
-DSP_STATUS DPC_Create(OUT struct DPC_OBJECT **phDPC, DPC_PROC pfnDPC,
- void *pRefData)
-{
- DSP_STATUS status = DSP_SOK;
- struct DPC_OBJECT *pDPCObject = NULL;
-
- if ((phDPC != NULL) && (pfnDPC != NULL)) {
- /*
- * Allocate a DPC object to store information allowing our DPC
- * callback to dispatch to the client's DPC.
- */
- MEM_AllocObject(pDPCObject, struct DPC_OBJECT, SIGNATURE);
- if (pDPCObject != NULL) {
- tasklet_init(&pDPCObject->dpc_tasklet,
- DPC_DeferredProcedure,
- (u32) pDPCObject);
- /* Fill out our DPC Object: */
- pDPCObject->pRefData = pRefData;
- pDPCObject->pfnDPC = pfnDPC;
- pDPCObject->numRequested = 0;
- pDPCObject->numScheduled = 0;
-#ifdef DEBUG
- pDPCObject->numRequestedMax = 0;
- pDPCObject->cEntryCount = 0;
-#endif
- spin_lock_init(&pDPCObject->dpc_lock);
- *phDPC = pDPCObject;
- } else {
- GT_0trace(DPC_DebugMask, GT_6CLASS,
- "DPC_Create: DSP_EMEMORY\n");
- status = DSP_EMEMORY;
- }
- } else {
- GT_0trace(DPC_DebugMask, GT_6CLASS,
- "DPC_Create: DSP_EPOINTER\n");
- status = DSP_EPOINTER;
- }
- DBC_Ensure((DSP_FAILED(status) && (!phDPC || (phDPC && *phDPC == NULL)))
- || DSP_SUCCEEDED(status));
- return status;
-}
-
-/*
- * ======== DPC_Destroy ========
- * Purpose:
- * Cancel the last scheduled DPC, and deallocate a DPC object previously
- * allocated with DPC_Create(). Frees the Object only if the thread
- * and the event terminated successfuly.
- */
-DSP_STATUS DPC_Destroy(struct DPC_OBJECT *hDPC)
-{
- DSP_STATUS status = DSP_SOK;
- struct DPC_OBJECT *pDPCObject = (struct DPC_OBJECT *)hDPC;
-
- if (MEM_IsValidHandle(hDPC, SIGNATURE)) {
-
- /* Free our DPC object: */
- if (DSP_SUCCEEDED(status)) {
- tasklet_kill(&pDPCObject->dpc_tasklet);
- MEM_FreeObject(pDPCObject);
- pDPCObject = NULL;
- GT_0trace(DPC_DebugMask, GT_2CLASS,
- "DPC_Destroy: SUCCESS\n");
- }
- } else {
- GT_0trace(DPC_DebugMask, GT_6CLASS,
- "DPC_Destroy: DSP_EHANDLE\n");
- status = DSP_EHANDLE;
- }
- DBC_Ensure((DSP_SUCCEEDED(status) && pDPCObject == NULL)
- || DSP_FAILED(status));
- return status;
-}
-
/*
* ======== DPC_Exit ========
* Purpose:
@@ -167,54 +67,12 @@ bool DPC_Init(void)
}
/*
- * ======== DPC_Schedule ========
- * Purpose:
- * Schedule a deferred procedure call to be executed at a later time.
- * Latency and order of DPC execution is platform specific.
- */
-DSP_STATUS DPC_Schedule(struct DPC_OBJECT *hDPC)
-{
- DSP_STATUS status = DSP_SOK;
- struct DPC_OBJECT *pDPCObject = (struct DPC_OBJECT *)hDPC;
- unsigned long flags;
-
- GT_1trace(DPC_DebugMask, GT_ENTER, "DPC_Schedule hDPC %x\n", hDPC);
- if (MEM_IsValidHandle(hDPC, SIGNATURE)) {
- /* Increment count of DPC's pending. Needs to be protected
- * from ISRs since this function is called from process
- * context also. */
- spin_lock_irqsave(&hDPC->dpc_lock, flags);
- pDPCObject->numRequested++;
- spin_unlock_irqrestore(&hDPC->dpc_lock, flags);
- tasklet_schedule(&(hDPC->dpc_tasklet));
-#ifdef DEBUG
- if (pDPCObject->numRequested > pDPCObject->numScheduled +
- pDPCObject->numRequestedMax) {
- pDPCObject->numRequestedMax = pDPCObject->numRequested -
- pDPCObject->numScheduled;
- }
-#endif
- /* If an interrupt occurs between incrementing numRequested and the
- * assertion below, then DPC will get executed while returning from
- * ISR, which will complete all requests and make numRequested equal
- * to numScheduled, firing this assertion. This happens only when
- * DPC is being scheduled in process context */
- } else {
- GT_0trace(DPC_DebugMask, GT_6CLASS,
- "DPC_Schedule: DSP_EHANDLE\n");
- status = DSP_EHANDLE;
- }
- GT_1trace(DPC_DebugMask, GT_ENTER, "DPC_Schedule status %x\n", status);
- return status;
-}
-
-/*
* ======== DeferredProcedure ========
* Purpose:
* Main DPC routine. This is called by host OS DPC callback
* mechanism with interrupts enabled.
*/
-static void DPC_DeferredProcedure(IN unsigned long pDeferredContext)
+void DPC_DeferredProcedure(IN unsigned long pDeferredContext)
{
struct DPC_OBJECT *pDPCObject = (struct DPC_OBJECT *)pDeferredContext;
/* read numRequested in local variable */
diff --git a/drivers/dsp/bridge/wmd/io_sm.c b/drivers/dsp/bridge/wmd/io_sm.c
index 3a35378..b7b7bd9 100644
--- a/drivers/dsp/bridge/wmd/io_sm.c
+++ b/drivers/dsp/bridge/wmd/io_sm.c
@@ -248,7 +248,26 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
if (devType == DSP_UNIT) {
/* Create a DPC object */
- status = DPC_Create(&pIOMgr->hDPC, IO_DPC, (void *)pIOMgr);
+ MEM_AllocObject(pIOMgr->hDPC, struct DPC_OBJECT,
+ IO_MGRSIGNATURE);
+ if (pIOMgr->hDPC) {
+ tasklet_init(&pIOMgr->hDPC->dpc_tasklet,
+ DPC_DeferredProcedure, (u32)pIOMgr->hDPC);
+ /* Fill out our DPC Object */
+ pIOMgr->hDPC->pRefData = (void *)pIOMgr;
+ pIOMgr->hDPC->pfnDPC = IO_DPC;
+ pIOMgr->hDPC->numRequested = 0;
+ pIOMgr->hDPC->numScheduled = 0;
+#ifdef DEBUG
+ pIOMgr->hDPC->numRequestedMax = 0;
+ pIOMgr->hDPC->cEntryCount = 0;
+#endif
+ spin_lock_init(&pIOMgr->hDPC->dpc_lock);
+ } else {
+ DBG_Trace(GT_6CLASS, "IO DPC Create: DSP_EMEMORY\n");
+ status = DSP_EMEMORY;
+ }
+
if (DSP_SUCCEEDED(status))
status = DEV_GetDevNode(hDevObject, &hDevNode);
@@ -310,8 +329,13 @@ DSP_STATUS WMD_IO_Destroy(struct IO_MGR *hIOMgr)
destroy_workqueue(bridge_workqueue);
/* Linux function to uninstall ISR */
free_irq(INT_MAIL_MPU_IRQ, (void *)hIOMgr);
- if (hIOMgr->hDPC)
- (void)DPC_Destroy(hIOMgr->hDPC);
+
+ /* Free DPC object */
+ tasklet_kill(&hIOMgr->hDPC->dpc_tasklet);
+ MEM_FreeObject(hIOMgr->hDPC);
+ hIOMgr->hDPC = NULL;
+ DBG_Trace(GT_2CLASS, "DPC_Destroy: SUCCESS\n");
+
#ifndef DSP_TRACEBUF_DISABLED
if (hIOMgr->pMsg)
MEM_Free(hIOMgr->pMsg);
@@ -1032,6 +1056,8 @@ irqreturn_t IO_ISR(int irq, IN void *pRefData)
{
struct IO_MGR *hIOMgr = (struct IO_MGR *)pRefData;
bool fSchedDPC;
+ unsigned long flags;
+
if (irq != INT_MAIL_MPU_IRQ ||
!MEM_IsValidHandle(hIOMgr, IO_MGRSIGNATURE))
return IRQ_NONE;
@@ -1053,8 +1079,25 @@ irqreturn_t IO_ISR(int irq, IN void *pRefData)
DBG_Trace(DBG_LEVEL6, "*** DSP RESET ***\n");
hIOMgr->wIntrVal = 0;
} else if (fSchedDPC) {
- /* PROC-COPY defer i/o */
- DPC_Schedule(hIOMgr->hDPC);
+ /*
+ * PROC-COPY defer i/o.
+ * Increment count of DPC's pending.
+ */
+ spin_lock_irqsave(&hIOMgr->hDPC->dpc_lock, flags);
+ hIOMgr->hDPC->numRequested++;
+ spin_unlock_irqrestore(&hIOMgr->hDPC->dpc_lock, flags);
+
+ /* Schedule DPC */
+ tasklet_schedule(&hIOMgr->hDPC->dpc_tasklet);
+#ifdef DEBUG
+ if (hIOMgr->hDPC->numRequested >
+ hIOMgr->hDPC->numScheduled +
+ hIOMgr->hDPC->numRequestedMax) {
+ hIOMgr->hDPC->numRequestedMax =
+ hIOMgr->hDPC->numRequested -
+ hIOMgr->hDPC->numScheduled;
+ }
+#endif
}
} else {
/* Ensure that, if WMD didn't claim it, the IRQ is shared. */
@@ -1116,10 +1159,26 @@ func_end:
*/
void IO_Schedule(struct IO_MGR *pIOMgr)
{
+ unsigned long flags;
+
if (!MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE))
return;
- DPC_Schedule(pIOMgr->hDPC);
+ /* Increment count of DPC's pending. */
+ spin_lock_irqsave(&pIOMgr->hDPC->dpc_lock, flags);
+ pIOMgr->hDPC->numRequested++;
+ spin_unlock_irqrestore(&pIOMgr->hDPC->dpc_lock, flags);
+
+ /* Schedule DPC */
+ tasklet_schedule(&pIOMgr->hDPC->dpc_tasklet);
+#ifdef DEBUG
+ if (pIOMgr->hDPC->numRequested > pIOMgr->hDPC->numScheduled +
+ pIOMgr->hDPC->numRequestedMax) {
+ pIOMgr->hDPC->numRequestedMax = pIOMgr->hDPC->numRequested -
+ pIOMgr->hDPC->numScheduled;
+ }
+#endif
+
}
/*
diff --git a/drivers/dsp/bridge/wmd/mmu_fault.c b/drivers/dsp/bridge/wmd/mmu_fault.c
index 05a7f55..057fe65 100644
--- a/drivers/dsp/bridge/wmd/mmu_fault.c
+++ b/drivers/dsp/bridge/wmd/mmu_fault.c
@@ -77,7 +77,7 @@ irqreturn_t MMU_FaultIsr(int irq, IN void *pRefData)
struct WMD_DEV_CONTEXT *pDevContext;
struct CFG_HOSTRES resources;
DSP_STATUS status = DSP_SOK;
-
+ unsigned long flags;
DBG_Trace(DBG_LEVEL1, "Entering DEH_DspMmuIsr: 0x%x\n", pRefData);
DBC_Require(irq == INT_DSP_MMU_IRQ);
@@ -98,14 +98,30 @@ irqreturn_t MMU_FaultIsr(int irq, IN void *pRefData)
"0x%x\n", dmmuEventMask);
printk(KERN_INFO "***** DSPMMU FAULT ***** faultAddr "
"0x%x\n", faultAddr);
- /* Disable the MMU events, else once we clear it will
- * start to raise INTs again */
/*
* Schedule a DPC directly. In the future, it may be
* necessary to check if DSP MMU fault is intended for
* Bridge.
*/
- DPC_Schedule(pDehMgr->hMmuFaultDpc);
+ /* Increment count of DPC's pending. */
+ spin_lock_irqsave(&pDehMgr->hMmuFaultDpc->dpc_lock,
+ flags);
+ pDehMgr->hMmuFaultDpc->numRequested++;
+ spin_unlock_irqrestore(&pDehMgr->hMmuFaultDpc->dpc_lock,
+ flags);
+
+ /* Schedule DPC */
+ tasklet_schedule(&pDehMgr->hMmuFaultDpc->dpc_tasklet);
+#ifdef DEBUG
+ if (pDehMgr->hMmuFaultDpc->numRequested >
+ pDehMgr->hMmuFaultDpc->numScheduled +
+ pDehMgr->hMmuFaultDpc->numRequestedMax) {
+ pDehMgr->hMmuFaultDpc->numRequestedMax =
+ pDehMgr->hMmuFaultDpc->numRequested -
+ pDehMgr->hMmuFaultDpc->numScheduled;
+ }
+#endif
+
/* Reset errInfo structure before use. */
pDehMgr->errInfo.dwErrMask = DSP_MMUFAULT;
pDehMgr->errInfo.dwVal1 = faultAddr >> 16;
diff --git a/drivers/dsp/bridge/wmd/ue_deh.c b/drivers/dsp/bridge/wmd/ue_deh.c
index c480f62..d4d45d4 100644
--- a/drivers/dsp/bridge/wmd/ue_deh.c
+++ b/drivers/dsp/bridge/wmd/ue_deh.c
@@ -91,8 +91,27 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr,
status = NTFY_Create(&pDehMgr->hNtfy);
/* Create a DPC object. */
- status = DPC_Create(&pDehMgr->hMmuFaultDpc, MMU_FaultDpc,
- (void *)pDehMgr);
+ MEM_AllocObject(pDehMgr->hMmuFaultDpc, struct DPC_OBJECT,
+ SIGNATURE);
+ if (pDehMgr->hMmuFaultDpc) {
+ tasklet_init(&pDehMgr->hMmuFaultDpc->dpc_tasklet,
+ DPC_DeferredProcedure,
+ (u32)pDehMgr->hMmuFaultDpc);
+ /* Fill out DPC Object */
+ pDehMgr->hMmuFaultDpc->pRefData = (void *)pDehMgr;
+ pDehMgr->hMmuFaultDpc->pfnDPC = MMU_FaultDpc;
+ pDehMgr->hMmuFaultDpc->numRequested = 0;
+ pDehMgr->hMmuFaultDpc->numScheduled = 0;
+#ifdef DEBUG
+ pDehMgr->hMmuFaultDpc->numRequestedMax = 0;
+ pDehMgr->hMmuFaultDpc->cEntryCount = 0;
+#endif
+ spin_lock_init(&pDehMgr->hMmuFaultDpc->dpc_lock);
+ } else {
+ DBG_Trace(GT_6CLASS, "DEH DPC Create: DSP_EMEMORY\n");
+ status = DSP_EMEMORY;
+ }
+
if (DSP_SUCCEEDED(status))
status = DEV_GetDevNode(hDevObject, &hDevNode);
@@ -144,7 +163,13 @@ DSP_STATUS WMD_DEH_Destroy(struct DEH_MGR *hDehMgr)
(void)NTFY_Delete(pDehMgr->hNtfy);
/* Disable DSP MMU fault */
free_irq(INT_DSP_MMU_IRQ, pDehMgr);
- (void)DPC_Destroy(pDehMgr->hMmuFaultDpc);
+
+ /* Free DPC object */
+ tasklet_kill(&pDehMgr->hMmuFaultDpc->dpc_tasklet);
+ MEM_FreeObject(pDehMgr->hMmuFaultDpc);
+ pDehMgr->hMmuFaultDpc = NULL;
+ DBG_Trace(GT_2CLASS, "DPC_Destroy: SUCCESS\n");
+
/* Deallocate the DEH manager object */
MEM_FreeObject(pDehMgr);
}
--
1.6.2.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] DSPBRIDGE: Remove main DPC wrapper for IO and MMUfault
2010-01-15 23:35 ` [PATCH 1/4] DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers Omar Ramirez Luna
@ 2010-01-15 23:35 ` Omar Ramirez Luna
2010-01-15 23:35 ` [PATCH 3/4] DSPBRIDGE: Remove DPC module from SERVICES layer Omar Ramirez Luna
0 siblings, 1 reply; 6+ messages in thread
From: Omar Ramirez Luna @ 2010-01-15 23:35 UTC (permalink / raw)
To: linux-omap
Cc: Ameya Palande, Hiroshi Doyu, Felipe Contreras, Nishanth Menon,
Omar Ramirez Luna
Remove DeferredProcedure which is used as a wrapper to call
either IO or MMUfault DPCs. This also removes a custom typedef.
Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
---
arch/arm/plat-omap/include/dspbridge/dpc.h | 23 ---------------
arch/arm/plat-omap/include/dspbridge/io_sm.h | 2 +-
drivers/dsp/bridge/services/dpc.c | 36 -----------------------
drivers/dsp/bridge/wmd/io_sm.c | 40 +++++++++++++++++--------
drivers/dsp/bridge/wmd/mmu_fault.c | 2 +-
drivers/dsp/bridge/wmd/mmu_fault.h | 2 +-
drivers/dsp/bridge/wmd/ue_deh.c | 5 +--
7 files changed, 31 insertions(+), 79 deletions(-)
diff --git a/arch/arm/plat-omap/include/dspbridge/dpc.h b/arch/arm/plat-omap/include/dspbridge/dpc.h
index 0c60342..b22140f 100644
--- a/arch/arm/plat-omap/include/dspbridge/dpc.h
+++ b/arch/arm/plat-omap/include/dspbridge/dpc.h
@@ -19,30 +19,10 @@
#ifndef DPC_
#define DPC_
-/*
- * ======== DPC_PROC ========
- * Purpose:
- * Deferred processing routine. Typically scheduled from an ISR to
- * complete I/O processing.
- * Parameters:
- * pRefData: Ptr to user data: passed in via ISR_ScheduleDPC.
- * Returns:
- * Requires:
- * The DPC should not block, or otherwise acquire resources.
- * Interrupts to the processor are enabled.
- * DPC_PROC executes in a critical section.
- * Ensures:
- * This DPC will not be reenterred on the same thread.
- * However, the DPC may take hardware interrupts during execution.
- * Interrupts to the processor are enabled.
- */
- typedef void(*DPC_PROC) (void *pRefData);
-
/* The DPC object, passed to our priority event callback routine: */
struct DPC_OBJECT {
u32 dwSignature; /* Used for object validation. */
void *pRefData; /* Argument for client's DPC. */
- DPC_PROC pfnDPC; /* Client's DPC. */
u32 numRequested; /* Number of requested DPC's. */
u32 numScheduled; /* Number of executed DPC's. */
struct tasklet_struct dpc_tasklet;
@@ -81,7 +61,4 @@ struct DPC_OBJECT {
*/
extern bool DPC_Init(void);
-/* ----------------------------------- Function Prototypes */
- void DPC_DeferredProcedure(IN unsigned long pDeferredContext);
-
#endif /* DPC_ */
diff --git a/arch/arm/plat-omap/include/dspbridge/io_sm.h b/arch/arm/plat-omap/include/dspbridge/io_sm.h
index 77f9e25..67e3834 100644
--- a/arch/arm/plat-omap/include/dspbridge/io_sm.h
+++ b/arch/arm/plat-omap/include/dspbridge/io_sm.h
@@ -77,7 +77,7 @@
* Ensures:
* Non-preemptible (but interruptible).
*/
- extern void IO_DPC(IN OUT void *pRefData);
+ extern void IO_DPC(IN OUT unsigned long pRefData);
/*
* ======== IO_ISR ========
diff --git a/drivers/dsp/bridge/services/dpc.c b/drivers/dsp/bridge/services/dpc.c
index 10bd792..bbb2d47 100644
--- a/drivers/dsp/bridge/services/dpc.c
+++ b/drivers/dsp/bridge/services/dpc.c
@@ -66,39 +66,3 @@ bool DPC_Init(void)
return true;
}
-/*
- * ======== DeferredProcedure ========
- * Purpose:
- * Main DPC routine. This is called by host OS DPC callback
- * mechanism with interrupts enabled.
- */
-void DPC_DeferredProcedure(IN unsigned long pDeferredContext)
-{
- struct DPC_OBJECT *pDPCObject = (struct DPC_OBJECT *)pDeferredContext;
- /* read numRequested in local variable */
- u32 requested;
- u32 serviced;
-
- DBC_Require(pDPCObject != NULL);
- requested = pDPCObject->numRequested;
- serviced = pDPCObject->numScheduled;
-
- GT_1trace(DPC_DebugMask, GT_ENTER, "> DPC_DeferredProcedure "
- "pDeferredContext=%x\n", pDeferredContext);
- /* Rollover taken care of using != instead of < */
- if (serviced != requested) {
- if (pDPCObject->pfnDPC != NULL) {
- /* Process pending DPC's: */
- do {
- /* Call client's DPC: */
- (*(pDPCObject->pfnDPC))(pDPCObject->pRefData);
- serviced++;
- } while (serviced != requested);
- }
- pDPCObject->numScheduled = requested;
- }
- GT_2trace(DPC_DebugMask, GT_ENTER,
- "< DPC_DeferredProcedure requested %d"
- " serviced %d\n", requested, serviced);
-}
-
diff --git a/drivers/dsp/bridge/wmd/io_sm.c b/drivers/dsp/bridge/wmd/io_sm.c
index b7b7bd9..470c83b 100644
--- a/drivers/dsp/bridge/wmd/io_sm.c
+++ b/drivers/dsp/bridge/wmd/io_sm.c
@@ -252,10 +252,8 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
IO_MGRSIGNATURE);
if (pIOMgr->hDPC) {
tasklet_init(&pIOMgr->hDPC->dpc_tasklet,
- DPC_DeferredProcedure, (u32)pIOMgr->hDPC);
+ IO_DPC, (u32)pIOMgr);
/* Fill out our DPC Object */
- pIOMgr->hDPC->pRefData = (void *)pIOMgr;
- pIOMgr->hDPC->pfnDPC = IO_DPC;
pIOMgr->hDPC->numRequested = 0;
pIOMgr->hDPC->numScheduled = 0;
#ifdef DEBUG
@@ -1010,12 +1008,14 @@ static void IO_DispatchPM(struct work_struct *work)
* out the dispatch of I/O as a non-preemptible event.It can only be
* pre-empted by an ISR.
*/
-void IO_DPC(IN OUT void *pRefData)
+void IO_DPC(IN OUT unsigned long pRefData)
{
struct IO_MGR *pIOMgr = (struct IO_MGR *)pRefData;
struct CHNL_MGR *pChnlMgr;
struct MSG_MGR *pMsgMgr;
struct DEH_MGR *hDehMgr;
+ u32 requested;
+ u32 serviced;
if (!MEM_IsValidHandle(pIOMgr, IO_MGRSIGNATURE))
goto func_end;
@@ -1025,16 +1025,27 @@ void IO_DPC(IN OUT void *pRefData)
if (!MEM_IsValidHandle(pChnlMgr, CHNL_MGRSIGNATURE))
goto func_end;
DBG_Trace(DBG_LEVEL7, "Entering IO_DPC(0x%x)\n", pRefData);
- /* Check value of interrupt register to ensure it is a valid error */
- if ((pIOMgr->wIntrVal > DEH_BASE) && (pIOMgr->wIntrVal < DEH_LIMIT)) {
- /* Notify DSP/BIOS exception */
- if (hDehMgr)
- WMD_DEH_Notify(hDehMgr, DSP_SYSERROR, pIOMgr->wIntrVal);
- }
- IO_DispatchChnl(pIOMgr, NULL, IO_SERVICE);
+
+ requested = pIOMgr->hDPC->numRequested;
+ serviced = pIOMgr->hDPC->numScheduled;
+
+ if (serviced == requested)
+ goto func_end;
+
+ /* Process pending DPC's */
+ do {
+ /* Check value of interrupt reg to ensure it's a valid error */
+ if ((pIOMgr->wIntrVal > DEH_BASE) &&
+ (pIOMgr->wIntrVal < DEH_LIMIT)) {
+ /* Notify DSP/BIOS exception */
+ if (hDehMgr)
+ WMD_DEH_Notify(hDehMgr, DSP_SYSERROR,
+ pIOMgr->wIntrVal);
+ }
+ IO_DispatchChnl(pIOMgr, NULL, IO_SERVICE);
#ifdef CHNL_MESSAGES
- if (MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE))
- IO_DispatchMsg(pIOMgr, pMsgMgr);
+ if (MEM_IsValidHandle(pMsgMgr, MSGMGR_SIGNATURE))
+ IO_DispatchMsg(pIOMgr, pMsgMgr);
#endif
#ifndef DSP_TRACEBUF_DISABLED
if (pIOMgr->wIntrVal & MBX_DBG_SYSPRINTF) {
@@ -1042,6 +1053,9 @@ void IO_DPC(IN OUT void *pRefData)
PrintDSPDebugTrace(pIOMgr);
}
#endif
+ serviced++;
+ } while (serviced != requested);
+ pIOMgr->hDPC->numScheduled = requested;
func_end:
return;
}
diff --git a/drivers/dsp/bridge/wmd/mmu_fault.c b/drivers/dsp/bridge/wmd/mmu_fault.c
index 057fe65..d3807ac 100644
--- a/drivers/dsp/bridge/wmd/mmu_fault.c
+++ b/drivers/dsp/bridge/wmd/mmu_fault.c
@@ -54,7 +54,7 @@ static bool MMU_CheckIfFault(struct WMD_DEV_CONTEXT *pDevContext);
* ======== MMU_FaultDpc ========
* Deferred procedure call to handle DSP MMU fault.
*/
-void MMU_FaultDpc(IN void *pRefData)
+void MMU_FaultDpc(IN unsigned long pRefData)
{
struct DEH_MGR *hDehMgr = (struct DEH_MGR *)pRefData;
struct DEH_MGR *pDehMgr = (struct DEH_MGR *)hDehMgr;
diff --git a/drivers/dsp/bridge/wmd/mmu_fault.h b/drivers/dsp/bridge/wmd/mmu_fault.h
index bed466c..d3849b5 100644
--- a/drivers/dsp/bridge/wmd/mmu_fault.h
+++ b/drivers/dsp/bridge/wmd/mmu_fault.h
@@ -23,7 +23,7 @@
* ======== MMU_FaultDpc ========
* Deferred procedure call to handle DSP MMU fault.
*/
- void MMU_FaultDpc(IN void *pRefData);
+ void MMU_FaultDpc(IN unsigned long pRefData);
/*
* ======== MMU_FaultIsr ========
diff --git a/drivers/dsp/bridge/wmd/ue_deh.c b/drivers/dsp/bridge/wmd/ue_deh.c
index d4d45d4..cd2d220 100644
--- a/drivers/dsp/bridge/wmd/ue_deh.c
+++ b/drivers/dsp/bridge/wmd/ue_deh.c
@@ -95,11 +95,8 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr,
SIGNATURE);
if (pDehMgr->hMmuFaultDpc) {
tasklet_init(&pDehMgr->hMmuFaultDpc->dpc_tasklet,
- DPC_DeferredProcedure,
- (u32)pDehMgr->hMmuFaultDpc);
+ MMU_FaultDpc, (u32)pDehMgr);
/* Fill out DPC Object */
- pDehMgr->hMmuFaultDpc->pRefData = (void *)pDehMgr;
- pDehMgr->hMmuFaultDpc->pfnDPC = MMU_FaultDpc;
pDehMgr->hMmuFaultDpc->numRequested = 0;
pDehMgr->hMmuFaultDpc->numScheduled = 0;
#ifdef DEBUG
--
1.6.2.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] DSPBRIDGE: Remove DPC module from SERVICES layer
2010-01-15 23:35 ` [PATCH 2/4] DSPBRIDGE: Remove main DPC wrapper for IO and MMUfault Omar Ramirez Luna
@ 2010-01-15 23:35 ` Omar Ramirez Luna
2010-01-15 23:35 ` [PATCH 4/4] DSPBRIDGE: Remove DPC object structure Omar Ramirez Luna
0 siblings, 1 reply; 6+ messages in thread
From: Omar Ramirez Luna @ 2010-01-15 23:35 UTC (permalink / raw)
To: linux-omap
Cc: Ameya Palande, Hiroshi Doyu, Felipe Contreras, Nishanth Menon,
Omar Ramirez Luna
This patch removes init and exit functions for DPC module.
It also deletes dpc source file and takes out the module from
Makefile.
Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
---
arch/arm/plat-omap/include/dspbridge/dpc.h | 26 -----------
drivers/dsp/bridge/Makefile | 3 +-
drivers/dsp/bridge/services/dpc.c | 68 ----------------------------
drivers/dsp/bridge/services/services.c | 9 +---
4 files changed, 3 insertions(+), 103 deletions(-)
delete mode 100644 drivers/dsp/bridge/services/dpc.c
diff --git a/arch/arm/plat-omap/include/dspbridge/dpc.h b/arch/arm/plat-omap/include/dspbridge/dpc.h
index b22140f..aee910d 100644
--- a/arch/arm/plat-omap/include/dspbridge/dpc.h
+++ b/arch/arm/plat-omap/include/dspbridge/dpc.h
@@ -35,30 +35,4 @@ struct DPC_OBJECT {
spinlock_t dpc_lock;
};
-/*
- * ======== DPC_Exit ========
- * Purpose:
- * Discontinue usage of the DPC module.
- * Parameters:
- * Returns:
- * Requires:
- * DPC_Init(void) was previously called.
- * Ensures:
- * Resources acquired in DPC_Init(void) are freed.
- */
- extern void DPC_Exit(void);
-
-/*
- * ======== DPC_Init ========
- * Purpose:
- * Initialize the DPC module's private state.
- * Parameters:
- * Returns:
- * TRUE if initialized; FALSE if error occured.
- * Requires:
- * Ensures:
- * A requirement for each of the other public DPC functions.
- */
- extern bool DPC_Init(void);
-
#endif /* DPC_ */
diff --git a/drivers/dsp/bridge/Makefile b/drivers/dsp/bridge/Makefile
index cb6d1ce..df870c9 100644
--- a/drivers/dsp/bridge/Makefile
+++ b/drivers/dsp/bridge/Makefile
@@ -1,8 +1,7 @@
obj-$(CONFIG_MPU_BRIDGE) += bridgedriver.o
libgen = gen/gb.o gen/gt.o gen/gs.o gen/gh.o gen/_gt_para.o gen/uuidutil.o
-libservices = services/mem.o services/list.o services/dpc.o \
- services/sync.o \
+libservices = services/mem.o services/list.o services/sync.o \
services/clk.o services/cfg.o services/reg.o \
services/regsup.o services/ntfy.o \
services/dbg.o services/services.o
diff --git a/drivers/dsp/bridge/services/dpc.c b/drivers/dsp/bridge/services/dpc.c
deleted file mode 100644
index bbb2d47..0000000
--- a/drivers/dsp/bridge/services/dpc.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * dpc.c
- *
- * DSP-BIOS Bridge driver support functions for TI OMAP processors.
- *
- * Deferred Procedure Call(DPC) Services.
- *
- * Copyright (C) 2005-2006 Texas Instruments, Inc.
- *
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-/* ----------------------------------- Host OS */
-#include <dspbridge/host_os.h>
-
-/* ----------------------------------- DSP/BIOS Bridge */
-#include <dspbridge/std.h>
-#include <dspbridge/dbdefs.h>
-#include <dspbridge/errbase.h>
-
-/* ----------------------------------- Trace & Debug */
-#include <dspbridge/dbc.h>
-#include <dspbridge/gt.h>
-
-/* ----------------------------------- OS Adaptation Layer */
-#include <dspbridge/mem.h>
-
-/* ----------------------------------- This */
-#include <dspbridge/dpc.h>
-
-/* ----------------------------------- Defines, Data Structures, Typedefs */
-#define SIGNATURE 0x5f435044 /* "DPC_" (in reverse). */
-
-/* ----------------------------------- Globals */
-#if GT_TRACE
-static struct GT_Mask DPC_DebugMask = { NULL, NULL }; /* DPC Debug Mask */
-#endif
-
-/*
- * ======== DPC_Exit ========
- * Purpose:
- * Discontinue usage of the DPC module.
- */
-void DPC_Exit(void)
-{
- GT_0trace(DPC_DebugMask, GT_5CLASS, "Entered DPC_Exit\n");
-}
-
-/*
- * ======== DPC_Init ========
- * Purpose:
- * Initialize the DPC module's private state.
- */
-bool DPC_Init(void)
-{
- GT_create(&DPC_DebugMask, "DP");
-
- GT_0trace(DPC_DebugMask, GT_5CLASS, "Entered DPC_Init\n");
-
- return true;
-}
-
diff --git a/drivers/dsp/bridge/services/services.c b/drivers/dsp/bridge/services/services.c
index 7d35f03..e337cf3 100644
--- a/drivers/dsp/bridge/services/services.c
+++ b/drivers/dsp/bridge/services/services.c
@@ -68,7 +68,6 @@ void SERVICES_Exit(void)
CLK_Exit();
REG_Exit();
LST_Exit();
- DPC_Exit();
DBG_Exit();
CFG_Exit();
MEM_Exit();
@@ -87,7 +86,7 @@ void SERVICES_Exit(void)
bool SERVICES_Init(void)
{
bool fInit = true;
- bool fCFG, fDBG, fDPC, fLST, fMEM;
+ bool fCFG, fDBG, fLST, fMEM;
bool fREG, fSYNC, fCLK, fNTFY;
DBC_Require(cRefs >= 0);
@@ -105,13 +104,12 @@ bool SERVICES_Init(void)
fREG = REG_Init();
fCFG = CFG_Init();
fDBG = DBG_Init();
- fDPC = DPC_Init();
fLST = LST_Init();
fSYNC = SYNC_Init();
fCLK = CLK_Init();
fNTFY = NTFY_Init();
- fInit = fCFG && fDBG && fDPC &&
+ fInit = fCFG && fDBG &&
fLST && fMEM && fREG && fSYNC && fCLK;
if (!fInit) {
@@ -130,9 +128,6 @@ bool SERVICES_Init(void)
if (fLST)
LST_Exit();
- if (fDPC)
- DPC_Exit();
-
if (fDBG)
DBG_Exit();
--
1.6.2.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] DSPBRIDGE: Remove DPC object structure
2010-01-15 23:35 ` [PATCH 3/4] DSPBRIDGE: Remove DPC module from SERVICES layer Omar Ramirez Luna
@ 2010-01-15 23:35 ` Omar Ramirez Luna
0 siblings, 0 replies; 6+ messages in thread
From: Omar Ramirez Luna @ 2010-01-15 23:35 UTC (permalink / raw)
To: linux-omap
Cc: Ameya Palande, Hiroshi Doyu, Felipe Contreras, Nishanth Menon,
Omar Ramirez Luna
Remove DPC object structure and declare required members
for each tasklet inside their correspondent modules.
Remove dpc header file.
Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
---
arch/arm/plat-omap/include/dspbridge/_chnl_sm.h | 1 -
arch/arm/plat-omap/include/dspbridge/dpc.h | 38 -----------
drivers/dsp/bridge/pmgr/chnl.c | 1 -
drivers/dsp/bridge/services/services.c | 1 -
drivers/dsp/bridge/wmd/_deh.h | 5 +-
drivers/dsp/bridge/wmd/io_sm.c | 79 ++++++++---------------
drivers/dsp/bridge/wmd/mmu_fault.c | 24 +------
drivers/dsp/bridge/wmd/ue_deh.c | 25 +------
8 files changed, 35 insertions(+), 139 deletions(-)
delete mode 100644 arch/arm/plat-omap/include/dspbridge/dpc.h
diff --git a/arch/arm/plat-omap/include/dspbridge/_chnl_sm.h b/arch/arm/plat-omap/include/dspbridge/_chnl_sm.h
index f22b2cb..eb5adc2 100644
--- a/arch/arm/plat-omap/include/dspbridge/_chnl_sm.h
+++ b/arch/arm/plat-omap/include/dspbridge/_chnl_sm.h
@@ -25,7 +25,6 @@
#include <dspbridge/wcd.h>
#include <dspbridge/wmd.h>
-#include <dspbridge/dpc.h>
#include <dspbridge/list.h>
#include <dspbridge/ntfy.h>
diff --git a/arch/arm/plat-omap/include/dspbridge/dpc.h b/arch/arm/plat-omap/include/dspbridge/dpc.h
deleted file mode 100644
index aee910d..0000000
--- a/arch/arm/plat-omap/include/dspbridge/dpc.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * dpc.h
- *
- * DSP-BIOS Bridge driver support functions for TI OMAP processors.
- *
- * Deferred Procedure Call(DPC) Services.
- *
- * Copyright (C) 2005-2006 Texas Instruments, Inc.
- *
- * This package is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#ifndef DPC_
-#define DPC_
-
-/* The DPC object, passed to our priority event callback routine: */
-struct DPC_OBJECT {
- u32 dwSignature; /* Used for object validation. */
- void *pRefData; /* Argument for client's DPC. */
- u32 numRequested; /* Number of requested DPC's. */
- u32 numScheduled; /* Number of executed DPC's. */
- struct tasklet_struct dpc_tasklet;
-
-#ifdef DEBUG
- u32 cEntryCount; /* Number of times DPC reentered. */
- u32 numRequestedMax; /* Keep track of max pending DPC's. */
-#endif
-
- spinlock_t dpc_lock;
-};
-
-#endif /* DPC_ */
diff --git a/drivers/dsp/bridge/pmgr/chnl.c b/drivers/dsp/bridge/pmgr/chnl.c
index f4d0fc1..fd487f0 100644
--- a/drivers/dsp/bridge/pmgr/chnl.c
+++ b/drivers/dsp/bridge/pmgr/chnl.c
@@ -31,7 +31,6 @@
/* ----------------------------------- OS Adaptation Layer */
#include <dspbridge/cfg.h>
-#include <dspbridge/dpc.h>
#include <dspbridge/list.h>
#include <dspbridge/mem.h>
#include <dspbridge/sync.h>
diff --git a/drivers/dsp/bridge/services/services.c b/drivers/dsp/bridge/services/services.c
index e337cf3..efedb00 100644
--- a/drivers/dsp/bridge/services/services.c
+++ b/drivers/dsp/bridge/services/services.c
@@ -29,7 +29,6 @@
/* ----------------------------------- OS Adaptation Layer */
#include <dspbridge/cfg.h>
#include <dspbridge/dbg.h>
-#include <dspbridge/dpc.h>
#include <dspbridge/list.h>
#include <dspbridge/mem.h>
#include <dspbridge/ntfy.h>
diff --git a/drivers/dsp/bridge/wmd/_deh.h b/drivers/dsp/bridge/wmd/_deh.h
index 2b364b5..aadb9fa 100644
--- a/drivers/dsp/bridge/wmd/_deh.h
+++ b/drivers/dsp/bridge/wmd/_deh.h
@@ -19,7 +19,6 @@
#ifndef _DEH_
#define _DEH_
-#include <dspbridge/dpc.h>
#include <dspbridge/ntfy.h>
#include <dspbridge/wmd.h>
@@ -30,8 +29,10 @@ struct DEH_MGR {
u32 dwSignature; /* Used for object validation. */
struct WMD_DEV_CONTEXT *hWmdContext; /* WMD device context. */
struct NTFY_OBJECT *hNtfy; /* NTFY object */
- struct DPC_OBJECT *hMmuFaultDpc; /* DPC object handle. */
struct DSP_ERRORINFO errInfo; /* DSP exception info. */
+
+ /* MMU Fault DPC */
+ struct tasklet_struct dpc_tasklet;
} ;
#endif /* _DEH_ */
diff --git a/drivers/dsp/bridge/wmd/io_sm.c b/drivers/dsp/bridge/wmd/io_sm.c
index 470c83b..4511ec5 100644
--- a/drivers/dsp/bridge/wmd/io_sm.c
+++ b/drivers/dsp/bridge/wmd/io_sm.c
@@ -39,7 +39,6 @@
/* Services Layer */
#include <dspbridge/cfg.h>
-#include <dspbridge/dpc.h>
#include <dspbridge/mem.h>
#include <dspbridge/ntfy.h>
#include <dspbridge/sync.h>
@@ -104,7 +103,6 @@ struct IO_MGR {
u8 *pMsgOutput; /* Address of output messages */
u32 uSMBufSize; /* Size of a shared memory I/O channel */
bool fSharedIRQ; /* Is this IRQ shared? */
- struct DPC_OBJECT *hDPC; /* DPC object handle */
struct SYNC_CSOBJECT *hCSObj; /* Critical section object handle */
u32 uWordSize; /* Size in bytes of DSP word */
u16 wIntrVal; /* Interrupt value */
@@ -124,6 +122,12 @@ struct IO_MGR {
u32 ulGppVa;
u32 ulDspVa;
#endif
+ /* IO Dpc */
+ u32 dpc_req; /* Number of requested DPC's. */
+ u32 dpc_sched; /* Number of executed DPC's. */
+ struct tasklet_struct dpc_tasklet;
+ spinlock_t dpc_lock;
+
} ;
/* Function Prototypes */
@@ -247,24 +251,14 @@ DSP_STATUS WMD_IO_Create(OUT struct IO_MGR **phIOMgr,
status = SYNC_InitializeCS(&pIOMgr->hCSObj);
if (devType == DSP_UNIT) {
- /* Create a DPC object */
- MEM_AllocObject(pIOMgr->hDPC, struct DPC_OBJECT,
- IO_MGRSIGNATURE);
- if (pIOMgr->hDPC) {
- tasklet_init(&pIOMgr->hDPC->dpc_tasklet,
- IO_DPC, (u32)pIOMgr);
- /* Fill out our DPC Object */
- pIOMgr->hDPC->numRequested = 0;
- pIOMgr->hDPC->numScheduled = 0;
-#ifdef DEBUG
- pIOMgr->hDPC->numRequestedMax = 0;
- pIOMgr->hDPC->cEntryCount = 0;
-#endif
- spin_lock_init(&pIOMgr->hDPC->dpc_lock);
- } else {
- DBG_Trace(GT_6CLASS, "IO DPC Create: DSP_EMEMORY\n");
- status = DSP_EMEMORY;
- }
+ /* Create an IO DPC */
+ tasklet_init(&pIOMgr->dpc_tasklet, IO_DPC, (u32)pIOMgr);
+
+ /* Initialize DPC counters */
+ pIOMgr->dpc_req = 0;
+ pIOMgr->dpc_sched = 0;
+
+ spin_lock_init(&pIOMgr->dpc_lock);
if (DSP_SUCCEEDED(status))
status = DEV_GetDevNode(hDevObject, &hDevNode);
@@ -328,10 +322,8 @@ DSP_STATUS WMD_IO_Destroy(struct IO_MGR *hIOMgr)
/* Linux function to uninstall ISR */
free_irq(INT_MAIL_MPU_IRQ, (void *)hIOMgr);
- /* Free DPC object */
- tasklet_kill(&hIOMgr->hDPC->dpc_tasklet);
- MEM_FreeObject(hIOMgr->hDPC);
- hIOMgr->hDPC = NULL;
+ /* Free IO DPC object */
+ tasklet_kill(&hIOMgr->dpc_tasklet);
DBG_Trace(GT_2CLASS, "DPC_Destroy: SUCCESS\n");
#ifndef DSP_TRACEBUF_DISABLED
@@ -1026,8 +1018,8 @@ void IO_DPC(IN OUT unsigned long pRefData)
goto func_end;
DBG_Trace(DBG_LEVEL7, "Entering IO_DPC(0x%x)\n", pRefData);
- requested = pIOMgr->hDPC->numRequested;
- serviced = pIOMgr->hDPC->numScheduled;
+ requested = pIOMgr->dpc_req;
+ serviced = pIOMgr->dpc_sched;
if (serviced == requested)
goto func_end;
@@ -1055,7 +1047,7 @@ void IO_DPC(IN OUT unsigned long pRefData)
#endif
serviced++;
} while (serviced != requested);
- pIOMgr->hDPC->numScheduled = requested;
+ pIOMgr->dpc_sched = requested;
func_end:
return;
}
@@ -1097,21 +1089,12 @@ irqreturn_t IO_ISR(int irq, IN void *pRefData)
* PROC-COPY defer i/o.
* Increment count of DPC's pending.
*/
- spin_lock_irqsave(&hIOMgr->hDPC->dpc_lock, flags);
- hIOMgr->hDPC->numRequested++;
- spin_unlock_irqrestore(&hIOMgr->hDPC->dpc_lock, flags);
+ spin_lock_irqsave(&hIOMgr->dpc_lock, flags);
+ hIOMgr->dpc_req++;
+ spin_unlock_irqrestore(&hIOMgr->dpc_lock, flags);
/* Schedule DPC */
- tasklet_schedule(&hIOMgr->hDPC->dpc_tasklet);
-#ifdef DEBUG
- if (hIOMgr->hDPC->numRequested >
- hIOMgr->hDPC->numScheduled +
- hIOMgr->hDPC->numRequestedMax) {
- hIOMgr->hDPC->numRequestedMax =
- hIOMgr->hDPC->numRequested -
- hIOMgr->hDPC->numScheduled;
- }
-#endif
+ tasklet_schedule(&hIOMgr->dpc_tasklet);
}
} else {
/* Ensure that, if WMD didn't claim it, the IRQ is shared. */
@@ -1179,20 +1162,12 @@ void IO_Schedule(struct IO_MGR *pIOMgr)
return;
/* Increment count of DPC's pending. */
- spin_lock_irqsave(&pIOMgr->hDPC->dpc_lock, flags);
- pIOMgr->hDPC->numRequested++;
- spin_unlock_irqrestore(&pIOMgr->hDPC->dpc_lock, flags);
+ spin_lock_irqsave(&pIOMgr->dpc_lock, flags);
+ pIOMgr->dpc_req++;
+ spin_unlock_irqrestore(&pIOMgr->dpc_lock, flags);
/* Schedule DPC */
- tasklet_schedule(&pIOMgr->hDPC->dpc_tasklet);
-#ifdef DEBUG
- if (pIOMgr->hDPC->numRequested > pIOMgr->hDPC->numScheduled +
- pIOMgr->hDPC->numRequestedMax) {
- pIOMgr->hDPC->numRequestedMax = pIOMgr->hDPC->numRequested -
- pIOMgr->hDPC->numScheduled;
- }
-#endif
-
+ tasklet_schedule(&pIOMgr->dpc_tasklet);
}
/*
diff --git a/drivers/dsp/bridge/wmd/mmu_fault.c b/drivers/dsp/bridge/wmd/mmu_fault.c
index d3807ac..ef6ea77 100644
--- a/drivers/dsp/bridge/wmd/mmu_fault.c
+++ b/drivers/dsp/bridge/wmd/mmu_fault.c
@@ -27,7 +27,6 @@
#include <dspbridge/dbg.h>
/* ----------------------------------- OS Adaptation Layer */
-#include <dspbridge/dpc.h>
#include <dspbridge/mem.h>
#include <dspbridge/drv.h>
@@ -57,11 +56,10 @@ static bool MMU_CheckIfFault(struct WMD_DEV_CONTEXT *pDevContext);
void MMU_FaultDpc(IN unsigned long pRefData)
{
struct DEH_MGR *hDehMgr = (struct DEH_MGR *)pRefData;
- struct DEH_MGR *pDehMgr = (struct DEH_MGR *)hDehMgr;
DBG_Trace(DBG_LEVEL1, "MMU_FaultDpc Enter: 0x%x\n", pRefData);
- if (pDehMgr)
+ if (hDehMgr)
WMD_DEH_Notify(hDehMgr, DSP_MMUFAULT, 0L);
DBG_Trace(DBG_LEVEL1, "MMU_FaultDpc Exit: 0x%x\n", pRefData);
@@ -77,7 +75,6 @@ irqreturn_t MMU_FaultIsr(int irq, IN void *pRefData)
struct WMD_DEV_CONTEXT *pDevContext;
struct CFG_HOSTRES resources;
DSP_STATUS status = DSP_SOK;
- unsigned long flags;
DBG_Trace(DBG_LEVEL1, "Entering DEH_DspMmuIsr: 0x%x\n", pRefData);
DBC_Require(irq == INT_DSP_MMU_IRQ);
@@ -103,24 +100,7 @@ irqreturn_t MMU_FaultIsr(int irq, IN void *pRefData)
* necessary to check if DSP MMU fault is intended for
* Bridge.
*/
- /* Increment count of DPC's pending. */
- spin_lock_irqsave(&pDehMgr->hMmuFaultDpc->dpc_lock,
- flags);
- pDehMgr->hMmuFaultDpc->numRequested++;
- spin_unlock_irqrestore(&pDehMgr->hMmuFaultDpc->dpc_lock,
- flags);
-
- /* Schedule DPC */
- tasklet_schedule(&pDehMgr->hMmuFaultDpc->dpc_tasklet);
-#ifdef DEBUG
- if (pDehMgr->hMmuFaultDpc->numRequested >
- pDehMgr->hMmuFaultDpc->numScheduled +
- pDehMgr->hMmuFaultDpc->numRequestedMax) {
- pDehMgr->hMmuFaultDpc->numRequestedMax =
- pDehMgr->hMmuFaultDpc->numRequested -
- pDehMgr->hMmuFaultDpc->numScheduled;
- }
-#endif
+ tasklet_schedule(&pDehMgr->dpc_tasklet);
/* Reset errInfo structure before use. */
pDehMgr->errInfo.dwErrMask = DSP_MMUFAULT;
diff --git a/drivers/dsp/bridge/wmd/ue_deh.c b/drivers/dsp/bridge/wmd/ue_deh.c
index cd2d220..daf75b6 100644
--- a/drivers/dsp/bridge/wmd/ue_deh.c
+++ b/drivers/dsp/bridge/wmd/ue_deh.c
@@ -30,7 +30,6 @@
/* ----------------------------------- OS Adaptation Layer */
#include <dspbridge/cfg.h>
-#include <dspbridge/dpc.h>
#include <dspbridge/mem.h>
#include <dspbridge/ntfy.h>
#include <dspbridge/drv.h>
@@ -90,24 +89,8 @@ DSP_STATUS WMD_DEH_Create(OUT struct DEH_MGR **phDehMgr,
if (DSP_SUCCEEDED(status))
status = NTFY_Create(&pDehMgr->hNtfy);
- /* Create a DPC object. */
- MEM_AllocObject(pDehMgr->hMmuFaultDpc, struct DPC_OBJECT,
- SIGNATURE);
- if (pDehMgr->hMmuFaultDpc) {
- tasklet_init(&pDehMgr->hMmuFaultDpc->dpc_tasklet,
- MMU_FaultDpc, (u32)pDehMgr);
- /* Fill out DPC Object */
- pDehMgr->hMmuFaultDpc->numRequested = 0;
- pDehMgr->hMmuFaultDpc->numScheduled = 0;
-#ifdef DEBUG
- pDehMgr->hMmuFaultDpc->numRequestedMax = 0;
- pDehMgr->hMmuFaultDpc->cEntryCount = 0;
-#endif
- spin_lock_init(&pDehMgr->hMmuFaultDpc->dpc_lock);
- } else {
- DBG_Trace(GT_6CLASS, "DEH DPC Create: DSP_EMEMORY\n");
- status = DSP_EMEMORY;
- }
+ /* Create a MMUfault DPC */
+ tasklet_init(&pDehMgr->dpc_tasklet, MMU_FaultDpc, (u32)pDehMgr);
if (DSP_SUCCEEDED(status))
status = DEV_GetDevNode(hDevObject, &hDevNode);
@@ -162,9 +145,7 @@ DSP_STATUS WMD_DEH_Destroy(struct DEH_MGR *hDehMgr)
free_irq(INT_DSP_MMU_IRQ, pDehMgr);
/* Free DPC object */
- tasklet_kill(&pDehMgr->hMmuFaultDpc->dpc_tasklet);
- MEM_FreeObject(pDehMgr->hMmuFaultDpc);
- pDehMgr->hMmuFaultDpc = NULL;
+ tasklet_kill(&pDehMgr->dpc_tasklet);
DBG_Trace(GT_2CLASS, "DPC_Destroy: SUCCESS\n");
/* Deallocate the DEH manager object */
--
1.6.2.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH 0/4] DPC Removal from services
2010-01-15 23:35 [PATCH 0/4] DPC Removal from services Omar Ramirez Luna
2010-01-15 23:35 ` [PATCH 1/4] DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers Omar Ramirez Luna
@ 2010-01-18 19:15 ` Ramirez Luna, Omar
1 sibling, 0 replies; 6+ messages in thread
From: Ramirez Luna, Omar @ 2010-01-18 19:15 UTC (permalink / raw)
To: Ramirez Luna, Omar, linux-omap
Cc: Ameya Palande, Hiroshi Doyu, Felipe Contreras, Menon, Nishanth
>From: Ramirez Luna, Omar on Friday, January 15, 2010 5:35 PM
>
>This patches remove the DPC custom implementation and wrappers.
>
>They should be applied on top of "trivial cleanups" set and are
>part of the current patch queue.
>
>Omar Ramirez Luna (4):
> DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers
> DSPBRIDGE: Remove main DPC wrapper for IO and MMUfault
> DSPBRIDGE: Remove DPC module from SERVICES layer
> DSPBRIDGE: Remove DPC object structure
>
> arch/arm/plat-omap/include/dspbridge/_chnl_sm.h | 1 -
> arch/arm/plat-omap/include/dspbridge/dpc.h | 145 -------------
> arch/arm/plat-omap/include/dspbridge/io_sm.h | 2 +-
> drivers/dsp/bridge/Makefile | 3 +-
> drivers/dsp/bridge/pmgr/chnl.c | 1 -
> drivers/dsp/bridge/services/dpc.c | 246 -----------------------
> drivers/dsp/bridge/services/services.c | 10 +-
> drivers/dsp/bridge/wmd/_deh.h | 5 +-
> drivers/dsp/bridge/wmd/io_sm.c | 86 ++++++--
> drivers/dsp/bridge/wmd/mmu_fault.c | 12 +-
> drivers/dsp/bridge/wmd/mmu_fault.h | 2 +-
> drivers/dsp/bridge/wmd/ue_deh.c | 13 +-
> 12 files changed, 87 insertions(+), 439 deletions(-)
> delete mode 100644 arch/arm/plat-omap/include/dspbridge/dpc.h
> delete mode 100644 drivers/dsp/bridge/services/dpc.c
Pushed to dspbridge
- omar
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-01-18 19:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-15 23:35 [PATCH 0/4] DPC Removal from services Omar Ramirez Luna
2010-01-15 23:35 ` [PATCH 1/4] DSPBRIDGE: Remove DPC, create, destroy and schedule wrappers Omar Ramirez Luna
2010-01-15 23:35 ` [PATCH 2/4] DSPBRIDGE: Remove main DPC wrapper for IO and MMUfault Omar Ramirez Luna
2010-01-15 23:35 ` [PATCH 3/4] DSPBRIDGE: Remove DPC module from SERVICES layer Omar Ramirez Luna
2010-01-15 23:35 ` [PATCH 4/4] DSPBRIDGE: Remove DPC object structure Omar Ramirez Luna
2010-01-18 19:15 ` [PATCH 0/4] DPC Removal from services Ramirez Luna, Omar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox