📄 cpu_startup.h
字号:
/* * $QNXLicenseC: * Copyright 2008, 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 <arm/inout.h>#include <arm/inline.h>#include <arm/mmu.h>/***************************************************************************************************************************************** These definitions are required for the system independent code.*****************************************************************************************************************************************/#define KERCALL_SEQUENCE(name) uint32_t name[] = { \ 0xef000000, /* swi (syscall no. in ip) */ \ 0xe7ffffef /* undefined instruction */ \}#define CPU_SYSPAGE_TYPE SYSPAGE_ARMstruct cpu_local_syspage { SYSPAGE_SECTION(arm_boxinfo); SYSPAGE_SECTION(arm_cpu);};extern void print_arm_boxinfo(void);extern void print_arm_cpu(void);#define CPU_PRT_SYSPAGE_RTNS \ CPU_PRT_SYSPAGE_RTN(arm, 1, boxinfo), \ CPU_PRT_SYSPAGE_RTN(arm, 1, cpu),#define BOOTSTRAPS_RUN_ONE_TO_ONE 0#define CPU_COMMON_OPTIONS_STRING "w:"/***************************************************************************************************************************************** Everything below is specific to the ARM.*****************************************************************************************************************************************//* * ------------------------------------------------------------------ * Generic ARM support * ------------------------------------------------------------------ */extern unsigned long arm_cpuspeed();extern paddr_t arm_map(uintptr_t va, paddr_t pa, size_t sz, int flags);extern void arm_pdmap(uintptr_t va);extern void arm_scmap(paddr_t va, paddr_t pa, int flags);extern void arm_scunmap(uintptr_t va);extern void arm_map_cpu(int cpu, uintptr_t va, paddr_t pa, int flags);extern unsigned trap_vectors;extern unsigned mmu_cr_set;extern unsigned mmu_cr_clr;extern int cycles_per_loop;extern paddr_t L1_paddr;extern paddr_t L1_vaddr;extern paddr_t L2_paddr;extern paddr_t startup_base;extern unsigned startup_size;#define ARM_MAP_SYSPAGE 0xffffffff /* flags to arm_map() for syspage *//* * ------------------------------------------------------------------ * Cache/MMU/CPU configuration information * ------------------------------------------------------------------ */extern unsigned long arm_cpuspeed();/* * CPU cache configuration used if there is no CP15 cache type register */struct arm_cache_config { unsigned flags; unsigned line_size; unsigned num_lines;};/* * CPU cache callout and configuration */struct armv_cache { const struct arm_cache_config *dcache_config; const struct callout_rtn *dcache_rtn; const struct arm_cache_config *icache_config; const struct callout_rtn *icache_rtn;};extern void arm_add_cache(struct cpuinfo_entry *cpu, const struct armv_cache *cache);extern const struct armv_cache armv_cache_720;extern const struct armv_cache armv_cache_920;extern const struct armv_cache armv_cache_925;extern const struct armv_cache armv_cache_1020;extern const struct armv_cache armv_cache_sa1100;extern const struct armv_cache armv_cache_xscale;extern const struct armv_cache armv_cache_1136;extern const struct armv_cache armv_cache_mp11;extern const struct armv_cache armv_cache_xsc3;extern const struct armv_cache armv_cache_a8;/* * MMU PTE details */struct armv_pte { unsigned short upte_ro; // user RO mappings unsigned short upte_rw; // user RW mappings unsigned short kpte_ro; // kern RO mappings unsigned short kpte_rw; // kern RW mappings unsigned short mask_nc; // bits to clear for uncached mappings unsigned short l1_pgtable; // bits to set for L1 page table entry unsigned kscn_ro; // kern RO section mapping unsigned kscn_rw; // kern RW section mapping unsigned kscn_cb; // cacheable section mapping};extern const struct armv_pte *armv_pte;extern void arm_pte_setup();extern int arm_altpte;extern const struct armv_pte armv_pte_v4wb;extern const struct armv_pte armv_pte_v4wt;extern const struct armv_pte armv_pte_v5wa;extern const struct armv_pte armv_pte_v5wb;extern const struct armv_pte armv_pte_v5wt;extern const struct armv_pte armv_pte_ixp2xxx;extern const struct armv_pte armv_pte_v6wb;extern const struct armv_pte armv_pte_v6mp;extern const struct armv_pte armv_pte_xsc3;extern const struct armv_pte armv_pte_v7wb;/* * CPU specific configuration information */struct armv_chip { unsigned cpuid; // bits 4-15 of CP15 C1 const char *name; unsigned mmu_cr_set; // CP15 C0 values to set unsigned mmu_cr_clr; // CP15 C0 values to clear int cycles; // cycles per arm_cpuspeed() loop const struct armv_cache *cache; // cache configuration const struct callout_rtn *power; // idle callout const struct callout_rtn *flush; // page_flush callout const struct callout_rtn *deferred; // page_flush_deferred callout const struct armv_pte *pte; // page table entries const struct armv_pte *pte_wa; // for -wa option const struct armv_pte *pte_wb; // for -wb option const struct armv_pte *pte_wt; // for -wt option void (*setup)(struct cpuinfo_entry *cpu, unsigned cpuid);};extern const struct armv_chip *armv_list[];extern const struct armv_chip *armv_chip_detect();extern const struct armv_chip armv_chip_720;extern const struct armv_chip armv_chip_920;extern const struct armv_chip armv_chip_922;extern const struct armv_chip armv_chip_925;extern const struct armv_chip armv_chip_926;extern const struct armv_chip armv_chip_1020;extern const struct armv_chip armv_chip_1022;extern const struct armv_chip armv_chip_sa1100;extern const struct armv_chip armv_chip_sa1110;extern const struct armv_chip armv_chip_ixp1200;extern const struct armv_chip armv_chip_80200;extern const struct armv_chip armv_chip_pxa250a;extern const struct armv_chip armv_chip_pxa250b;extern const struct armv_chip armv_chip_pxa255;extern const struct armv_chip armv_chip_pxa210b;extern const struct armv_chip armv_chip_pxa210c;extern const struct armv_chip armv_chip_pxa270;extern const struct armv_chip armv_chip_ixp2400;extern const struct armv_chip armv_chip_ixp2800;extern const struct armv_chip armv_chip_ixp23xx;extern const struct armv_chip armv_chip_ixp425;extern const struct armv_chip armv_chip_ixp465;extern const struct armv_chip armv_chip_mp11;extern const struct armv_chip armv_chip_1136;extern const struct armv_chip armv_chip_1176;extern const struct armv_chip armv_chip_a8;/* * Operations supported for multiple cores */extern struct callout_rtn power_cp15_wfi;extern void armv_setup_v6(struct cpuinfo_entry *, unsigned, unsigned);extern void armv_setup_v7(struct cpuinfo_entry *, unsigned, unsigned);/* * ------------------------------------------------------------------ * SA-1100/1110 Processor Support * ------------------------------------------------------------------ */extern void init_sa1100(unsigned, const char *, const char *);extern void put_sa1100(int);extern void init_qtime_sa1100(void);extern unsigned sa11x1_base;extern unsigned sa1100_grer;extern unsigned sa1100_gfer;extern struct callout_rtn reboot_sa1100;extern struct callout_rtn power_sa1100;extern struct callout_rtn interrupt_id_sa1100;extern struct callout_rtn interrupt_eoi_sa1100;extern struct callout_rtn interrupt_mask_sa1100;extern struct callout_rtn interrupt_unmask_sa1100;extern struct callout_rtn interrupt_id_sa1100_gpio;extern struct callout_rtn interrupt_eoi_sa1100_gpio;extern struct callout_rtn interrupt_mask_sa1100_gpio;extern struct callout_rtn interrupt_unmask_sa1100_gpio;extern struct callout_rtn display_char_sa1100;extern struct callout_rtn poll_key_sa1100;extern struct callout_rtn break_detect_sa1100;extern struct callout_rtn timer_load_sa1100;extern struct callout_rtn timer_value_sa1100;extern struct callout_rtn timer_reload_sa1100;extern struct callout_rtn cache_sa_i;extern struct callout_rtn cache_sa_d;extern struct callout_rtn page_flush_sa;extern struct callout_rtn page_flush_deferred_sa;extern struct callout_rtn interrupt_id_sa1101;extern struct callout_rtn interrupt_eoi_sa1101;extern struct callout_rtn interrupt_mask_sa1101;extern struct callout_rtn interrupt_unmask_sa1101;extern struct callout_rtn interrupt_id_sa1111;extern struct callout_rtn interrupt_eoi_sa1111;extern struct callout_rtn interrupt_mask_sa1111;extern struct callout_rtn interrupt_unmask_sa1111;extern unsigned long rtc_time_sa1100(unsigned);/* * ------------------------------------------------------------------ * Xscale processor support * ------------------------------------------------------------------ */extern struct callout_rtn power_xscale;extern struct callout_rtn cache_xscale_i;extern struct callout_rtn cache_xscale_d;extern struct callout_rtn page_flush_xscale;extern struct callout_rtn page_flush_deferred_xscale;extern void armv_setup_xscale(struct cpuinfo_entry *, unsigned);extern struct callout_rtn cache_xsc3_i;extern struct callout_rtn cache_xsc3_d;extern struct callout_rtn page_flush_xsc3;extern struct callout_rtn page_flush_deferred_xsc3;/* * ------------------------------------------------------------------ * ARM720T processor support * ------------------------------------------------------------------ */extern struct callout_rtn cache_720;extern struct callout_rtn page_flush_720;extern struct callout_rtn page_flush_deferred_720;/* * ------------------------------------------------------------------ * ARM920T processor support * ------------------------------------------------------------------ */extern struct callout_rtn cache_920_i;extern struct callout_rtn cache_920_d;extern struct callout_rtn page_flush_920;extern struct callout_rtn page_flush_deferred_920;extern struct callout_rtn cache_925_i;extern struct callout_rtn cache_925_d;extern struct callout_rtn page_flush_925;extern struct callout_rtn page_flush_deferred_925;/* * ------------------------------------------------------------------ * ARM1020T processor support * ------------------------------------------------------------------ */extern struct callout_rtn cache_1020_i;extern struct callout_rtn cache_1020_d;extern struct callout_rtn page_flush_1020;extern struct callout_rtn page_flush_deferred_1020;/* * ------------------------------------------------------------------ * PrimeCell UART/RTC support * ------------------------------------------------------------------ */extern void init_primecell(unsigned, const char *, const char *);extern void put_primecell(int);extern struct callout_rtn display_char_primecell;extern struct callout_rtn poll_key_primecell;extern struct callout_rtn break_detect_primecell;extern unsigned long rtc_time_primecell(unsigned);/* * ------------------------------------------------------------------ * PXA250 support * ------------------------------------------------------------------ */extern void init_pxa250(unsigned, const char *, const char *);extern void put_pxa250(int);extern void init_qtime_pxa250(void);extern struct callout_rtn display_char_pxa250;extern struct callout_rtn poll_key_pxa250;extern struct callout_rtn break_detect_pxa250;extern struct callout_rtn timer_load_pxa250;extern struct callout_rtn timer_value_pxa250;extern struct callout_rtn timer_reload_pxa250;extern struct callout_rtn interrupt_id_pxa250;extern struct callout_rtn interrupt_eoi_pxa250;extern struct callout_rtn interrupt_mask_pxa250;extern struct callout_rtn interrupt_unmask_pxa250;extern struct callout_rtn interrupt_id_pxa250_gpio;extern struct callout_rtn interrupt_eoi_pxa250_gpio;extern struct callout_rtn interrupt_mask_pxa250_gpio;extern struct callout_rtn interrupt_unmask_pxa250_gpio;extern unsigned long rtc_time_pxa250(unsigned);/* * ------------------------------------------------------------------ * PXA270 support * ------------------------------------------------------------------ */extern void init_qtime_pxa270(void);extern struct callout_rtn interrupt_id_pxa270;extern struct callout_rtn interrupt_eoi_pxa270;extern struct callout_rtn interrupt_mask_pxa270;extern struct callout_rtn interrupt_unmask_pxa270;extern struct callout_rtn interrupt_id_pxa270_gpio;extern struct callout_rtn interrupt_eoi_pxa270_gpio;extern struct callout_rtn interrupt_mask_pxa270_gpio;extern struct callout_rtn interrupt_unmask_pxa270_gpio;/* * ------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -