]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blob - arch/mips/include/asm/rtlx.h
MIPS: APRP: Add RTLX API support for CMP platforms.
[mirror_ubuntu-eoan-kernel.git] / arch / mips / include / asm / rtlx.h
1 /*
2 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
3 * Copyright (C) 2013 Imagination Technologies Ltd.
4 */
5
6 #ifndef __ASM_RTLX_H_
7 #define __ASM_RTLX_H_
8
9 #include <irq.h>
10
11 #define RTLX_MODULE_NAME "rtlx"
12
13 #define LX_NODE_BASE 10
14
15 #define MIPS_CPU_RTLX_IRQ 0
16
17 #define RTLX_VERSION 2
18 #define RTLX_xID 0x12345600
19 #define RTLX_ID (RTLX_xID | RTLX_VERSION)
20 #define RTLX_BUFFER_SIZE 2048
21 #define RTLX_CHANNELS 8
22
23 #define RTLX_CHANNEL_STDIO 0
24 #define RTLX_CHANNEL_DBG 1
25 #define RTLX_CHANNEL_SYSIO 2
26
27 void rtlx_starting(int vpe);
28 void rtlx_stopping(int vpe);
29
30 int rtlx_open(int index, int can_sleep);
31 int rtlx_release(int index);
32 ssize_t rtlx_read(int index, void __user *buff, size_t count);
33 ssize_t rtlx_write(int index, const void __user *buffer, size_t count);
34 unsigned int rtlx_read_poll(int index, int can_sleep);
35 unsigned int rtlx_write_poll(int index);
36
37 int __init rtlx_module_init(void);
38 void __exit rtlx_module_exit(void);
39
40 void _interrupt_sp(void);
41
42 extern struct vpe_notifications rtlx_notify;
43 extern const struct file_operations rtlx_fops;
44 extern void (*aprp_hook)(void);
45
46 enum rtlx_state {
47 RTLX_STATE_UNUSED = 0,
48 RTLX_STATE_INITIALISED,
49 RTLX_STATE_REMOTE_READY,
50 RTLX_STATE_OPENED
51 };
52
53 extern struct chan_waitqueues {
54 wait_queue_head_t rt_queue;
55 wait_queue_head_t lx_queue;
56 atomic_t in_open;
57 struct mutex mutex;
58 } channel_wqs[RTLX_CHANNELS];
59
60 /* each channel supports read and write.
61 linux (vpe0) reads lx_buffer and writes rt_buffer
62 SP (vpe1) reads rt_buffer and writes lx_buffer
63 */
64 struct rtlx_channel {
65 enum rtlx_state rt_state;
66 enum rtlx_state lx_state;
67
68 int buffer_size;
69
70 /* read and write indexes per buffer */
71 int rt_write, rt_read;
72 char *rt_buffer;
73
74 int lx_write, lx_read;
75 char *lx_buffer;
76 };
77
78 extern struct rtlx_info {
79 unsigned long id;
80 enum rtlx_state state;
81 int ap_int_pending; /* Status of 0 or 1 for CONFIG_MIPS_CMP only */
82
83 struct rtlx_channel channel[RTLX_CHANNELS];
84 } *rtlx;
85 #endif /* __ASM_RTLX_H_ */