• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ page_to_phys函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中page_to_phys函数的典型用法代码示例。如果您正苦于以下问题:C++ page_to_phys函数的具体用法?C++ page_to_phys怎么用?C++ page_to_phys使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了page_to_phys函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: alloc_pages

unsigned long *crst_table_alloc(struct mm_struct *mm, int noexec)
{
	struct page *page = alloc_pages(GFP_KERNEL, ALLOC_ORDER);

	if (!page)
		return NULL;
	page->index = 0;
	if (noexec) {
		struct page *shadow = alloc_pages(GFP_KERNEL, ALLOC_ORDER);
		if (!shadow) {
			__free_pages(page, ALLOC_ORDER);
			return NULL;
		}
		page->index = page_to_phys(shadow);
	}
	return (unsigned long *) page_to_phys(page);
}
开发者ID:PennPanda,项目名称:linux-repo,代码行数:17,代码来源:pgtable.c


示例2: arc_dma_map_page

static dma_addr_t arc_dma_map_page(struct device *dev, struct page *page,
		unsigned long offset, size_t size, enum dma_data_direction dir,
		unsigned long attrs)
{
	phys_addr_t paddr = page_to_phys(page) + offset;
	_dma_cache_sync(paddr, size, dir);
	return plat_phys_to_dma(dev, paddr);
}
开发者ID:JarryChou,项目名称:linux,代码行数:8,代码来源:dma.c


示例3: dma_map_page

dma_addr_t dma_map_page(struct device *dev, struct page *page,
			unsigned long offset, size_t size,
			enum dma_data_direction dir)
{
	dma_addr_t handle = page_to_phys(page) + offset;

	dma_sync_single_for_device(dev, handle, size, dir);
	return handle;
}
开发者ID:AllenWeb,项目名称:linux,代码行数:9,代码来源:dma.c


示例4: tegra114_flush_dcache

static void tegra114_flush_dcache(struct page *page, unsigned long offset,
				  size_t size)
{
	phys_addr_t phys = page_to_phys(page) + offset;
	void *virt = page_address(page) + offset;

	__cpuc_flush_dcache_area(virt, size);
	outer_flush_range(phys, phys + size);
}
开发者ID:Seagate,项目名称:SMR_FS-EXT4,代码行数:9,代码来源:tegra114.c


示例5: kvm_kaddr_to_phys

static phys_addr_t kvm_kaddr_to_phys(void *kaddr)
{
	if (!is_vmalloc_addr(kaddr)) {
		BUG_ON(!virt_addr_valid(kaddr));
		return __pa(kaddr);
	} else {
		return page_to_phys(vmalloc_to_page(kaddr)) +
		       offset_in_page(kaddr);
	}
}
开发者ID:ManCheol,项目名称:kernel,代码行数:10,代码来源:mmu.c


示例6: PAGE_ALIGN

void *dma_generic_alloc_coherent(struct device *dev, size_t size,
				 dma_addr_t *dma_addr, gfp_t flag,
				 struct dma_attrs *attrs)
{
	unsigned long dma_mask;
	struct page *page;
	unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT;
	dma_addr_t addr;

	dma_mask = dma_alloc_coherent_mask(dev, flag);

	flag &= ~__GFP_ZERO;
again:
	page = NULL;
	/* CMA can be used only in the context which permits sleeping */
	if (flag & __GFP_WAIT) {
		page = dma_alloc_from_contiguous(dev, count, get_order(size));
		if (page && page_to_phys(page) + size > dma_mask) {
			dma_release_from_contiguous(dev, page, count);
			page = NULL;
		}
	}
	/* fallback */
	if (!page)
		page = alloc_pages_node(dev_to_node(dev), flag, get_order(size));
	if (!page)
		return NULL;

	addr = page_to_phys(page);
	if (addr + size > dma_mask) {
		__free_pages(page, get_order(size));

		if (dma_mask < DMA_BIT_MASK(32) && !(flag & GFP_DMA)) {
			flag = (flag & ~GFP_DMA32) | GFP_DMA;
			goto again;
		}

		return NULL;
	}
	memset(page_address(page), 0, size);
	*dma_addr = addr;
	return page_address(page);
}
开发者ID:JcShang,项目名称:linux-80211n-csitool,代码行数:43,代码来源:pci-dma.c


示例7: alloc_pages

static void *ion_page_pool_alloc_pages(struct ion_page_pool *pool)
{
	struct page *page = alloc_pages(pool->gfp_mask, pool->order);

	if (!page)
		return NULL;
	dma_sync_single_for_device(NULL, (dma_addr_t)page_to_phys(page),
		PAGE_SIZE << pool->order, DMA_BIDIRECTIONAL);
	return page;
}
开发者ID:miricy,项目名称:speaker-lichee,代码行数:10,代码来源:ion_page_pool.c


示例8: kmap_invalidate_coherent

static inline void kmap_invalidate_coherent(struct page *page,
					    unsigned long vaddr)
{
	if (!DCACHE_ALIAS_EQ(page_to_phys(page), vaddr)) {
		unsigned long kvaddr;

		if (!PageHighMem(page)) {
			kvaddr = (unsigned long)page_to_virt(page);

			__invalidate_dcache_page(kvaddr);
		} else {
			kvaddr = TLBTEMP_BASE_1 +
				(page_to_phys(page) & DCACHE_ALIAS_MASK);

			__invalidate_dcache_page_alias(kvaddr,
						       page_to_phys(page));
		}
	}
}
开发者ID:JamesChenFromChina,项目名称:linux,代码行数:19,代码来源:cache.c


示例9: __do_machine_kexec

/*
 * Do normal kexec
 */
static void __do_machine_kexec(void *data)
{
	relocate_kernel_t data_mover;
	struct kimage *image = data;

	data_mover = (relocate_kernel_t) page_to_phys(image->control_code_page);

	/* Call the moving routine */
	(*data_mover)(&image->head, image->start);
}
开发者ID:AllenWeb,项目名称:linux,代码行数:13,代码来源:machine_kexec.c


示例10: i460_insert_memory_small_io_page

static int i460_insert_memory_small_io_page (struct agp_memory *mem,
				off_t pg_start, int type)
{
	unsigned long paddr, io_pg_start, io_page_size;
	int i, j, k, num_entries;
	void *temp;

	pr_debug("i460_insert_memory_small_io_page(mem=%p, pg_start=%ld, type=%d, paddr0=0x%lx)\n",
		 mem, pg_start, type, page_to_phys(mem->pages[0]));

	if (type >= AGP_USER_TYPES || mem->type >= AGP_USER_TYPES)
		return -EINVAL;

	io_pg_start = I460_IOPAGES_PER_KPAGE * pg_start;

	temp = agp_bridge->current_size;
	num_entries = A_SIZE_8(temp)->num_entries;

	if ((io_pg_start + I460_IOPAGES_PER_KPAGE * mem->page_count) > num_entries) {
		printk(KERN_ERR PFX "Looks like we're out of AGP memory\n");
		return -EINVAL;
	}

	j = io_pg_start;
	while (j < (io_pg_start + I460_IOPAGES_PER_KPAGE * mem->page_count)) {
		if (!PGE_EMPTY(agp_bridge, RD_GATT(j))) {
			pr_debug("i460_insert_memory_small_io_page: GATT[%d]=0x%x is busy\n",
				 j, RD_GATT(j));
			return -EBUSY;
		}
		j++;
	}

	io_page_size = 1UL << I460_IO_PAGE_SHIFT;
	for (i = 0, j = io_pg_start; i < mem->page_count; i++) {
		paddr = page_to_phys(mem->pages[i]);
		for (k = 0; k < I460_IOPAGES_PER_KPAGE; k++, j++, paddr += io_page_size)
			WR_GATT(j, i460_mask_memory(agp_bridge, paddr, mem->type));
	}
	WR_FLUSH_GATT(j - 1);
	return 0;
}
开发者ID:Epirex,项目名称:Chrono_Kernel-1,代码行数:42,代码来源:i460-agp.c


示例11: __mic_dma_map_page

static dma_addr_t
__mic_dma_map_page(struct device *dev, struct page *page, unsigned long offset,
		   size_t size, enum dma_data_direction dir,
		   struct dma_attrs *attrs)
{
	void *va = phys_to_virt(page_to_phys(page)) + offset;
	struct scif_hw_dev *scdev = dev_get_drvdata(dev);
	struct mic_device *mdev = scdev_to_mdev(scdev);

	return mic_map_single(mdev, va, size);
}
开发者ID:DenisLug,项目名称:mptcp,代码行数:11,代码来源:mic_boot.c


示例12: alloc_pages

unsigned long *crst_table_alloc(struct mm_struct *mm, int noexec)
{
	struct page *page = alloc_pages(GFP_KERNEL, ALLOC_ORDER);

	if (!page)
		return NULL;
	page->index = 0;
	if (noexec) {
		struct page *shadow = alloc_pages(GFP_KERNEL, ALLOC_ORDER);
		if (!shadow) {
			__free_pages(page, ALLOC_ORDER);
			return NULL;
		}
		page->index = page_to_phys(shadow);
	}
	spin_lock(&mm->page_table_lock);
	list_add(&page->lru, &mm->context.crst_list);
	spin_unlock(&mm->page_table_lock);
	return (unsigned long *) page_to_phys(page);
}
开发者ID:mobilipia,项目名称:iods,代码行数:20,代码来源:pgtable.c


示例13: flush_cache_page

void flush_cache_page(struct vm_area_struct* vma, unsigned long address,
    		      unsigned long pfn)
{
	

	unsigned long phys = page_to_phys(pfn_to_page(pfn));
	unsigned long virt = TLBTEMP_BASE_1 + (address & DCACHE_ALIAS_MASK);

	__flush_invalidate_dcache_page_alias(virt, phys);
	__invalidate_icache_page_alias(virt, phys);
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:11,代码来源:cache.c


示例14: local_flush_cache_page

void local_flush_cache_page(struct vm_area_struct *vma, unsigned long address,
		      unsigned long pfn)
{
	/* Note that we have to use the 'alias' address to avoid multi-hit */

	unsigned long phys = page_to_phys(pfn_to_page(pfn));
	unsigned long virt = TLBTEMP_BASE_1 + (address & DCACHE_ALIAS_MASK);

	__flush_invalidate_dcache_page_alias(virt, phys);
	__invalidate_icache_page_alias(virt, phys);
}
开发者ID:JamesChenFromChina,项目名称:linux,代码行数:11,代码来源:cache.c


示例15: pci_direct_map_sg

static int pci_direct_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
		int nents, enum dma_data_direction direction)
{
	int i;

	for (i = 0; i < nents; i++, sg++) {
		sg->dma_address = page_to_phys(sg->page) + sg->offset;
		sg->dma_length = sg->length;
	}

	return nents;
}
开发者ID:Antonio-Zhou,项目名称:Linux-2.6.11,代码行数:12,代码来源:pci_direct_iommu.c


示例16: nommu_map_page

static dma_addr_t nommu_map_page(struct device *dev, struct page *page,
				 unsigned long offset, size_t size,
				 enum dma_data_direction dir,
				 unsigned long attrs)
{
	dma_addr_t addr = page_to_phys(page) + offset;

	WARN_ON(size == 0);
	dma_cache_sync(dev, page_address(page) + offset, size, dir);

	return addr;
}
开发者ID:AK101111,项目名称:linux,代码行数:12,代码来源:dma-nommu.c


示例17: hp3a_histogram_isr

/**
 * hp3a_histogram_isr - ISR for the histogram done interrupt.
 *
 * No return value.
 **/
static void hp3a_histogram_isr(unsigned long status, isp_vbq_callback_ptr arg1,
	void *arg2)
{
	u32 *hist_buffer;
	u32 i;
	struct hp3a_internal_buffer *ibuffer = NULL;

	if (unlikely((HIST_DONE & status) != HIST_DONE))
		return;

	omap_writel(omap_readl(ISPHIST_PCR) & ~(ISPHIST_PCR_EN), ISPHIST_PCR);

	if (unlikely(g_tc.v4l2_streaming == 0))
		return;

	if (hp3a_dequeue_irqsave(&g_tc.hist_hw_queue, &ibuffer) == 0) {
		/* If there is a buffer available then fill it. */
		hist_buffer = (u32 *)phys_to_virt( \
			page_to_phys(ibuffer->pages[0]));

		omap_writel((omap_readl(ISPHIST_CNT)) | \
			ISPHIST_CNT_CLR_EN, ISPHIST_CNT);
		for (i = g_tc.hist_bin_size; i--;) {
			*hist_buffer = omap_readl(ISPHIST_DATA);
			++hist_buffer;
		}
		omap_writel((omap_readl(ISPHIST_CNT)) & ~ISPHIST_CNT_CLR_EN,
			ISPHIST_CNT);
	} else {
		/* There are no buffers availavle so just */
		/* clear internal histogram memory. */
		omap_writel((omap_readl(ISPHIST_CNT)) | \
			ISPHIST_CNT_CLR_EN, ISPHIST_CNT);
		for (i = g_tc.hist_bin_size; i--;)
			omap_writel(0, ISPHIST_DATA);
		omap_writel((omap_readl(ISPHIST_CNT)) & ~ISPHIST_CNT_CLR_EN,
			ISPHIST_CNT);
	}

	/* Set memory HW memory address and enable. */
	omap_writel(0, ISPHIST_ADDR);

	if (g_tc.hist_hw_enable == 1) {
		/* Enable histogram. */
		omap_writel(omap_readl(ISPHIST_PCR) | (ISPHIST_PCR_EN),
			ISPHIST_PCR);
	}

	g_tc.hist_done = 1;

	/* Release the tasks waiting for stats. */
	wake_up(&g_tc.stats_done);
}
开发者ID:StarKissed,项目名称:android_kernel_omap,代码行数:58,代码来源:hp3a_histogram.c


示例18: ___dma_page_dev_to_cpu

void ___dma_page_dev_to_cpu(struct page *page, unsigned long off,
	size_t size, enum dma_data_direction dir)
{
	unsigned long paddr = page_to_phys(page) + off;

	/* FIXME: non-speculating: not required */
	/* don't bother invalidating if DMA to device */
	if (dir != DMA_TO_DEVICE)
		outer_inv_range(paddr, paddr + size);

	dma_cache_maint_page(page, off, size, dir, dmac_unmap_area);
}
开发者ID:koxudaxi,项目名称:GTAB7_GB_kernel,代码行数:12,代码来源:dma-mapping.c


示例19: copy_user_highpage

void copy_user_highpage(struct page *to, struct page *from,
			unsigned long vaddr, struct vm_area_struct *vma)
{
	unsigned long vto, vfrom, flags, kto, kfrom, pfrom, pto;
	kto = ((unsigned long)page_address(to) & PAGE_MASK);
	kfrom = ((unsigned long)page_address(from) & PAGE_MASK);
	pto = page_to_phys(to);
	pfrom = page_to_phys(from);

	if (aliasing(vaddr, (unsigned long)kfrom))
		cpu_dcache_wb_page((unsigned long)kfrom);
	if (aliasing(vaddr, (unsigned long)kto))
		cpu_dcache_inval_page((unsigned long)kto);
	local_irq_save(flags);
	vto = kremap0(vaddr, pto);
	vfrom = kremap1(vaddr, pfrom);
	copy_page((void *)vto, (void *)vfrom);
	kunmap01(vfrom);
	kunmap01(vto);
	local_irq_restore(flags);
}
开发者ID:andyprice,项目名称:linux,代码行数:21,代码来源:cacheflush.c


示例20: copy_from_user_page

void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
			 unsigned long vaddr, void *dst, void *src, int len)
{
	unsigned long vto, flags;

	local_irq_save(flags);
	vto = kremap0(vaddr, page_to_phys(page));
	src = (void *)(vto | (vaddr & (PAGE_SIZE - 1)));
	memcpy(dst, src, len);
	kunmap01(vto);
	local_irq_restore(flags);
}
开发者ID:andyprice,项目名称:linux,代码行数:12,代码来源:cacheflush.c



注:本文中的page_to_phys函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ page_zone函数代码示例发布时间:2022-05-30
下一篇:
C++ page_to_pfn函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap