diff options
Diffstat (limited to 'drivers/mxc/amd-gpu/common/gsl_cmdwindow.c')
-rw-r--r-- | drivers/mxc/amd-gpu/common/gsl_cmdwindow.c | 52 |
1 files changed, 16 insertions, 36 deletions
diff --git a/drivers/mxc/amd-gpu/common/gsl_cmdwindow.c b/drivers/mxc/amd-gpu/common/gsl_cmdwindow.c index ea106a2735af..4d70da5b25c8 100644 --- a/drivers/mxc/amd-gpu/common/gsl_cmdwindow.c +++ b/drivers/mxc/amd-gpu/common/gsl_cmdwindow.c @@ -31,31 +31,12 @@ ////////////////////////////////////////////////////////////////////////////// -// macros -////////////////////////////////////////////////////////////////////////////// -#ifdef GSL_LOCKING_FINEGRAIN -#define GSL_CMDWINDOW_MUTEX_CREATE() device->cmdwindow_mutex = kos_mutex_create("gsl_cmdwindow"); \ - if (!device->cmdwindow_mutex) return (GSL_FAILURE); -#define GSL_CMDWINDOW_MUTEX_LOCK() kos_mutex_lock(device->cmdwindow_mutex) -#define GSL_CMDWINDOW_MUTEX_UNLOCK() kos_mutex_unlock(device->cmdwindow_mutex) -#define GSL_CMDWINDOW_MUTEX_FREE() kos_mutex_free(device->cmdwindow_mutex); device->cmdwindow_mutex = 0; -#else -#define GSL_CMDWINDOW_MUTEX_CREATE() (void) device // unreferenced formal parameter -#define GSL_CMDWINDOW_MUTEX_LOCK() -#define GSL_CMDWINDOW_MUTEX_UNLOCK() -#define GSL_CMDWINDOW_MUTEX_FREE() (void) device // unreferenced formal parameter -#endif - - -////////////////////////////////////////////////////////////////////////////// // functions ////////////////////////////////////////////////////////////////////////////// int kgsl_cmdwindow_init(gsl_device_t *device) { - GSL_CMDWINDOW_MUTEX_CREATE(); - return (GSL_SUCCESS); } @@ -64,8 +45,6 @@ kgsl_cmdwindow_init(gsl_device_t *device) int kgsl_cmdwindow_close(gsl_device_t *device) { - GSL_CMDWINDOW_MUTEX_FREE(); - return (GSL_SUCCESS); } @@ -73,8 +52,8 @@ kgsl_cmdwindow_close(gsl_device_t *device) //---------------------------------------------------------------------------- -KGSL_API int -kgsl_cmdwindow_write(gsl_deviceid_t device_id, gsl_cmdwindow_t target, unsigned int addr, unsigned int data) +int +kgsl_cmdwindow_write0(gsl_deviceid_t device_id, gsl_cmdwindow_t target, unsigned int addr, unsigned int data) { #ifdef GSL_BLD_G12 gsl_device_t *device; @@ -84,14 +63,10 @@ kgsl_cmdwindow_write(gsl_deviceid_t device_id, gsl_cmdwindow_t target, unsigned kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_TRACE, "--> int kgsl_cmdwindow_write( gsl_device_id_t device_id=%d, gsl_cmdwindow_t target=%d, unsigned int addr=0x%08x, unsigned int data=0x%08x)\n", device_id, target, addr, data ); - GSL_API_MUTEX_LOCK(); - device = &gsl_driver.device[device_id-1]; // device_id is 1 based if (target < GSL_CMDWINDOW_MIN || target > GSL_CMDWINDOW_MAX) { - GSL_API_MUTEX_UNLOCK(); - kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_ERROR, "ERROR: Invalid target.\n" ); kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_TRACE, "<-- kgsl_cmdwindow_write. Return value %B\n", GSL_FAILURE ); return (GSL_FAILURE); @@ -100,7 +75,6 @@ kgsl_cmdwindow_write(gsl_deviceid_t device_id, gsl_cmdwindow_t target, unsigned if ((!(device->flags & GSL_FLAGS_INITIALIZED) && target == GSL_CMDWINDOW_MMU) || (!(device->flags & GSL_FLAGS_STARTED) && target != GSL_CMDWINDOW_MMU)) { - GSL_API_MUTEX_UNLOCK(); kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_ERROR, "ERROR: Invalid device state to write to selected targer.\n" ); kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_TRACE, "<-- kgsl_cmdwindow_write. Return value %B\n", GSL_FAILURE ); return (GSL_FAILURE); @@ -110,7 +84,6 @@ kgsl_cmdwindow_write(gsl_deviceid_t device_id, gsl_cmdwindow_t target, unsigned if (target == GSL_CMDWINDOW_MMU) { #ifdef GSL_NO_MMU - GSL_API_MUTEX_UNLOCK(); return (GSL_SUCCESS); #endif cmdstream = ADDR_VGC_MMUCOMMANDSTREAM; @@ -125,21 +98,16 @@ kgsl_cmdwindow_write(gsl_deviceid_t device_id, gsl_cmdwindow_t target, unsigned cmdwinaddr = ((target << GSL_CMDWINDOW_TARGET_SHIFT) & GSL_CMDWINDOW_TARGET_MASK); cmdwinaddr |= ((addr << GSL_CMDWINDOW_ADDR_SHIFT) & GSL_CMDWINDOW_ADDR_MASK); - GSL_CMDWINDOW_MUTEX_LOCK(); - #ifndef GSL_NO_MMU // set mmu pagetable kgsl_mmu_setpagetable(device, GSL_CALLER_PROCESSID_GET()); #endif // write command window address - kgsl_device_regwrite(device_id, (cmdstream)>>2, cmdwinaddr); + device->ftbl.device_regwrite(device, (cmdstream)>>2, cmdwinaddr); // write data - kgsl_device_regwrite(device_id, (cmdstream)>>2, data); - - GSL_CMDWINDOW_MUTEX_UNLOCK(); - GSL_API_MUTEX_UNLOCK(); + device->ftbl.device_regwrite(device, (cmdstream)>>2, data); kgsl_log_write( KGSL_LOG_GROUP_COMMAND | KGSL_LOG_LEVEL_TRACE, "<-- kgsl_cmdwindow_write. Return value %B\n", GSL_SUCCESS ); @@ -154,3 +122,15 @@ kgsl_cmdwindow_write(gsl_deviceid_t device_id, gsl_cmdwindow_t target, unsigned return (GSL_FAILURE); #endif // GSL_BLD_G12 } + +//---------------------------------------------------------------------------- + +KGSL_API int +kgsl_cmdwindow_write(gsl_deviceid_t device_id, gsl_cmdwindow_t target, unsigned int addr, unsigned int data) +{ + int status = GSL_SUCCESS; + GSL_API_MUTEX_LOCK(); + status = kgsl_cmdwindow_write0(device_id, target, addr, data); + GSL_API_MUTEX_UNLOCK(); + return status; +} |