/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Retrieval of the DIMM serial number from data encoded in the SPD and
* SEEPROM formats.
*/
#include <mem_spd.h>
#include <mem_seeprom.h>
#include <mem.h>
#include <fm/fmd_fmri.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <strings.h>
#include <sys/byteorder.h>
/*
* SEEPROMs are composed of self-describing containers. The first container,
* starting at offset 0, is r/w. The second container, starting at 0x1800, is
* r/o, and contains identification information supplied by the manufacturer.
*/
static int
{
char *c;
int i;
if (bufsz < sizeof (spd_data_t))
return (fmd_fmri_set_errno(EINVAL));
return (fmd_fmri_set_errno(EINVAL));
}
*c = '\0';
return (0);
}
static void *
{
int sidx;
return (NULL);
/* Validate sc size then dereference it */
return (NULL);
sc->seec_nsegs == 0)
return (NULL);
/* LINTED - pointer alignment */
return (NULL);
}
}
return (NULL);
}
static int
{
return (fmd_fmri_set_errno(EINVAL));
return (fmd_fmri_set_errno(EINVAL));
if (segsz < sizeof (seeprom_seg_sd_t))
return (fmd_fmri_set_errno(EINVAL));
return (0);
}
int
{
int fd;
return (-1); /* errno is set for us */
return (fmd_fmri_set_errno(err));
}
switch (sz) {
case BUFSIZ_SPD:
case BUFSIZ_SEEPROM:
seridsz));
default:
return (fmd_fmri_set_errno(EINVAL));
}
}