mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-10-31 18:09:19 +00:00
42c818494b
The msm_remote_spinlock driver currently does not store the owner of the lock (the raw value of the lock), and the state of the hardware lock is not saved in memory dumps. This increases difficulty when debugging situations where the lock could not be acquired. Store the value of each lock in an array, and provide an API to read elements from this array for testing purposes. Change-Id: I7186c5201bbd6e51249fb073e899d2ac69e5bec7 Signed-off-by: Steven Cahail <scahail@codeaurora.org>
80 lines
2.6 KiB
C
80 lines
2.6 KiB
C
/* Copyright (c) 2009, 2011, 2013-2015 The Linux Foundation.
|
|
* All rights reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 and
|
|
* only version 2 as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
*/
|
|
|
|
/*
|
|
* Part of this this code is based on the standard ARM spinlock
|
|
* implementation (asm/spinlock.h) found in the 2.6.29 kernel.
|
|
*/
|
|
|
|
#ifndef __ASM__ARCH_QC_REMOTE_SPINLOCK_H
|
|
#define __ASM__ARCH_QC_REMOTE_SPINLOCK_H
|
|
|
|
#include <linux/io.h>
|
|
#include <linux/types.h>
|
|
|
|
#define REMOTE_SPINLOCK_NUM_PID 128
|
|
#define REMOTE_SPINLOCK_TID_START REMOTE_SPINLOCK_NUM_PID
|
|
|
|
/* Remote spinlock definitions. */
|
|
|
|
typedef struct {
|
|
volatile uint32_t lock;
|
|
} raw_remote_spinlock_t;
|
|
|
|
typedef raw_remote_spinlock_t *_remote_spinlock_t;
|
|
|
|
#define remote_spinlock_id_t const char *
|
|
|
|
#if defined(CONFIG_REMOTE_SPINLOCK_MSM)
|
|
int _remote_spin_lock_init(remote_spinlock_id_t, _remote_spinlock_t *lock);
|
|
void _remote_spin_release_all(uint32_t pid);
|
|
void _remote_spin_lock(_remote_spinlock_t *lock);
|
|
void _remote_spin_unlock(_remote_spinlock_t *lock);
|
|
int _remote_spin_trylock(_remote_spinlock_t *lock);
|
|
int _remote_spin_release(_remote_spinlock_t *lock, uint32_t pid);
|
|
int _remote_spin_owner(_remote_spinlock_t *lock);
|
|
void _remote_spin_lock_rlock_id(_remote_spinlock_t *lock, uint32_t tid);
|
|
void _remote_spin_unlock_rlock(_remote_spinlock_t *lock);
|
|
int _remote_spin_get_hw_spinlocks_element(_remote_spinlock_t *lock);
|
|
#else
|
|
static inline
|
|
int _remote_spin_lock_init(remote_spinlock_id_t id, _remote_spinlock_t *lock)
|
|
{
|
|
return -EINVAL;
|
|
}
|
|
static inline void _remote_spin_release_all(uint32_t pid) {}
|
|
static inline void _remote_spin_lock(_remote_spinlock_t *lock) {}
|
|
static inline void _remote_spin_unlock(_remote_spinlock_t *lock) {}
|
|
static inline int _remote_spin_trylock(_remote_spinlock_t *lock)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
static inline int _remote_spin_release(_remote_spinlock_t *lock, uint32_t pid)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
static inline int _remote_spin_owner(_remote_spinlock_t *lock)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
static inline void _remote_spin_lock_rlock_id(_remote_spinlock_t *lock,
|
|
uint32_t tid) {}
|
|
static inline void _remote_spin_unlock_rlock(_remote_spinlock_t *lock) {}
|
|
static inline int _remote_spin_get_hw_spinlocks_element(
|
|
_remote_spinlock_t *lock)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
#endif
|
|
#endif /* __ASM__ARCH_QC_REMOTE_SPINLOCK_H */
|