/drivers/include/asm-generic/fixmap.h |
---|
0,0 → 1,103 |
/* |
* fixmap.h: compile-time virtual memory allocation |
* |
* This file is subject to the terms and conditions of the GNU General Public |
* License. See the file "COPYING" in the main directory of this archive |
* for more details. |
* |
* Copyright (C) 1998 Ingo Molnar |
* |
* Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999 |
* x86_32 and x86_64 integration by Gustavo F. Padovan, February 2009 |
* Break out common bits to asm-generic by Mark Salter, November 2013 |
*/ |
#ifndef __ASM_GENERIC_FIXMAP_H |
#define __ASM_GENERIC_FIXMAP_H |
#include <linux/bug.h> |
#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) |
#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) |
#ifndef __ASSEMBLY__ |
/* |
* 'index to address' translation. If anyone tries to use the idx |
* directly without translation, we catch the bug with a NULL-deference |
* kernel oops. Illegal ranges of incoming indices are caught too. |
*/ |
static __always_inline unsigned long fix_to_virt(const unsigned int idx) |
{ |
BUILD_BUG_ON(idx >= __end_of_fixed_addresses); |
return __fix_to_virt(idx); |
} |
static inline unsigned long virt_to_fix(const unsigned long vaddr) |
{ |
BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); |
return __virt_to_fix(vaddr); |
} |
/* |
* Provide some reasonable defaults for page flags. |
* Not all architectures use all of these different types and some |
* architectures use different names. |
*/ |
#ifndef FIXMAP_PAGE_NORMAL |
#define FIXMAP_PAGE_NORMAL PAGE_KERNEL |
#endif |
#if !defined(FIXMAP_PAGE_RO) && defined(PAGE_KERNEL_RO) |
#define FIXMAP_PAGE_RO PAGE_KERNEL_RO |
#endif |
#ifndef FIXMAP_PAGE_NOCACHE |
#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_NOCACHE |
#endif |
#ifndef FIXMAP_PAGE_IO |
#define FIXMAP_PAGE_IO PAGE_KERNEL_IO |
#endif |
#ifndef FIXMAP_PAGE_CLEAR |
#define FIXMAP_PAGE_CLEAR __pgprot(0) |
#endif |
#ifndef set_fixmap |
#define set_fixmap(idx, phys) \ |
__set_fixmap(idx, phys, FIXMAP_PAGE_NORMAL) |
#endif |
#ifndef clear_fixmap |
#define clear_fixmap(idx) \ |
__set_fixmap(idx, 0, FIXMAP_PAGE_CLEAR) |
#endif |
/* Return a pointer with offset calculated */ |
#define __set_fixmap_offset(idx, phys, flags) \ |
({ \ |
unsigned long addr; \ |
__set_fixmap(idx, phys, flags); \ |
addr = fix_to_virt(idx) + ((phys) & (PAGE_SIZE - 1)); \ |
addr; \ |
}) |
#define set_fixmap_offset(idx, phys) \ |
__set_fixmap_offset(idx, phys, FIXMAP_PAGE_NORMAL) |
/* |
* Some hardware wants to get fixmapped without caching. |
*/ |
#define set_fixmap_nocache(idx, phys) \ |
__set_fixmap(idx, phys, FIXMAP_PAGE_NOCACHE) |
#define set_fixmap_offset_nocache(idx, phys) \ |
__set_fixmap_offset(idx, phys, FIXMAP_PAGE_NOCACHE) |
/* |
* Some fixmaps are for IO |
*/ |
#define set_fixmap_io(idx, phys) \ |
__set_fixmap(idx, phys, FIXMAP_PAGE_IO) |
#define set_fixmap_offset_io(idx, phys) \ |
__set_fixmap_offset(idx, phys, FIXMAP_PAGE_IO) |
#endif /* __ASSEMBLY__ */ |
#endif /* __ASM_GENERIC_FIXMAP_H */ |
/drivers/include/asm-generic/kmap_types.h |
---|
0,0 → 1,10 |
#ifndef _ASM_GENERIC_KMAP_TYPES_H |
#define _ASM_GENERIC_KMAP_TYPES_H |
#ifdef __WITH_KM_FENCE |
# define KM_TYPE_NR 41 |
#else |
# define KM_TYPE_NR 20 |
#endif |
#endif |
/drivers/include/asm-generic/pci-dma-compat.h |
---|
7,6 → 7,13 |
#include <linux/dma-mapping.h> |
static inline void * |
pci_alloc_consistent(struct pci_dev *hwdev, size_t size, |
dma_addr_t *dma_handle) |
{ |
return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC); |
} |
static inline void * |
pci_zalloc_consistent(struct pci_dev *hwdev, size_t size, |
dma_addr_t *dma_handle) |
{ |
14,6 → 21,13 |
size, dma_handle, GFP_ATOMIC); |
} |
static inline void |
pci_free_consistent(struct pci_dev *hwdev, size_t size, |
void *vaddr, dma_addr_t dma_handle) |
{ |
dma_free_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, vaddr, dma_handle); |
} |
static inline dma_addr_t |
pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction) |
{ |
/drivers/include/asm-generic/topology.h |
---|
0,0 → 1,76 |
/* |
* linux/include/asm-generic/topology.h |
* |
* Written by: Matthew Dobson, IBM Corporation |
* |
* Copyright (C) 2002, IBM Corp. |
* |
* 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 as published by |
* the Free Software Foundation; either version 2 of the License, or |
* (at your option) any later version. |
* |
* 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, GOOD TITLE or |
* NON INFRINGEMENT. See the GNU General Public License for more |
* details. |
* |
* You should have received a copy of the GNU General Public License |
* along with this program; if not, write to the Free Software |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
* |
* Send feedback to <colpatch@us.ibm.com> |
*/ |
#ifndef _ASM_GENERIC_TOPOLOGY_H |
#define _ASM_GENERIC_TOPOLOGY_H |
#ifndef CONFIG_NUMA |
/* Other architectures wishing to use this simple topology API should fill |
in the below functions as appropriate in their own <asm/topology.h> file. */ |
#ifndef cpu_to_node |
#define cpu_to_node(cpu) ((void)(cpu),0) |
#endif |
#ifndef set_numa_node |
#define set_numa_node(node) |
#endif |
#ifndef set_cpu_numa_node |
#define set_cpu_numa_node(cpu, node) |
#endif |
#ifndef cpu_to_mem |
#define cpu_to_mem(cpu) ((void)(cpu),0) |
#endif |
#ifndef parent_node |
#define parent_node(node) ((void)(node),0) |
#endif |
#ifndef cpumask_of_node |
#define cpumask_of_node(node) ((void)node, cpu_online_mask) |
#endif |
#ifndef pcibus_to_node |
#define pcibus_to_node(bus) ((void)(bus), -1) |
#endif |
#ifndef cpumask_of_pcibus |
#define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ |
cpu_all_mask : \ |
cpumask_of_node(pcibus_to_node(bus))) |
#endif |
#endif /* CONFIG_NUMA */ |
#if !defined(CONFIG_NUMA) || !defined(CONFIG_HAVE_MEMORYLESS_NODES) |
#ifndef set_numa_mem |
#define set_numa_mem(node) |
#endif |
#ifndef set_cpu_numa_mem |
#define set_cpu_numa_mem(cpu, node) |
#endif |
#endif /* !CONFIG_NUMA || !CONFIG_HAVE_MEMORYLESS_NODES */ |
#endif /* _ASM_GENERIC_TOPOLOGY_H */ |