Ejemplo n.º 1
0
uintptr_t mainboard_get_spd_data(void)
{
	char *spd_file;
	size_t spd_file_len;
	int spd_index;

	spd_index = mainboard_get_spd_index();
	printk(BIOS_INFO, "SPD index %d\n", spd_index);

	/* Load SPD data from CBFS */
	spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
		&spd_file_len);
	if (!spd_file)
		die("SPD data not found.");

	/* make sure we have at least one SPD in the file. */
	if (spd_file_len < SPD_LEN)
		die("Missing SPD data.");

	/* Make sure we did not overrun the buffer */
	if (spd_file_len < ((spd_index + 1) * SPD_LEN)) {
		printk(BIOS_ERR, "SPD index override to 1 - old hardware?\n");
		spd_index = 1;
	}

	spd_index *= SPD_LEN;
	mainboard_print_spd_info((uint8_t *)(spd_file + spd_index));

	return (uintptr_t)(spd_file + spd_index);
}
Ejemplo n.º 2
0
/* Copy SPD data for on-board memory */
void mainboard_fill_spd_data(struct pei_data *pei_data)
{
	char *spd_file;
	size_t spd_file_len;
	int spd_index, sku_id;

	gpio_t spd_gpios[] = {
		GPIO_MEM_CONFIG_0,
		GPIO_MEM_CONFIG_1,
		GPIO_MEM_CONFIG_2,
		GPIO_MEM_CONFIG_3,
	};

	spd_index = gpio_base2_value(spd_gpios, ARRAY_SIZE(spd_gpios));
	/*
	 * XXX: This is incorrect usage.The Board ID should be the revision ID
	 *      and not SKU ID but on SCRD it indicates SKU.
	 */
	sku_id = board_id();
	printk(BIOS_INFO, "SPD index %d\n", spd_index);
	printk(BIOS_INFO, "Board ID %d\n", sku_id);

	/* Load SPD data from CBFS */
	spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
		&spd_file_len);
	if (!spd_file)
		die("SPD data not found.");

	/* make sure we have at least one SPD in the file. */
	if (spd_file_len < SPD_LEN)
		die("Missing SPD data.");

	/* Make sure we did not overrun the buffer */
	if (spd_file_len < ((spd_index + 1) * SPD_LEN)) {
		printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n");
		spd_index = 0;
	}

	/* Assume same memory in both channels */
	spd_index *= SPD_LEN;
	memcpy(pei_data->spd_data[0][0], spd_file + spd_index, SPD_LEN);
	/*
	 * XXX: This is incorrect usage. mem_cfg should be used here instead of
	 *	SKU ID. The current implementation of mem_config does not
	 *	support channel population.
	 */

	if (sku_id != SCRD_SKU1)
		memcpy(pei_data->spd_data[1][0], spd_file + spd_index, SPD_LEN);

	/* Make sure a valid SPD was found */
	if (pei_data->spd_data[0][0][0] == 0)
		die("Invalid SPD data.");

	mainboard_print_spd_info(pei_data->spd_data[0][0]);
}
Ejemplo n.º 3
0
/* Copy SPD data for on-board memory */
void mainboard_fill_spd_data(struct pei_data *pei_data)
{
	int spd_bits[3] = {
		SPD_GPIO_BIT0,
		SPD_GPIO_BIT1,
		SPD_GPIO_BIT2
	};
	int spd_gpio[3];
	int spd_index;
	size_t spd_file_len;
	char *spd_file;

	spd_gpio[0] = get_gpio(SPD_GPIO_BIT0);
	spd_gpio[1] = get_gpio(SPD_GPIO_BIT1);
	spd_gpio[2] = get_gpio(SPD_GPIO_BIT2);

	spd_index = spd_gpio[2] << 2 | spd_gpio[1] << 1 | spd_gpio[0];

	printk(BIOS_DEBUG, "SPD: index %d (GPIO%d=%d GPIO%d=%d GPIO%d=%d)\n",
	       spd_index,
	       spd_bits[2], spd_gpio[2],
	       spd_bits[1], spd_gpio[1],
	       spd_bits[0], spd_gpio[0]);

	spd_file = cbfs_boot_map_with_leak("spd.bin", 0xab, &spd_file_len);
	if (!spd_file)
		die("SPD data not found.");

	if (spd_file_len < ((spd_index + 1) * SPD_LEN)) {
		printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n");
		spd_index = 0;
	}

	if (spd_file_len < SPD_LEN)
		die("Missing SPD data.");

	memcpy(pei_data->spd_data[0][0],
		spd_file + (spd_index * SPD_LEN), SPD_LEN);
	/* Index 0-2 are 4GB config with both CH0 and CH1.
	 * Index 4-6 are 2GB config with CH0 only. */
	if (spd_index > 3)
		pei_data->dimm_channel1_disabled = 3;
	else
		memcpy(pei_data->spd_data[1][0],
			spd_file + (spd_index * SPD_LEN), SPD_LEN);

	/* Make sure a valid SPD was found */
	if (pei_data->spd_data[0][0][0] == 0)
		die("Invalid SPD data.");

	mainboard_print_spd_info(pei_data->spd_data[0][0]);
}
Ejemplo n.º 4
0
/* Copy SPD data for on-board memory */
void mainboard_fill_spd_data(struct pei_data *pei_data)
{
    int spd_bits[4] = {
        SPD_GPIO_BIT0,
        SPD_GPIO_BIT1,
        SPD_GPIO_BIT2,
        SPD_GPIO_BIT3
    };
    int spd_gpio[4];
    int spd_index;
    size_t spd_file_len;
    char *spd_file;

    spd_gpio[0] = get_gpio(spd_bits[0]);
    spd_gpio[1] = get_gpio(spd_bits[1]);
    spd_gpio[2] = get_gpio(spd_bits[2]);
    spd_gpio[3] = get_gpio(spd_bits[3]);

    spd_index = (spd_gpio[3] << 3) | (spd_gpio[2] << 2) |
                (spd_gpio[1] << 1) | spd_gpio[0];

    printk(BIOS_DEBUG, "SPD: index %d (GPIO%d=%d GPIO%d=%d "
           "GPIO%d=%d GPIO%d=%d)\n", spd_index,
           spd_bits[3], spd_gpio[3], spd_bits[2], spd_gpio[2],
           spd_bits[1], spd_gpio[1], spd_bits[0], spd_gpio[0]);

    spd_file = cbfs_boot_map_with_leak("spd.bin", 0xab, &spd_file_len);
    if (!spd_file)
        die("SPD data not found.");

    if (spd_file_len < ((spd_index + 1) * SPD_LEN)) {
        printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n");
        spd_index = 0;
    }

    if (spd_file_len < SPD_LEN)
        die("Missing SPD data.");

    /* Assume same memory in both channels */
    spd_index *= SPD_LEN;
    memcpy(pei_data->spd_data[0][0], spd_file + spd_index, SPD_LEN);
    memcpy(pei_data->spd_data[1][0], spd_file + spd_index, SPD_LEN);

    /* Make sure a valid SPD was found */
    if (pei_data->spd_data[0][0][0] == 0)
        die("Invalid SPD data.");

    mainboard_print_spd_info(pei_data->spd_data[0][0]);
}
Ejemplo n.º 5
0
/* Copy SPD data for on-board memory */
void mainboard_fill_spd_data(struct pei_data *pei_data)
{
	char *spd_file;
	size_t spd_file_len;
	int spd_index;

	gpio_t spd_gpios[] = {
		GPIO_MEM_CONFIG_0,
		GPIO_MEM_CONFIG_1,
		GPIO_MEM_CONFIG_2,
		GPIO_MEM_CONFIG_3,
	};

	spd_index = gpio_base2_value(spd_gpios, ARRAY_SIZE(spd_gpios));
	printk(BIOS_INFO, "SPD index %d\n", spd_index);

	/* Load SPD data from CBFS */
	spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
		&spd_file_len);
	if (!spd_file)
		die("SPD data not found.");

	/* make sure we have at least one SPD in the file. */
	if (spd_file_len < SPD_LEN)
		die("Missing SPD data.");

	/* Make sure we did not overrun the buffer */
	if (spd_file_len < ((spd_index + 1) * SPD_LEN)) {
		printk(BIOS_ERR, "SPD index override to 1 - old hardware?\n");
		spd_index = 1;
	}

	/* Assume same memory in both channels */
	spd_index *= SPD_LEN;
	memcpy(pei_data->spd_data[0][0], spd_file + spd_index, SPD_LEN);
	memcpy(pei_data->spd_data[1][0], spd_file + spd_index, SPD_LEN);

	/* Make sure a valid SPD was found */
	if (pei_data->spd_data[0][0][0] == 0)
		die("Invalid SPD data.");

	mainboard_print_spd_info(pei_data->spd_data[0][0]);
}
Ejemplo n.º 6
0
/* Copy SPD data for on-board memory */
void mainboard_fill_spd_data(struct pei_data *pei_data)
{
	char *spd_file;
	size_t spd_file_len;
	int spd_index;

	/* Find the SPD data in CBFS. */
	spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
		&spd_file_len);
	if (!spd_file)
		die("SPD data not found.");

	/* make sure we have at least one SPD in the file. */
	if (spd_file_len < SPD_LEN)
		die("Missing SPD data.");

	/* Add board SKU detection here.  Currently we only support one. */
	spd_index = 0;

	/* Make sure we did not overrun the buffer */
	if (spd_file_len < ((spd_index + 1) * SPD_LEN)) {
		printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n");
		spd_index = 0;
	}

	/* Assume same memory in both channels */
	spd_index *= SPD_LEN;
	memcpy(pei_data->spd_data[0][0], spd_file + spd_index, SPD_LEN);
	memcpy(pei_data->spd_data[1][0], spd_file + spd_index, SPD_LEN);

	/* Make sure a valid SPD was found */
	if (pei_data->spd_data[0][0][0] == 0)
		die("Invalid SPD data.");

	mainboard_print_spd_info(pei_data->spd_data[0][0]);
}
Ejemplo n.º 7
0
/* Copy SPD data for on-board memory */
void mainboard_fill_spd_data(struct pei_data *pei_data)
{
	char *spd_file;
	size_t spd_file_len;
	int spd_index;
	int spd_gpio[4];

	/*************************************************************
	 * FIXME: Remove when real GPIO support is ready.
	 */
	GPIO_PAD gpio_set[4] = {
		GPIO_LP_GPP_C12,	/* PCH_MEM_CONFIG[0] */
		GPIO_LP_GPP_C13,	/* PCH_MEM_CONFIG[1] */
		GPIO_LP_GPP_C14,	/* PCH_MEM_CONFIG[2] */
		GPIO_LP_GPP_C15,	/* PCH_MEM_CONFIG[3] */
	};
	int index;

	for (index = 0; index < ARRAY_SIZE(gpio_set); index++) {
		u32 number = GPIO_GET_PAD_NUMBER(gpio_set[index]);
		u32 cfgreg = 8 * number + R_PCH_PCR_GPIO_GPP_C_PADCFG_OFFSET;
		/*
		 * Set GPIO mode and enable input
		 * Clear PMODE0 | PMODE1 | GPIORXDIS
		 */
		u32 dw0mask = (1 << 10) | (1 << 11) | (1 << 9);
		u32 dw0reg = 0;
		pcr_andthenor32(PID_GPIOCOM1, cfgreg, ~dw0mask, dw0reg);

		/* Read current input value */
		pcr_read32(PID_GPIOCOM1, cfgreg, &dw0reg);
		spd_gpio[index] = !!(dw0reg & (1 << 1));
	}
	/*************************************************************/

	spd_index = (spd_gpio[3] << 3) | (spd_gpio[2] << 2) |
		(spd_gpio[1] << 1) | spd_gpio[0];

	printk(BIOS_DEBUG,
	       "SPD: index %d (GPP_C15=%d GPP_C14=%d GPP_C13=%d GPP_C12=%d)\n",
	       spd_index, spd_gpio[3], spd_gpio[2], spd_gpio[1], spd_gpio[0]);

	/* Load SPD data from CBFS */
	spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD,
		&spd_file_len);
	if (!spd_file)
		die("SPD data not found.");

	/* make sure we have at least one SPD in the file. */
	if (spd_file_len < SPD_LEN)
		die("Missing SPD data.");

	/* Make sure we did not overrun the buffer */
	if (spd_file_len < ((spd_index + 1) * SPD_LEN)) {
		printk(BIOS_ERR, "SPD index override to 1 - old hardware?\n");
		spd_index = 1;
	}

	/* Assume same memory in both channels */
	spd_index *= SPD_LEN;
	memcpy(pei_data->spd_data[0][0], spd_file + spd_index, SPD_LEN);
	memcpy(pei_data->spd_data[1][0], spd_file + spd_index, SPD_LEN);

	/* Make sure a valid SPD was found */
	if (pei_data->spd_data[0][0][0] == 0)
		die("Invalid SPD data.");

	mainboard_print_spd_info(pei_data->spd_data[0][0]);
}