1744d9859SSimon Glass /* 2744d9859SSimon Glass * Copyright (c) 2011 The Chromium OS Authors. 3744d9859SSimon Glass * 4744d9859SSimon Glass * See file CREDITS for list of people who contributed to this 5744d9859SSimon Glass * project. 6744d9859SSimon Glass * 7744d9859SSimon Glass * This program is free software; you can redistribute it and/or 8744d9859SSimon Glass * modify it under the terms of the GNU General Public License as 9744d9859SSimon Glass * published by the Free Software Foundation; either version 2 of 10744d9859SSimon Glass * the License, or (at your option) any later version. 11744d9859SSimon Glass * 12744d9859SSimon Glass * This program is distributed in the hope that it will be useful, 13744d9859SSimon Glass * but WITHOUT ANY WARRANTY; without even the implied warranty of 14744d9859SSimon Glass * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15744d9859SSimon Glass * GNU General Public License for more details. 16744d9859SSimon Glass * 17744d9859SSimon Glass * You should have received a copy of the GNU General Public License 18744d9859SSimon Glass * along with this program; if not, write to the Free Software 19744d9859SSimon Glass * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 20744d9859SSimon Glass * MA 02111-1307 USA 21744d9859SSimon Glass */ 22744d9859SSimon Glass 23744d9859SSimon Glass /* 24744d9859SSimon Glass * Given a physical address and a length, return a virtual address 25744d9859SSimon Glass * that can be used to access the memory range with the caching 26744d9859SSimon Glass * properties specified by "flags". 27744d9859SSimon Glass */ 28744d9859SSimon Glass #define MAP_NOCACHE (0) 29744d9859SSimon Glass #define MAP_WRCOMBINE (0) 30744d9859SSimon Glass #define MAP_WRBACK (0) 31744d9859SSimon Glass #define MAP_WRTHROUGH (0) 32744d9859SSimon Glass 33744d9859SSimon Glass void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags); 34744d9859SSimon Glass 35744d9859SSimon Glass /* 36744d9859SSimon Glass * Take down a mapping set up by map_physmem(). 37744d9859SSimon Glass */ 38744d9859SSimon Glass static inline void unmap_physmem(void *vaddr, unsigned long flags) 39744d9859SSimon Glass { 40744d9859SSimon Glass 41744d9859SSimon Glass } 424213fc29SSimon Glass 434213fc29SSimon Glass /* For sandbox, we want addresses to point into our RAM buffer */ 444213fc29SSimon Glass static inline void *map_sysmem(phys_addr_t paddr, unsigned long len) 454213fc29SSimon Glass { 464213fc29SSimon Glass return map_physmem(paddr, len, MAP_WRBACK); 474213fc29SSimon Glass } 484213fc29SSimon Glass 494213fc29SSimon Glass static inline void unmap_sysmem(const void *vaddr) 504213fc29SSimon Glass { 514213fc29SSimon Glass } 52*781adb57SSimon Glass 53*781adb57SSimon Glass /* Map from a pointer to our RAM buffer */ 54*781adb57SSimon Glass phys_addr_t map_to_sysmem(void *ptr); 55