** Solution for Removing Duplicate Thunderbolt Port Entries **
@roastable @Inqnuam
Finally we have a solution to the problem of duplicate Port entries in
System Information --> Thunderbolt.
Background:
On a system with multiple Thunderbolt controllers, we assign a unique Thunderbolt Bus ID to each one. This is done by changing the first byte of
UID (in DROM) to BusID and optionally changing the first byte of
ThunderboltConfig to BusID. Unfortunately, this results in duplicate ports as shown below for Bus ID 2:
Solution:
Using
ThunderboltUtil by
@joevt, we can see that the first 4 ports (0x81, 0x82, 0x83, 0x84) in
green (see below) have the values shown in
red and blue.
To change Bus ID properly, not only do we modify the first byte of UID (
orange), but we must also modify the least significant
4 bits of those
red values. Currently, we can see that the least significant 4 bits of all eight red numbers are 0. These values appear to be the Bus ID as well.
"ThunderboltDROM",
Buffer (0x7B)
{
/* 0x00 */ 0x27, // CRC8 checksum: 0x27
/* 0x01 */ 0x02, 0x67, 0x66, 0x70, 0x13, 0x27, 0x00, 0x00, // Thunderbolt Bus 2, UID: 0x0000271370666702
/* 0x09 */ 0x5C, 0xF4, 0xA8, 0xBC, // CRC32c checksum: 0xBCA8F45C
/* 0x0D */ 0x01, // Device ROM Revision: 1
/* 0x0E */ 0x6E, 0x00, // Length: 110 (starting from previous byte)
/* 0x10 */ 0x01, 0x00, // Vendor ID: 0x1
/* 0x12 */ 0x0D, 0x00, // Device ID: 0xD
/* 0x14 */ 0x01, // Device Revision: 0x1
/* 0x15 */ 0x00, // EEPROM Revision: 0
/* 0x16 1 */ 0x08, 0x81, 0x80, 0x02, 0x80, 0x00, 0x00, 0x00,
/* 0x1E 2 */ 0x08, 0x82, 0x90, 0x01, 0x80, 0x00, 0x00, 0x00,
/* 0x26 3 */ 0x08, 0x83, 0x80, 0x04, 0x80, 0x01, 0x00, 0x00,
/* 0x2E 4 */ 0x08, 0x84, 0x90, 0x03, 0x80, 0x01, 0x00, 0x00,
/* 0x36 5 */ 0x05, 0x85, 0x50, 0x00, 0x00,
/* 0x3B 6 */ 0x05, 0x86, 0x50, 0x00, 0x00,
/* 0x40 7 */ 0x02, 0x87,
/* 0x42 8 */ 0x0b, 0x88, 0x20, 0x01, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0x4D 9 */ 0x03, 0x89, 0x80, // PCIe xx:04.0
/* 0x50 A */ 0x05, 0x8a, 0x50, 0x40, 0x00,
/* 0x55 B */ 0x05, 0x8b, 0x50, 0x40, 0x00,
/* 0x5A 1 */ 0x0b, 0x01, 0x47, 0x49, 0x47, 0x41, 0x42, 0x59, 0x54, 0x45, 0x00, // Vendor Name: "GIGABYTE"
/* 0x65 2 */ 0x16, 0x02, 0x5A, 0x33, 0x39, 0x30, 0x20, 0x47, 0x43, 0x2D, 0x54, 0x69, 0x74, 0x61, 0x6E, 0x20, 0x52, 0x69, 0x64, 0x67, 0x65, 0x00, // Device Name: "Z390 GC-Titan Ridge"
},
So we must add Bus ID to these 8
red values. If the new Bus ID is 02, the eight
red values become the following:
0x80 + 2 =
0x82, 0x80 + 2 =
0x82
0x90 + 2 =
0x92, 0x80 + 2 =
0x82
0x80 + 2 =
0x82, 0x80 + 2 =
0x82
0x90 + 2 =
0x92, 0x80 + 2 =
0x82
And the new Thunderbolt DROM (with new CRC_32C checksum) becomes:
"ThunderboltDROM",
Buffer (0x7B)
{
/* 0x00 */ 0x27, // CRC8 checksum: 0x27
/* 0x01 */ 0x02, 0x67, 0x66, 0x70, 0x13, 0x27, 0x00, 0x00, // Thunderbolt Bus 2, UID: 0x0000271370666702
/* 0x09 */ 0xd3, 0x4a, 0x5d, 0xdb, // CRC32c checksum: 0xDB5D4AD3
/* 0x0D */ 0x01, // Device ROM Revision: 1
/* 0x0E */ 0x6E, 0x00, // Length: 110 (starting from previous byte)
/* 0x10 */ 0x01, 0x00, // Vendor ID: 0x1
/* 0x12 */ 0x0D, 0x00, // Device ID: 0xD
/* 0x14 */ 0x01, // Device Revision: 0x1
/* 0x15 */ 0x00, // EEPROM Revision: 0
/* 0x16 1 */ 0x08, 0x81, 0x82, 0x02, 0x82, 0x00, 0x00, 0x00,
/* 0x1E 2 */ 0x08, 0x82, 0x92, 0x01, 0x82, 0x00, 0x00, 0x00,
/* 0x26 3 */ 0x08, 0x83, 0x82, 0x04, 0x82, 0x01, 0x00, 0x00,
/* 0x2E 4 */ 0x08, 0x84, 0x92, 0x03, 0x82, 0x01, 0x00, 0x00,
/* 0x36 5 */ 0x05, 0x85, 0x50, 0x00, 0x00,
/* 0x3B 6 */ 0x05, 0x86, 0x50, 0x00, 0x00,
/* 0x40 7 */ 0x02, 0x87,
/* 0x42 8 */ 0x0b, 0x88, 0x20, 0x01, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0x4D 9 */ 0x03, 0x89, 0x80, // PCIe xx:04.0
/* 0x50 A */ 0x05, 0x8a, 0x50, 0x40, 0x00,
/* 0x55 B */ 0x05, 0x8b, 0x50, 0x40, 0x00,
/* 0x5A 1 */ 0x0b, 0x01, 0x47, 0x49, 0x47, 0x41, 0x42, 0x59, 0x54, 0x45, 0x00, // Vendor Name: "GIGABYTE"
/* 0x65 2 */ 0x16, 0x02, 0x5A, 0x33, 0x39, 0x30, 0x20, 0x47, 0x43, 0x2D, 0x54, 0x69, 0x74, 0x61, 0x6E, 0x20, 0x52, 0x69, 0x64, 0x67, 0x65, 0x00, // Device Name: "Z390 GC-Titan Ridge"
},
These changes can be made using
ThunderboltUtil as follows:
Bash:
% source ThunderboltUtil.sh
% loadioreg
% usedromnum 1
% replacebytes 0x18 820282
% replacebytes 0x20 920182
% replacebytes 0x28 820482
% replacebytes 0x30 920382
% repairchecksums
% makedromdsl
The result is now correct: