Exemplo n.º 1
0
int checkboard (void)
{
	vpd_packet_t *packet;
	int i;
	const char *const fmt =
		"\n	 *** Warning: Low Battery Status - %s Battery ***";

	puts ("Board: ");

	packet = vpd_find_packet (VPD_PID_PID);
	for (i = 0; i < packet->size; i++) {
		serial_putc (packet->data[i]);
	}
	packet = vpd_find_packet (VPD_PID_MT);
	for (i = 0; i < packet->size; i++) {
		serial_putc (packet->data[i]);
	}
	serial_putc ('(');
	packet = vpd_find_packet (VPD_PID_FAN);
	for (i = 0; i < packet->size; i++) {
		serial_putc (packet->data[i]);
	}
	serial_putc (')');

	if (!(MBX_CSR2 & SR2_BATGD))
		printf (fmt, "On-Board");
	if (!(MBX_CSR2 & SR2_NVBATGD))
		printf (fmt, "NVRAM");

	serial_putc ('\n');

	return (0);
}
Exemplo n.º 2
0
int checkboard (void)
{
    vpd_packet_t *packet;
    int i;

    packet = vpd_find_packet(VPD_PID_PID);
    for (i=0; i<packet->size; i++) {
        serial_putc (packet->data[i]);
    }
    packet = vpd_find_packet(VPD_PID_MT);
    for (i=0; i<packet->size; i++) {
        serial_putc (packet->data[i]);
    }
    serial_putc ('(');
    packet = vpd_find_packet(VPD_PID_FAN);
    for (i=0; i<packet->size; i++) {
        serial_putc (packet->data[i]);
    }
    serial_putc (')');

    if (!(MBX_CSR2 & SR2_BATGD))
        printf("\n         *** Warning: Low Battery Status - On-Board Battery ***");
    if (!(MBX_CSR2 & SR2_NVBATGD))
        printf("\n         *** Warning: Low Battery Status - NVRAM Battery ***");

    serial_putc ('\n');

    return (1);
}
Exemplo n.º 3
0
/*
 * vpd_is_valid() - Validates contents of VPD data
 *		    in I2C EEPROM.  Returns 1 for
 *		    success or 0 for failure.
 */
static int vpd_is_valid(unsigned dev_addr, unsigned char *buf)
{
    unsigned	    num_bytes;
    vpd_packet_t    *packet;
    vpd_t	    *vpd = (vpd_t *)buf;
    unsigned short  stored_crc16, calc_crc16 = 0xffff;

    /* Check Eyecatcher */
    if (strncmp((char *)(vpd->header.eyecatcher), VPD_EYECATCHER, VPD_EYE_SIZE) != 0) {
	unsigned offset = 0;
	if (dev_addr == CFG_DEF_EEPROM_ADDR)
	    offset += SDRAM_SPD_DATA_SIZE;
	printf("Error: VPD EEPROM 0x%x corrupt @ 0x%x\n", dev_addr, offset);

	return 0;
    }

    /* Check Length */
    if (vpd->header.size> VPD_MAX_EEPROM_SIZE) {
	printf("Error: VPD EEPROM 0x%x contains bad size 0x%x\n",
	       dev_addr, vpd->header.size);
	return 0;
    }

    /* Now find the termination packet */
    if ((packet = vpd_find_packet(vpd, VPD_PID_TERM)) == NULL) {
	printf("Error: VPD EEPROM 0x%x missing termination packet\n",
	       dev_addr);
	return 0;
    }

    /* Calculate data size */
    num_bytes = (unsigned long)((unsigned char *)packet -
				(unsigned char *)vpd + sizeof(vpd_packet_t));

    /* Find stored CRC and clear it */
    if ((packet = vpd_find_packet(vpd, VPD_PID_CRC)) == NULL) {
	printf("Error: VPD EEPROM 0x%x missing CRC\n", dev_addr);
	return 0;
    }
    stored_crc16 = *((ushort *)packet->data);
    *(ushort *)packet->data = 0;

    /* OK, lets calculate the CRC and check it */
#if defined(VXWORKS)
    calc_crc16 = (0xffff & crc32(buf, num_bytes));
#else
    calc_crc16 = (0xffff & crc32(0, buf, num_bytes));
#endif
    *(ushort *)packet->data = stored_crc16;     /* Now restore the CRC */
    if (stored_crc16 != calc_crc16) {
	printf("Error: VPD EEPROM 0x%x has bad CRC 0x%x\n",
	       dev_addr, stored_crc16);
	return 0;
    }

    return 1;
} /* vpd_is_valid() */
Exemplo n.º 4
0
static unsigned int get_reffreq(void)
{
    vpd_packet_t *packet;

    packet = vpd_find_packet(VPD_PID_RCS);
    return *((ulong*)packet->data);
}
Exemplo n.º 5
0
static unsigned int board_get_cpufreq(void)
{
    vpd_packet_t *packet;

    packet = vpd_find_packet(VPD_PID_ICS);
    return *((ulong*)packet->data);
}
Exemplo n.º 6
0
void board_get_enetaddr (uchar *addr)
{
    int i;
    vpd_packet_t *packet;

    packet = vpd_find_packet(VPD_PID_EA);
    for (i=0; i<6; i++)
        addr[i] = packet->data[i];
}
Exemplo n.º 7
0
static unsigned int board_get_cpufreq (void)
{
#ifndef CONFIG_8xx_GCLK_FREQ
	vpd_packet_t *packet;

	packet = vpd_find_packet (VPD_PID_ICS);
	return *((ulong *) packet->data);
#else
	return((unsigned int)CONFIG_8xx_GCLK_FREQ );
#endif /* CONFIG_8xx_GCLK_FREQ */
}