# Video BIOS of HD 8650G / HD 8570M / R5 M230 - dump support?



## qmastery (Jul 1, 2017)

Recently GPU-Z added the support for _*HD 8350G*_ which is a part of A4-5150M mobile APU.
but *HD 8650G* - a part of A10-5750M mobile APU from the same family - is still unsupported !

Also I have an access to a couple of AMD laptops which have HD 8650G as integrated
with *HD 8570M* and *R5 M230* as discrete graphics - early mobile GCN 1.0/1.1 families

I really want to share their Video BIOS with your TechPowerup community,
but sadly it is still not supported by GPU-Z to dump their Video BIOS

Please add the support for these GPUs to your wonderful GPU-Z utility,
*I could help to debug your test builds !*


----------



## W1zzard (Jul 1, 2017)

Are you specifically talking about BIOS save for those models? I think BIOS saving won't work because the video BIOS is part of the motherboard BIOS.

Feel free to post GPU-Z screenshots to indicate missing or broken detection.


----------



## qmastery (Jul 1, 2017)

W1zzard said:


> Are you specifically talking about BIOS save for those models? I think BIOS saving won't work because the video BIOS is part of the motherboard BIOS


 You are partially correct: at most laptops initially all the Video BIOS ROMs are a part of motherboard's UEFI/BIOS. But during laptop's initialization at startup: these "option ROMs" are loaded to GPUs after some modification _(e.g. integrated GPU video BIOS is runtime patched by motherboard's UEFI to enable laptop's backlight)_ , so the Video BIOS ROMs are available at GPUs after laptop's launch - and that is why AIDA64 dumps HD 8650G video BIOS without a problem

Also it would have been strange if HD 8350G could be dumped but HD 8650G could not. Maybe there is "whitelist limitation" built-in to GPU-Z : if a GPU is not a part of supported GPUs list, dont even try to dump its' video BIOS, just give _"BIOS reading not supported on this device."_ error message  I think it would have been better to try and fail/succeed than don't try at all. if I didn't had HD 8650G video BIOS already, I would have patched GPU-Z to avoid this whitelist and use the same method of video BIOS retrieval as it is for HD 8350G - most likely it would have worked because these APUs are from the same family 





W1zzard said:


> Feel free to post GPU-Z screenshots to indicate missing or broken detection


 My combined screenshots of GPU-Z and AIDA64 :

*1) Integrated HD 8650G - http://i.imgur.com/pys1hwm.png*

GPU-Z detection is good but it gives "_BIOS reading not supported on this device_",
despite that it successfully detected the Video BIOS build time and version!
This information is a part of any AMD's Video BIOS at its' beginning:
so, if GPU-Z was able to read this information, it could have read
the whole Video BIOS as well - if it weren't for this "whitelist" 

Meanwhile, AIDA64 dumps this Video BIOS without a problem

*2) Discrete R5 M230 - http://i.imgur.com/baqmOd8.png
*
GPU-Z detection is problematic, e.g. it cannot detect the amount of transistors,
but most importantly - cannot even detect the Video BIOS version.

Meanwhile, AIDA64 is able to detect its' Video BIOS build time and version,
which means that it successfully accesses the beginning of Video BIOS
and most likely could read the rest of it - but sadly the current version
does not allow you to select a GPU which you would like to dump
so it always dumps integrated (already wrote a bug report to them:
_(https://forums.aida64.com/topic/3882-video-bios-dump-aida64-does-not-ask-gpu-choice/_)

Probably the same situation with discrete HD 8570M because its very similar to R5 M230


----------



## qmastery (Jul 1, 2017)

Please at least add HD 8650G to your supported GPUs list, like you have already added HD 8350G.
Also it would have been super great if you could fix HD 8570M / R5 M230 detection and BIOS dumping


----------



## qmastery (Jul 4, 2017)

W1zzard said:


> GPU-Z


GPU-Z is it open source? Usually such utilities are open source and everyone can contribute
As a software programmer I would gladly improve GPU-Z but sadly I can't find the source code


----------



## W1zzard (Jul 4, 2017)

No matter where the video bios is stored, on bootup, for the primary adapter, part of it is copied to the video bios shadow at C0000- CFFFF, but only 64K of it. Which for modern cards is not enough, so the BIOS will be truncated.

GPU-Z will not let you extract from there because it's an incomplete BIOS that will break your card when flashing.

There is no whitelist. GPU-Z tries several different methods.

Transistor count can't be read, its value is stored in a database within GPU-Z. I'm not sure if AIDA is showing the correct transistor count. I see various different values online.


----------



## qmastery (Jul 4, 2017)

W1zzard said:


> No matter where the video bios is stored, on bootup, for the primary adapter, part of it is copied to the video bios shadow at C0000- CFFFF, but only 64K of it. Which for modern cards is not enough, so the BIOS will be truncated
> 
> GPU-Z will not let you extract from there because it's an incomplete BIOS that will break your card when flashing


 luckily the video BIOS of HD 8650G is smaller - 61952 bytes, less than 64K.
meanwhile, for HD 8570M it is should be 33792 bytes and for R5 M230 - 32768 bytes, both are smaller than 64K

So there is nothing wrong in at least trying to extract the video BIOS from these GPUs


----------



## qmastery (Jul 7, 2017)

W1zzard said:


> GPU-Z


 After a lot of researching I found this wonderful freeware tool:

_" Belkasoft Live RAM Capturer is a tiny free forensic tool that allows to reliably extract the entire contents
of computer’s volatile memory – even if protected by an active anti-debugging or anti-dumping system "_

https://belkasoft.com/ram-capturer - Indeed this forensic software is dumping more than just RAM!
My laptop has 16 GB RAM - 16384 MB ( 0x400000000 bytes ) but these dumps are 0x42F000000 bytes, 17136 MB.
Then I just searched through this dump for BR45149.002 _(discrete GPU Video BIOS part number, learned from AIDA64
or Radeon Control Center at Information tab)_ and have found two full copies of this ROM after 0x42D000000 offset:
copies at 0x42D305020 and 0x42E40DCD0 offsets!

I know how AtomBIOS starts ( 0x55 0xaa ) as well as how it ends ( a lot of 0xFF's and aligned to 0x200 or maybe 0x100 ),
so it became obvious that the size is 32768 bytes ( 0x8000 ) and from what offset I should start copying it to get ROM !
Of course there is a lot of manual work with this method, but so far its the only method that has worked for me 
	

	
	
		
		

		
			





Good luck and happy hacking!


----------



## W1zzard (Jul 8, 2017)

good approach. what will you do with the bios now?


----------



## qmastery (Jul 8, 2017)

W1zzard said:


> good approach. what will you do with the bios now?


 Most people are dumping it to mod to improve the performance of desktop's GPU or just to backup.
But I plan to use this Video BIOS _(AMD AtomBIOS)_ together with coreboot open source BIOS :

https://www.coreboot.org/
https://www.coreboot.org/Supported_Motherboards
This wonderful BIOS is fully open source - which has a lot of real advantages!  You can:

*1)* Personally verify that there are no secret backdoors in it.
Also there are no stupid restrictions like Wi-Fi card whitelists
*
2) *Rebuild and update it even every day, because it has several source code updates every day!
Meanwhile, the "ordinary BIOS" is forgotten by manufacturer after 1-2 years since the release of laptop/motherboard
*
3)* Easily add a lot of cool stuff right in this BIOS: memtest, Tetris, GRUB bootloader, Linux kernel,
and even Kolibri OS - https://kolibrios.org/en/ - tiny OS with GUI that fits on a floppy, written on pure assembly 
*
4) *Participate in its' development: fixing the bugs, adding new features and advancing your coding skills.
However, there are not many bugs in it - because its' source code is open, it is much better quality
than the "ordinary BIOS" written by outsourced team of Indians for a bowl of rice at the coding sweatshop 
*
5)* Boot it very quickly - thanks to its' relatively small and optimized source code it boots like a lightning

It is hard to obtain all the datasheets necessary to port coreboot to new hardware.
Partially thats why coreboot supports only a few laptops and motherboards,
the majority are Lenovo laptops just because Linux software developers love them 

https://www.coreboot.org/Supported_Motherboards

as you see, AMD-based Lenovo G505S is a part of this list, - and maybe your computer is also??? 

Sometimes you need a few closed source binaries _(aka "blobs")_ to add to this open source BIOS.
For example: some models of G505S have only integrated GPU, but a lot of have integrated+discrete.
In any case, if I don't add integrated GPU Video BIOS binary to my coreboot BIOS before flashing it,
there will be no video signal at laptop's internal screen as well as at external,
and then this laptop could be used only as a headless server.

Also, often this video BIOS has to be extracted from a booted laptop with proprietary BIOS.
At least in case of AMD GPU, if you extract a Video BIOS from manufacturer's BIOS image,
_(e.g. by using InsydeH20 BIOS tools https://github.com/s-sosnitskiy80/Insider_BIOS_Tools )_
these "clean" AtomBIOS are not initialized enough and I got no working backlight with them

After getting the "dirty" AtomBIOS ROM _(extracted from a booted laptop with proprietary BIOS)_
that belongs to integrated GPU, and copying it to coreboot BIOS, my backlight became working!

But I still have problems with R5 M230 discrete graphics card, it is visible by PCI but doesn't work!
Could be a driver problem_ (AMD Linux open source drivers are not good enough yet)_ ,
but maybe if - in addition to integrated GPU Video BIOS - I also add a "dirty" discrete GPU Video BIOS
_(that I got with this method above)_ to coreboot open source BIOS, maybe then my discrete card will work...

Sorry for long explanation, hopefully its' not boring enough to be TLDR 
Good luck to your projects, *@W1zzard* , and happy hacking


----------



## W1zzard (Jul 8, 2017)

I see. From a GPU-Z perspective that is a very specialized problem you are solving, and I rather not add a feature that lets people download partial or broken ROMs, which will lead to lots of bricked cards.

Dumping physical memory seems to be the right approach, couldn't you just dd out of the physical memory device on Linux?


----------



## qmastery (Jul 8, 2017)

W1zzard said:


> Dumping physical memory seems to be the right approach, couldn't you just dd out of the physical memory device on Linux?


 https://unix.stackexchange.com/questions/119762/how-to-dump-memory-image-from-linux-system


> On recent Linux systems, however, /dev/mem provides access only to a restricted range of addresses, rather than the full physical memory of a system



Even if somehow I manage to dump the whole 16 GB of RAM, I doubt they would contain a Video BIOS for discrete GPU : *" cat /proc/iomem "* shows only one "Video BIOS" there - which is for integrated GPU. Perhaps I could find out how that Belkasoft Dumper is getting almost 17 GB of memory, maybe it knows a good way of successfully accessing the PCI devices internal memory, and then I could try to do the same at Linux - maybe with low level PCI commands...



W1zzard said:


> From a GPU-Z perspective that is a very specialized problem you are solving, and I rather not add a feature that lets people download partial or broken ROMs, which will lead to lots of bricked cards


 Please tell, is there any way to submit ROMs to TechPowerUp's Video BIOS Collection directly, without using GPU-Z ?
After I test these ROMs on my real hardware, if they are working perfectly - I would be happy to share them


----------



## W1zzard (Jul 8, 2017)

qmastery said:


> After I test these ROMs on my real hardware, if they are working perfectly - I would be happy to share them


If you use atiflash to flash a zero-filled rom and after that your backup and then the card still works, please email the bios to me, w1zzard@techpowerup.com, i'll add it manually.


----------



## qmastery (Feb 21, 2019)

W1zzard said:


> i'll add it manually


 Good day, @W1zzard ! Sorry for such a looong reply, but finally I have the good news.
Recently we got the Lenovo G505S discrete GPU working at coreboot opensource BIOS , with the help of these VideoBIOS ROMs :

*1)* https://github.com/g505s-opensource...bios/tree/master/G505S_with_discrete_HD-8570M
pci1002,990b.rom - for integrated HD 8650G _( sha256 = a928af5b129fe13c5a0032a28e387edf238198b8ce56fc076c580427cbf8835c )_
pci1002,6663.rom - for discrete HD 8570M _( sha256 = 6052b5def3fda2a93f6c4d55ec91b819429e212e26cdb8e0fcca54599c9c92ed )_

*2)* https://github.com/g505s-opensource...mbios/tree/master/G505S_with_discrete_R5-M230
pci1002,990b.rom - for integrated HD 8650G _( sha256 = 6104e6989ea3f494d7bfa30573bf38e830f1068bab9980caec5e890e0ccbfced )_
pci1002,6665.rom - for discrete R5 M230 _( sha256 = 15d74515332bc512de66e0dc910d8600aeb134bf715bbc34a4faac0257f4a0dc )_

Detailed instruction about how we extracted these correctly initialized VideoBIOS when all the other methods have failed -
- is available at this repository's primary page: https://github.com/g505s-opensource-researcher/g505s-atombios 
and at https://web.archive.org/web/2018092....org/pipermail/coreboot/2017-July/084660.html

Interesting that, while there was the same "clean" BIOS image flashed both to _"G505S with HD 8570M_" and to _"G505S with R5 M230"_,
their VGA BIOSes for *integrated* HD 8650G turned out as slightly different! I made their full disassembly with this AtomDis tool -
https://cgit.freedesktop.org/~mhopf/AtomDis/ , and compared, diff results here -  https://pastebin.com/eewzswnD
As you could see from these diff results, for some reason _"G505S R5 version"_ sets a slightly higher voltages for its' integrated GPU :
compared to _"G505S HD version"_ it is 1.8% - 3.2% higher if these 0x3e / 0x40 / 0x6e / 0x70 values are linear and 0x0 = 0 volts.

What do you think: would it be okay to use the integrated VGA BIOS obtained from _"G505S R5 version"_ for _"G505S HD version"_ ?
This voltage difference seems small enough and the integrated GPU is the same part after all ---> I think that it should be fine.

So I am attaching three VideoBIOS to this message for your convenience:

**)* pci1002,990b.rom - for Integrated HD 8650G inside Lenovo G505S _(taken from "G505S R5 version")_
Version - 015.031.000.000 , Date - 01/16/2013 , Part Number - 113-DVST-113
**)* pci1002,6663.rom - for discrete HD 8570M inside Lenovo G505S
Version - 015.032.000.000 , Date - 06/24/2013 , Part Number - BR44464.011
**)* pci1002,6663.rom - for discrete R5 M230 inside Lenovo G505S
Version - 015.041.000.000 , Date - 11/28/2013 , Part Number - BR45149.002

They are inside Lenovo_G505S_VideoBIOS.zip archive. Please add them to your database


----------

