Ejemplo n.º 1
0
AGESA_STATUS
AmdMemoryReadSPD (
  IN UINT32 Func,
  IN UINTN Data,
  IN OUT AGESA_READ_SPD_PARAMS *SpdData
 )
{
	UINT8  SmBusAddress = 0;
	UINTN  Index;
	UINTN  MaxSocket = ARRAY_SIZE(SpdAddrLookup);

	for (Index = 0; Index < MaxSocket; Index ++) {
		if ((SpdData->SocketId     == SpdAddrLookup[Index].SocketId)     &&
				(SpdData->MemChannelId == SpdAddrLookup[Index].MemChannelId) &&
				(SpdData->DimmId       == SpdAddrLookup[Index].DimmId)) {
			SmBusAddress = SpdAddrLookup[Index].SmbusAddress;
			break;
		}
	}

	if (SmBusAddress == 0)
		return AGESA_ERROR;

	int err = smbus_readSpd(SmBusAddress, (char *) SpdData->Buffer, 128);
	if (err)
		return AGESA_ERROR;
	return AGESA_SUCCESS;
}
Ejemplo n.º 2
0
int sema_send_alive(void)
{
	const u8 i_am_alive[] = { 0x03 };
	int i, j = 0;
	char one_spd_byte;

	/* Fake read just to setup SMBUS controller. */
	if (ENV_ROMSTAGE)
		smbus_readSpd(0xa0, &one_spd_byte, 1);

	/* Notify the SMC we're alive and kicking, or after a while it will
	 * effect a power cycle and switch to the alternate BIOS chip.
	 * Should be done as late as possible. */

	printk(BIOS_CRIT, "Sending BIOS alive message... ");

	do {
		i = smb_write_blk(0x50, 0x25, sizeof(i_am_alive), i_am_alive);
		early_mdelay(25);
	} while ((++j < RETRY_COUNT) && i);

	if (j == RETRY_COUNT) {
		printk(BIOS_INFO, "failed\n");
		return -1;
	}
	printk(BIOS_CRIT, "took %d tries\n", j);

	return 0;
}
Ejemplo n.º 3
0
/**
 * Gets the SMBus address for an SPD from the array in devicetree.cb
 * then read the SPD into the supplied buffer.
 */
AGESA_STATUS AmdMemoryReadSPD (UINT32 unused1, UINT32 unused2, AGESA_READ_SPD_PARAMS *info)
{
	UINT8 spdAddress;

	ROMSTAGE_CONST struct device *dev = dev_find_slot(0, PCI_DEVFN(0x18, 2));
	if (dev == NULL)
		return AGESA_ERROR;

	ROMSTAGE_CONST struct northbridge_amd_agesa_family15_config *config = dev->chip_info;
	if (config == NULL)
		return AGESA_ERROR;

	if (info->SocketId >= ARRAY_SIZE(config->spdAddrLookup))
		return AGESA_ERROR;
	if (info->MemChannelId >= ARRAY_SIZE(config->spdAddrLookup[0]))
		return AGESA_ERROR;
	if (info->DimmId >= ARRAY_SIZE(config->spdAddrLookup[0][0]))
		return AGESA_ERROR;

	spdAddress = config->spdAddrLookup
		[info->SocketId][info->MemChannelId][info->DimmId];

	if (spdAddress == 0)
		return AGESA_ERROR;

	int err = smbus_readSpd(spdAddress, (void *) info->Buffer, 256);
	if (err)
		return AGESA_ERROR;
	return AGESA_SUCCESS;
}