📄 cpu_startup.h
字号:
/* * $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 <ppc/cpu.h>#include <ppc/inline.h>#include <ppc/priv.h>#include <ppc/401cpu.h>#include <ppc/403cpu.h>#include <ppc/405cpu.h>#include <ppc/400intr.h>#include <ppc/700cpu.h>#include <ppc/800intr.h>#include <ppc/800cpu.h>#include <ppc/8260intr.h>#include <ppc/83xxintr.h>#include <ppc/8260cpu.h>#include <ppc/83xxcpu.h>#include <ppc/440cpu.h>/***************************************************************************************************************************************** These definitions are required for the system independent code.*****************************************************************************************************************************************/#define KERCALL_SEQUENCE(name) uint32_t name[] = { \ 0x60000000, /* NOP */ \ 0x44000002, /* SC */ \}#define CPU_SYSPAGE_TYPE SYSPAGE_PPCstruct cpu_local_syspage { SYSPAGE_SECTION(ppc_boxinfo); SYSPAGE_SECTION(ppc_kerinfo); SYSPAGE_SECTION(ppc_smpinfo); SYSPAGE_SECTION(ppc_tlbinfo);};extern void print_ppc_boxinfo();extern void print_ppc_kerinfo();extern void print_ppc_smpinfo();extern void print_ppc_tlbinfo();#define CPU_PRT_SYSPAGE_RTNS \ CPU_PRT_SYSPAGE_RTN(ppc, 1, boxinfo), \ CPU_PRT_SYSPAGE_RTN(ppc, 1, kerinfo), \ CPU_PRT_SYSPAGE_RTN(ppc, 1, smpinfo), \ CPU_PRT_SYSPAGE_RTN(ppc, 1, tlbinfo),#define BOOTSTRAPS_RUN_ONE_TO_ONE 1/* Reserve the bottom part of memory for the exception table */#define CPU_MEM_RESERVE_START 0#define CPU_MEM_RESERVE_SIZE PPC_EXC_SIZE#define CPU_COMMON_OPTIONS_STRING "xE"/***************************************************************************************************************************************** Everything below is specific to the PPC.*****************************************************************************************************************************************/ extern unsigned boot_regs[];extern int save_EAR;int ppc400_virtual_supported(void);int ppc400_mftb_supported(void);int ppc600_has_fpu(void);unsigned long ppc_cpuspeed(void);void set_spr_indirect(unsigned spr, unsigned value);void ppc_dec_init_qtime(void);void ppc_booke_dec_init_qtime(void);void ppc440gp_set_clock_freqs(unsigned);void ppc440gx_set_clock_freqs(unsigned);void ppc405_set_clock_freqs(unsigned, unsigned);void ppc400_pit_init_qtime(void);void ppc400_mal0_reset(void);void ppc800_pit_init_qtime(void);void ppc8260_pit_init_qtime(void);void ppc800_set_clock_freqs(unsigned, unsigned, int);void ppc800_unlock_registers(void);void ppc600_set_clock_freqs(unsigned);void ppc750fx_set_clock_freqs(unsigned);void ppc600_init_caches(void);void ppc600_init_features(void);void ppc600_flush_caches(void);void ppc700_init_l2_cache(unsigned);void ppc7450_init_l2_cache(unsigned);void ppc7450_init_l3_cache(unsigned);unsigned falcon_system_clock(paddr_t);void falcon_init_l2_cache(paddr_t);void falcon_init_raminfo(paddr_t);void hawk_init_raminfo(paddr_t);void openbios_init_raminfo(void);void ppc405_init_raminfo(void);void ppc400_sdram0_init_raminfo(void);void ppc8260_init_raminfo(void);void ppc8260_set_clock_freqs(unsigned);unsigned ppc83xx_set_clock_freqs(unsigned);void ppc83xx_init_raminfo(void);void ppc85xx_init_raminfo(void);void ppc85xx_init_l2_cache(void);void ppc85xx_set_clock_freqs(unsigned, unsigned);void ppc85xx_set_get_clock_freqs(unsigned, unsigned, unsigned *, unsigned *);unsigned harrier_system_clock(paddr_t);void harrier_init_raminfo(paddr_t);extern paddr_t immr_paddr;extern unsigned cpm_offset;void ppc_set_immr_paddr(paddr_t);void as_add_immr(unsigned, unsigned);unsigned long rtc_time_rtc8xx(void);unsigned ppcbug_smp_num_cpu(void);void ppcbug_smp_init(struct smp_entry *, unsigned);int ppcbug_smp_start(unsigned, void (*)(void));unsigned ppcbug_smp_adjust_num(unsigned);extern void board_cpuconfig1(int cpu);extern void board_cpuconfig2(int cpu);/* * PPC variant routines/structures */enum mmu_info { MI_PAGESIZES, MI_NUM_ENTRIES};struct ppcv_config { unsigned family; void (*cpuconfig1)(int cpu); void (*cpuconfig2)(int cpu); void (*cpuinfo)(struct cpuinfo_entry *cpu); void (*qtime)(void); void *(*map)(unsigned size, paddr_t phys, unsigned prot_flags); void (*unmap)(void *);};extern struct ppcv_config ppcv_config;struct ppcv_chip { unsigned short chip; _Uint8t paddr_bits; _Uint8t cache_lsize; unsigned short icache_lines; unsigned short dcache_lines; unsigned cpu_flags; unsigned pretend_cpu; const char *name; void (*setup)(void);};/* 400 family */extern void ppcv_setup_400(void);extern void ppcv_cpuconfig1_400(int cpu);extern void ppcv_cpuinfo_400(struct cpuinfo_entry *);extern void ppcv_setup_405(void);extern void ppcv_cpuconfig2_405(int cpu);extern const struct ppcv_chip ppcv_chip_401;extern const struct ppcv_chip ppcv_chip_403;extern const struct ppcv_chip ppcv_chip_405;extern const struct ppcv_chip ppcv_chip_405H;extern const struct ppcv_chip ppcv_chip_405GPR;extern const struct ppcv_chip ppcv_chip_405EP;extern const struct ppcv_chip ppcv_chip_vesta;/* 600 family */extern unsigned ppc700_l2cache_giip;extern void ppcv_setup_600(void);extern void ppcv_setup_604(void);extern void ppcv_setup_700(void);extern void ppcv_setup_7400(void);extern void ppcv_setup_7410(void);extern void ppcv_setup_7447(void);extern void ppcv_setup_7450(void);extern void ppcv_setup_7455(void);extern void ppcv_setup_8200(void);extern void ppcv_cpuconfig1_600(int cpu);extern void ppcv_cpuconfig2_600(int cpu);extern void ppcv_cpuinfo_600(struct cpuinfo_entry *);extern void ppcv_cpuinfo_8200(struct cpuinfo_entry *);extern void ppcv_cpuinfo_700(struct cpuinfo_entry *);extern void ppcv_cpuconfig1_604(int cpu);extern void ppcv_cpuconfig2_700(int cpu);extern void ppcv_cpuconfig2_7400(int cpu);extern void ppcv_cpuconfig2_7450(int cpu);extern void ppcv_mmuconfig1_600(int cpu);extern void ppcv_mmuconfig2_600(int cpu);extern void *ppcv_map_600(unsigned size, paddr_t phys, unsigned prot_flags);extern void ppcv_unmap_600(void *p);extern const struct ppcv_chip ppcv_chip_603;extern const struct ppcv_chip ppcv_chip_603e;extern const struct ppcv_chip ppcv_chip_603e7;extern const struct ppcv_chip ppcv_chip_604;extern const struct ppcv_chip ppcv_chip_604e;extern const struct ppcv_chip ppcv_chip_604e5;extern const struct ppcv_chip ppcv_chip_750;extern const struct ppcv_chip ppcv_chip_750fx;extern const struct ppcv_chip ppcv_chip_7400;extern const struct ppcv_chip ppcv_chip_7410;extern const struct ppcv_chip ppcv_chip_7447;extern const struct ppcv_chip ppcv_chip_7450;extern const struct ppcv_chip ppcv_chip_7455;extern const struct ppcv_chip ppcv_chip_7457;extern const struct ppcv_chip ppcv_chip_8245;extern const struct ppcv_chip ppcv_chip_8260;extern const struct ppcv_chip ppcv_chip_8280;extern const struct ppcv_chip ppcv_chip_e300c1;extern const struct ppcv_chip ppcv_chip_mgt5200;/* 800 family */extern void ppcv_setup_800(void);extern void ppcv_cpuconfig1_800(int cpu);extern void ppcv_cpuinfo_800(struct cpuinfo_entry *);extern const struct ppcv_chip ppcv_chip_800;extern const struct ppcv_chip ppcv_chip_823; /* Don't add to ppcv_list[] *//* Book E family */struct ppcbke_tlb_rtns { unsigned asid_bits; int (*info)(enum mmu_info, unsigned tlb); void (*read)(int tlb, int idx, ppcbke_tlb_t *); void (*write)(int tlb, int idx, const ppcbke_tlb_t *);};extern struct ppcbke_tlb_rtns ppcbke_tlb;extern int ppcbke_tlb_info_static(enum mmu_info, unsigned);extern void ppcbke_tlb_write_ibm(int tlb, int idx, const ppcbke_tlb_t *);extern void ppcbke_tlb_read_ibm(int tlb, int idx, ppcbke_tlb_t *);extern int ppcbke_tlb_info_motorola(enum mmu_info, unsigned);extern void ppcbke_tlb_write_e500(int tlb, int idx, const ppcbke_tlb_t *);extern void ppcbke_tlb_read_e500(int tlb, int idx, ppcbke_tlb_t *);struct tlb_info_booke { unsigned short num_tlbs; struct { unsigned short entries; unsigned short page_sizes; } tlb[4];};extern struct tlb_info_booke static_tlb_info;extern void *ppcv_map_booke(unsigned size, paddr_t phys, unsigned prot_flags);extern void ppcv_setup_booke(void);extern void ppcv_setup_440(void);extern void ppcv_setup_e500(void);extern void ppcv_cpuconfig1_booke(int cpu);extern void ppcv_cpuconfig2_booke(int cpu);extern void ppcv_cpuinfo_booke(struct cpuinfo_entry *);extern void ppcv_cpuconfig1_e500(int cpu);extern void ppcv_cpuconfig2_e500(int cpu);extern void ppcv_cpuinfo_e500(struct cpuinfo_entry *);extern const struct ppcv_chip ppcv_chip_440gp;extern const struct ppcv_chip ppcv_chip_440gx;extern const struct ppcv_chip ppcv_chip_440ep;extern const struct ppcv_chip ppcv_chip_e500;extern const struct ppcv_chip ppcv_chip_e500v2;#define IVOR_LIST_CREATE(spr, num) (((num) << 12) | (spr))#define IVOR_LIST_SPR(list) ((list) & 0x3ff)#define IVOR_LIST_NUM(list) ((list) >> 12)extern unsigned short ivor32_47_list;extern unsigned short ivor48_63_list;extern const struct ppcv_chip *ppcv_list[];extern const struct ppcv_chip *ppcv;/* * Common debugging routines */void init_403(unsigned, const char *, const char *);void put_403(int);extern struct callout_rtn display_char_403;extern struct callout_rtn poll_key_403;extern struct callout_rtn break_detect_403;void init_800cpm(unsigned, const char *, const char *);void put_800cpm(int c);extern struct callout_rtn display_char_800cpm;extern struct callout_rtn poll_key_800cpm;extern struct callout_rtn break_detect_800cpm;void init_8260cpm(unsigned, const char *, const char *);void put_8260cpm(int c);extern struct callout_rtn display_char_8260cpm;extern struct callout_rtn poll_key_8260cpm;extern struct callout_rtn break_detect_8260cpm;/* * Common callouts */extern struct callout_rtn smp_spin;extern struct callout_rtn cache_ippc;extern struct callout_rtn cache_dppc;extern struct callout_rtn cache_ippc_700smp;extern struct callout_rtn cache_dppc_700smp;/* These two only needed to work around PPC405 errata #37. */extern struct callout_rtn cache_ippc_400;extern struct callout_rtn cache_dppc_400;extern struct callout_rtn reboot_400;extern struct callout_rtn reboot_405;extern struct callout_rtn reboot_800;extern struct callout_rtn reboot_booke;extern struct callout_rtn interrupt_mask_403;extern struct callout_rtn interrupt_unmask_403;extern struct callout_rtn interrupt_id_403;extern struct callout_rtn interrupt_eoi_403;extern struct callout_rtn interrupt_mask_405;extern struct callout_rtn interrupt_unmask_405;extern struct callout_rtn interrupt_id_405;extern struct callout_rtn interrupt_eoi_405;extern struct callout_rtn interrupt_mask_ibm_uic;extern struct callout_rtn interrupt_unmask_ibm_uic;extern struct callout_rtn interrupt_id_ibm_uic;extern struct callout_rtn interrupt_eoi_ibm_uic;extern struct callout_rtn interrupt_mask_400pit;extern struct callout_rtn interrupt_unmask_400pit;extern struct callout_rtn interrupt_id_400pit;extern struct callout_rtn interrupt_eoi_400pit;extern struct callout_rtn interrupt_mask_400fit;extern struct callout_rtn interrupt_unmask_400fit;extern struct callout_rtn interrupt_id_400fit;extern struct callout_rtn interrupt_eoi_400fit;extern struct callout_rtn interrupt_mask_400wd;extern struct callout_rtn interrupt_unmask_400wd;extern struct callout_rtn interrupt_id_400wd;extern struct callout_rtn interrupt_eoi_400wd;extern struct callout_rtn interrupt_mask_800;extern struct callout_rtn interrupt_unmask_800;extern struct callout_rtn interrupt_id_800;extern struct callout_rtn interrupt_eoi_800;extern struct callout_rtn interrupt_mask_800cpm;extern struct callout_rtn interrupt_unmask_800cpm;extern struct callout_rtn interrupt_id_800cpm;extern struct callout_rtn interrupt_eoi_800cpm;extern struct callout_rtn interrupt_mask_8260;extern struct callout_rtn interrupt_unmask_8260;extern struct callout_rtn interrupt_id_8260;extern struct callout_rtn interrupt_eoi_8260;extern struct callout_rtn interrupt_mask_83xx;extern struct callout_rtn interrupt_unmask_83xx;extern struct callout_rtn interrupt_id_83xx;extern struct callout_rtn interrupt_eoi_83xx;extern struct callout_rtn interrupt_mask_dec;extern struct callout_rtn interrupt_unmask_dec;extern struct callout_rtn interrupt_id_dec;extern struct callout_rtn interrupt_id_dec_smp;extern struct callout_rtn interrupt_eoi_dec;extern struct callout_rtn interrupt_mask_booke_dec;extern struct callout_rtn interrupt_unmask_booke_dec;extern struct callout_rtn interrupt_id_booke_dec;extern struct callout_rtn interrupt_eoi_booke_dec;extern struct callout_rtn interrupt_mask_booke_fit;extern struct callout_rtn interrupt_unmask_booke_fit;extern struct callout_rtn interrupt_id_booke_fit;extern struct callout_rtn interrupt_eoi_booke_fit;extern struct callout_rtn interrupt_mask_booke_watchdog;extern struct callout_rtn interrupt_unmask_booke_watchdog;extern struct callout_rtn interrupt_id_booke_watchdog;extern struct callout_rtn interrupt_eoi_booke_watchdog;extern struct callout_rtn interrupt_mask_pmi;extern struct callout_rtn interrupt_unmask_pmi;extern struct callout_rtn interrupt_id_pmi;extern struct callout_rtn interrupt_eoi_pmi;extern struct callout_rtn timer_load_400;extern struct callout_rtn timer_reload_400;extern struct callout_rtn timer_value_400;extern struct callout_rtn timer_load_800;extern struct callout_rtn timer_reload_800;extern struct callout_rtn timer_value_800;extern struct callout_rtn timer_load_8260;extern struct callout_rtn timer_reload_8260;extern struct callout_rtn timer_value_8260;extern struct callout_rtn timer_load_dec;extern struct callout_rtn timer_reload_dec;extern struct callout_rtn timer_value_dec;extern struct callout_rtn timer_load_dec_booke;extern struct callout_rtn timer_value_dec_booke;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -