Re: [PATCH] nouveau: fix OpenFirmware support

Laurent Vivier
2015-10-10T19:29:32Z

Le 10/10/2015 20:41, Ilia Mirkin a écrit :
> Hi Laurent,
>
> On Sat, Oct 10, 2015 at 9:27 AM, Laurent Vivier <laurent@vivier.eu> wrote:
>> On PowerMac G5 (and I think on all OpenFirmware platforms), nvbios_pcirTp()
>> returns NULL. But in fact the OpenFirmware has given us the size
>> we can store in image->size.
>>
>> This size is stored in bios->size by of_init() as there is no way
>> to retrieve it otherwise. And as we know the size, copy all data
>> to bios->data.
>>
>> Tested on PowerMac G5 with 64bit kernel and a NV43 card (GeForce 6600 LE).
>
> Can you give this patch a shot instead?
>
> http://cgit.freedesktop.org/~darktama/nouveau/commit/?id=794a63cc75eada9ad6b2a0275c1c8c4d3522864f

Well, I think mine is also a good solution and it is much more simple.
;)

... because it is useless to add a size() function if we can directly
copy the content/size of the bios in bios->data and bios->size.
We can do that because we have the size of the property, which is not
the case when we discover the BIOS directly from a PCI ROM or from ACPI
(this is why we need a shadow, I think).

For pcir part, I think we can just ignore the result and take the size
from bios->size, as in the case of non openfirmware bios->size will be 4
(we have only shadowed the first word to read the id, 0xaa55) and then
the checksum and others ID searches will fail. So I think the checksum
should not be ignored.

I've tried to restore behavior before commit:

7af4dec drm/nouveau/bios: use size/type from pci data structure

and commit:

ad4a362 drm/nouveau/bios: split out shadow methods

Originally, openfirmware content was copied directly into bios->data:

77145f1 drm/nouveau: port remainder of drm code, and rip out compat layer

> This resolved my issues on a PPC G5 + NV34. I think mine ran into a
> few additional problems that you didn't see -- no PCIR header and
> invalid checksum.

I have no PCIR header too.

Could you send me the content of the file "NVDA,BMP" you can find
somewhere under /proc/device-tree/ ?

Could you try my patch on your system, please ?

Laurent