2 * This confidential and proprietary software may be used only as
3 * authorised by a licensing agreement from ARM Limited
4 * (C) COPYRIGHT 2008-2013 ARM Limited
6 * The entire notice above must be reproduced on all authorised
7 * copies and copies may only be made to the extent permitted
8 * by a licensing agreement from ARM Limited.
12 * @file mali_osk_misc.c
13 * Implementation of the OS abstraction layer for the kernel device driver
15 #include <linux/kernel.h>
16 #include <asm/uaccess.h>
17 #include <asm/cacheflush.h>
18 #include <linux/sched.h>
19 #include <linux/module.h>
21 #include "mt_reg_base.h"
23 extern void smi_dumpDebugMsg(void);
24 extern int m4u_dump_debug_registers(void);;
26 void _mali_osk_dbgmsg( const char *fmt
, ... )
34 u32
_mali_osk_snprintf( char *buf
, u32 size
, const char *fmt
, ... )
40 res
= vscnprintf(buf
, (size_t)size
, fmt
, args
);
46 #define CLK_CFG_0 (INFRA_BASE + 0x0040)
47 #define VENCPLL_CON0 (DDRPHY_BASE+0x800)
48 #define MMPLL_CON0 (APMIXEDSYS_BASE + 0x0230)
50 void _mali_osk_abort(void)
54 /* make a simple fault by dereferencing a NULL pointer */
57 for (index
= 0; index
< 5; index
++)
59 MALI_DEBUG_PRINT(2, ("=== [MALI] PLL Dump %d ===\n", index
));
60 MALI_DEBUG_PRINT(2, ("CLK_CFG_0: 0x%08x\n", *((volatile unsigned int*)CLK_CFG_0
)));
61 MALI_DEBUG_PRINT(2, ("VENCPLL_CON0: 0x%08x\n", *((volatile unsigned int*)VENCPLL_CON0
)));
62 MALI_DEBUG_PRINT(2, ("MMPLL_CON0: 0x%08x\n", *((volatile unsigned int*)MMPLL_CON0
)));
64 MALI_DEBUG_PRINT(2, ("=== [MALI] SMI Dump %d ===\n", index
));
67 MALI_DEBUG_PRINT(2, ("=== [MALI] 8127 m4u not provide API? M4U Dump %d ===\n", index
));
68 /*m4u_dump_debug_registers();*/
74 void _mali_osk_break(void)
79 u32
_mali_osk_get_pid(void)
81 /* Thread group ID is the process ID on Linux */
82 return (u32
)current
->tgid
;
85 u32
_mali_osk_get_tid(void)
87 /* pid is actually identifying the thread on Linux */
88 u32 tid
= current
->pid
;
90 /* If the pid is 0 the core was idle. Instead of returning 0 we return a special number
91 * identifying which core we are on. */
93 tid
= -(1 + raw_smp_processor_id());