static int get_board_id_via_ext_ec(void) { uint32_t id = BOARD_ID_INIT; if (google_chromeec_get_board_version(&id)) id = BOARD_ID_UNKNOWN; return id; }
uint8_t board_id(void) { MAYBE_STATIC int id = -1; #if IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC) if (id < 0) id = google_chromeec_get_board_version(); #endif return id; }
static void mainboard_init(device_t dev) { /* Initialize the Embedded Controller */ link_ec_init(); if (google_chromeec_get_board_version() == 0) { /* If running on proto1 - enable reversion of gpio11. */ u32 gpio_inv; u16 gpio_base = pci_read_config16 (dev_find_slot(0, PCI_DEVFN(0x1f, 0)), GPIO_BASE) & 0xfffc; u16 gpio_inv_addr = gpio_base + GPI_INV; gpio_inv = inl(gpio_inv_addr); outl(gpio_inv | (1 << 11), gpio_inv_addr); } }
/* Copy SPD data for on-board memory */ static void copy_spd(struct pei_data *peid) { const int gpio_vector[] = {13, 9, 47, -1}; int spd_index = get_gpios(gpio_vector); char *spd_file; size_t spd_file_len; printk(BIOS_DEBUG, "SPD index %d\n", spd_index); spd_file = cbfs_get_file_content(CBFS_DEFAULT_MEDIA, "spd.bin", 0xab, &spd_file_len); if (!spd_file) die("SPD data not found."); switch (google_chromeec_get_board_version()) { case PEPPY_BOARD_VERSION_PROTO: /* Index 0 is 2GB config with CH0 only. */ if (spd_index == 0) peid->dimm_channel1_disabled = 3; break; case PEPPY_BOARD_VERSION_EVT: default: /* Index 0-2 are 4GB config with both CH0 and CH1. * Index 4-6 are 2GB config with CH0 only. */ if (spd_index > 3) peid->dimm_channel1_disabled = 3; break; } if (spd_file_len < ((spd_index + 1) * sizeof(peid->spd_data[0]))) { printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n"); spd_index = 0; } if (spd_file_len < sizeof(peid->spd_data[0])) die("Missing SPD data."); memcpy(peid->spd_data[0], spd_file + spd_index * sizeof(peid->spd_data[0]), sizeof(peid->spd_data[0])); }
uint8_t __attribute__((weak)) variant_board_id(void) { return google_chromeec_get_board_version(); }