📄 info.c
字号:
/************************************************************************ * * info.c * * Info command for shell * * info [board | cpu | ide | mem | pci | isa | lan | boot | all] * * ###################################################################### * * mips_start_of_legal_notice * * Copyright (c) 2004 MIPS Technologies, Inc. All rights reserved. * * * Unpublished rights (if any) reserved under the copyright laws of the * United States of America and other countries. * * This code is proprietary to MIPS Technologies, Inc. ("MIPS * Technologies"). Any copying, reproducing, modifying or use of this code * (in whole or in part) that is not expressly permitted in writing by MIPS * Technologies or an authorized third party is strictly prohibited. At a * minimum, this code is protected under unfair competition and copyright * laws. Violations thereof may result in criminal penalties and fines. * * MIPS Technologies reserves the right to change this code to improve * function, design or otherwise. MIPS Technologies does not assume any * liability arising out of the application or use of this code, or of any * error or omission in such code. Any warranties, whether express, * statutory, implied or otherwise, including but not limited to the implied * warranties of merchantability or fitness for a particular purpose, are * excluded. Except as expressly provided in any written license agreement * from MIPS Technologies or an authorized third party, the furnishing of * this code does not give recipient any license to any intellectual * property rights, including any patent rights, that cover this code. * * This code shall not be exported, reexported, transferred, or released, * directly or indirectly, in violation of the law of any country or * international law, regulation, treaty, Executive Order, statute, * amendments or supplements thereto. Should a conflict arise regarding the * export, reexport, transfer, or release of this code, the laws of the * United States of America shall be the governing law. * * This code constitutes one or more of the following: commercial computer * software, commercial computer software documentation or other commercial * items. If the user of this code, or any related documentation of any * kind, including related technical data or manuals, is an agency, * department, or other entity of the United States government * ("Government"), the use, duplication, reproduction, release, * modification, disclosure, or transfer of this code, or any related * documentation of any kind, is restricted in accordance with Federal * Acquisition Regulation 12.212 for civilian agencies and Defense Federal * Acquisition Regulation Supplement 227.7202 for military agencies. The use * of this code by the Government is further restricted in accordance with * the terms of the license agreement(s) and/or applicable contract terms * and conditions covering this code from MIPS Technologies or an authorized * third party. * * * * * mips_end_of_legal_notice * * ************************************************************************//************************************************************************ * Include files ************************************************************************/#include <sysdefs.h>#include <syserror.h>#include <shell_api.h>#include <pci_api.h>#include <isa_api.h>#include <mips.h>#include <shell.h>#include <sysdev.h>#include <serial_api.h>#include <sysenv_api.h>#include <lan_api.h>#include <syscon_api.h>#include <sys_api.h>#include <stdio.h>#include <string.h>#include <io_api.h>#include <env_api.h>/************************************************************************ * Definitions ************************************************************************/typedef struct{ char *name; bool (*func)(void);}t_item;#define MAX_ITEM 12#define INDENT 32/* Messages */#define SUPPORT "support@mips.com"#define UPGRADE "DIMM Socket J11: PC100 SDRAM 3.3V 64-128Mbyte"#define SDBREV "MIPS SDB Version "#define SDBREV_UNKNOWN "MIPS SDB non-approved version"#define CONFIGURATION "\JP1: Position \"TERM\" : Enable SCSI termination.\n\JP2: Position \"TPWR\" : Enable SCSI termination power.\n\JP3: Position \"16\" : PCI bus frequency = 16MHz.\n\ Position \"33\" : PCI bus frequency = 33MHz.\n\\n\Do no fit any other jumpers.\n\\n\All switches in S5 should be OFF (up).\n\Front panel switch S1 functions as per Harp SDB spec."#define SHELL_WELCOME_MSG \ "YAMON ROM Monitor, Revision " \ YAMON_REV_STRING \ ".\n" \ "Copyright (c) 1999-2004 " \ MIPS_NAME \ " - All Rights Reserved.\n\n" \ "For a list of available commands, type 'help'.\n"/************************************************************************ * Public variables ************************************************************************//************************************************************************ * Static variables ************************************************************************/static char syntax_descr[500] = "Display information on the requested item (default boot).";static char *info_board_name = "board";static char *info_sysctrl_name= "sysctrl";static char *info_cpu_name = "cpu";static char *info_mem_name = "memory";static char *info_pci_name = "pci";static char *info_ide_name = "ide";static char *info_isa_name = "isa";static char *info_uart_name = "uart";static char *info_lan_name = "lan";static char *info_boot_name = "boot";static char *info_all_name = "all";static char *boot_name = "boot";#define MAX_NAME_LEN 7static char *info_board_descr = "Board properties";static char *info_sysctrl_descr = "System Controller properties";static char *info_cpu_descr = "CPU properties";static char *info_mem_descr = "Memory properties";static char *info_pci_descr = "PCI autodiscovery/autoconfiguration";static char *info_ide_descr = "IDE configuration";static char *info_isa_descr = "ISA bus configuration";static char *info_uart_descr = "Serial ports statistics";static char *info_lan_descr = "Ethernet statistics";static char *info_boot_descr = "Info displayed after reset";static char *info_all_descr = "All info";static char syntax[100];static t_item item[MAX_ITEM];static UINT32 item_count;static bool board_pci;static bool board_ide;static bool board_isa;static bool board_lan;static bool board_eeprom;static bool init_done = FALSE;static bool disp_all = FALSE;/************************************************************************ * Static function prototypes ************************************************************************/static boolcheck_config1(void);static boolcheck_ip(void);static boolcheck_eeprom(void);static voidinit_command( void );static UINT32 get_options( UINT32 argc, char **argv, char **name );static UINT32determine_total_flash( void );static booldisp_prid( UINT32 prid );static boolinfo_boot(void);static boolinfo_board(void);static boolinfo_sysctrl(void);static boolinfo_cpu(void);static boolinfo_cpu_boot(void);static boolinfo_mem(void);static boolinfo_mem_boot(void);static voidinfo_microsoft(void);static boolinfo_pci( void );static boolinfo_ide( void );static boolinfo_isa( void );static boolinfo_uart( void );static boolinfo_lan( void );static voiddetermine_sdbrevision( char *msg );/************************************************************************ * Implementation : Static functions ************************************************************************//************************************************************************ * check_config1 ************************************************************************/static boolcheck_config1(void){ UINT32 config1, config1_reset; if( SYSCON_read( SYSCON_CPU_CP0_CONFIG1_ID, &config1, sizeof(UINT32) ) != OK ) { return FALSE; } if( SYSCON_read( SYSCON_CPU_CP0_CONFIG1_RESET_ID, &config1_reset, sizeof(UINT32) ) != OK ) { return FALSE; } if( config1 == config1_reset ) { return FALSE; } printf("\nWARNING: Non default cache configuration!"); return TRUE;}/************************************************************************ * check_fpu ************************************************************************/static boolcheck_fpu(void){ if (shell_fpu_warning) { printf("\nWARNING: Non default FPU configuration!"); return TRUE; } return FALSE;}/************************************************************************ * check_ip ************************************************************************/static boolcheck_ip(void){ UINT32 wdata; bool errflag = FALSE; if( board_lan ) { if( (SYSCON_read(SYSCON_COM_EN0_IP_ADDR_ID, &wdata, sizeof(UINT32)) != OK) || (wdata == 0) ) { printf("\nWARNING: Environment variable 'ipaddr' is undefined!"); errflag = TRUE; } if( (SYSCON_read(SYSCON_COM_EN0_IP_SUBNETMASK_ID, &wdata, sizeof(UINT32)) != OK) || (wdata == 0) ) { printf("\nWARNING: Environment variable 'subnetmask' is undefined!"); errflag = TRUE; } } return errflag;}/************************************************************************ * check_eeprom ************************************************************************/static boolcheck_eeprom(void){ t_mac_addr mac; t_sn_ascii sn; bool errflag = FALSE; if( board_eeprom ) { if( SYSCON_read(SYSCON_BOARD_SN_ID, &sn, sizeof(sn)) != OK ) errflag = TRUE; if( board_lan ) { if( SYSCON_read(SYSCON_COM_EN0_MAC_ADDR_ID, &mac, sizeof(mac)) != OK ) { errflag = TRUE; } } } if( errflag ) { printf("\nWARNING: EEPROM content is not valid!"); } return errflag;}/************************************************************************ * check_pci_alloc ************************************************************************/static boolcheck_pci_alloc(void){ bool bdata; if (SYSCON_read(SYSCON_BOARD_PCI_ALLOC_ERR_ID, &bdata, sizeof(bool)) == OK && bdata != FALSE ) { printf("\nWARNING: PCI ressource overrun (see 'info pci')!"); return TRUE; } return FALSE;}/************************************************************************ * info ************************************************************************/static MON_FUNC(info){ /* Options */ char *name; UINT32 rc; rc = get_options( argc, argv, &name ); if( rc != OK ) return rc; else return shell_disp_info( name );}/************************************************************************ * info_sdb ************************************************************************/static MON_FUNC(info_sdb){ /* Microsoft Windows CE validation */ if( argc != 1 ) { if( *(argv[1]) == '-' ) { shell_error_data = argv[1]; return SHELL_ERROR_OPTION; } else return SHELL_ERROR_SYNTAX; } info_microsoft(); SHELL_PUTC( '\n' ); return OK;}/************************************************************************ * register_item ************************************************************************/static voidregister_item( char *name, char *descr, bool (*func)(void) ){ UINT32 i; if (item_count >= MAX_ITEM) return; if (item_count == 0) { strcat( syntax_descr, "\n\nThe following information displays can be requested:\n\n"); } else { strcat( syntax, "|"); } strcat( syntax, name );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -