Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "test.h"
#include "screen_buffer.h"
#include "dmi.h"
#include "spd.h"

extern int bail, beepmode;
extern struct tseq tseq[];
Expand Down Expand Up @@ -46,7 +47,9 @@ void get_config(void)
cprint(POP_Y+6, POP_X+6, "(4) Core Selection");
cprint(POP_Y+7, POP_X+6, "(5) Refresh Screen");
cprint(POP_Y+8, POP_X+6, "(6) Display DMI Data");
#ifndef SPD_DISABLED
cprint(POP_Y+9, POP_X+6, "(7) Display SPD Data");
#endif
cprint(POP_Y+11, POP_X+6, "(0) Continue");

/* Wait for key release */
Expand Down
4 changes: 4 additions & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,7 @@

/* Location of flashing '+' symbol */
#define MEMTEST_PLUS_LOCATION 9

/* SPD_DISABLED - disabled SPD data reading and usage
*/
//#define SPD_DISABLED
32 changes: 31 additions & 1 deletion spd.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,25 @@
* http://www.canardpc.com - http://www.memtest.org
*/

#include "spd.h"
#include "config.h"

#ifndef SPD_DISABLED

#include "stdint.h"
#include "test.h"
#include "io.h"
#include "pci.h"
#include "msr.h"
#include "spd.h"
#include "screen_buffer.h"
#include "jedec_id.h"

#define NULL 0

#define AMD_INDEX_IO_PORT 0xCD6
#define AMD_DATA_IO_PORT 0xCD7
#define AMD_SMBUS_BASE_REG 0x2C

#define SMBHSTSTS smbusbase
#define SMBHSTCNT smbusbase + 2
#define SMBHSTCMD smbusbase + 3
Expand All @@ -23,6 +31,11 @@

extern void wait_keyup();

int get_ddr2_module_size(int rank_density_byte, int rank_num_byte);
int get_ddr3_module_size(int sdram_capacity, int prim_bus_width, int sdram_width, int ranks);
char* convert_hex_to_char(unsigned hex_org);
void sb800_get_smb(void);

int smbdev, smbfun;
unsigned short smbusbase;
unsigned char spd_raw[256];
Expand Down Expand Up @@ -546,3 +559,20 @@ char* convert_hex_to_char(unsigned hex_org) {

return buf;
}
#else // SPD_DISABLED

void show_spd(void)
{
//
// Empty implementations if there is not SPD available
//
}

void get_spd_spec()
{
//
// Empty implementations if there is not SPD available
//
}

#endif
13 changes: 5 additions & 8 deletions spd.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
* By Samuel DEMEULEMEESTER, [email protected]
* http://www.canardpc.com - http://www.memtest.org
*/

#define AMD_INDEX_IO_PORT 0xCD6
#define AMD_DATA_IO_PORT 0xCD7
#define AMD_SMBUS_BASE_REG 0x2C
#ifndef _SPD_H_
#define _SPD_H_

void get_spd_spec(void);
int get_ddr2_module_size(int rank_density_byte, int rank_num_byte);
int get_ddr3_module_size(int sdram_capacity, int prim_bus_width, int sdram_width, int ranks);
char* convert_hex_to_char(unsigned hex_org);
void sb800_get_smb(void);
void show_spd(void);

#endif


1 change: 0 additions & 1 deletion test.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ void parity_err(ulong edi, ulong esi);
void start_config(void);
void clear_screen(void);
void paging_off(void);
void show_spd(void);
int map_page(unsigned long page);
void *mapping(unsigned long page_address);
void *emapping(unsigned long page_address);
Expand Down