Commit Graph

207 Commits

Author SHA1 Message Date
Jonathan Teh
50f59d411d
cpuinfo: Fix VIA Samuel 2 L2 cache (#341)
* cpuinfo: Fix VIA Samuel 2 L2 cache (Hardcode to 64K)
2023-09-16 18:30:04 +02:00
Sam Demeulemeester
03b6cbe4e4 Add IMC polling for AMD Rembrandt
Refactor cpuinfo() for AMD Family 19h CPUs and add detection for AMD Chagall, Storm Peak, Rembrandt, Phoenix and Granite Ridge
2023-06-01 22:00:02 +02:00
Jonathan Teh
a1ef11c3ba
cpuinfo: Add support for Vortex86 (#290)
* cpuinfo: Add support for Vortex86

Hardcode cache for family 5, use CPUID cache info for family 6.

* cpuinfo: Add support for Vortex86EX

The EX does not have brand string so hardcode name and cache.

* In determine_cache_size(), add an additional test to ensure that only
Vortex86 CPUs are handled, allowing Zhaoxin CPUs to fall through.
2023-05-20 20:10:05 +02:00
Sam Demeulemeester
de4f4768fc Fix various temperature-related issues on older Atom CPUs
Also, remove the no_temperature var to keep only the enable_temperature flag
Older Atom still have the enable_temperature flag hard-coded to false until further tests are done
2023-05-18 16:03:48 +02:00
Sam Demeulemeester
9e3958714b
Add support for MMIO UART console (#300)
8/16/32-bit MMIO supported, with configuration options as kernel parameters.
2023-05-12 15:49:00 +02:00
Sam Demeulemeester
7aeac7271f
Add Memory Controller Registers polling to get current DRAM Timings/Frequency (#306)
Read the memory controller configuration (instead of just relying on SPD data) to get the actual live settings.

Currently supported platforms:
* Intel SNB to RPL (Core 2nd Gen to Core 13th Gen) - Desktop only (no Server nor Mobile)
* AMD SMR to RPL (Zen to Zen4) - Desktop only (no Server, Mobile nor APU).


Individual commits below for archival:

* First functions skeleton for reading IMC/ECC Registers

* Change directory name from 'chipsets' to 'mch' (Memory Controller Hub)

* Add Intel HSW and fix new files encoding

* First Intel HSW IMC implementation

* Add an option to disable MCH registers polling

* Remove old include from Makefiles

* Better Makefile and padding fixes

* Statically init 'imc' struct to generate string relocation record

* Small typos & code fixes

* Add IMC support for Intel Core 6/7/8/9th Gen (SKL/KBL/CFL/CML) This is a bit more complex than Haswell and below because MMIO switched to 64-bit with Skylake (lot of) betatesting needed

* Add IMC read support for Intel SNB/IVB (2nd/3rd gen Core)

* Fix hard-lock on Intel SNB/IVB due to wrong access type on MCHBAR pointer

* Move AMD SMN Registers & offsets to a specific header file

* Add IMC Read support for AMD Zen/Zen2 CPUs

* Change 'IMC' to 'MCH' in Makefiles to match actual mch/ directory

* Add IMC Reading support for Intel ADL&RPL CPUs (Core Gen12&13)

* Add support for Intel Rocket Lake (Core 11th Gen) and AMD Vermeer

* Add IMC reading for AMD Zen4 'Raphael' AM5 CPUs

* Various Cleanup #1 
Change terminology from Intel-based 'MCH' (Memory Controller Hub) to more universal 'IMC' (Integrated Memory Controller) Integrate imc_type var into imc struct. Remove previously created AMD SNM header file

* Various Cleanup 2

* Change DDR5 display format for IMC specs
DDR5 Freq can be > 10000 and timings up to 63-127-127-127, which overwflow the available space.
This commit remove the raw frequency on DDR5 (which may be incorrect due to Gear mechanism) and leave a bit of space to display the Gear engaged in the future
2023-05-12 15:33:28 +02:00
Sam Demeulemeester
1f1fe5bfe8 Generalize the SMBus IO Enable quirk on all Intel ICHs
This has been tested safe on every ICH since the very first one by CPU-Z.
It also solves various SMBus access issues on Mobile PCHs (like #157)
2023-04-26 00:42:58 +02:00
Sam Demeulemeester
0fd2e4c37a Add support for Intel AlderLake-N CPUs 2023-04-24 00:29:37 +02:00
Sam Demeulemeester
fa4e903509 Fix APIC Timer detection fail on some modern mobile/embedded PCH
On some modern ULV cores (eg: Gracemont), the 2 following I/O reads to check APIC Timer working status are fused in the frontend, leading to the same value being reported twice and the code falling back to the (unusually disabled on these platforms) PIT timer.

Whether this behavior is intentional or not is unknown.

As usleep/sleep is not available at this point, a dirty delay is added between the two reads.
2023-04-23 22:45:27 +02:00
Sam Demeulemeester
5cbcd2046b Add 'Jade Star' & 'InnoDisk' JEDEC Manufacturers 2023-03-09 23:08:01 +01:00
Jonathan Teh
dcca756e48
[cpuinfo] Fix old CPUs (P5/P6-class) name and cache info (#267)
* cpuinfo: Fix WinChip and Cyrix/NSC CPU name and cache info

Always populate the cache info from extended CPUID, it is not used for
Intel CPUs, even though it is present, and is useful for non-Intel CPUs.

Fix the CPU name and cache sizes for Centaur and Cyrix/NSC CPUs without
brand string, which are the WinChip C6 and all Cyrix CPUs except the
Media GXm.

For the Media GXm and Geode GXm/GXLV/GX1, which are available with both
Cyrix and NSC vendor strings, hardcode the L1 cache size. The Geode GX2
uses standard cache info.

* Add 'Intel' in CPU names for older CPUs

* Add 'Transmeta' and 'IDT' in CPU names for older CPUs
-------

Co-authored-by: Sam Demeulemeester <github@x86-secret.com>
2023-03-03 13:21:27 +01:00
Sam Demeulemeester
262aac4f85
[SMBUS] Add support for ALi M1533/1535/1543C (#273)
Closes #126
2023-02-20 18:31:33 +01:00
Sam Demeulemeester
66bd82f12a
[SMBus] Add support for ALi M1563 Southbridge (#272) 2023-02-19 17:29:56 +01:00
Sam Demeulemeester
ee0c400821 [SMBUS] Add support for VIA VT8233 Southbridge 2023-02-18 19:01:59 +01:00
Sam Demeulemeester
e1fc02bfe0 [SMBUS] Add support for VIA VT8233A Southbridge 2023-02-18 18:58:34 +01:00
Sam Demeulemeester
1a38f513de
[Temperature] Add support for CPUs with specific TjMax (#269)
Solve an issue where reading MSR_IA32_TEMPERATURE_TARGET makes the system crash (e.g. Early Mobile Yonah)
2023-02-18 18:43:38 +01:00
Sam Demeulemeester
22663f89bb
Add support for AMD K8 temperature reporting. (#268)
Add various quirks to handle AMD temp sensors erratas
2023-02-13 22:29:17 +01:00
Sam Demeulemeester
c38b0cbc5f [SMBUS] Add support for nVidia nForce 3 2023-02-13 19:43:09 +01:00
Sam Demeulemeester
dfc41f7196 Solve incorrect core/thread count on some VIA CPUs
No Cyrix / VIA / CentaurHauls / Zhaoxin CPUs support HT, so disable it.
2023-02-11 19:00:36 +01:00
Jonathan Teh
8305d47675
Support cache and temperature info for VIA/Centaur/Zhaoxin CPUs (#259)
* Support cache and temperature info for VIA/Centaur/Zhaoxin CPUs

Use extended CPUID for VIA C3/C7/Nano cache information.

Use MSR reads for Nano/Zhaoxin and VIA C7 processor temperature.

Tested on VIA C7-D 1.5GHz.

* Small code conventions fixes

* Fix overallocation of cpuid_cache_info_t union (From PR #263)

---------

Co-authored-by: Sam Demeulemeester <github@x86-secret.com>
2023-02-10 22:32:31 +01:00
Jonathan Teh
a47f681151 smbus: Add support for VIA VT8237
Tested on Jetway J7F2 with VT8237R+.

Signed-off-by: Jonathan Teh <jonathan.teh@outlook.com>
2023-02-05 08:22:13 +01:00
Sam Demeulemeester
485bfa46a3
Add a quirk to disable SMP on SuperMicro X10SDV (#244) 2023-01-30 16:47:54 +01:00
Sam Demeulemeester
b15a8bb632 Add SPD support for ATI SB400 Southbridge 2023-01-23 16:09:32 +01:00
martinwhitaker
327495ec61
Allow use on headless EFI systems. (#242)
A headless EFI system may have no GOP devices. In this case, disable
output to the physical display, but continue to write to the shadow
buffer. This allows operation via a serial console.
2023-01-23 15:50:52 +01:00
Sam Demeulemeester
10e8435604 Add SPD support for legacy VIA Southbridges (VT82C686A/B & VT8235)
(From PR #236)

Author: Corentin Labbe clabbe.montjoie@gmail.com
Co-developed-by: Lionel Debroux lionel_debroux@yahoo.fr
2023-01-23 15:01:48 +01:00
Martin Whitaker
a1af48a8cf Fix and improve documentation in heap.h (issue #232) 2023-01-03 11:55:51 +00:00
Martin Whitaker
aaa0cffaa6 Use virtual memory base address when probing USB controllers (issue #180)
We still want to display the physical address for debug purposes, but
must access the controller via the possibly remapped virtual address.
2022-10-07 13:06:42 +01:00
Martin Whitaker
66b1389348 Revert workaround for issue #6 and issue #71 (commit 3a10701).
The early USB handoff is a better fix for those issues.
2022-10-07 09:33:23 +01:00
martinwhitaker
407fb811c2
Take ownership of all USB controllers before probing for devices. (#167)
When two controllers are attached to a physical port (e.g. in the
case of EHCI and its companion controllers, problems can occur if
the BIOS still has control of one controller when we try to use the
other one. So perform a first pass to scan the PCI bus and take
ownership of and reset all the controllers we find, and perform a
second pass to initialise the controllers and probe for attached
devices.

As we don't support hot plugging, split the second pass into two,
with the first probing the EHCI controllers and handing over any
low and full speed devices to the companion controllers, and the
second probing the remaining controller types.
2022-10-07 09:32:09 +01:00
Lionel Debroux
1c4d7f4089
Document PCI vendor and device IDs for several SMBus controller models from SiS, EFAR and ALi; move the PCI vendor ID defines from system/smbus.h to system/pci.h and add several vendor IDs; use the defines from system/pci.h in system/hwquirks.c. (#154)
Inspired by #126.
2022-09-14 18:57:10 +02:00
Martin Whitaker
c41159084d Guard against unsupported or invalid USB controller types. 2022-09-09 19:48:59 +01:00
Sam Demeulemeester
03a5222ee2 Add support for Zen4/AM5 DDR5 SPD 2022-09-09 18:09:13 +02:00
Martin Whitaker
f265d1f1c5 Fix EHCI and XHCI drivers to handle USB1 hubs (issue #156) 2022-09-08 18:09:43 +01:00
Sam Demeulemeester
18f12116c0 Fix a rare capacity detection issue with DDR3 modules built using 3 or 4 ranks 2022-08-29 02:50:11 +02:00
Sam Demeulemeester
385f912776 Fix date decoding issue: week 53 is actually valid for some years 2022-08-29 02:12:05 +02:00
Sam Demeulemeester
6799bfba3c Fix timings decoding issues with DDR3 XMP Modules. Add quirks for early modules based on XMP Draft 2022-08-29 01:59:36 +02:00
01e3
540270513f smbus: introduce and use bcd_to_ui8 helper function
Introduce bcd_to_ui8 for converting BCD into uint8_t.

Currently, smbus.c is the only user of this code so I placed it there.
Once (if?) there are more, we may want to move it to a dedicated ".h" file.

Replace all BCD conversion in smbus.c with a call to bcd_to_ui8().

No change in the binary output.
2022-08-28 18:14:41 +02:00
01e3
5686da4b1d smbus: optimize parse_spd_* functions
Convert calling / return convention for all parse_spd_* functions from
returning the value of spd_info structure to updating the received
reference. This also allows to move / remove some boilerplate code,
like initializing spdi/curspd and setting slot_num.

At the end, print_smbus_startup_info wants curspd to be updated,
so we can do this in a more efficient way.

Before:
      text       data        bss      total filename
     10784       3887         18      14689 build32/system/smbus.o
     10486       4399         18      14903 build64/system/smbus.o

     79353      51101      13088     143542 build32/memtest_shared
     78438      58077     294432     430947 build64/memtest_shared

After:
      text       data        bss      total filename
     10379       3871         18      14268 build32/system/smbus.o
      9833       4399         18      14250 build64/system/smbus.o

     78937      51101      13088     143126 build32/memtest_shared
     77782      58077     294432     430291 build64/memtest_shared

gcc-11.3.0.
2022-08-28 18:14:41 +02:00
01e3
43b0f64ddb smbus: refactor SPD SKU (part number) handling
Replace SPD SKU reading code repeated multiple times across
all the parse_spd_* functions with a dedicated read_sku function.

Convert spd_infos.sku from len+data into classic NULL-terminated C-string.
Takes the same space, but simplifies handling. Also, use char instead of
uint8_t so no conversion is needed when printing.

Change the way how the end of part number is handled. Stop on the first
non-ASCII character and then trim all trailing spaces. This allows SKUs
with two (or more) spaces inside the name to be handled properly.

Finally, fix incorrect / inconsistent part number length handling, with
the following end result:
 - parse_spd_sdram: 18 [73-90] (no change)
 - parse_spd_rdram: 18 [73-90] (no change)
 - parse_spd_ddr:   18 [73-90] (no change)
 - parse_spd_ddr2:  18 [73-90] (no change)
 - parse_spd_ddr3:  20+1=21 -> 18 [128-145]
 - parse_spd_ddr4:  20+1=21 -> 20 [329-348]
 - parse_spd_ddr5:  29+1=30 -> 30 [521-550] (technicaly no change)

Before:
      text       data        bss      total filename
     13143       3795         18      16956 build32/system/smbus.o
     11735       4359         18      16112 build64/system/smbus.o

     81705      51133      13088     145926 build32/memtest_shared
     79686      58109     294432     432227 build64/memtest_shared

After:
      text       data        bss      total filename
     10784       3887         18      14689 build32/system/smbus.o
     10486       4399         18      14903 build64/system/smbus.o

     79353      51101      13088     143542 build32/memtest_shared
     78438      58077     294432     430947 build64/memtest_shared

gcc-11.3.0.
2022-08-28 18:14:41 +02:00
Sam Demeulemeester
0f8981412c
Various fixes on SPD decoding algorithms (#152)
* [DDR5] Fix rounding errors on SPD Timings

* [DDR5] Add a rounding factor of ~0.3% according to JEDEC to solve the last rounding issue found on NETAC Modules

* [DDR5] Add missing package ranks per channel parameter in total module capacity algorithm

* [DDR4] Fix rounding issues in SPD timings & frequency

* [DDR3] Fix rounding issues in SPD timings & frequency decoding. Check XMP Profile #2. Add a quirk for Kingston based on very early XMP 1.0 specs

* [DDR2] Fix CAS detection & rounding issues in SPD timings w/ EPP

* [DDR] Correct SPD timings rounding issues & add support for x.5 CAS latencies

* [SDR] Correct SPD Timings decoding due to rounding errors

* Add various JEP106 Manufacturers found while debugging

* Update timings display function to handle x.5 CAS
2022-08-26 21:56:12 +02:00
Sam Demeulemeester
02702fa8c5 Change check to be sure Extended Topology Information (CPUID.0BH:EBX[15:0]) is supported 2022-08-15 22:26:22 +02:00
a1346054
9660eead4e
Simple maintenance improvements (#145)
* Fix typos

* Add missing final newline

* Trim trailing whitespace
2022-08-15 17:51:48 +02:00
Martin Whitaker
148dfd4d54 Apply the USB_2_STEP_INIT option when using an XHCI controller.
This was added to the generic assign_address() method, but the XHCI
driver overrides that.
2022-08-05 20:48:24 +01:00
Martin Whitaker
1316c6c099 Fix scanning of an external USB hub attached to an Intel XHCI (issue #135)
The Intel controller requires unused fields in the input context to be zero.
2022-08-05 20:40:18 +01:00
Sam Demeulemeester
8a3cac8133 Fix an issue while detection Core topology on Core 2 CPU.
Some CPU like Intel Yorkfield (Core 2 Quad) reports max CPUID > 0xB but doesn't support CPUID = 0xB. Check x2apic flag to be sure CPUID 0xB is supported. If not, fallback to older detection method
2022-07-26 20:02:58 +02:00
Lionel Debroux
408fdb8db6 Switch to an array of heaps in the heap manager, and heap IDs in the allocation functions. 2022-07-25 12:53:21 +02:00
Martin Whitaker
13d9569041 By default, only enable USB keyboard detection when booted in UEFI mode.
Most legacy BIOSs will support USB legacy keyboard emulation. Using that
will avoid having to reserve memory for the USB drivers, and should
improve the chance of having a working keyboard without having to work
around various USB device quirks.
2022-07-24 13:56:41 +01:00
Sam Demeulemeester
740df34656 Remove now useless IMC check to allow temperature reporting on more older CPUs 2022-07-23 23:59:49 +02:00
Sam Demeulemeester
cf156adc4a Solve an issue with Core 2 Duo/Quad and same gen CPUs, where HTT flag is enabled in CPUID while the CPU does not support SMT. (#125 #129)
Now compare the number of physical core with the number of reserved APIC to check if SMT is really available or not
2022-07-23 23:47:06 +02:00
Sam Demeulemeester
53f61e6b87 Add 'Heoriady' and 'Golden Empire' to the list of known JEDEC Manufacturers for SPD decoding (#22) 2022-07-23 23:01:53 +02:00