?? sysmotvpd.c
字號:
/* sysMotVpd.c - Board-Specified Vital Product Data Routines. *//* Copyright 1998-2000 Motorola, Inc., All Rights Reserved *//*modification history--------------------01k,08feb00,rhk Removed sysProdConfigGet.01i,28may99,dmw Updated to Wind River coding standards.01h,07may99,dmw Changed how sysCpuSpeed is calculated to VPD value.01g,29jan99,rhv Removed unused definition of EXIT_TO_MONITOR and fixed a bug in product ID string processing.01f,28jan99,rhv Changed sysMsgSpit to sysDebugMsg.01e,19jan99,rhv Removing unused variables.01d,14jan99,mdp Fix for Hawk Aux Clock.01c,13jan99,rhv Re-ordering file history.01b,13jan99,rhv Moved sysModel back to sysLib.c and updated copyright.01a,15dec98,rhv Created by Motorola.*//*DESCRIPTIONThis file contains the Board-Specific Vital Product Data utility routines.CAVEATSThese routines are needed before the kernel is un-compressed. For properoperation, this file must be added to the BOOT_EXTRA list in the Makefile toprevent it from being compressed during kernel generation.*/#include "sysMotVpd.h"/* defines *//* locals *//* globals */VPD sysVpd; /* board vital product data */VPD_PACKET * sysVpdPkts[VPD_PKT_LIMIT] = { 0 }; /* board vpd packets */UINT32 sysBusSpeed = DEFAULT_BUS_CLOCK; /* bus speed in Hz. */UINT32 sysCpuSpeed = DEFAULT_INTERNAL_CLOCK; /* internal cpu speed in Hz. */UINT32 sysPciSpeed = DEFAULT_PCI_CLOCK; /* PCI bus speed in Hz. */UCHAR sysProductStr[25] = DEFAULT_PRODUCT_ID; /* product identifier */VPD_PACKET * pSysBrdOpts = NULL; /* board options packet *//* forwards */STATUS sysVpdPktInit ( UCHAR, UCHAR, VPD *, VPD_PACKET **, UINT32, UINT32);STATUS sysVpdPktGet ( UCHAR, UINT32, VPD_PACKET **, VPD_PACKET **);void sysDebugMsg (char *, UINT32);/******************************************************************************** sysReportVpdError - routine to report errors in vpd data.** This routine prints an error message at the system console and optionally* returns to the boot rom.** RETURNS: N/A*/void sysReportVpdError ( char * str /* message to display */ ) { sysDebugMsg (str, DEFAULT_BSP_ERROR_BEHAVIOR); }/******************************************************************************** sysGetBusSpd - routine to get the speed of the 60x processor bus** This routine returns the speed (in Hz) of the 60x system bus.** RETURNS: The bus speed (inHz).*/UINT sysGetBusSpd (void) { return (sysBusSpeed); }/******************************************************************************** sysGetPciSpd - routine to get the speed of the PCI bus** This routine returns the speed (in Hz) of the PCI bus.** RETURNS: The bus speed (inHz).*/UINT sysGetPciSpd (void) { return (sysPciSpeed); }/******************************************************************************** sysGetMpuSpd - routine to get the speed of the 60x processor bus** This routine returns the speed (in Hz) of the 60x system bus.** RETURNS: The bus speed (inHz).*/UINT sysGetMpuSpd (void) { return (sysCpuSpeed); }/********************************************************************************* sysVpdInit - initialize the board vital product data structures.** This routine reads the VPD and extracts the commonly used data.** RETURNS: OK, if successful or ERROR if unsuccessful.** SEE ALSO: N/A()*/STATUS sysVpdInit(void) { VPD_PACKET * pVpdPkt; /* VPD packet pointer */ UINT32 idx; /* index loop counter */ /* read the vpd from the serial eeprom. */ if ( sysVpdPktInit (VPD_BRD_EEPROM_ADRS, VPD_BRD_OFFSET, &sysVpd, &sysVpdPkts[0], VPD_PKT_LIMIT, 1) != OK) { sysReportVpdError ( "sysVpdInit: Unable to read Vital Product Data (VPD).\n\r"); return (ERROR); } /* get the board type */ if ( (sysVpdPktGet (VPD_PID_PID, 0, &sysVpdPkts[0], &pVpdPkt) == OK) && ((pVpdPkt->size + 1) < sizeof (sysProductStr)) ) { for (idx = 0; idx < pVpdPkt->size; idx++) sysProductStr[idx] = pVpdPkt->data[idx]; sysProductStr[idx] = '\0'; } else sysReportVpdError ("sysVpdInit: Unable to read board type.\n\r"); /* get the PCI bus speed */ if ( (sysVpdPktGet (VPD_PID_PCS, 0, &sysVpdPkts[0], &pVpdPkt) == OK) && (pVpdPkt->size == sizeof (UINT32)) ) sysPciSpeed = *(UINT32 *)&pVpdPkt->data[0]; else sysReportVpdError ("sysVpdInit: Unable to read PCI bus speed.\n\r"); /* get the bus speed */ if ( (sysVpdPktGet (VPD_PID_ECS, 0, &sysVpdPkts[0], &pVpdPkt) == OK) && (pVpdPkt->size == sizeof (UINT32)) ) sysBusSpeed = *(UINT32 *)&pVpdPkt->data[0]; else sysReportVpdError ("sysVpdInit: Unable to read bus speed.\n\r"); /* get the internal cpu speed */ if ( (sysVpdPktGet (VPD_PID_ICS, 0, &sysVpdPkts[0], &pVpdPkt) == OK) && (pVpdPkt->size == sizeof (UINT32)) ) sysCpuSpeed = *(UINT32 *)&pVpdPkt->data[0]; else sysReportVpdError ("sysVpdInit: Unable to read bus speed.\n\r"); /* get the product configuration options */ if (sysVpdPktGet (VPD_PID_PCO, 0, &sysVpdPkts[0], &pSysBrdOpts) != OK) sysReportVpdError ( "sysVpdInit: Unable to read configuration options.\n\r"); return (OK); }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -