⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpu_syspage_memory.c

📁 QNX ADS BSP code for i.MX27 chips
💻 C
字号:
/* * $QNXLicenseC:  * Copyright 2007, QNX Software Systems.   *   * Licensed under the Apache License, Version 2.0 (the "License"). You   * may not reproduce, modify or distribute this software except in   * compliance with the License. You may obtain a copy of the License   * at: http://www.apache.org/licenses/LICENSE-2.0   *   * Unless required by applicable law or agreed to in writing, software   * distributed under the License is distributed on an "AS IS" basis,   * WITHOUT WARRANTIES OF ANY KIND, either express or implied.  *  * This file may contain contributions from others, either as   * contributors under the License or as licensors under other terms.    * Please review this entire file for other proprietary rights or license   * notices, as well as the QNX Development Suite License Guide at   * http://licensing.qnx.com/license-guide/ for other information.  * $ */#include "startup.h"/* * Initialize CPU specific pointers in the system page. * This code is hardware independant and should not have to be * changed by end users. */voidcpu_init_syspage_memory(){	set_syspage_section(&lsp.cpu.arm_cpu, sizeof(*lsp.cpu.arm_cpu.p));}struct syspage_entry *cpu_alloc_syspage_memory(paddr32_t *cpupagep, paddr32_t *syspagep, unsigned spsize){	struct syspage_entry		*sp = lsp.syspage.p;	struct system_private_entry	*private;	unsigned					size;	unsigned					cpsize;	paddr32_t					syspage_paddr;	#define	SP_OFFSET(field)	PTR_DIFF(lsp.cpu.field.p, sp)	#define	INIT_ENTRY(_cpu, _field) \		sp->un._cpu._field.entry_size = lsp.cpu._cpu##_##_field.size; \		sp->un._cpu._field.entry_off  = SP_OFFSET(_cpu##_##_field)	/*	 * WARNING: ARMs are uniprocessor only, so we put the (single) cpupage	 *			entry at the end of the syspage. On a multiprocessor system	 *			we would need to allocate a page for each cpupage and a page	 *			for the syspage, to allow mapping each processor's cpupage	 *			at the same virtual address.	 */	spsize = ROUND(spsize, sizeof(uint64_t));	cpsize = sp->num_cpu * sizeof(struct cpupage_entry);	/*	 * Allocate the system page (and cpupage entries) and save it away.	 * The system page must be 4K aligned in a virtual system	 */	size = spsize + cpsize;	syspage_paddr = alloc_ram(NULL_PADDR, size, lsp.system_private.p->pagesize);	if (syspage_paddr == NULL_PADDR32) {		crash("could not allocate 0x%l bytes for syspage/cpupage\n", size);	}	private = lsp.system_private.p;	private->user_syspageptr = TOPTR(arm_map(~0L, syspage_paddr, size, ARM_PTE_U | ARM_PTE_RO | ARM_PTE_CB));	private->user_cpupageptr = TOPTR((uintptr_t)private->user_syspageptr + spsize);	private->kern_syspageptr = private->user_syspageptr;	private->kern_cpupageptr = private->user_cpupageptr;	private->cpupage_spacing = cpsize;	*syspagep = syspage_paddr;	*cpupagep = syspage_paddr + spsize;	sp->un.arm.L1_vaddr = L1_vaddr;	sp->un.arm.L1_paddr = L1_paddr;	sp->un.arm.startup_base = startup_base;	sp->un.arm.startup_size = startup_size;	INIT_ENTRY(arm, boxinfo);	INIT_ENTRY(arm, cpu);	return((void *)syspage_paddr);}voidcpu_write_syspage_memory(paddr32_t sysp_paddr, unsigned sysp_size, unsigned callout_size){	/*	 * WARNING: currently run startup with MMU disabled.	 *			If we ever run with MMU enabled, we need to flush the data	 *			cache to ensure that callout code is flushed to memory.	 */}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -