#ifndef _SPD_DATA_H
#define _SPD_DATA_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <sys/types.h>
size_t get_sp_sec_hdr(void *sec_hdr, size_t sec_hdr_len);
size_t get_sp_seg_hdr(void *seg_hdr, size_t seg_hdr_len);
int get_spd_data(int fd, char *spd_data, size_t ctr_len, off_t ctr_offset);
int cvrt_dim_data(const char *spd_data, size_t spd_data_len,
uchar_t **sp_seg_ptr, size_t *sp_seg_len);
enum spd_memtype {
SPDMEM_RESERVED = 0,
SPDMEM_FPM_DRAM,
SPDMEM_EDO,
SPDMEM_PIPE,
SPDMEM_SDRAM,
SPDMEM_ROM,
SPDMEM_SGRAM_DDR,
SPDMEM_SDRAM_DDR,
SPDMEM_DDR2_SDRAM
};
typedef struct {
uchar_t spd_len;
uchar_t spd_max_len;
uchar_t memory_type;
uchar_t n_rows;
uchar_t n_cols;
uchar_t n_mod_rows;
uchar_t ls_data_width;
uchar_t ms_data_width;
uchar_t vddq_if;
uchar_t cycle_time25;
uchar_t access_time25;
uchar_t config;
uchar_t refresh;
uchar_t primary_width;
uchar_t err_chk_width;
uchar_t tCCD;
uchar_t burst_lengths;
uchar_t n_banks;
uchar_t cas_lat;
uchar_t cs_lat;
uchar_t we_lat;
uchar_t mod_attrs;
uchar_t dev_attrs;
uchar_t cycle_time20;
uchar_t access_time20;
uchar_t cycle_time15;
uchar_t access_time15;
uchar_t tRP;
uchar_t tRRD;
uchar_t tRCD;
uchar_t tRAS;
uchar_t mod_row_density;
uchar_t addr_ip_setup;
uchar_t addr_ip_hold;
uchar_t data_ip_setup;
uchar_t data_ip_hold;
uchar_t superset[62 - 36];
uchar_t spd_rev;
uchar_t chksum_0_62;
uchar_t jedec[8];
uchar_t manu_loc;
uchar_t manu_part_no[91 - 73];
uchar_t manu_rev_pcb;
uchar_t manu_rev_comp;
uchar_t manu_year;
uchar_t manu_week;
uchar_t asmb_serial_no[4];
uchar_t manu_specific[128 - 99];
} spd_data_t;
#define SP_SEC_HDR \
{ 0x08, 0x00, 0x01, 0x00, 0x33, 0x01 }
#define SP_SEG_HDR \
{ 'S', 'P', 0x00, 0x00, 0x41, 0xb6, 0x00, 0x00, 0x00, 0x8d }
#define SP_DATA { \
0xc1, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0xf0, 0x00, 0xfb, 0x00, 0x00, 0x00, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x0c, 0x00, 0x00, 0x00, 0x00 }
#define DIMM_CAP_OFF 2
#define SPD_R_OFF 13
#define DATA_WIDTH 6
#define MANUF_ID 64
#define MANUF_LOC 66
#define MANUF_YEAR 87
#define MANUF_WEEK 89
#define SPD_R_LEN 123
#ifdef __cplusplus
}
#endif
#endif