android_kernel_google_msm/include/linux/fmem.h
Larry Bassel fca8a06f35 fmem: add qcache implementation
Part of this code is originally from the 3.1 version of the
tmem backend zcache.

The zcache code was copied to the qcache directory and
modifications were made, notably to the memory allocation
(from a block of pre-reserved contiguous memory rather
than from system memory), and to allow tmem and qcache to
be turned on and off either from a /sys file or using
an exported API.

A higher level driver (fmem) is provided that is
the interface to other (PMEM, ION, tmem/qcache) drivers.

Change-Id: Ieda939ed1ba7c5337dd4338b9d9caffde883e82b
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
2013-02-25 11:33:57 -08:00

62 lines
1.7 KiB
C

/*
*
* Copyright (c) 2011-2012, Code Aurora Forum. 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.
*
*/
#ifndef _FMEM_H_
#define _FMEM_H_
#include <linux/vmalloc.h>
struct fmem_platform_data {
unsigned long phys;
unsigned long size;
unsigned long reserved_size_low;
unsigned long reserved_size_high;
unsigned long align;
};
struct fmem_data {
unsigned long phys;
void *virt;
struct vm_struct *area;
unsigned long size;
unsigned long reserved_size_low;
unsigned long reserved_size_high;
};
enum fmem_state {
FMEM_UNINITIALIZED = 0,
FMEM_C_STATE,
FMEM_T_STATE,
FMEM_O_STATE,
};
#ifdef CONFIG_QCACHE
struct fmem_data *fmem_get_info(void);
int fmem_set_state(enum fmem_state);
void lock_fmem_state(void);
void unlock_fmem_state(void);
void *fmem_map_virtual_area(int cacheability);
void fmem_unmap_virtual_area(void);
#else
static inline struct fmem_data *fmem_get_info(void) { return NULL; }
static inline int fmem_set_state(enum fmem_state f) { return -ENODEV; }
static inline void lock_fmem_state(void) { return; }
static inline void unlock_fmem_state(void) { return; }
static inline void *fmem_map_virtual_area(int cacheability) { return NULL; }
static inline void fmem_unmap_virtual_area(void) { return; }
#endif
int request_fmem_c_region(void *unused);
int release_fmem_c_region(void *unused);
#endif