blob: cda4a0fe13d681319718fe2f6144fe05ff56e5d0 [file] [log] [blame]
Larry Bassel1daa0f02011-12-06 15:55:58 -08001/*
2 *
Duy Truong790f06d2013-02-13 16:38:12 -08003 * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
Larry Bassel1daa0f02011-12-06 15:55:58 -08004 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 and
7 * only version 2 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15#ifndef _FMEM_H_
16#define _FMEM_H_
17
Laura Abbott77497922011-12-13 11:32:19 -080018#include <linux/vmalloc.h>
19
Larry Bassel1daa0f02011-12-06 15:55:58 -080020struct fmem_platform_data {
21 unsigned long phys;
22 unsigned long size;
Olav Hauganf6dc7742012-02-15 09:11:55 -080023 unsigned long reserved_size_low;
24 unsigned long reserved_size_high;
Olav Haugan8726caf2012-05-10 15:11:35 -070025 unsigned long align;
Larry Bassel1daa0f02011-12-06 15:55:58 -080026};
27
28struct fmem_data {
29 unsigned long phys;
30 void *virt;
Laura Abbott77497922011-12-13 11:32:19 -080031 struct vm_struct *area;
Larry Bassel1daa0f02011-12-06 15:55:58 -080032 unsigned long size;
Olav Hauganf6dc7742012-02-15 09:11:55 -080033 unsigned long reserved_size_low;
34 unsigned long reserved_size_high;
Larry Bassel1daa0f02011-12-06 15:55:58 -080035};
36
37enum fmem_state {
38 FMEM_UNINITIALIZED = 0,
39 FMEM_C_STATE,
40 FMEM_T_STATE,
41 FMEM_O_STATE,
42};
43
Laura Abbott99f87d22011-12-14 16:01:54 -080044#ifdef CONFIG_QCACHE
Larry Bassel1daa0f02011-12-06 15:55:58 -080045struct fmem_data *fmem_get_info(void);
46int fmem_set_state(enum fmem_state);
47void lock_fmem_state(void);
48void unlock_fmem_state(void);
Laura Abbott77497922011-12-13 11:32:19 -080049void *fmem_map_virtual_area(int cacheability);
50void fmem_unmap_virtual_area(void);
Laura Abbott99f87d22011-12-14 16:01:54 -080051#else
52static inline struct fmem_data *fmem_get_info(void) { return NULL; }
53static inline int fmem_set_state(enum fmem_state f) { return -ENODEV; }
54static inline void lock_fmem_state(void) { return; }
55static inline void unlock_fmem_state(void) { return; }
Laura Abbott77497922011-12-13 11:32:19 -080056static inline void *fmem_map_virtual_area(int cacheability) { return NULL; }
57static inline void fmem_unmap_virtual_area(void) { return; }
Laura Abbott99f87d22011-12-14 16:01:54 -080058#endif
59
Laura Abbottf637aff2011-12-14 14:16:17 -080060int request_fmem_c_region(void *unused);
61int release_fmem_c_region(void *unused);
Larry Bassel1daa0f02011-12-06 15:55:58 -080062#endif