mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2025-02-02 22:51:28 +01:00
join same devices
Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
parent
8221a911a2
commit
a8d0208452
@ -44,7 +44,7 @@ UINT8* mProperties = NULL;
|
||||
CHAR8* gDeviceProperties = NULL;
|
||||
|
||||
UINT32 cPropSize = 0;
|
||||
UINT8* cProperties = NULL;
|
||||
UINT8* cProperties = NULL; //this is properties as string
|
||||
CHAR8* BootOSName = NULL;
|
||||
|
||||
UINT16 KeyboardVendor = 0x05ac; //Apple inc.
|
||||
|
@ -967,6 +967,7 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
MsgLog("Properties with Label=%ls ignored because getDevicePath() return NULL\n", Prop.DevicePathAsString.wc_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
device = devprop_add_device_pci(device_inject_string, NULL, DevicePath);
|
||||
DBG("add device: %ls\n", Prop.DevicePathAsString.wc_str());
|
||||
for ( size_t jdx = 0 ; jdx < Prop.propertiesArray.size() ; ++jdx ) {
|
||||
@ -1799,6 +1800,7 @@ SetDevices (LOADER_ENTRY *Entry)
|
||||
// StringDirty = false;
|
||||
//-------
|
||||
mPropSize = (UINT32)hex2bin(newDeviceProperties, mProperties, EFI_PAGES_TO_SIZE(nbPages)); // cast should be safe as hex2bin return <= MAXUINT32
|
||||
// gDeviceProperties is not used
|
||||
gDeviceProperties = newDeviceProperties.forgetDataWithoutFreeing(); // do this AFTER hex2bin
|
||||
// DBG("Final size of mProperties=%d\n", mPropSize);
|
||||
//---------
|
||||
|
@ -331,7 +331,7 @@ const radeon_card_info_t radeon_cards[] = {
|
||||
// Polaris 11
|
||||
{ 0x67E0, CHIP_FAMILY_BAFFIN, "AMD Radeon RX 460", kAcre },
|
||||
{ 0x67E1, CHIP_FAMILY_BAFFIN, "AMD Radeon Polaris 11", kNull },
|
||||
{ 0x67E3, CHIP_FAMILY_BAFFIN, "AMD Radeon Polaris 11", kNull },
|
||||
{ 0x67E3, CHIP_FAMILY_BAFFIN, "AMD Radeon Pro WX4100", kNull },
|
||||
{ 0x67E7, CHIP_FAMILY_BAFFIN, "AMD Radeon Polaris 11", kNull },
|
||||
{ 0x67E8, CHIP_FAMILY_BAFFIN, "AMD Radeon Polaris 11", kNull },
|
||||
{ 0x67E9, CHIP_FAMILY_BAFFIN, "AMD Radeon Polaris 11", kNull },
|
||||
@ -510,6 +510,8 @@ const radeon_card_info_t radeon_cards[] = {
|
||||
{ 0x7300, CHIP_FAMILY_FIJI, "AMD Radeon R9 Fury", kNull },
|
||||
// Navi10
|
||||
{ 0x731F, CHIP_FAMILY_NAVI10, "AMD Radeon RX5700", kNull },
|
||||
// Navi15
|
||||
{ 0x7340, CHIP_FAMILY_NAVI10, "AMD Radeon RX5500", kNull },
|
||||
// Navi21
|
||||
{ 0x73BF, CHIP_FAMILY_NAVI20, "AMD Radeon RX6800XT", kNull },
|
||||
/*
|
||||
@ -2241,7 +2243,6 @@ XBool setup_ati_devprop(LOADER_ENTRY *Entry, pci_dt_t *ati_dev)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DBG("ATI %s %s %dMB (%s) [%04hX:%04hX] (subsys [%04hX:%04hX]):: %s\n",
|
||||
chip_family_name[card->info->chip_family], card->info->model_name,
|
||||
(UINT32)RShiftU64(card->vram_size, 20), card->cfg_name,
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Cleaned and merged by iNDi
|
||||
*/
|
||||
// UEFI adaptation by usr-sse2, then slice, dmazar
|
||||
// UEFI adaptation by usr-sse2, then slice, dmazar, jief
|
||||
|
||||
|
||||
|
||||
@ -133,7 +133,7 @@ DevPropDevice *devprop_add_device_pci(DevPropString *StringBuf, pci_dt_t *PciDt,
|
||||
}
|
||||
|
||||
if (!DevicePath && (PciDt != 0)) {
|
||||
DevicePath = DevicePathFromHandle(PciDt->DeviceHandle);
|
||||
DevicePath = DevicePathFromHandle(PciDt->DeviceHandle);
|
||||
}
|
||||
// DBG("devprop_add_device_pci %ls ", DevicePathToStr(DevicePath));
|
||||
if (!DevicePath)
|
||||
@ -280,19 +280,30 @@ XBool devprop_add_value(DevPropDevice *device, const XString8& nm, const XBuffer
|
||||
return devprop_add_value(device, nm.data(), vl.data(), vl.size());
|
||||
}
|
||||
|
||||
bool SameDevice(DevPropDevice* D1, DevPropDevice* D2)
|
||||
{
|
||||
if (D1->num_pci_devpaths != D2->num_pci_devpaths) return false;
|
||||
for (UINT32 x=0; x < D1->num_pci_devpaths; x++) {
|
||||
if (D1->pci_dev_path[x].function != D2->pci_dev_path[x].function) return false;
|
||||
if (D1->pci_dev_path[x].device != D2->pci_dev_path[x].device) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
XBuffer<char> devprop_generate_string(DevPropString *StringBuf)
|
||||
{
|
||||
UINTN len = StringBuf->length * 2;
|
||||
INT32 i = 0;
|
||||
UINT32 x = 0;
|
||||
|
||||
XBuffer<char> buffer;
|
||||
buffer.dataSized(len+1);
|
||||
|
||||
// DBG("devprop_generate_string\n");
|
||||
//TODO здесь нужно сделать join одинаковых устройств StringBuf->entries[i] по признаку ->pci_dev_path[x] (отдельный опретаор сравнения)
|
||||
|
||||
buffer.S8Catf("%08X%08X%04hX%04hX", SwapBytes32(StringBuf->length), StringBuf->WHAT2, SwapBytes16(StringBuf->numentries), StringBuf->WHAT3);
|
||||
while(i < StringBuf->numentries) {
|
||||
for (int i = 0; i < StringBuf->numentries; i++) {
|
||||
UINT8 *dataptr = StringBuf->entries[i]->data;
|
||||
if (!dataptr) continue;
|
||||
buffer.S8Catf("%08X%04hX%04hX", SwapBytes32(StringBuf->entries[i]->length),
|
||||
SwapBytes16(StringBuf->entries[i]->numentries), StringBuf->entries[i]->WHAT2); //FIXME: wrong buffer sizes!
|
||||
|
||||
@ -302,8 +313,8 @@ XBuffer<char> devprop_generate_string(DevPropString *StringBuf)
|
||||
SwapBytes32(StringBuf->entries[i]->acpi_dev_path._HID),
|
||||
SwapBytes32(StringBuf->entries[i]->acpi_dev_path._UID));
|
||||
|
||||
for(x = 0; x < StringBuf->entries[i]->num_pci_devpaths; x++) {
|
||||
buffer.S8Catf("%02hhX%02hhX%04hX%02hhX%02hhX", StringBuf->entries[i]->pci_dev_path[x].type,
|
||||
for(int x = 0; x < StringBuf->entries[i]->num_pci_devpaths; x++) {
|
||||
buffer.S8Catf("%02hhX%02hhX%04hX%02hhX%02hhX", StringBuf->entries[i]->pci_dev_path[x].type,
|
||||
StringBuf->entries[i]->pci_dev_path[x].subtype,
|
||||
SwapBytes16(StringBuf->entries[i]->pci_dev_path[x].length),
|
||||
StringBuf->entries[i]->pci_dev_path[x].function,
|
||||
@ -314,10 +325,17 @@ XBuffer<char> devprop_generate_string(DevPropString *StringBuf)
|
||||
StringBuf->entries[i]->path_end.subtype,
|
||||
SwapBytes16(StringBuf->entries[i]->path_end.length));
|
||||
|
||||
for(x = 0; x < (StringBuf->entries[i]->length) - (24 + (6 * StringBuf->entries[i]->num_pci_devpaths)); x++) {
|
||||
for(UINT32 x = 0; x < (StringBuf->entries[i]->length) - (24 + (6 * StringBuf->entries[i]->num_pci_devpaths)); x++) {
|
||||
buffer.S8Catf("%02hhX", *dataptr++);
|
||||
}
|
||||
i++;
|
||||
//try to find same devices
|
||||
for (int j=i+1; j < StringBuf->numentries; j++) {
|
||||
if (!SameDevice(StringBuf->entries[i], StringBuf->entries[j])) continue;
|
||||
for (UINT32 x = 0; x < (StringBuf->entries[j]->length) - (24 + (6 * StringBuf->entries[j]->num_pci_devpaths)); x++) {
|
||||
buffer.S8Catf("%02hhX", *dataptr++);
|
||||
}
|
||||
StringBuf->entries[j]->data = NULL;
|
||||
}
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
@ -96,7 +96,6 @@ struct DevPropDevice {
|
||||
struct DevPropString *string;
|
||||
// ------------------------
|
||||
};
|
||||
|
||||
typedef struct DevPropDevice DevPropDevice;
|
||||
|
||||
struct DevPropString {
|
||||
|
Loading…
Reference in New Issue
Block a user