Merge changes I74d93f35,Iea942e84 into msm-3.0

* changes:
  fmem: reserve memory for fmem
  fmem: add fmem API header file
This commit is contained in:
Linux Build Service Account
2011-12-14 04:44:16 -08:00
committed by QuIC Gerrit Code Review
3 changed files with 61 additions and 0 deletions

View File

@@ -62,4 +62,6 @@ struct reserve_info {
};
extern struct reserve_info *reserve_info;
unsigned long __init reserve_memory_for_fmem(unsigned long);
#endif

View File

@@ -304,6 +304,24 @@ static void __init reserve_memory_for_mempools(void)
}
}
unsigned long __init reserve_memory_for_fmem(unsigned long fmem_size)
{
struct membank *mb;
int ret;
unsigned long fmem_phys;
if (!fmem_size)
return 0;
mb = &meminfo.bank[meminfo.nr_banks - 1];
fmem_phys = mb->start + (mb->size - fmem_size);
ret = memblock_remove(fmem_phys, fmem_size);
BUG_ON(ret);
pr_info("fmem start %lx size %lx\n", fmem_phys, fmem_size);
return fmem_phys;
}
static void __init initialize_mempools(void)
{
struct mem_pool *mpool;

41
include/linux/fmem.h Normal file
View File

@@ -0,0 +1,41 @@
/*
*
* Copyright (c) 2011, 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_
struct fmem_platform_data {
unsigned long phys;
unsigned long size;
};
struct fmem_data {
unsigned long phys;
void *virt;
unsigned long size;
};
enum fmem_state {
FMEM_UNINITIALIZED = 0,
FMEM_C_STATE,
FMEM_T_STATE,
FMEM_O_STATE,
};
struct fmem_data *fmem_get_info(void);
int fmem_set_state(enum fmem_state);
void lock_fmem_state(void);
void unlock_fmem_state(void);
#endif