函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\cma.c Create Date:2022-07-27 18:07:13
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:ma_declare_contiguous() - reserve custom contiguous area*@base: Base address of the reserved area optional, use 0 for any*@size: Size of the reserved area (in bytes),*@limit: End address of the reserved memory (optional, 0 for any)

函数原型:int __init cma_declare_contiguous(phys_addr_t base, phys_addr_t size, phys_addr_t limit, phys_addr_t alignment, unsigned int order_per_bit, bool fixed, const char *name, struct cma **res_cma)

返回类型:int

参数:

类型参数名称
phys_addr_tbase
phys_addr_tsize
phys_addr_tlimit
phys_addr_talignment
unsigned intorder_per_bit
boolfixed
const char *name
struct cma **res_cma
246  memblock_end等于memblock_end_of_DRAM()
248  ret等于0
256  highmem_start等于__pa(A number of key systems in x86 including ioremap() rely on the assumption* that high_memory defines the upper bound on direct map memory, then end* of ZONE_NORMAL - 1)加1
257  pr_debug("%s(size %pa, base %pa, limit %pa alignment %pa)\n", __func__, & size, & base, & limit, & alignment)
260  如果cma_area_count恒等于ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(cma_areas)则
261  打印错误信息("Not enough slots for CMA reserved regions!\n")
262  返回:负ENOSPC
265  如果非size则返回:负EINVAL
268  如果alignment且非s_power_of_2() - check if a value is a power of two*@n: the value to check* Determine whether some value is a power of two, where zero is* *not* considered a power of two.* Return: true if @n is a power of 2, otherwise false.则返回:负EINVAL
277  alignment等于两数取大(alignment, (phys_addr_t)PAGE_SIZE << max_t - return maximum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(unsignedlong, Free memory management - zoned buddy allocator. - 1, Huge pages are a constant size ))
279  如果fixedbase按位与alignment减1则
280  ret等于负EINVAL
281  打印错误信息("Region at %pa must be aligned to %pa bytes\n", & base, & alignment)
283  转到:err
285  base等于@a is a power of 2 value (base, alignment)
286  size等于@a is a power of 2 value (size, alignment)
287  limit与等于alignment减1的差的反
289  如果非basefixed = false
293  如果非IS_ALIGNED(size >> PAGE_SHIFT determines the page size , 1 << order_per_bit)则返回:负EINVAL
300  如果fixedbase小于highmem_startbasesize大于highmem_start
301  ret等于负EINVAL
302  打印错误信息("Region at %pa defined on low/high memory boundary (%pa)\n", & base, & highmem_start)
304  转到:err
312  如果limit恒等于0或limit大于memblock_endlimit等于memblock_end
315  如果basesize大于limit
316  ret等于负EINVAL
317  打印错误信息("Size (%pa) of region at %pa exceeds limit (%pa)\n", & size, & base, & limit)
319  转到:err
323  如果fixed
326  ret等于负EBUSY
327  转到:err
329  否则
330  addr等于0
338  如果base小于highmem_startlimit大于highmem_start
341  limit等于highmem_start
344  如果非addr
347  如果非addr
348  ret等于负ENOMEM
349  转到:err
357  kmemleak_ignore_phys - similar to kmemleak_ignore but taking a physical* address argument*@phys: physical address of the object
358  base等于addr
361  ret等于ma_init_reserved_mem() - create custom contiguous area from reserved memory*@base: Base address of the reserved area*@size: Size of the reserved area (in bytes),*@order_per_bit: Order of pages represented by one bit on bitmap.*@name: The name of the area
362  如果ret则转到:free_mem
365  打印信息("Reserved %ld MiB at %pa\n", (unsignedlong)size / SZ_1M, & base)
367  返回:0
369  free_mem :
370  memblock_free(base, size)
371  err :
372  打印错误信息("Failed to reserve %ld MiB\n", (unsignedlong)size / SZ_1M)
373  返回:ret
调用者
名称描述
dma_contiguous_reserve_areadma_contiguous_reserve_area() - reserve custom contiguous area*@size: Size of the reserved area (in bytes),*@base: Base address of the reserved area optional, use 0 for any*@limit: End address of the reserved memory (optional, 0 for any).