android_kernel_xiaomi_sm8350/drivers/char/drm/drm_memory.h
Dave Airlie 31f64bd101 drm: deline a few large inlines in DRM code
This patch moves a few large functions from drm_memory.h
to drm_memory.c, with the following effect:

  text    data     bss     dec     hex filename
 46305    1304      20   47629    ba0d new/drm.ko
 46367    1304      20   47691    ba4b org/drm.ko
 12969    1372       0   14341    3805 new/i810.ko
 14712    1372       0   16084    3ed4 org/i810.ko
 16447    1364       0   17811    4593 new/i830.ko
 18198    1364       0   19562    4c6a org/i830.ko
 11875    1324       0   13199    338f new/i915.ko
 13025    1324       0   14349    380d org/i915.ko
 23936   29288       0   53224    cfe8 new/mga.ko
 27280   29288       0   56568    dcf8 org/mga.ko

Please apply.

Signed-off-by: Denis Vlasenko <vda@ilport.com.ua>
Signed-off-by: Dave Airlie <airlied@linux.ie>
2006-04-07 16:55:43 +10:00

107 lines
3.0 KiB
C

/**
* \file drm_memory.h
* Memory management wrappers for DRM
*
* \author Rickard E. (Rik) Faith <faith@valinux.com>
* \author Gareth Hughes <gareth@valinux.com>
*/
/*
* Created: Thu Feb 4 14:00:34 1999 by faith@valinux.com
*
* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include <linux/config.h>
#include <linux/highmem.h>
#include <linux/vmalloc.h>
#include "drmP.h"
/**
* Cut down version of drm_memory_debug.h, which used to be called
* drm_memory.h.
*/
#if __OS_HAS_AGP
#include <linux/vmalloc.h>
#ifdef HAVE_PAGE_AGP
#include <asm/agp.h>
#else
# ifdef __powerpc__
# define PAGE_AGP __pgprot(_PAGE_KERNEL | _PAGE_NO_CACHE)
# else
# define PAGE_AGP PAGE_KERNEL
# endif
#endif
/*
* Find the drm_map that covers the range [offset, offset+size).
*/
drm_map_t *drm_lookup_map(unsigned long offset,
unsigned long size, drm_device_t * dev);
void *agp_remap(unsigned long offset, unsigned long size,
drm_device_t * dev);
static inline unsigned long drm_follow_page(void *vaddr)
{
pgd_t *pgd = pgd_offset_k((unsigned long)vaddr);
pud_t *pud = pud_offset(pgd, (unsigned long)vaddr);
pmd_t *pmd = pmd_offset(pud, (unsigned long)vaddr);
pte_t *ptep = pte_offset_kernel(pmd, (unsigned long)vaddr);
return pte_pfn(*ptep) << PAGE_SHIFT;
}
#else /* __OS_HAS_AGP */
static inline drm_map_t *drm_lookup_map(unsigned long offset,
unsigned long size, drm_device_t * dev)
{
return NULL;
}
static inline void *agp_remap(unsigned long offset, unsigned long size,
drm_device_t * dev)
{
return NULL;
}
static inline unsigned long drm_follow_page(void *vaddr)
{
return 0;
}
#endif
void *drm_ioremap(unsigned long offset, unsigned long size,
drm_device_t * dev);
void *drm_ioremap_nocache(unsigned long offset,
unsigned long size, drm_device_t * dev);
void drm_ioremapfree(void *pt, unsigned long size,
drm_device_t * dev);