| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /* SPDX-License-Identifier: GPL-2.0-only */ | ||
|
|
||
| #include <arch/ram_segs.h> | ||
| #include <cpu/x86/msr.h> | ||
| #include <cpu/x86/cr.h> | ||
|
|
||
|
|
||
| #ifdef __x86_64__ | ||
|
|
||
| /* | ||
| * Functions to handle mode switches from long mode to protected | ||
| * mode. | ||
| */ | ||
| .text | ||
| .code64 | ||
| .section ".text.protected_mode_jump", "ax", @progbits | ||
| .globl protected_mode_jump | ||
| protected_mode_jump: | ||
|
|
||
| push %rbp | ||
| mov %rsp, %rbp | ||
|
|
||
| /* Arguments to stack */ | ||
| push %rdi | ||
| push %rsi | ||
|
|
||
| #include <cpu/x86/64bit/exit32.inc> | ||
|
|
||
| movl -8(%ebp), %eax /* Function to call */ | ||
| movl -16(%ebp), %ebx /* Argument 0 */ | ||
|
|
||
| /* Align the stack */ | ||
| andl $0xFFFFFFF0, %esp | ||
| subl $12, %esp | ||
| pushl %ebx /* Argument 0 */ | ||
|
|
||
| jmp *%eax | ||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,6 +67,4 @@ static __always_inline void atomic_dec(atomic_t *v) | |
| : "m" (v->counter)); | ||
| } | ||
|
|
||
| #endif /* ARCH_SMP_ATOMIC_H */ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| /* SPDX-License-Identifier: GPL-2.0-only */ | ||
|
|
||
| #include <memory_info.h> | ||
| #include <smbios.h> | ||
| #include <stdint.h> | ||
| #include <string.h> | ||
|
|
||
| /* this function will fill the corresponding locator */ | ||
| __weak void smbios_fill_dimm_locator(const struct dimm_info *dimm, struct smbios_type17 *t) | ||
| { | ||
| char locator[40]; | ||
|
|
||
| snprintf(locator, sizeof(locator), "Channel-%d-DIMM-%d", | ||
| dimm->channel_num, dimm->dimm_num); | ||
| t->device_locator = smbios_add_string(t->eos, locator); | ||
|
|
||
| snprintf(locator, sizeof(locator), "BANK %d", dimm->bank_locator); | ||
| t->bank_locator = smbios_add_string(t->eos, locator); | ||
| } | ||
|
|
||
| __weak const char *smbios_mainboard_bios_version(void) | ||
| { | ||
| return NULL; | ||
| } | ||
|
|
||
| __weak const char *smbios_mainboard_serial_number(void) | ||
| { | ||
| return CONFIG_MAINBOARD_SERIAL_NUMBER; | ||
| } | ||
|
|
||
| __weak const char *smbios_mainboard_version(void) | ||
| { | ||
| return CONFIG_MAINBOARD_VERSION; | ||
| } | ||
|
|
||
| __weak const char *smbios_mainboard_manufacturer(void) | ||
| { | ||
| return CONFIG_MAINBOARD_SMBIOS_MANUFACTURER; | ||
| } | ||
|
|
||
| __weak const char *smbios_mainboard_product_name(void) | ||
| { | ||
| return CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME; | ||
| } | ||
|
|
||
| __weak const char *smbios_mainboard_asset_tag(void) | ||
| { | ||
| return ""; | ||
| } | ||
|
|
||
| __weak u8 smbios_mainboard_feature_flags(void) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| __weak const char *smbios_mainboard_location_in_chassis(void) | ||
| { | ||
| return ""; | ||
| } | ||
|
|
||
| __weak smbios_board_type smbios_mainboard_board_type(void) | ||
| { | ||
| return SMBIOS_BOARD_TYPE_UNKNOWN; | ||
| } | ||
|
|
||
| /* | ||
| * System Enclosure or Chassis Types as defined in SMBIOS specification. | ||
| * The default value is SMBIOS_ENCLOSURE_DESKTOP (0x03) but laptop, | ||
| * convertible, or tablet enclosure will be used if the appropriate | ||
| * system type is selected. | ||
| */ | ||
| __weak smbios_enclosure_type smbios_mainboard_enclosure_type(void) | ||
| { | ||
| if (CONFIG(SYSTEM_TYPE_LAPTOP)) | ||
| return SMBIOS_ENCLOSURE_LAPTOP; | ||
| else if (CONFIG(SYSTEM_TYPE_TABLET)) | ||
| return SMBIOS_ENCLOSURE_TABLET; | ||
| else if (CONFIG(SYSTEM_TYPE_CONVERTIBLE)) | ||
| return SMBIOS_ENCLOSURE_CONVERTIBLE; | ||
| else if (CONFIG(SYSTEM_TYPE_DETACHABLE)) | ||
| return SMBIOS_ENCLOSURE_DETACHABLE; | ||
| else | ||
| return SMBIOS_ENCLOSURE_DESKTOP; | ||
| } | ||
|
|
||
| __weak const char *smbios_system_serial_number(void) | ||
| { | ||
| return smbios_mainboard_serial_number(); | ||
| } | ||
|
|
||
| __weak const char *smbios_system_version(void) | ||
| { | ||
| return smbios_mainboard_version(); | ||
| } | ||
|
|
||
| __weak const char *smbios_system_manufacturer(void) | ||
| { | ||
| return smbios_mainboard_manufacturer(); | ||
| } | ||
|
|
||
| __weak const char *smbios_system_product_name(void) | ||
| { | ||
| return smbios_mainboard_product_name(); | ||
| } | ||
|
|
||
| __weak void smbios_system_set_uuid(u8 *uuid) | ||
| { | ||
| /* leave all zero */ | ||
| } | ||
|
|
||
| __weak unsigned int smbios_cpu_get_max_speed_mhz(void) | ||
| { | ||
| return 0; /* Unknown */ | ||
| } | ||
|
|
||
| __weak unsigned int smbios_cpu_get_current_speed_mhz(void) | ||
| { | ||
| return 0; /* Unknown */ | ||
| } | ||
|
|
||
| __weak const char *smbios_system_sku(void) | ||
| { | ||
| return ""; | ||
| } | ||
|
|
||
| __weak const char *smbios_chassis_version(void) | ||
| { | ||
| return ""; | ||
| } | ||
|
|
||
| __weak const char *smbios_chassis_serial_number(void) | ||
| { | ||
| return ""; | ||
| } | ||
|
|
||
| __weak const char *smbios_processor_serial_number(void) | ||
| { | ||
| return ""; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ | |
|
|
||
| #define CBFS_FILE_STRUCTSIZE (CBFS_FILE_OFFSET + 4) | ||
|
|
||
| .code32 | ||
| .section .text | ||
| .global walkcbfs_asm | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ | |
|
|
||
| #include <arch/cpu.h> | ||
| #include <cpu/x86/msr.h> | ||
| #include "model_206ax.h" | ||
|
|
||
| /* MSR Documentation based on | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| config DRIVERS_GENESYSLOGIC_GL9763E | ||
| bool |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ramstage-$(CONFIG_DRIVERS_GENESYSLOGIC_GL9763E) += gl9763e.c |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /* SPDX-License-Identifier: GPL-2.0-only */ | ||
|
|
||
| /* Driver for Genesys Logic GL9763E */ | ||
|
|
||
| #include <console/console.h> | ||
| #include <device/device.h> | ||
| #include <device/path.h> | ||
| #include <device/pci.h> | ||
| #include <device/pci_ops.h> | ||
| #include <device/pci_ids.h> | ||
| #include "gl9763e.h" | ||
|
|
||
| static void gl9763e_init(struct device *dev) | ||
| { | ||
| printk(BIOS_INFO, "GL9763E: init\n"); | ||
| pci_dev_init(dev); | ||
|
|
||
| /* Set VHS (Vendor Header Space) to be writable */ | ||
| pci_update_config32(dev, VHS, ~VHS_REV_MASK, VHS_REV_W); | ||
| /* Set single AXI request */ | ||
| pci_or_config32(dev, SCR, SCR_AXI_REQ); | ||
| /* Disable L0s support */ | ||
| pci_and_config32(dev, CFG_REG_2, ~CFG_REG_2_L0S); | ||
| /* Set SSC to 30000 ppm */ | ||
| pci_update_config32(dev, PLL_CTL_2, ~PLL_CTL_2_MAX_SSC_MASK, MAX_SSC_30000PPM); | ||
| /* Enable SSC */ | ||
| pci_or_config32(dev, PLL_CTL, PLL_CTL_SSC); | ||
| /* Set VHS to read-only */ | ||
| pci_update_config32(dev, VHS, ~VHS_REV_MASK, VHS_REV_R); | ||
| } | ||
|
|
||
| static struct device_operations gl9763e_ops = { | ||
| .read_resources = pci_dev_read_resources, | ||
| .set_resources = pci_dev_set_resources, | ||
| .enable_resources = pci_dev_enable_resources, | ||
| .ops_pci = &pci_dev_ops_pci, | ||
| .init = gl9763e_init, | ||
| }; | ||
|
|
||
| static const unsigned short pci_device_ids[] = { | ||
| PCI_DEVICE_ID_GLI_9763E, | ||
| 0 | ||
| }; | ||
|
|
||
| static const struct pci_driver genesyslogic_gl9763e __pci_driver = { | ||
| .ops = &gl9763e_ops, | ||
| .vendor = PCI_VENDOR_ID_GLI, | ||
| .devices = pci_device_ids, | ||
| }; | ||
|
|
||
| struct chip_operations drivers_generic_genesyslogic_ops = { | ||
| CHIP_NAME("Genesys Logic GL9763E") | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /* SPDX-License-Identifier: GPL-2.0-only */ | ||
|
|
||
| /* Definitions for Genesys Logic GL9763E */ | ||
|
|
||
| #include <types.h> | ||
|
|
||
| #define VHS 0x884 | ||
| #define VHS_REV_MASK (0xF << 16) | ||
| #define VHS_REV_R (0x0 << 16) | ||
| #define VHS_REV_M (0x1 << 16) | ||
| #define VHS_REV_W (0x2 << 16) | ||
| #define SCR 0x8E0 | ||
| #define SCR_AXI_REQ BIT(9) | ||
|
|
||
| #define CFG_REG_2 0x8A4 | ||
| #define CFG_REG_2_L0S BIT(11) | ||
|
|
||
| #define PLL_CTL 0x938 | ||
| #define PLL_CTL_SSC BIT(19) | ||
|
|
||
| #define PLL_CTL_2 0x93C | ||
| #define PLL_CTL_2_MAX_SSC_MASK (0xFFFF << 16) | ||
| #define MAX_SSC_30000PPM (0xF5C3 << 16) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,17 @@ | ||
| config DRIVERS_INTEL_DPTF | ||
| bool | ||
| depends on HAVE_ACPI_TABLES | ||
| default n | ||
| help | ||
| When enabled, entries in the devicetree are used to generate | ||
| Intel DPTF Tables at runtime in the SSDT. | ||
|
|
||
| config DPTF_USE_EISA_HID | ||
| bool | ||
| depends on DRIVERS_INTEL_DPTF | ||
| default n | ||
| help | ||
| Prior to Tiger Lake, all DPTF devices used 7-character EISA | ||
| IDs. If selected, the 7-character _HIDs will be emitted, | ||
| otherwise, it will use the "new" style, which are regular | ||
| 8-character _HIDs. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /* SPDX-License-Identifier: GPL-2.0-only */ | ||
|
|
||
| #include <fsp/api.h> | ||
| #include <intelblocks/mp_init.h> | ||
|
|
||
| /* | ||
| * As per FSP integration guide: | ||
| * If bootloader needs to take control of APs back, a full AP re-initialization is | ||
| * required after FSP-S is completed and control has been transferred back to bootloader | ||
| */ | ||
| void do_mpinit_after_fsp(void) | ||
| { | ||
| init_cpus(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| config IPMI_OCP | ||
| bool | ||
| default n | ||
| help | ||
| This implements OCP specific IPMI command | ||
|
|
||
| config IPMI_OCP_MANU_ID | ||
| hex | ||
| default 0x0 | ||
| depends on IPMI_OCP |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ramstage-$(CONFIG_IPMI_OCP) += ipmi_ocp.c |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,173 @@ | ||
| /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
| /* | ||
| * Place in devicetree.cb: | ||
| * | ||
| * chip drivers/ipmi/ocp # OCP specific IPMI porting | ||
| device pnp ca2.1 on end | ||
| * end | ||
| */ | ||
|
|
||
| #include <console/console.h> | ||
| #include <device/device.h> | ||
| #include <device/pnp.h> | ||
| #include <string.h> | ||
| #include <intelblocks/cpulib.h> | ||
| #include <arch/cpu.h> | ||
| #include "chip.h" | ||
| #include "drivers/ipmi/ipmi_kcs.h" | ||
| #include "ipmi_ocp.h" | ||
|
|
||
| static int ipmi_set_processor_information_param1(struct device *dev) | ||
| { | ||
| int ret; | ||
| struct ipmi_processor_info_param1_req req1 = {0}; | ||
| struct ipmi_rsp rsp; | ||
| int mfid = CONFIG_IPMI_OCP_MANU_ID; | ||
|
|
||
| memcpy(&req1.data.manufacturer_id, &mfid, 3); | ||
| printk(BIOS_DEBUG, "IPMI BMC manufacturer id: %02x%02x%02x\n", | ||
| req1.data.manufacturer_id[2], req1.data.manufacturer_id[1], | ||
| req1.data.manufacturer_id[0]); | ||
|
|
||
| req1.data.index = 0; | ||
| req1.data.parameter_selector = 1; | ||
|
|
||
| /* Get processor name. */ | ||
| fill_processor_name(req1.product_name); | ||
| printk(BIOS_DEBUG, "IPMI BMC CPU NAME: %s.\n", req1.product_name); | ||
|
|
||
| ret = ipmi_kcs_message(dev->path.pnp.port, IPMI_NETFN_OEM_COMMON, 0, | ||
| IPMI_BMC_SET_PROCESSOR_INFORMATION, (u8 *) &req1, | ||
| sizeof(req1), (u8 *) &rsp, sizeof(rsp)); | ||
|
|
||
| if (ret < sizeof(struct ipmi_rsp) || rsp.completion_code) { | ||
| printk(BIOS_ERR, "IPMI BMC: %s command failed (ret=%d rsp=0x%x)\n", | ||
| __func__, ret, rsp.completion_code); | ||
| return CB_ERR; | ||
| } | ||
| return CB_SUCCESS; | ||
| } | ||
|
|
||
| static int ipmi_set_processor_information_param2(struct device *dev) | ||
| { | ||
| int ret; | ||
| struct ipmi_processor_info_param2_req req2 = {0}; | ||
| struct ipmi_rsp rsp; | ||
| uint8_t stepping_id; | ||
| int mfid = CONFIG_IPMI_OCP_MANU_ID; | ||
| unsigned int core_count, thread_count; | ||
| struct cpuinfo_x86 c; | ||
|
|
||
| memcpy(&req2.data.manufacturer_id, &mfid, 3); | ||
| printk(BIOS_DEBUG, "IPMI BMC manufacturer id: %02x%02x%02x\n", | ||
| req2.data.manufacturer_id[2], req2.data.manufacturer_id[1], | ||
| req2.data.manufacturer_id[0]); | ||
|
|
||
| req2.data.index = 0; | ||
| req2.data.parameter_selector = 2; | ||
|
|
||
| /* Get core number and thread number. */ | ||
| cpu_read_topology(&core_count, &thread_count); | ||
| req2.core_number = core_count; | ||
| req2.thread_number = thread_count; | ||
| printk(BIOS_DEBUG, "IPMI BMC CPU has %u cores, %u threads enabled.\n", | ||
| req2.core_number, req2.thread_number); | ||
|
|
||
| /* Get processor frequency. */ | ||
| req2.processor_freq = 100 * cpu_get_max_ratio(); | ||
| printk(BIOS_DEBUG, "IPMI BMC CPU frequency is %u MHz.\n", | ||
| req2.processor_freq); | ||
|
|
||
| /* Get revision. */ | ||
| get_fms(&c, cpuid_eax(1)); | ||
| stepping_id = c.x86_mask; | ||
| printk(BIOS_DEBUG, "IPMI BMC CPU stepping id is %x.\n", stepping_id); | ||
| switch (stepping_id) { | ||
| /* TBD */ | ||
| case 0x0a: | ||
| req2.revision[0] = 'A'; | ||
| req2.revision[1] = '0'; | ||
| break; | ||
| default: | ||
| req2.revision[0] = 'X'; | ||
| req2.revision[1] = 'X'; | ||
| } | ||
|
|
||
| ret = ipmi_kcs_message(dev->path.pnp.port, IPMI_NETFN_OEM_COMMON, 0, | ||
| IPMI_BMC_SET_PROCESSOR_INFORMATION, (u8 *) &req2, | ||
| sizeof(req2), (u8 *) &rsp, sizeof(rsp)); | ||
|
|
||
| if (ret < sizeof(struct ipmi_rsp) || rsp.completion_code) { | ||
| printk(BIOS_ERR, "IPMI: %s command failed (ret=%d rsp=0x%x)\n", | ||
| __func__, ret, rsp.completion_code); | ||
| return CB_ERR; | ||
| } | ||
| return CB_SUCCESS; | ||
| } | ||
|
|
||
| static void ipmi_set_processor_information(struct device *dev) | ||
| { | ||
| if (ipmi_set_processor_information_param1(dev)) | ||
| printk(BIOS_ERR, "IPMI BMC set param 1 processor info failed\n"); | ||
|
|
||
| if (ipmi_set_processor_information_param2(dev)) | ||
| printk(BIOS_ERR, "IPMI BMC set param 2 processor info failed\n"); | ||
| } | ||
|
|
||
| static void ipmi_ocp_init(struct device *dev) | ||
| { | ||
| /* Add OCP specific IPMI command */ | ||
| } | ||
|
|
||
| static void ipmi_ocp_final(struct device *dev) | ||
| { | ||
| /* Add OCP specific IPMI command */ | ||
|
|
||
| /* Send processor information */ | ||
| ipmi_set_processor_information(dev); | ||
| } | ||
|
|
||
| static void ipmi_set_resources(struct device *dev) | ||
| { | ||
| struct resource *res; | ||
|
|
||
| for (res = dev->resource_list; res; res = res->next) { | ||
| if (!(res->flags & IORESOURCE_ASSIGNED)) | ||
| continue; | ||
|
|
||
| res->flags |= IORESOURCE_STORED; | ||
| report_resource_stored(dev, res, ""); | ||
| } | ||
| } | ||
|
|
||
| static void ipmi_read_resources(struct device *dev) | ||
| { | ||
| struct resource *res = new_resource(dev, 0); | ||
| res->base = dev->path.pnp.port; | ||
| res->size = 2; | ||
| res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED; | ||
| } | ||
|
|
||
| static struct device_operations ops = { | ||
| .read_resources = ipmi_read_resources, | ||
| .set_resources = ipmi_set_resources, | ||
| .init = ipmi_ocp_init, | ||
| .final = ipmi_ocp_final, | ||
| }; | ||
|
|
||
| static void enable_dev(struct device *dev) | ||
| { | ||
| if (dev->path.type != DEVICE_PATH_PNP) | ||
| printk(BIOS_ERR, "%s: Unsupported device type\n", | ||
| dev_path(dev)); | ||
| else if (dev->path.pnp.port & 1) | ||
| printk(BIOS_ERR, "%s: Base address needs to be aligned to 2\n", | ||
| dev_path(dev)); | ||
| else | ||
| dev->ops = &ops; | ||
| } | ||
|
|
||
| struct chip_operations drivers_ipmi_ocp_ops = { | ||
| CHIP_NAME("IPMI OCP") | ||
| .enable_dev = enable_dev, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
|
|
||
| #ifndef __IPMI_OCP_H | ||
| #define __IPMI_OCP_H | ||
|
|
||
| #include <cpu/x86/msr.h> | ||
| #include <cpu/x86/name.h> | ||
| #include "drivers/ipmi/ipmi_kcs.h" | ||
|
|
||
| #define IPMI_NETFN_OEM_COMMON 0x36 | ||
| #define IPMI_BMC_SET_PROCESSOR_INFORMATION 0x10 | ||
| #define IPMI_BMC_GET_PROCESSOR_INFORMATION 0x11 | ||
|
|
||
| #define MSR_CORE_THREAD_COUNT 0x35 | ||
| #define MSR_PLATFORM_INFO 0xce | ||
|
|
||
| struct ipmi_processor_info_req { | ||
| uint8_t manufacturer_id[3]; | ||
| uint8_t index; | ||
| uint8_t parameter_selector; | ||
| } __packed; | ||
|
|
||
| struct ipmi_processor_info_param1_req { | ||
| struct ipmi_processor_info_req data; | ||
| char product_name[48]; | ||
| } __packed; | ||
|
|
||
| struct ipmi_processor_info_param2_req { | ||
| struct ipmi_processor_info_req data; | ||
| uint8_t core_number; | ||
| uint16_t thread_number; | ||
| uint16_t processor_freq; | ||
| char revision[2]; | ||
| } __packed; | ||
|
|
||
| #endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ | |
|
|
||
| #include <stdint.h> | ||
| #include <console/console.h> | ||
| #include <pc80/mc146818rtc.h> | ||
| #include <fallback.h> | ||
|
|
||
|
|
||