📄 tgt_machdep.c
字号:
/* $Id: tgt_machdep.c,v 1.5 2002/11/16 18:01:34 pefo Exp $ *//* * Copyright (c) 2000 Opsycon AB (www.opsycon.se) * Copyright (c) 2000 Rtmx, Inc (www.rtmx.com) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed for Rtmx, Inc by * Opsycon Open System Consulting AB, Sweden. * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */#include <sys/types.h>#include <stdio.h>#include <setjmp.h>#include <termio.h>#include <string.h>#include <time.h>#include <machine/cpu.h>#include <machine/pio.h>#include <include/palomarii.h>#include <pmon/dev/cpc700.h>#include <pmon/dev/cpc700_iic.h>#include <sys/dev/pci/pcivar.h>#include <pmon/dev/ns16550.h>#include <pmon.h>extern unsigned char hwethadr[6];int md_pipefreq = 0;int md_cpufreq = 0;ConfigEntry ConfigTable[] ={#ifdef POCONO { (char *)REAR_COM_BASE_ADDR, 0, ns16550, 256, B9600, 18432000 }, { (char *)FRONT_COM_BASE_ADDR, 0, ns16550, 256, B9600, 18432000 },#else { (char *)CPC700_UART0RBR, 0, ns16550, 256, B9600, (33000000 / 4) },#endif { 0 }};unsigned long _filebase;static void _probe_frequencies __P((void));extern void configure(void);extern void config_init(void);/* * This function makes inital HW setup for debugger and * returns the apropriate setting for the status register. */register_ttgt_enable(int machtype){ /* XXX Do any HW specific setup */ return(PSL_IR|PSL_DR|PSL_FP|PSL_RI|PSL_ME|PSL_FE_DFLT);}/* * Print out any target specific logo */voidtgt_logo(){ printf("\n"); printf("[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[\n"); printf("[[[ [[[[ [[[[[[[[[[ [[[[ [[[[ [[[[[[[ [[\n"); printf("[[ [[[[[[[[ [[[ [[[[[[[[ [[[ [[[[[[[[ [[[ [[[[[[ [[\n"); printf("[[ [[[[[[[[[[ [[[ [ [[[[[[ [ [[[ [[[[[[[[[[ [[[ [ [[[[[ [[\n"); printf("[[ [[[[[[[[[[ [[[ [[ [[[[ [[ [[[ [[[[[[[[[[ [[[ [[ [[[[ [[\n"); printf("[[ [[[[[[[[ [[[ [[[ [[ [[[ [[[ [[[[[[[[[[ [[[ [[[ [[[ [[\n"); printf("[[ [[[[ [[[[ [[[[ [[[ [[[[[[[[[[ [[[ [[[[ [[ [[\n"); printf("[[ [[[[[[[[[[[[[[[ [[[[[ [[[[[ [[[ [[[[[[[[[[ [[[ [[[[[ [ [[\n"); printf("[[ [[[[[[[[[[[[[[[ [[[[[[[[[[[[ [[[ [[[[[[[[[[ [[[ [[[[[[ [[\n"); printf("[[ [[[[[[[[[[[[[[[ [[[[[[[[[[[[ [[[ [[[[[[[[ [[[ [[[[[[[ [[\n"); printf("[[ [[[[[[[[[[[[[[[ [[[[[[[[[[[[ [[[[ [[[[ [[[[[[[[ [[\n"); printf("[[[[[[[2000][[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[\n");}/* * Target dependent version printout. * Printout available target version information. */voidtgt_cmd_vers(){ /* printf("Board revision level: %c.\n", in8(PLD_BAR) + 'A'); */}static void_probe_frequencies(){ SBD_DISPLAY ("FREQ", CHKPNT_FREQ); md_cpufreq = 66000000; md_pipefreq = md_getpipefreq(md_cpufreq); if(md_pipefreq == -1) { printf("Serius problem incorrect pipe freq!!!\n"); }}/* * Returns the CPU pipelie clock frequency */inttgt_pipefreq(){ if(md_pipefreq == 0) { _probe_frequencies(); } return(md_pipefreq);}/* * Returns the external clock frequency, usually the bus clock */inttgt_cpufreq(){ if(md_cpufreq == 0) { _probe_frequencies(); } return(md_cpufreq);}/* * Print out any target specific memory information */voidtgt_memprint(){ if(tgt_gettime() == -1) { printf("\nWARN! Date invalid, use 'date' to set time!\n"); }}voidtgt_machprint(){#ifdef POCONO printf("BSP Copyright 2001, IP Unplugged Inc.\n"); printf("CPU PowerPC 750 @");#else printf("CPU PowerPC %s @", md_cpuname());#endif } /* * Return a suitable address for the client stack. * Usually top of RAM memory. */register_ttgt_clienttos(){ return((memorysize & ~7) - 64);}/* * Network stuff. */voidtgt_netinit(){}inttgt_ethaddr(char *p){ bcopy((void *)&hwethadr, p, 6); return(0);}voidtgt_netreset(){}/* * Simple display function to display a 4 char string or code. * Called during startup to display progress on any feasible * display before any serial port have been initialized. */voidtgt_display(char *msg, int x){ /* Have simple serial port driver */ tgt_putchar(msg[0]); tgt_putchar(msg[1]); tgt_putchar(msg[2]); tgt_putchar(msg[3]); tgt_putchar('\r'); tgt_putchar('\n');}voidclrhndlrs(){}inttgt_getmachtype(){ return(md_cputype());}/* * Create stubs if network is not compiled in */#ifdef INETvoidtgt_netpoll(){ splx(splhigh());}#elsegsignal(jmp_buf jb, int sig){ if(jb != NULL) { longjmp(jb, 1); }}netopen() { return -1;}netread() { return -1;}netwrite() { return -1;}netclose() { return -1;}netlseek() { return -1;}netioctl() { return -1;}void netpoll() {}unsigned long__time(){ return(tgt_gettime));}#endif /*INET*//* * Put all machine dependent initialization here. This call * is done after console has been initialized so it's safe * to output configuration and debug information with printf. */voidtgt_devconfig(){ _pci_devinit(1); /* PCI device initialization */ config_init(); configure();}voidtgt_devinit(){ _pci_businit(1); /* PCI bus initialization */}voidtgt_machreset(){ tgt_netreset();}voidtgt_reboot(){ outb(PALOMAR_WD_TIME, 1); outb(PALOMAR_WD_TIME + 1, 1); outb(PALOMAR_CNTL_SET, PALOMAR_BIT_EN_WD); while(1);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -