📄 sysmotvpd.c
字号:
/* sysMotVpd.c - Board-Specified Vital Product Data Routines. *//* Copyright 2002 Wind River Systems, Inc. *//* Copyright 1998-2002 Motorola, Inc., All Rights Reserved *//*modification history--------------------01a,02nov00,djs created based on 01k,08feb00,rhk mv2100*//*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 + -