andreiw / RaspberryPiPkg

DEPRECATED - DO NOT USE | Go here instead ->
https://github.com/tianocore/edk2-platforms/tree/master/Platform/RaspberryPi/RPi3
746 stars 143 forks source link

Replace MsftFunctionConfig with standard PinFunction #134

Closed driver1998 closed 4 years ago

driver1998 commented 4 years ago

Tested with I2C on Windows 10 v1903 (Build 18362), should work fine with SPI too.

Related: https://github.com/andreiw/RaspberryPiPkg/issues/132

pbatard commented 4 years ago

I have been testing this PR with the aim of submitting it to edk2-platforms, but the problem I'm seeing is that most Linux people will be using the iasl that comes with their platform (for instance, on the latest Debian that would be the one that is provided by the acpica-tools package) and therefore are still likely to get a version of iasl that doesn't have support for PinFunction() yet.

If you try to compile the patched DSDT.asl on such a platform, you end up with:

Intel ACPI Component Architecture
ASL+ Optimizing Compiler version 20160831-64
Copyright (c) 2000 - 2016 Intel Corporation
/usr/src/Build/RPi3/RELEASE_GCC5/AARCH64/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables/OUTPUT/./Dsdt.iiii    476:           PinFunction(Exclusive, PullUp, 0x4, "\\_SB.GPI0", 0, ResourceConsumer, , ) {2, 3}
Error    6126 -                                                                        syntax error, unexpected PARSEOP_NAMESEG ^

ASL Input:     /usr/src/Build/RPi3/RELEASE_GCC5/AARCH64/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables/OUTPUT/./Dsdt.iiii - 529 lines, 20502 bytes, 160 keywords

/usr/src/Build/RPi3/RELEASE_GCC5/AARCH64/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables/OUTPUT/./Dsdt.iiii    521:           PinFunction(Exclusive, PullDown, 0x4, "\\_SB.GPI0", 0, ResourceConsumer, , ) {9, 10, 11}
Error    6126 -                                                                        syntax error, unexpected PARSEOP_NAMESEG ^
Compilation complete. 3 Errors, 0 Warnings, 0 Remarks, 0 Optimizations
GNUmakefile:309: recipe for target '/usr/src/Build/RPi3/RELEASE_GCC5/AARCH64/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables/OUTPUT/Dsdt.aml' failed

/usr/src/Build/RPi3/RELEASE_GCC5/AARCH64/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables/OUTPUT/./Dsdt.iiii    529:
Error    6126 - syntax error, unexpected PARSEOP_DEVICE, expecting $end and premature End-Of-File

make: *** [/usr/src/Build/RPi3/RELEASE_GCC5/AARCH64/Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables/OUTPUT/Dsdt.aml] Error 255

I guess I'll let Andrei decide whether he wants to require people who compile this repo to manually update their iasl, in case their default package is not recent enough, or if we should just sit on this request until distros like Debian upgrade acpica-tools so that PinFunction() becomes supported.

At any rate, I will not be submitting this patch for integration into edk2-platforms at this stage.

andreiw commented 4 years ago

How much work would it be to leave the old and the new in place and use a C preprocesssor macro to disambiguate (ie running the preprocessor before iasl)

driver1998 commented 4 years ago

Since the EDK2 build process send the ASL file to C preprocessor first, then iasl, we should be able to use #ifdef there...

driver1998 commented 4 years ago

Now you can specify -DACPI_PINFUNCTION=1 in the build commandline to use PinFunction, by default it still uses MsftFunctionConfig.

build5 and build49 are also updated to contain this, along with some comments.