Angel Pons | b04c2f8 | 2020-04-03 01:23:20 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Julien Viard de Galbert | 4f13640 | 2018-02-16 14:40:53 +0100 | [diff] [blame] | 2 | |
Julien Viard de Galbert | 4f22641 | 2018-02-26 14:42:39 +0100 | [diff] [blame] | 3 | #include <string.h> |
Julien Viard de Galbert | 4f13640 | 2018-02-16 14:40:53 +0100 | [diff] [blame] | 4 | #include <fsp/api.h> |
| 5 | #include <soc/ramstage.h> |
Julien Viard de Galbert | 4f22641 | 2018-02-26 14:42:39 +0100 | [diff] [blame] | 6 | #include <smbios.h> |
Julien Viard de Galbert | 9d217bf | 2018-05-02 10:55:25 +0200 | [diff] [blame] | 7 | #include <spd.h> |
Julien Viard de Galbert | 4f13640 | 2018-02-16 14:40:53 +0100 | [diff] [blame] | 8 | |
Julien Viard de Galbert | 0e755d4 | 2018-03-07 15:48:54 +0100 | [diff] [blame] | 9 | #include "bmcinfo.h" |
| 10 | |
Julien Viard de Galbert | 4f13640 | 2018-02-16 14:40:53 +0100 | [diff] [blame] | 11 | void mainboard_silicon_init_params(FSPS_UPD *params) |
| 12 | { |
Julien Viard de Galbert | b424caa | 2018-02-13 22:19:30 +0100 | [diff] [blame] | 13 | /* Disable eMMC */ |
| 14 | params->FspsConfig.PcdEnableEmmc = 0; |
Julien Viard de Galbert | 0e755d4 | 2018-03-07 15:48:54 +0100 | [diff] [blame] | 15 | |
| 16 | if (bmcinfo_disable_nic1()) |
| 17 | params->FspsConfig.PcdEnableGbE = 2; // disable lan 1 only |
Julien Viard de Galbert | 4f13640 | 2018-02-16 14:40:53 +0100 | [diff] [blame] | 18 | } |
Julien Viard de Galbert | 4f22641 | 2018-02-26 14:42:39 +0100 | [diff] [blame] | 19 | |
| 20 | /* Override smbios_mainboard_serial_number to retrieve it from BMC */ |
| 21 | const char *smbios_mainboard_serial_number(void) |
| 22 | { |
| 23 | const char *bmc_serial = bmcinfo_serial(); |
| 24 | if (bmc_serial) |
| 25 | return bmc_serial; |
| 26 | return CONFIG_MAINBOARD_SERIAL_NUMBER; |
| 27 | } |
| 28 | |
Nico Huber | ebd8a4f | 2017-11-01 09:49:16 +0100 | [diff] [blame] | 29 | /* Override smbios_system_set_uuid */ |
| 30 | void smbios_system_set_uuid(u8 *uuid) |
Julien Viard de Galbert | 4f22641 | 2018-02-26 14:42:39 +0100 | [diff] [blame] | 31 | { |
| 32 | const u8 *bmc_uuid = bmcinfo_uuid(); |
| 33 | if (bmc_uuid) |
| 34 | memcpy(uuid, bmc_uuid, 16); |
| 35 | /* leave all zero */ |
| 36 | } |
| 37 | |
| 38 | /* Override smbios_mainboard_version */ |
| 39 | const char *smbios_mainboard_version(void) |
| 40 | { |
| 41 | const int hwRev = bmcinfo_hwrev(); |
| 42 | switch (hwRev) { |
| 43 | case 0: |
| 44 | return "Z0"; |
| 45 | case 1: |
| 46 | return "A0"; |
| 47 | case 2: |
| 48 | return "A1"; |
| 49 | } |
| 50 | return ""; |
| 51 | } |
| 52 | |
| 53 | /* Override smbios_mainboard_features_flags */ |
| 54 | u8 smbios_mainboard_feature_flags(void) |
| 55 | { |
| 56 | return 0xc; |
| 57 | } |
| 58 | |
| 59 | /* Override smbios_mainboard_location_in_chassis */ |
| 60 | const char *smbios_mainboard_location_in_chassis(void) |
| 61 | { |
| 62 | static char location[4] = "n/a"; |
| 63 | int slot = bmcinfo_slot(); |
| 64 | if (slot >= 0) |
| 65 | snprintf(location, 4, "N%d", slot); |
| 66 | return location; |
| 67 | } |
| 68 | |
| 69 | /* Override smbios_mainboard_board_type */ |
| 70 | smbios_board_type smbios_mainboard_board_type(void) |
| 71 | { |
| 72 | return SMBIOS_BOARD_TYPE_SERVER_BLADE; |
| 73 | } |
Julien Viard de Galbert | 9d217bf | 2018-05-02 10:55:25 +0200 | [diff] [blame] | 74 | |
Kyösti Mälkki | 8770954 | 2020-06-07 12:07:01 +0300 | [diff] [blame] | 75 | smbios_enclosure_type smbios_mainboard_enclosure_type(void) |
| 76 | { |
| 77 | return SMBIOS_ENCLOSURE_MULTI_SYSTEM_CHASSIS; |
| 78 | } |
| 79 | |
Julien Viard de Galbert | 9d217bf | 2018-05-02 10:55:25 +0200 | [diff] [blame] | 80 | /* Add any mainboard specific information for dimm */ |
| 81 | void mainboard_add_dimm_info( |
| 82 | struct memory_info *mem_info, |
| 83 | int channel, int dimm, int index) |
| 84 | { |
| 85 | /* Mainboard only has DDR4 DIMM slots */ |
| 86 | mem_info->dimm[index].mod_type = SPD_UDIMM; |
| 87 | } |