From f862483c00fa7f0e3ce2afb2bcd2699fadb80a8a Mon Sep 17 00:00:00 2001 From: vit9696 Date: Thu, 27 Jul 2017 01:42:19 +0300 Subject: [PATCH] Initial commit --- Changelog.md | 5 + LICENSE.txt | 13 + Manual/FAQ.en.md | 62 +++ Manual/FAQ.ru.md | 62 +++ Manual/Sample.dsl | 183 +++++++++ README.md | 40 ++ WhateverGreen/kern_model.cpp | 774 +++++++++++++++++++++++++++++++++++ 7 files changed, 1139 insertions(+) create mode 100644 Changelog.md create mode 100644 LICENSE.txt create mode 100644 Manual/FAQ.en.md create mode 100644 Manual/FAQ.ru.md create mode 100644 Manual/Sample.dsl create mode 100644 README.md create mode 100644 WhateverGreen/kern_model.cpp diff --git a/Changelog.md b/Changelog.md new file mode 100644 index 00000000..5b197707 --- /dev/null +++ b/Changelog.md @@ -0,0 +1,5 @@ +WhateverGreen Changelog +======================= + +#### v1.0.0 +- Initial release \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 00000000..0dbc9af3 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,13 @@ +Copyright (c) 2017, vit9696 + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Manual/FAQ.en.md b/Manual/FAQ.en.md new file mode 100644 index 00000000..e4708bca --- /dev/null +++ b/Manual/FAQ.en.md @@ -0,0 +1,62 @@ +####Quick FAQ: +- _When do I need WhateverGreen?_ +If you run macOS 10.11 or newer (possibly latest 10.10 as well) with an ATI/AMD GPU 5xxx or newer, you most likely do. +Unfortunately it is not possible to test all the GPUs and their configurations, use at your own risk. + +- _How do I get the debug log?_ +Install DEBUG versions of WhateverGreen and Lilu, then add `-raddbg -liludbg` to the boot arguments. Once you boot run the following command in terminal: +`log show --predicate 'process == "kernel" AND (eventMessage CONTAINS "WhateverGreen" OR eventMessage CONTAINS "Lilu")' --style syslog --source` +If you have macOS 10.11 or earlier, use this command: +`cat /var/log/system.log | egrep '(WhateverGreen|Lilu)'` + +- _What is the state of 10.13 support?_ +At the time of the release 10.13 is still being tested, so no support could even be thought about. There exist cases of broken AMD graphics on pre-Nehalem CPU chipsets. If you have older hardware please stay away from using 10.13. For other systems WhateverGreen may work if no drastic changes happen in 10.13. + +- _What are the hardware requirements for WhateverGreen?_ +Full UEFI without CSM. You are strongly recommended to flash a UEFI-compatible ROM unless your card already has it. Failing to do so will quite likely result in issues in multi-monitor configurations and possibly even in single-monitor configurations. It may stil work for non-UEFI motherboards, try at your own risk. There are known issues when using 2 or more GPUs in multi-monitor configurations. + +- _How do I flash my GPU?_ +You could follow [this guide](https://www.techpowerup.com/forums/threads/amd-ati-flashing-guide.212849/) in flashing your UEFI-enabled ROM. To create a UEFI-enabled ROM for your GPU you could follow [this guide](http://www.win-raid.com/t892f16-AMD-and-Nvidia-GOP-update-No-requests-DIY.html). Note, that there is [a tool](http://www.insanelymac.com/forum/topic/299614-asus-eah6450-video-bios-uefi-gop-upgrade-and-gop-uefi-binary-in-efi-for-many-ati-cards/#entry2042163) for macOS, it could also work, but you will likely have to take care of extra padding. + +- _When should I use a named framebuffer?_ +Named framebuffers (Baladi, Futomaki, Lotus, etc.), enabled by "Clover GPU injection" or any other methods should _never ever be used_. This way of GPU injection is a common mistake, preventing automatic configuration of various important GPU parameters. This will inavoidably lead to borked GPU functioning in quite a number of cases. + +- _When should I use custom connectors?_ +In extremely rare cases VBIOS could (e.g. 290, 290X, 370 GPUs) be incompatible with automatic controller detection written in Apple kexts. WhateverGreen incorporates automatic connector correction for such cases. However, if you discovered that the automatically generated connectors are still wrong (you could find them in debug log), you may specify them as a GPU device property called `connects`, for example, via SSDT. You could pass your connectors in either 24-byte or 16-byte format, they will be automatically adapted to the running system. If you need to provide more or less connectors than it is detected automatically, you are to specify `connector-count` property as well. + +- _How can I change display priority?_ +To do so there is no need to use custom connectors with 7xxx GPUs or newer. Add `connector-priority` GPU controller property with sense ids (could be seen in debug log) in the order of their importance. This property may sometimes help with the multi-monitor configurations. + +- _What properties should I inject for my GPU?_ +Very few! You should inject an `HDAU` device to your GPU controller, `hda-gfx` properties with a corresponding number to the amount of audio codecs you have, and that is basically all. If you need to mask to an unsupported GPU, additionally add `device-id`. It is also recommended to add some cosmetic properties: `AAPL,slot-name` (displayed slot name in system details), `@X,AAPL,boot-display` (boot logo drawing issues), `model` (GPU display name, if detection failed). +While not pretending to be perfect, there is a [SSDT sample](https://github.com/vit9696/WhateverGreen/blob/master/Docs/Sample.dsl) to get the general idea. + +- _When do I need to use `radpg` boot argument?_ +This argument is as a replacement for the original igork's AMDRadeonX4000 Info.plist patch required for some 7xxx GPUs to start. It allows to force-enable certain power-gating flags like CAIL_DisableGfxCGPowerGating. The value is a bit mask of CAIL_DisableDrmdmaPowerGating, CAIL_DisableGfxCGPowerGating, CAIL_DisableUVDPowerGating, CAIL_DisableVCEPowerGating, CAIL_DisableDynamicGfxMGPowerGating, CAIL_DisableGmcPowerGating, CAIL_DisableAcpPowerGating, CAIL_DisableSAMUPowerGating. Therefore `radpg=15` activates the first four keys. + +- _How to change my GPU model?_ +The controller kext (e.g. AMD6000Controller) replaces GPU model with a generic name (e.g. AMD Radeon HD 6xxx) if it performs the initialisation on its own. Injecting the properties and disabling this will break connector autodetect, and therefore is quite not recommended. WhateverGreen attempts to automatically detect the GPU model name if it is unspecified. If the autodetected model name is not valid (for example, in case of a fake device-id or a new GPU model) please provide a correct one via `model` property. All the questions about automatic GPU model detection correctness should be addressed to [The PCI ID Repository](http://pci-ids.ucw.cz). In special cases you may submit a [patch](https://github.com/vit9696/WhateverGreen/pulls) for [kern_model.cpp](https://github.com/vit9696/WhateverGreen/blob/master/WhateverGreen/kern_model.cpp). GPU model name is absolutely unimportant for GPU functioning. + +- _What to do when my GPU does not wake until I start typing on the keyboard?_ +If this bothers you, either wait a bit longer or try adding `darkwake=0` boot argument. + +- _How do I know my GPU initialises fine?_ +One of the easiest signs is boot time. If initialised improperly, your boot process will stall for 30 extra seconds to get your display ready. + +- _Is it normal to have `Prototype` in OpenGL/OpenCL engine names?_ +Yes. It was discovered during the reverse-engineering that the displayed title has no effect on performance. Furthermore, it was discovered that certain attempts to patch this by modifying the identitiers in kexts (e.g. AMDRadeonX4000) may lead to overall system instability. + +- _How do I use my IGPU?_ +In most cases IGPU should be used for hardware video decoding (with a connector-less frame). In case you need extra screens, IGPU may be fully enabled. You should not use `-radlogo` boot argument with IntelGraphicsFixup. + +- _How do I get hardware video decoding to work?_ +Generally hardware video decoding is performed by an IGPU, and thus you are required to inject a connector-less frame. For some GPUs (e.g. HD 7870, HD 6670, HD 7970) it is still possible to get AMD hardware video decoding to work. Please refer to [Shiki's FAQ](https://github.com/vit9696/Shiki/blob/master/FAQ.en.md) for further details. You may need `-shikigva` on mac models that have forceOfflineRenderer on. + +- _Why would I need to force 24-bit video output?_ +Several screens may not support 30-bit video output, but the GPU may not detect this. The result will look as distorted blinking colours. To resolve the issue either buy a more powerful display or add `-rad24` boot argument. + +- _How do I get HDMI audio to work?_ +In general it should be enough to inject the devices and properties mentioned above. In some cases you may also need to add a supported `device-id` property to HDAU and patch the identifier in AppleHDAController. More details are available in this [SSDT sample](https://github.com/vit9696/WhateverGreen/blob/master/Docs/Sample.dsl). + +- _May I access the source code?_ +Model detection code is [open](https://github.com/vit9696/WhateverGreen/blob/master/WhateverGreen/kern_model.cpp) as well as [Lilu](https://github.com/vit9696/Lilu). If you want to contribute a feature you have an implementation for please contact me. For example, getting better handling of AMD Switchable Graphics or providing more complete research on connector detection would be nice. diff --git a/Manual/FAQ.ru.md b/Manual/FAQ.ru.md new file mode 100644 index 00000000..c5819964 --- /dev/null +++ b/Manual/FAQ.ru.md @@ -0,0 +1,62 @@ +####Краткий FAQ: +- _Когда использовать WhateverGreen?_ +В macOS 10.11 и выше (возможно и в 10.10) с видеокартами ATI/AMD 5xxx и новее. +Проверить все серии видеокарт и их конфигурации возможности нет, используйте на свой страх и риск. + +- _Как получить подробный лог?_ +Установить DEBUG версии WhateverGreen и Lilu, добавить `-raddbg -liludbg` в аргументы загрузки. После запуска выполнить команду в терминале: +`log show --predicate 'process == "kernel" AND (eventMessage CONTAINS "WhateverGreen" OR eventMessage CONTAINS "Lilu")' --style syslog --source` +Для macOS 10.11 и старее использовать: +`cat /var/log/system.log | egrep '(WhateverGreen|Lilu)'` + +- _Каково состояние поддержки 10.13?_ +В момент выпуска 10.13 находится на стадии тестирования, потому об официальной поддержке речи не идёт. Известны случаи незапуска графики на чипсетах старше Nehalem. Если у вас имеется подобное железо, воздержитесь от обновления. В остальных случаях WhateverGreen может работать, при условии отстутствия значительных изменений в 10.13. + +- _Какие прочие аппаратные требования для WhateverGreen?_ +UEFI без использования CSM. В случае отсутствия поддержки UEFI видеокартой, её крайне желательно перешить. Непрошитая карта с высокой долей вероятности создаст проблемы при использовании нескольких мониторов или даже с одним монитором. Используйте материнские платы без UEFI на свой страх и риск. Известны проблемы мультимониторных конфигураций при использовании 2 и более видеокарт. + +- _Как прошить видеокарту?_ +Для самого процесса прошивки можно проследовать [этой инструкции](https://www.techpowerup.com/forums/threads/amd-ati-flashing-guide.212849/). Для создания прошивки можно использовать [эту инструкцию](http://www.win-raid.com/t892f16-AMD-and-Nvidia-GOP-update-No-requests-DIY.html). Также существует [утилита](http://www.insanelymac.com/forum/topic/299614-asus-eah6450-video-bios-uefi-gop-upgrade-and-gop-uefi-binary-in-efi-for-many-ati-cards/#entry2042163) и для macOS, но в случае её использование паддинг придётся убирать вручную. + +- _В каких случаях стоит ли использовать именной фреймбуфер?_ +Именной фреймбуфер (Baladi, Futomaki, Lotus и др.), включаемый "инжектом Clover" или любым другим способом, не следует использовать _ни при каких обстоятельствах_. Такой способ запуска видеокарты — распространённое заблуждение, приводящее к отключению автоматического конфигурирования множества важных параметров. В результате с высокой долей вероятности видеокарта будет работать неправильно. + +- _В каких случаях необходимо использовать собственные коннекторы?_ +В редких случаях видеобиос (например, видеокарты 290, 290X, 370) может быть не совместим с автоматическим детектированием коннекторов, реализованном в кекстах Apple. Для этих случаев в WhateverGreen предусмотрена автоматическая коррекция коннекторов. Тем не менее, если сгенерированные коннекторы не подошли (их можно посмотреть в режиме подробного логирования), то существует возможность указать пользовательские коннекторы в качестве свойства контроллера видеокарты `connectors`, например, через SSDT. Указывать коннекторы можно как в 24-байтном, так и в 16-байтном формате, они будут адаптированы под запущенную систему. Если нужно указать число коннектров больше или меньше, чем определяется автоматически, то необходимо также указать свойство `connector-count`. + +- _Как изменить приоритет мониторов?_ +С видеокартами 7xxx и новее для этого нет необходимости использовать собственные коннекторы. Добавьте свойство контроллера видеокарты `connector-priority`, перечислив sense id (можно посмотреть в режиме прдробного логирования) в порядке важности. Данное свойство иногда помогает решить проблемы с мультимониторными конфигурациями. + +- _Какие свойства нужно инжектировать для завода видеокарты?_ +Минимум необходимых! Добавлять нужно устройство `HDAU` в контроллер видеокарты, свойства `hda-gfx` с соответствующим номером числу имеющихся кодеков аудио, по сути всё. Если требуется маскировка на поддерживаемую видеокарту, указывать следует только `device-id`. Разумно добавлять некоторые косметические свойства: `AAPL,slot-name` (отображаемое имя слота в свойствах системы), `@X,AAPL,boot-display` (частично исправляет лого при загрузке), `model` (название видеокарты, если автоматика не справилась). +Не самый идеальный [пример SSDT](https://github.com/vit9696/WhateverGreen/blob/master/Manual/Sample.dsl) для общего понимания. + +- _Когда необходим аргумент загрузки `radpg`?_ +Данный аргумент — замена оригинальному патчу Info.plist AMDRadeonX4000 для запуска некоторых видеокарт 7xxx от igork. Он позволяет принудительно включить часть флагов технологии power-gating, например, CAIL_DisableGfxCGPowerGating. Значение является битовой маской из CAIL_DisableDrmdmaPowerGating, CAIL_DisableGfxCGPowerGating, CAIL_DisableUVDPowerGating, CAIL_DisableVCEPowerGating, CAIL_DisableDynamicGfxMGPowerGating, CAIL_DisableGmcPowerGating, CAIL_DisableAcpPowerGating, CAIL_DisableSAMUPowerGating. Так `radpg=15` активирует первые четыре ключа. + +- _Как изменить название видеокарты?_ +Кекст контроллера (например, AMD6000Controller) при автоматической инициализации заменяет название видеокарты на обобщённое (например, AMD Radeon HD 6xxx). Инжектирование свойств и отключение этого лишь приведёт к сломанному автодетекту коннекторов, потому исключительно не рекомендуется. WhateverGreen пытается автоматически определить название карты, если оно не задано. Если название определяется неверно (например, в случае маскировки device-id или использования новой карты), достаточно указать верное название в свойстве `model`. Все вопросы по корректности автоматического определния должны быть отправлены в [The PCI ID Repository](http://pci-ids.ucw.cz). В исключительных случаях вы можете отправить [патч](https://github.com/vit9696/WhateverGreen/pulls) для [kern_model.cpp](https://github.com/vit9696/WhateverGreen/blob/master/WhateverGreen/kern_model.cpp). На функционирование карты название никак не влияет. + +- _Что делать, если видеокарта для просыпания требует нескольких нажатий на клавиатуре?_ +Если это действительно беспокоит, можно подождать чуть дольше или попробовать добавить аргумент загрузки `darkwake=0`. + +- _Как понять, что видеокарта инициализируется правильно?_ +Один из наиболее простых показателей — время загрузки. При неправильном заводе загрузка происходит на 30 секунд дольше. + +- _Нормально ли иметь в названии движка OpenGL/OpenCL `Prototype`?_ +Да, нормально. В процессе обратной разработки удалось выяснить, что отображаемое название никак не влияет на производительность. Напротив, попытки поменять данное название патчем идентификаторов в кекстах (например, AMDRadeonX4000) могут привести к нестабильной работе системы. + +- _Как использовать IGPU?_ +В большинстве случаев желательно использовать IGPU для декодирования видео (с заводом на фрейм без коннекторов). В случае необходимости дополнительных мониторов возможно активировать IGPU полностью. При использовании IntelGraphicsFixup аргумент загрузки `-radlogo` не требуется. + +- _Как получить рабочее аппаратное декодирование видео?_ +Обычно это задача IGPU, заведённой на фрейм без коннекторов. На некоторых видеокартах (например, HD 7870, HD 6670, HD 7970) можно завести аппаратный декодер AMD. Подробности в [FAQ Shiki](https://github.com/vit9696/Shiki/blob/master/FAQ.ru.md). На моделях с принудительным forceOfflineRenderer может потребоваться аргумент загрузки `-shikigva`. + +- _Зачем принудительно выставлять 24-битный вывод цвета?_ +На некоторых мониторах нет поддержки 30-битного цвета, при этом видеокарта об этом может не знать. В результате цвета на экране будут мигать с искажениями. Для решения проблемы необходимо либо приобрести другой дисплей, либо добавить аргумент загрузки `-rad24`. + +- _Как заставить работать HDMI звук?_ +В большинстве случаев инжектирования вышеуказанных устройств и свойств достаточно. В некоторых случаях нужно также добавлять свойство `device-id` с поддерживаемым идентификатором в HDAU и патч AppleHDAController. Подробности описаны в [примере SSDT](https://github.com/vit9696/WhateverGreen/blob/master/Docs/Sample.dsl). + +- _Могу ли я получить исходный код?_ +Код автодетектирования модели [открыт](https://github.com/vit9696/WhateverGreen/blob/master/WhateverGreen/kern_model.cpp), как и код [Lilu](https://github.com/vit9696/Lilu). Если есть желание и знание, как добавить некоторый функционал, пишите. Например, неплохо бы добавить нормальную совместимость с AMD Switchable Graphics или более подробно разобрать детектирование коннекторов. diff --git a/Manual/Sample.dsl b/Manual/Sample.dsl new file mode 100644 index 00000000..56c1b492 --- /dev/null +++ b/Manual/Sample.dsl @@ -0,0 +1,183 @@ +DefinitionBlock ("", "SSDT", 2, "APPLE ", "SSDTAMDGPU", 0x00001000) +{ + External (_SB_.PCI0, DeviceObj) + External (_SB_.PCI0.GFX0, DeviceObj) + External (_SB_.PCI0.PEG0, DeviceObj) + External (_SB_.PCI0.PEG0.PEGP, DeviceObj) + + Scope (\_SB.PCI0) + { + // Follow your motherboard structure regarding the scope hierarchy. This example contains: + // PEG0 -> PEGP (GPU #1) and HDAU (HDMI audio for GPU #1) + // PEG1 -> PEGP (GPU #2) not installed + // PEG2 -> PEGP (GPU #3) not installed + // PEG3 -> PEGP (GPU #4) not installed + // IMEI (Intel IMEI device required for proper hardware video decoding functioning) + // GFX0 (disabled original IGPU name) + // IGPU (Intel GPU with a connector-less frame used for hardware video decoding) + // + // Depending on your method you may rename PEGP to GFX0. + Scope (PEG0) + { + Scope (PEGP) + { + Method (_DSM, 4, NotSerialized) // _DSM: Device-Specific Method + { + Store (Package () + { + // Write the preferred GPU index here (1-4) + + "AAPL,slot-name", + Buffer () + { + "Slot-1" + }, + + // Make sure not to write the same onboard index for each installed GPU + + "hda-gfx", + Buffer () + { + "onboard-1" + }, + + // Only use this if automatic detection fails or may not be used + + "model", + Buffer () + { + "AMD Radeon HD 6450" + }, + + // Monitor at index 0 is used as main, the value does not matter + + "@0,AAPL,boot-display", + Buffer (Zero) {} + + // You could also put other properties like "connectors", "connector-priority", + // or "device-id" here in case this is required for your setup. + }, Local0) + DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0)) + Return (Local0) + } + } + + Device (HDAU) + { + Name (_ADR, One) // _ADR: Address + Method (_DSM, 4, NotSerialized) // _DSM: Device-Specific Method + { + If (LEqual (Arg2, Zero)) + { + Return (Buffer (One) + { + 0x03 + }) + } + + Return (Package () + { + // layout-id should be defined, though the value is unused + + "layout-id", + Buffer (0x04) + { + 0x01, 0x00, 0x00, 0x00 + }, + + "hda-gfx", + Buffer () + { + "onboard-1" + } + + // You may need to put "device-id" here in case this is required for your setup. + // Please be aware that that AppleHDAController reads the device-id directly. + // This means that you may have to patch your device-id in AppleHDAController. + // Assume your original device-id is (R9 290X). + // And the id you are faking to is (Pro 460). + // So here you add device-id . + // And AppleHDAController patch is <02 10 e0 aa> -> <02 10 c8 aa>. + // Thanks to Pawel69 for this. + }) + } + } + + // Below goes an example for IGPU injection useful for enabling hardware video decoding and other stuff. + + Device (IMEI) + { + Name (_ADR, 0x00160000) // _ADR: Address + } + + Scope (GFX0) + { + Name (_STA, Zero) // _STA: Status + } + + Device (IGPU) + { + Name (_ADR, 0x00020000) // _ADR: Address + Method (_DSM, 4, NotSerialized) // _DSM: Device-Specific Method + { + Store (Package () + { + "name", + Buffer () + { + "display" + }, + + // This is a connector-less frame for Azul HD 4600 + + "AAPL,ig-platform-id", + Buffer (0x04) + { + 0x04, 0x00, 0x12, 0x04 + }, + + // This is an override for built-in device-id + + "device-id", + Buffer (0x04) + { + 0x12, 0x04, 0x00, 0x00 + } + }, Local0) + DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0)) + Return (Local0) + } + } + } + + Method (DTGP, 5, NotSerialized) + { + If (LEqual (Arg0, ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b"))) + { + If (LEqual (Arg1, One)) + { + If (LEqual (Arg2, Zero)) + { + Store (Buffer (One) + { + 0x03 + }, Arg4) + Return (One) + } + + If (LEqual (Arg2, One)) + { + Return (One) + } + } + } + + Store (Buffer (One) + { + 0x00 + }, Arg4) + Return (Zero) + } + } +} + diff --git a/README.md b/README.md new file mode 100644 index 00000000..01459ba5 --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +WhateverGreen +============= + +[Lilu](https://github.com/vit9696/Lilu) plugin providing patches to select ATI/AMD GPUs. Requires Lilu 1.1.6 or newer. + +#### Features +- Fixes boot to black screen +- Fixes sleep wake to black screen +- Fixes boot logo distortion in certain cases (`-radlogo`) +- Fixes transmitter/encoder in autodetected connectors for multimonitor support +- Fixes certain HD 7xxx initialisation (`radpg=15`) +- Allows enforcing 24-bit mode on unsupported displays (`-rad24`) +- Allows booting without video acceleration (`-radvesa`) +- Allows automatically setting GPU model name or providing it manually for RadeonFramebuffer +- Allows specifying custom connectors via device properties for RadeonFramebuffer +- Allows tuning autodetected connector priority via device properties (HD 7xxx or newer) + +#### Documentation +Read FAQs before and avoid asking any questions: +- [English FAQ](https://github.com/vit9696/WhateverGreen/blob/master/Manual/FAQ.en.md) +- [Русский FAQ](https://github.com/vit9696/WhateverGreen/blob/master/Manual/FAQ.ru.md) +No support is provided for the time being. + +#### Boot arguments +Add `-raddbg` to enable debug printing (available in DEBUG binaries). +Add `-radvesa` to disable ATI/AMD video acceleration completely. +Add `-radoff` to disable WhateverGreen. +Add `-radbeta` to enable WhateverGreen on unsupported os versions. +Add `-rad24` to enforce 24-bit display mode. +Add `-radlogo` to patch boot logo distortion. +Add `radpg=15` to disable several power-gating modes (read FAQ for more details). + +#### Credits +- [Apple](https://www.apple.com) for macOS +- [AMD](https://www.amd.com) for ATOM VBIOS parsing code +- [The PCI ID Repository](http://pci-ids.ucw.cz) for multiple GPU model names +- [igork](https://applelife.ru/members/igork.564/) for power-gating patch discovery +- [RemB](https://applelife.ru/members/remb.8064/) for continuing sleep-wake research and finding the right register +- [Vandroiy](https://applelife.ru/members/vandroiy.83653/) for maintaining the GPU model detection database +- [vit9696](https://github.com/vit9696) for writing the software and maintaining it diff --git a/WhateverGreen/kern_model.cpp b/WhateverGreen/kern_model.cpp new file mode 100644 index 00000000..794ab37e --- /dev/null +++ b/WhateverGreen/kern_model.cpp @@ -0,0 +1,774 @@ +// +// kern_model.cpp +// WhateverGreen +// +// Copyright © 2017 vit9696. All rights reserved. +// + +#include "kern_rad.hpp" + +/** + * General rules for GPU names: + * + * 1. Only use device identifiers present in Apple kexts starting with 5xxx series + * 2. Follow Apple naming style (e.g., ATI for 5xxx series, AMD for 6xxx series, Radeon Pro for 5xx GPUs) + * 3. Write earliest available hardware with slashes (e.g. Radeon Pro 455/555) + * 4. Avoid using generic names like "AMD Radeon RX" + * 5. Provide revision identifiers whenever possible + * 6. Detection order should be vendor-id, device-id, subsystem-vendor-id, subsystem-id, revision-id + * + * Some identifiers are taken from https://github.com/pciutils/pciids/blob/master/pci.ids?raw=true + * Last synced version 2017.07.24 (https://github.com/pciutils/pciids/blob/699e70f3de/pci.ids?raw=true) + */ + +struct Model { + enum Detect { + DetectDef = 0x0, + DetectSub = 0x1, + DetectRev = 0x2, + DetectAll = DetectSub | DetectRev + }; + Detect mode {DetectDef}; + uint16_t subven {0}; + uint16_t sub {0}; + uint16_t rev {0}; + const char *name {nullptr}; +}; + +struct DevicePair { + uint16_t dev; + const Model *models; + size_t modelNum; +}; + +static constexpr Model dev6640[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD FirePro M6100"} +}; + +static constexpr Model dev6641[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 8930M"} +}; + +static constexpr Model dev6646[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon R9 M280X"} +}; + +static constexpr Model dev6647[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon R9 M270X"} +}; + +static constexpr Model dev665c[] { + {Model::DetectSub, 0x1462, 0x2932, 0x0000, "AMD Radeon HD 8770"}, + {Model::DetectSub, 0x1462, 0x2934, 0x0000, "AMD Radeon R9 260"}, + {Model::DetectSub, 0x1462, 0x2938, 0x0000, "AMD Radeon R9 360"}, + {Model::DetectSub, 0x148c, 0x0907, 0x0000, "AMD Radeon R7 360"}, + {Model::DetectSub, 0x148c, 0x9260, 0x0000, "AMD Radeon R9 260"}, + {Model::DetectSub, 0x148c, 0x9360, 0x0000, "AMD Radeon R9 360"}, + {Model::DetectSub, 0x1682, 0x0907, 0x0000, "AMD Radeon R7 360"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 7790"} +}; + +static constexpr Model dev665d[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon R9 260"} +}; + +static constexpr Model dev6704[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD FirePro V7900"} +}; + +static constexpr Model dev6718[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 6970"} +}; + +static constexpr Model dev6719[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 6950"} +}; + +static constexpr Model dev6720[] { + {Model::DetectSub, 0x1028, 0x0490, 0x0000, "AMD Radeon HD 6970M"}, + {Model::DetectSub, 0x1028, 0x04a4, 0x0000, "AMD FirePro M8900"}, + {Model::DetectSub, 0x1028, 0x053f, 0x0000, "AMD FirePro M8900"}, + {Model::DetectSub, 0x106b, 0x0b00, 0x0000, "AMD Radeon HD 6970M"}, + {Model::DetectSub, 0x1558, 0x5102, 0x0000, "AMD Radeon HD 6970M"}, + {Model::DetectSub, 0x174b, 0xe188, 0x0000, "AMD Radeon HD 6970M"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 6990M"} +}; + +static constexpr Model dev6722[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 6900M"} +}; + +static constexpr Model dev6738[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 6870"} +}; + +static constexpr Model dev6739[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 6850"} +}; + +static constexpr Model dev6740[] { + {Model::DetectSub, 0x1019, 0x2392, 0x0000, "AMD Radeon HD 6770M"}, + {Model::DetectSub, 0x1028, 0x04a3, 0x0000, "Precision M4600"}, + {Model::DetectSub, 0x1028, 0x053e, 0x0000, "AMD FirePro M5950"}, + {Model::DetectSub, 0x103c, 0x1630, 0x0000, "AMD FirePro M5950"}, + {Model::DetectSub, 0x103c, 0x1631, 0x0000, "AMD FirePro M5950"}, + {Model::DetectSub, 0x103c, 0x164e, 0x0000, "AMD Radeon HD 6730M5"}, + {Model::DetectSub, 0x103c, 0x1657, 0x0000, "AMD Radeon HD 6770M"}, + {Model::DetectSub, 0x103c, 0x1658, 0x0000, "AMD Radeon HD 6770M"}, + {Model::DetectSub, 0x103c, 0x165a, 0x0000, "AMD Radeon HD 6770M"}, + {Model::DetectSub, 0x103c, 0x165b, 0x0000, "AMD Radeon HD 6770M"}, + {Model::DetectSub, 0x103c, 0x1688, 0x0000, "AMD Radeon HD 6770M"}, + {Model::DetectSub, 0x103c, 0x1689, 0x0000, "AMD Radeon HD 6770M"}, + {Model::DetectSub, 0x103c, 0x168a, 0x0000, "AMD Radeon HD 6770M"}, + {Model::DetectSub, 0x103c, 0x185e, 0x0000, "AMD Radeon HD 7690M"}, + {Model::DetectSub, 0x103c, 0x3388, 0x0000, "AMD Radeon HD 6770M"}, + {Model::DetectSub, 0x103c, 0x3389, 0x0000, "AMD Radeon HD 6770M"}, + {Model::DetectSub, 0x103c, 0x3582, 0x0000, "AMD Radeon HD 6770M"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 6730M"} +}; + +static constexpr Model dev6741[] { + {Model::DetectSub, 0x1028, 0x04c1, 0x0000, "AMD Radeon HD 6630M"}, + {Model::DetectSub, 0x1028, 0x04c5, 0x0000, "AMD Radeon HD 6630M"}, + {Model::DetectSub, 0x1028, 0x04cd, 0x0000, "AMD Radeon HD 6630M"}, + {Model::DetectSub, 0x1028, 0x04d7, 0x0000, "AMD Radeon HD 6630M"}, + {Model::DetectSub, 0x1028, 0x04d9, 0x0000, "AMD Radeon HD 6630M"}, + {Model::DetectSub, 0x1028, 0x052d, 0x0000, "AMD Radeon HD 6630M"}, + {Model::DetectSub, 0x103c, 0x1646, 0x0000, "AMD Radeon HD 6750M"}, + {Model::DetectSub, 0x103c, 0x1688, 0x0000, "AMD Radeon HD 6750M"}, + {Model::DetectSub, 0x103c, 0x1689, 0x0000, "AMD Radeon HD 6750M"}, + {Model::DetectSub, 0x103c, 0x168a, 0x0000, "AMD Radeon HD 6750M"}, + {Model::DetectSub, 0x103c, 0x1860, 0x0000, "AMD Radeon HD 7690M"}, + {Model::DetectSub, 0x103c, 0x3385, 0x0000, "AMD Radeon HD 6630M"}, + {Model::DetectSub, 0x103c, 0x3560, 0x0000, "AMD Radeon HD 6750M"}, + {Model::DetectSub, 0x103c, 0x358d, 0x0000, "AMD Radeon HD 6750M"}, + {Model::DetectSub, 0x103c, 0x3590, 0x0000, "AMD Radeon HD 6750M"}, + {Model::DetectSub, 0x103c, 0x3593, 0x0000, "AMD Radeon HD 6750M"}, + {Model::DetectSub, 0x1043, 0x2125, 0x0000, "AMD Radeon HD 7670M"}, + {Model::DetectSub, 0x1043, 0x2127, 0x0000, "AMD Radeon HD 7670M"}, + {Model::DetectSub, 0x104d, 0x907b, 0x0000, "AMD Radeon HD 6630M"}, + {Model::DetectSub, 0x104d, 0x9080, 0x0000, "AMD Radeon HD 6630M"}, + {Model::DetectSub, 0x104d, 0x9081, 0x0000, "AMD Radeon HD 6630M"}, + {Model::DetectSub, 0x1179, 0xfd63, 0x0000, "AMD Radeon HD 6630M"}, + {Model::DetectSub, 0x1179, 0xfd65, 0x0000, "AMD Radeon HD 6630M"}, + {Model::DetectSub, 0x144d, 0xc0b3, 0x0000, "AMD Radeon HD 6750M"}, + {Model::DetectSub, 0x144d, 0xc539, 0x0000, "AMD Radeon HD 6630M"}, + {Model::DetectSub, 0x144d, 0xc609, 0x0000, "AMD Radeon HD 6630M"}, + {Model::DetectSub, 0x17aa, 0x21e1, 0x0000, "AMD Radeon HD 6630M"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 6650M"} +}; + +static constexpr Model dev6745[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 6600M"} +}; + +static constexpr Model dev6750[] { + {Model::DetectSub, 0x1462, 0x2670, 0x0000, "AMD Radeon HD 6670A"}, + {Model::DetectSub, 0x17aa, 0x3079, 0x0000, "AMD Radeon HD 7650A"}, + {Model::DetectSub, 0x17aa, 0x3087, 0x0000, "AMD Radeon HD 7650A"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 6650A"} +}; + +static constexpr Model dev6758[] { + {Model::DetectSub, 0x1028, 0x0b0e, 0x0000, "AMD Radeon HD 6670"}, + {Model::DetectSub, 0x103c, 0x6882, 0x0000, "AMD Radeon HD 6670"}, + {Model::DetectSub, 0x174b, 0xe181, 0x0000, "AMD Radeon HD 6670"}, + {Model::DetectSub, 0x1787, 0x2309, 0x0000, "AMD Radeon HD 6670"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 7670"} +}; + +static constexpr Model dev6759[] { + {Model::DetectSub, 0x1462, 0x2509, 0x0000, "AMD Radeon HD 7570"}, + {Model::DetectSub, 0x148c, 0x7570, 0x0000, "AMD Radeon HD 7570"}, + {Model::DetectSub, 0x1682, 0x3280, 0x0000, "AMD Radeon HD 7570"}, + {Model::DetectSub, 0x1682, 0x3530, 0x0000, "AMD Radeon HD 8850"}, + {Model::DetectSub, 0x174b, 0x7570, 0x0000, "AMD Radeon HD 7570"}, + {Model::DetectSub, 0x1b0a, 0x90b5, 0x0000, "AMD Radeon HD 7570"}, + {Model::DetectSub, 0x1b0a, 0x90b6, 0x0000, "AMD Radeon HD 7570"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 6570"} +}; + +static constexpr Model dev6760[] { + {Model::DetectSub, 0x1028, 0x04cc, 0x0000, "AMD Radeon HD 6490M"}, + {Model::DetectSub, 0x1028, 0x051c, 0x0000, "AMD Radeon HD 6450M"}, + {Model::DetectSub, 0x1028, 0x051d, 0x0000, "AMD Radeon HD 6450M"}, + {Model::DetectSub, 0x103c, 0x1622, 0x0000, "AMD Radeon HD 6450M"}, + {Model::DetectSub, 0x103c, 0x1623, 0x0000, "AMD Radeon HD 6450M"}, + {Model::DetectSub, 0x103c, 0x1656, 0x0000, "AMD Radeon HD 6490M"}, + {Model::DetectSub, 0x103c, 0x1658, 0x0000, "AMD Radeon HD 6490M"}, + {Model::DetectSub, 0x103c, 0x1659, 0x0000, "AMD Radeon HD 6490M"}, + {Model::DetectSub, 0x103c, 0x165b, 0x0000, "AMD Radeon HD 6490M"}, + {Model::DetectSub, 0x103c, 0x167d, 0x0000, "AMD Radeon HD 6490M"}, + {Model::DetectSub, 0x103c, 0x167f, 0x0000, "AMD Radeon HD 6490M"}, + {Model::DetectSub, 0x103c, 0x169c, 0x0000, "AMD Radeon HD 6490M"}, + {Model::DetectSub, 0x103c, 0x1855, 0x0000, "AMD Radeon 7450M"}, + {Model::DetectSub, 0x103c, 0x1859, 0x0000, "AMD Radeon 7450M"}, + {Model::DetectSub, 0x103c, 0x185c, 0x0000, "AMD Radeon 7450M"}, + {Model::DetectSub, 0x103c, 0x185d, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x103c, 0x185f, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x103c, 0x1863, 0x0000, "AMD Radeon 7450M"}, + {Model::DetectSub, 0x103c, 0x355c, 0x0000, "AMD Radeon HD 6490M"}, + {Model::DetectSub, 0x103c, 0x355f, 0x0000, "AMD Radeon HD 6490M"}, + {Model::DetectSub, 0x103c, 0x3581, 0x0000, "AMD Radeon HD 6490M"}, + {Model::DetectSub, 0x103c, 0x358c, 0x0000, "AMD Radeon HD 6490M"}, + {Model::DetectSub, 0x103c, 0x358f, 0x0000, "AMD Radeon HD 6490M"}, + {Model::DetectSub, 0x103c, 0x3592, 0x0000, "AMD Radeon HD 6490M"}, + {Model::DetectSub, 0x103c, 0x3596, 0x0000, "AMD Radeon HD 6490M"}, + {Model::DetectSub, 0x103c, 0x3671, 0x0000, "AMD FirePro M3900"}, + {Model::DetectSub, 0x1043, 0x100a, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1043, 0x102a, 0x0000, "AMD Radeon 7450M"}, + {Model::DetectSub, 0x1043, 0x104b, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1043, 0x105d, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1043, 0x106b, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1043, 0x106d, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1043, 0x107d, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1043, 0x2002, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1043, 0x2107, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1043, 0x2108, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1043, 0x2109, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1043, 0x8515, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1043, 0x8517, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1043, 0x855a, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0x0001, 0x0000, "AMD Radeon HD 6450M"}, + {Model::DetectSub, 0x1179, 0x0003, 0x0000, "AMD Radeon HD 6450M"}, + {Model::DetectSub, 0x1179, 0x0004, 0x0000, "AMD Radeon HD 6450M"}, + {Model::DetectSub, 0x1179, 0xfb22, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb23, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb2c, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb31, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb32, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb33, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb38, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb39, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb3a, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb40, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb41, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb42, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb47, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb48, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb51, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb52, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb53, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb81, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb82, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfb83, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfc52, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfc56, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfcd3, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfcd4, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfcee, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x1179, 0xfdee, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x144d, 0xc0b3, 0x0000, "AMD Radeon HD 6490M"}, + {Model::DetectSub, 0x144d, 0xc609, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x144d, 0xc625, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x144d, 0xc636, 0x0000, "AMD Radeon 7450M"}, + {Model::DetectSub, 0x17aa, 0x3900, 0x0000, "AMD Radeon 7450M"}, + {Model::DetectSub, 0x17aa, 0x3902, 0x0000, "AMD Radeon 7450M"}, + {Model::DetectSub, 0x17aa, 0x3970, 0x0000, "AMD Radeon 7450M"}, + {Model::DetectSub, 0x17aa, 0x5101, 0x0000, "AMD Radeon HD 7470M"}, + {Model::DetectSub, 0x17aa, 0x5102, 0x0000, "AMD Radeon 7450M"}, + {Model::DetectSub, 0x17aa, 0x5103, 0x0000, "AMD Radeon 7450M"}, + {Model::DetectSub, 0x17aa, 0x5106, 0x0000, "AMD Radeon 7450M"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 6470M"} +}; + +static constexpr Model dev6761[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 6430M"} +}; + +static constexpr Model dev6768[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 6400M"} +}; + +static constexpr Model dev6770[] { + {Model::DetectSub, 0x17aa, 0x308d, 0x0000, "AMD Radeon HD 7450A"}, + {Model::DetectSub, 0x17aa, 0x3658, 0x0000, "AMD Radeon HD 7470A"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 6450A"} +}; + +static constexpr Model dev6779[] { + {Model::DetectSub, 0x103c, 0x2aee, 0x0000, "AMD Radeon HD 7450A"}, + {Model::DetectSub, 0x1462, 0x2346, 0x0000, "AMD Radeon HD 7450"}, + {Model::DetectSub, 0x1462, 0x2496, 0x0000, "AMD Radeon HD 7450"}, + {Model::DetectSub, 0x148c, 0x7450, 0x0000, "AMD Radeon HD 7450"}, + {Model::DetectSub, 0x148c, 0x8450, 0x0000, "AMD Radeon HD 8450"}, + {Model::DetectSub, 0x1545, 0x7470, 0x0000, "AMD Radeon HD 7470"}, + {Model::DetectSub, 0x1642, 0x3a66, 0x0000, "AMD Radeon HD 7450"}, + {Model::DetectSub, 0x1642, 0x3a76, 0x0000, "AMD Radeon HD 7450"}, + {Model::DetectSub, 0x1682, 0x3200, 0x0000, "AMD Radeon HD 7450"}, + {Model::DetectSub, 0x174b, 0x7450, 0x0000, "AMD Radeon HD 7450"}, + {Model::DetectSub, 0x1b0a, 0x90a8, 0x0000, "AMD Radeon HD 6450A"}, + {Model::DetectSub, 0x1b0a, 0x90b3, 0x0000, "AMD Radeon HD 7450A"}, + {Model::DetectSub, 0x1b0a, 0x90bb, 0x0000, "AMD Radeon HD 7450A"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 6450"} +}; + +static constexpr Model dev6780[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD FirePro W9000"} +}; + +static constexpr Model dev6790[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 7970"} +}; + +static constexpr Model dev6798[] { + {Model::DetectSub, 0x1002, 0x3001, 0x0000, "AMD Radeon R9 280X"}, + {Model::DetectSub, 0x1002, 0x4000, 0x0000, "AMD Radeon HD 8970"}, + {Model::DetectSub, 0x1043, 0x3001, 0x0000, "AMD Radeon R9 280X"}, + {Model::DetectSub, 0x1043, 0x3006, 0x0000, "AMD Radeon R9 280X"}, + {Model::DetectSub, 0x1043, 0x9999, 0x0000, "ASUS ARES II"}, + {Model::DetectSub, 0x1458, 0x3001, 0x0000, "AMD Radeon R9 280X"}, + {Model::DetectSub, 0x1787, 0x2317, 0x0000, "AMD Radeon HD 7990"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 7970"} +}; + +static constexpr Model dev679a[] { + {Model::DetectSub, 0x1002, 0x3000, 0x0000, "AMD Radeon HD 7950"}, + {Model::DetectSub, 0x174b, 0xa003, 0x0000, "AMD Radeon R9 280"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 8950"} +}; + +static constexpr Model dev679e[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 7870"} +}; + +static constexpr Model dev67b0[] { + {Model::DetectSub, 0x1028, 0x0b00, 0x0000, "AMD Radeon R9 390X"}, + {Model::DetectSub, 0x103c, 0x6566, 0x0000, "AMD Radeon R9 390X"}, + {Model::DetectSub, 0x1043, 0x0476, 0x0000, "ASUS ARES III"}, + {Model::DetectSub, 0x1043, 0x04d7, 0x0000, "AMD Radeon R9 390X"}, + {Model::DetectSub, 0x1043, 0x04db, 0x0000, "AMD Radeon R9 390X"}, + {Model::DetectSub, 0x1043, 0x04df, 0x0000, "AMD Radeon R9 390X"}, + {Model::DetectSub, 0x1043, 0x04e9, 0x0000, "AMD Radeon R9 390X"}, + {Model::DetectSub, 0x1458, 0x22bc, 0x0000, "AMD Radeon R9 390X"}, + {Model::DetectSub, 0x1458, 0x22c1, 0x0000, "AMD Radeon R9 390"}, + {Model::DetectSub, 0x1462, 0x2015, 0x0000, "AMD Radeon R9 390X"}, + {Model::DetectSub, 0x148c, 0x2347, 0x0000, "Devil 13 Dual Core R9 290X"}, + {Model::DetectSub, 0x148c, 0x2357, 0x0000, "AMD Radeon R9 390X"}, + {Model::DetectSub, 0x1682, 0x9395, 0x0000, "AMD Radeon R9 390X"}, + {Model::DetectSub, 0x174b, 0x0e34, 0x0000, "AMD Radeon R9 390X"}, + {Model::DetectSub, 0x174b, 0xe324, 0x0000, "AMD Radeon R9 390X"}, + {Model::DetectSub, 0x1787, 0x2357, 0x0000, "AMD Radeon R9 390X"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon R9 290X"} +}; + +static constexpr Model dev67c0[] { + {Model::DetectRev, 0x0000, 0x0000, 0x0080, "AMD Radeon E9550"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon Pro WX 7100"} //Actually rev 0 +}; + +static constexpr Model dev67df[] { + {Model::DetectRev, 0x0000, 0x0000, 0x00c1, "Radeon Pro 580"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00c2, "Radeon Pro 570"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00c3, "Radeon Pro 580"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00c4, "Radeon Pro 480/575"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00c5, "Radeon Pro 470/570"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00c6, "Radeon Pro 570"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00c7, "Radeon Pro 480/575"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00cf, "Radeon Pro 470/570"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00d7, "Radeon Pro 470/570"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00e7, "Radeon Pro 580"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00ef, "Radeon Pro 570"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00ff, "Radeon Pro 470"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "Radeon Pro 480"} +}; + +static constexpr Model dev67e0[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon Pro WX 7100"} +}; + +static constexpr Model dev67ef[] { + {Model::DetectRev, 0x0000, 0x0000, 0x00c0, "Radeon Pro 460/560"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00c1, "Radeon Pro 460"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00c5, "Radeon Pro 460"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00c7, "Radeon Pro 455/555"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00cf, "Radeon Pro 460"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00e0, "Radeon Pro 560"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00e5, "Radeon Pro 560"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00ef, "Radeon Pro 450/550"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00ff, "Radeon Pro 460"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "Radeon Pro 460"} +}; + +static constexpr Model dev67ff[] { + {Model::DetectRev, 0x0000, 0x0000, 0x00c0, "Radeon Pro 465"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00c1, "Radeon Pro 560"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00cf, "Radeon Pro 560"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00ef, "Radeon Pro 560"}, + {Model::DetectRev, 0x0000, 0x0000, 0x00ff, "Radeon Pro 550"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "Radeon Pro 560"} +}; + +static constexpr Model dev6800[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 7970M"} +}; + +static constexpr Model dev6801[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 8970M"} +}; + +static constexpr Model dev6806[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD FirePro W7000"} +}; + +static constexpr Model dev6808[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD FirePro W7000"} +}; + +static constexpr Model dev6810[] { + {Model::DetectSub, 0x1458, 0x2272, 0x0000, "AMD Radeon R9 270X"}, + {Model::DetectSub, 0x148c, 0x0908, 0x0000, "AMD Radeon R9 370"}, + {Model::DetectSub, 0x1682, 0x7370, 0x0000, "AMD Radeon R7 370"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon R9 370X"} +}; + +static constexpr Model dev6818[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 7870"} +}; + +static constexpr Model dev6819[] { + {Model::DetectSub, 0x174b, 0xe221, 0x0000, "AMD Radeon 7850"}, + {Model::DetectSub, 0x1462, 0x3058, 0x0000, "AMD Radeon R7 265"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon R9 270"} +}; + +static constexpr Model dev6820[] { + {Model::DetectSub, 0x103c, 0x1851, 0x0000, "AMD Radeon HD 7750M"}, + {Model::DetectSub, 0x17aa, 0x3643, 0x0000, "AMD Radeon R9 A375"}, + {Model::DetectSub, 0x17aa, 0x3801, 0x0000, "AMD Radeon R9 M275"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon R9 M375"} +}; + +static constexpr Model dev6821[] { + {Model::DetectSub, 0x1002, 0x031e, 0x0000, "AMD FirePro SX4000"}, + {Model::DetectSub, 0x1028, 0x05cc, 0x0000, "AMD FirePro M5100"}, + {Model::DetectSub, 0x1028, 0x15cc, 0x0000, "AMD FirePro M5100"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon R9 M370X"} +}; + +static constexpr Model dev6823[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 8850M/R9 M265X"} +}; + +static constexpr Model dev6825[] { + {Model::DetectSub, 0x1028, 0x053f, 0x0000, "AMD FirePro M6000"}, + {Model::DetectSub, 0x1028, 0x05cd, 0x0000, "AMD FirePro M6000"}, + {Model::DetectSub, 0x1028, 0x15cd, 0x0000, "AMD FirePro M6000"}, + {Model::DetectSub, 0x103c, 0x176c, 0x0000, "AMD FirePro M6000"}, + {Model::DetectSub, 0x8086, 0x2111, 0x0000, "AMD Radeon HD 7730M"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 7870M"} +}; + +static constexpr Model dev6827[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 7850M/8850M"} +}; + +static constexpr Model dev682b[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 8830M"} +}; + +static constexpr Model dev682d[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD FirePro M4000"} +}; + +static constexpr Model dev682f[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 7730M"} +}; + +static constexpr Model dev6835[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon R9 255"} +}; + +static constexpr Model dev6839[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 7700"} +}; + +static constexpr Model dev683b[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 7700"} +}; + +static constexpr Model dev683d[] { + {Model::DetectSub, 0x1002, 0x0030, 0x0000, "AMD Radeon HD 8760"}, + {Model::DetectSub, 0x1019, 0x0030, 0x0000, "AMD Radeon HD 8760"}, + {Model::DetectSub, 0x103c, 0x6890, 0x0000, "AMD Radeon HD 8760"}, + {Model::DetectSub, 0x1043, 0x8760, 0x0000, "AMD Radeon HD 8760"}, + {Model::DetectSub, 0x1462, 0x2710, 0x0000, "AMD Radeon HD 7770"}, + {Model::DetectSub, 0x174b, 0x8304, 0x0000, "AMD Radeon HD 8760"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 7770"} +}; + +static constexpr Model dev683f[] { + {Model::DetectSub, 0x1462, 0x2790, 0x0000, "AMD Radeon HD 8740"}, + {Model::DetectSub, 0x1462, 0x2791, 0x0000, "AMD Radeon HD 8740"}, + {Model::DetectSub, 0x1642, 0x3b97, 0x0000, "AMD Radeon HD 8740"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 7750"} +}; + +static constexpr Model dev6840[] { + {Model::DetectSub, 0x1025, 0x0696, 0x0000, "AMD Radeon HD 7650M"}, + {Model::DetectSub, 0x1025, 0x0697, 0x0000, "AMD Radeon HD 7650M"}, + {Model::DetectSub, 0x1025, 0x0698, 0x0000, "AMD Radeon HD 7650M"}, + {Model::DetectSub, 0x1025, 0x0699, 0x0000, "AMD Radeon HD 7650M"}, + {Model::DetectSub, 0x103c, 0x1789, 0x0000, "AMD FirePro M2000"}, + {Model::DetectSub, 0x103c, 0x17f1, 0x0000, "AMD Radeon HD 7570M"}, + {Model::DetectSub, 0x103c, 0x17f4, 0x0000, "AMD Radeon HD 7650M"}, + {Model::DetectSub, 0x103c, 0x1813, 0x0000, "AMD Radeon HD 7590M"}, + {Model::DetectSub, 0x144d, 0xc0c5, 0x0000, "AMD Radeon HD 7690M"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 7670M"} +}; + +static constexpr Model dev6841[] { + {Model::DetectSub, 0x1028, 0x057f, 0x0000, "AMD Radeon HD 7570M"}, + {Model::DetectSub, 0x103c, 0x17f1, 0x0000, "AMD Radeon HD 7570M"}, + {Model::DetectSub, 0x103c, 0x1813, 0x0000, "AMD Radeon HD 7570M"}, + {Model::DetectSub, 0x1179, 0x0001, 0x0000, "AMD Radeon HD 7570M"}, + {Model::DetectSub, 0x1179, 0x0002, 0x0000, "AMD Radeon HD 7570M"}, + {Model::DetectSub, 0x1179, 0xfb43, 0x0000, "AMD Radeon HD 7550M"}, + {Model::DetectSub, 0x1179, 0xfb91, 0x0000, "AMD Radeon HD 7550M"}, + {Model::DetectSub, 0x1179, 0xfb92, 0x0000, "AMD Radeon HD 7550M"}, + {Model::DetectSub, 0x1179, 0xfb93, 0x0000, "AMD Radeon HD 7550M"}, + {Model::DetectSub, 0x1179, 0xfba2, 0x0000, "AMD Radeon HD 7550M"}, + {Model::DetectSub, 0x1179, 0xfba3, 0x0000, "AMD Radeon HD 7550M"}, + {Model::DetectSub, 0x144d, 0xc0c7, 0x0000, "AMD Radeon HD 7550M"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon HD 7650M"} +}; + +static constexpr Model dev6898[] { + {Model::DetectSub, 0x174b, 0x6870, 0x0000, "AMD Radeon HD 6870"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "ATI Radeon HD 5870"} +}; + +static constexpr Model dev6899[] { + {Model::DetectSub, 0x174b, 0x237b, 0x0000, "ATI Radeon HD 5850 (x2)"}, + {Model::DetectSub, 0x174b, 0x6850, 0x0000, "AMD Radeon HD 6850"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "ATI Radeon HD 5850"} +}; + +static constexpr Model dev68a0[] { + {Model::DetectSub, 0x1028, 0x12ef, 0x0000, "ATI FirePro M7820"}, + {Model::DetectSub, 0x103c, 0x1520, 0x0000, "ATI FirePro M7820"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "ATI Mobility Radeon HD 5870"} +}; + +static constexpr Model dev68a1[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "ATI Mobility Radeon HD 5850"} +}; + +static constexpr Model dev68b0[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "ATI Radeon HD 5770"} +}; + +static constexpr Model dev68b1[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "ATI Radeon HD 5770"} +}; + +static constexpr Model dev68b8[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "ATI Radeon HD 5770"} +}; + +static constexpr Model dev68c0[] { + {Model::DetectSub, 0x103c, 0x1521, 0x0000, "ATI FirePro M5800"}, + {Model::DetectSub, 0x17aa, 0x3978, 0x0000, "AMD Radeon HD 6570M"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "ATI Mobility Radeon HD 5730"} +}; + +static constexpr Model dev68c1[] { + {Model::DetectSub, 0x1025, 0x0347, 0x0000, "ATI Mobility Radeon 5470"}, + {Model::DetectSub, 0x1025, 0x0517, 0x0000, "AMD Radeon HD 6550M"}, + {Model::DetectSub, 0x1025, 0x051a, 0x0000, "AMD Radeon HD 6550M"}, + {Model::DetectSub, 0x1025, 0x051b, 0x0000, "AMD Radeon HD 6550M"}, + {Model::DetectSub, 0x1025, 0x051c, 0x0000, "AMD Radeon HD 6550M"}, + {Model::DetectSub, 0x1025, 0x051d, 0x0000, "AMD Radeon HD 6550M"}, + {Model::DetectSub, 0x1025, 0x0525, 0x0000, "AMD Radeon HD 6550M"}, + {Model::DetectSub, 0x1025, 0x0526, 0x0000, "AMD Radeon HD 6550M"}, + {Model::DetectSub, 0x1025, 0x052b, 0x0000, "AMD Radeon HD 6550M"}, + {Model::DetectSub, 0x1025, 0x052c, 0x0000, "AMD Radeon HD 6550M"}, + {Model::DetectSub, 0x1025, 0x053c, 0x0000, "AMD Radeon HD 6550M"}, + {Model::DetectSub, 0x1025, 0x053d, 0x0000, "AMD Radeon HD 6550M"}, + {Model::DetectSub, 0x1025, 0x053e, 0x0000, "AMD Radeon HD 6550M"}, + {Model::DetectSub, 0x1025, 0x053f, 0x0000, "AMD Radeon HD 6550M"}, + {Model::DetectSub, 0x1025, 0x0607, 0x0000, "AMD Radeon HD 6550M"}, + {Model::DetectSub, 0x103c, 0x1521, 0x0000, "ATI FirePro M5800"}, + {Model::DetectSub, 0x103c, 0xfd52, 0x0000, "AMD Radeon HD 6530M"}, + {Model::DetectSub, 0x103c, 0xfd63, 0x0000, "AMD Radeon HD 6530M"}, + {Model::DetectSub, 0x103c, 0xfd65, 0x0000, "AMD Radeon HD 6530M"}, + {Model::DetectSub, 0x103c, 0xfdd2, 0x0000, "AMD Radeon HD 6530M"}, + {Model::DetectSub, 0x17aa, 0x3977, 0x0000, "AMD Radeon HD 6550M"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "ATI Mobility Radeon HD 5650"} +}; + +static constexpr Model dev68d8[] { + {Model::DetectSub, 0x1028, 0x68e0, 0x0000, "ATI Radeon HD 5670"}, + {Model::DetectSub, 0x174b, 0x5690, 0x0000, "ATI Radeon HD 5690"}, + {Model::DetectSub, 0x174b, 0xe151, 0x0000, "ATI Radeon HD 5670"}, + {Model::DetectSub, 0x1787, 0x200d, 0x0000, "ATI Radeon HD 5670"}, + {Model::DetectSub, 0x17af, 0x3011, 0x0000, "ATI Radeon HD 5690"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "ATI Radeon HD 5730"} +}; + +static constexpr Model dev68d9[] { + {Model::DetectSub, 0x148c, 0x3000, 0x0000, "AMD Radeon HD 6510"}, + {Model::DetectSub, 0x148c, 0x3001, 0x0000, "AMD Radeon HD 6610"}, + {Model::DetectSub, 0x1545, 0x7570, 0x0000, "AMD Radeon HD 7570"}, + {Model::DetectSub, 0x174b, 0x3000, 0x0000, "AMD Radeon HD 6510"}, + {Model::DetectSub, 0x174b, 0x6510, 0x0000, "AMD Radeon HD 6510"}, + {Model::DetectSub, 0x174b, 0x6610, 0x0000, "AMD Radeon HD 6610"}, + {Model::DetectSub, 0x1787, 0x3000, 0x0000, "AMD Radeon HD 6510"}, + {Model::DetectSub, 0x17af, 0x3000, 0x0000, "AMD Radeon HD 6510"}, + {Model::DetectSub, 0x17af, 0x3010, 0x0000, "ATI Radeon HD 5630"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "ATI Radeon HD 5570"} +}; + +static constexpr Model dev68e0[] { + {Model::DetectSub, 0x1682, 0x9e52, 0x0000, "ATI FirePro M3800"}, + {Model::DetectSub, 0x1682, 0x9e53, 0x0000, "ATI FirePro M3800"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "ATI Mobility Radeon HD 5450"} +}; + +static constexpr Model dev68e1[] { + {Model::DetectSub, 0x148c, 0x3001, 0x0000, "AMD Radeon HD 6230"}, + {Model::DetectSub, 0x148c, 0x3002, 0x0000, "AMD Radeon HD 6250"}, + {Model::DetectSub, 0x148c, 0x3003, 0x0000, "AMD Radeon HD 6350"}, + {Model::DetectSub, 0x148c, 0x7350, 0x0000, "AMD Radeon HD 7350"}, + {Model::DetectSub, 0x148c, 0x8350, 0x0000, "AMD Radeon HD 8350"}, + {Model::DetectSub, 0x1545, 0x7350, 0x0000, "AMD Radeon HD 7350"}, + {Model::DetectSub, 0x1682, 0x7350, 0x0000, "AMD Radeon HD 7350"}, + {Model::DetectSub, 0x174b, 0x5470, 0x0000, "ATI Radeon HD 5470"}, + {Model::DetectSub, 0x174b, 0x6230, 0x0000, "AMD Radeon HD 6230"}, + {Model::DetectSub, 0x174b, 0x6350, 0x0000, "AMD Radeon HD 6350"}, + {Model::DetectSub, 0x174b, 0x7350, 0x0000, "AMD Radeon HD 7350"}, + {Model::DetectSub, 0x17af, 0x3001, 0x0000, "AMD Radeon HD 6230"}, + {Model::DetectSub, 0x17af, 0x3014, 0x0000, "AMD Radeon HD 6350"}, + {Model::DetectSub, 0x17af, 0x3015, 0x0000, "AMD Radeon HD 7350"}, + {Model::DetectSub, 0x17af, 0x8350, 0x0000, "AMD Radeon HD 8350"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "ATI Radeon HD 5450"} +}; + +static constexpr Model dev6920[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon R9 M395"} +}; + +static constexpr Model dev6921[] { + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon R9 M295X"} +}; + +static constexpr Model dev6938[] { + {Model::DetectSub, 0x106b, 0x013a, 0x0000, "AMD Radeon R9 M295X"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon R9 380X"} +}; + +static constexpr Model dev6939[] { + {Model::DetectSub, 0x148c, 0x9380, 0x0000, "AMD Radeon R9 380"}, + {Model::DetectSub, 0x174b, 0xe308, 0x0000, "AMD Radeon R9 380"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon R9 285"} +}; + +static constexpr Model dev7300[] { + {Model::DetectSub, 0x1002, 0x0b36, 0x0000, "AMD Radeon NANO"}, + {Model::DetectSub, 0x1002, 0x1b36, 0x0000, "AMD Radeon Pro Duo"}, + {Model::DetectSub, 0x1043, 0x04a0, 0x0000, "AMD Radeon FURY X"}, + {Model::DetectDef, 0x0000, 0x0000, 0x0000, "AMD Radeon FURY"} +}; + +static constexpr DevicePair devices[] { + {0x6640, dev6640, arrsize(dev6640)}, + {0x6641, dev6641, arrsize(dev6641)}, + {0x6646, dev6646, arrsize(dev6646)}, + {0x6647, dev6647, arrsize(dev6647)}, + {0x665c, dev665c, arrsize(dev665c)}, + {0x665d, dev665d, arrsize(dev665d)}, + {0x6704, dev6704, arrsize(dev6704)}, + {0x6718, dev6718, arrsize(dev6718)}, + {0x6719, dev6719, arrsize(dev6719)}, + {0x6720, dev6720, arrsize(dev6720)}, + {0x6722, dev6722, arrsize(dev6722)}, + {0x6738, dev6738, arrsize(dev6738)}, + {0x6739, dev6739, arrsize(dev6739)}, + {0x6740, dev6740, arrsize(dev6740)}, + {0x6741, dev6741, arrsize(dev6741)}, + {0x6745, dev6745, arrsize(dev6745)}, + {0x6750, dev6750, arrsize(dev6750)}, + {0x6758, dev6758, arrsize(dev6758)}, + {0x6759, dev6759, arrsize(dev6759)}, + {0x6760, dev6760, arrsize(dev6760)}, + {0x6761, dev6761, arrsize(dev6761)}, + {0x6768, dev6768, arrsize(dev6768)}, + {0x6770, dev6770, arrsize(dev6770)}, + {0x6779, dev6779, arrsize(dev6779)}, + {0x6780, dev6780, arrsize(dev6780)}, + {0x6790, dev6790, arrsize(dev6790)}, + {0x6798, dev6798, arrsize(dev6798)}, + {0x679a, dev679a, arrsize(dev679a)}, + {0x679e, dev679e, arrsize(dev679e)}, + {0x67b0, dev67b0, arrsize(dev67b0)}, + {0x67c0, dev67c0, arrsize(dev67c0)}, + {0x67df, dev67df, arrsize(dev67df)}, + {0x67e0, dev67e0, arrsize(dev67e0)}, + {0x67ef, dev67ef, arrsize(dev67ef)}, + {0x67ff, dev67ff, arrsize(dev67ff)}, + {0x6800, dev6800, arrsize(dev6800)}, + {0x6801, dev6801, arrsize(dev6801)}, + {0x6806, dev6806, arrsize(dev6806)}, + {0x6808, dev6808, arrsize(dev6808)}, + {0x6810, dev6810, arrsize(dev6810)}, + {0x6818, dev6818, arrsize(dev6818)}, + {0x6819, dev6819, arrsize(dev6819)}, + {0x6820, dev6820, arrsize(dev6820)}, + {0x6821, dev6821, arrsize(dev6821)}, + {0x6823, dev6823, arrsize(dev6823)}, + {0x6825, dev6825, arrsize(dev6825)}, + {0x6827, dev6827, arrsize(dev6827)}, + {0x682b, dev682b, arrsize(dev682b)}, + {0x682d, dev682d, arrsize(dev682d)}, + {0x682f, dev682f, arrsize(dev682f)}, + {0x6835, dev6835, arrsize(dev6835)}, + {0x6839, dev6839, arrsize(dev6839)}, + {0x683b, dev683b, arrsize(dev683b)}, + {0x683d, dev683d, arrsize(dev683d)}, + {0x683f, dev683f, arrsize(dev683f)}, + {0x6840, dev6840, arrsize(dev6840)}, + {0x6841, dev6841, arrsize(dev6841)}, + {0x6898, dev6898, arrsize(dev6898)}, + {0x6899, dev6899, arrsize(dev6899)}, + {0x68a0, dev68a0, arrsize(dev68a0)}, + {0x68a1, dev68a1, arrsize(dev68a1)}, + {0x68b0, dev68b0, arrsize(dev68b0)}, + {0x68b1, dev68b1, arrsize(dev68b1)}, + {0x68b8, dev68b8, arrsize(dev68b8)}, + {0x68c0, dev68c0, arrsize(dev68c0)}, + {0x68c1, dev68c1, arrsize(dev68c1)}, + {0x68d8, dev68d8, arrsize(dev68d8)}, + {0x68d9, dev68d9, arrsize(dev68d9)}, + {0x68e0, dev68e0, arrsize(dev68e0)}, + {0x68e1, dev68e1, arrsize(dev68e1)}, + {0x6920, dev6920, arrsize(dev6920)}, + {0x6921, dev6921, arrsize(dev6921)}, + {0x6938, dev6938, arrsize(dev6938)}, + {0x6939, dev6939, arrsize(dev6939)}, + {0x7300, dev7300, arrsize(dev7300)} +}; + +const char *RAD::getModel(uint16_t ven, uint16_t dev, uint16_t rev, uint16_t subven, uint16_t sub) { + // Initially check vendor-id common to all ATI/AMD + if (ven != 0x1002) + return nullptr; + + for (auto &device : devices) { + if (device.dev == dev) { + for (size_t j = 0; j < device.modelNum; j++) { + auto &model = device.models[j]; + + if (model.mode & Model::DetectSub && (model.subven != subven || model.sub != sub)) + continue; + + if (model.mode & Model::DetectRev && (model.rev != rev)) + continue; + + return model.name; + } + break; + } + } + + return nullptr; +}