Path: blob/master/include/drm/ttm/ttm_page_alloc.h
10818 views
/*1* Copyright (c) Red Hat Inc.23* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sub license,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the11* next paragraph) shall be included in all copies or substantial portions12* of the Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER20* DEALINGS IN THE SOFTWARE.21*22* Authors: Dave Airlie <[email protected]>23* Jerome Glisse <[email protected]>24*/25#ifndef TTM_PAGE_ALLOC26#define TTM_PAGE_ALLOC2728#include "ttm_bo_driver.h"29#include "ttm_memory.h"3031/**32* Get count number of pages from pool to pages list.33*34* @pages: heado of empty linked list where pages are filled.35* @flags: ttm flags for page allocation.36* @cstate: ttm caching state for the page.37* @count: number of pages to allocate.38* @dma_address: The DMA (bus) address of pages (if TTM_PAGE_FLAG_DMA32 set).39*/40int ttm_get_pages(struct list_head *pages,41int flags,42enum ttm_caching_state cstate,43unsigned count,44dma_addr_t *dma_address);45/**46* Put linked list of pages to pool.47*48* @pages: list of pages to free.49* @page_count: number of pages in the list. Zero can be passed for unknown50* count.51* @flags: ttm flags for page allocation.52* @cstate: ttm caching state.53* @dma_address: The DMA (bus) address of pages (if TTM_PAGE_FLAG_DMA32 set).54*/55void ttm_put_pages(struct list_head *pages,56unsigned page_count,57int flags,58enum ttm_caching_state cstate,59dma_addr_t *dma_address);60/**61* Initialize pool allocator.62*/63int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages);64/**65* Free pool allocator.66*/67void ttm_page_alloc_fini(void);6869/**70* Output the state of pools to debugfs file71*/72extern int ttm_page_alloc_debugfs(struct seq_file *m, void *data);73#endif747576