mb/lenovo/sklkbl_thinkpad/cfr.c: Fix X280 build error

As there is no model of the X280 with a dGPU, its devicetree does not
declare a device with a dgpu alias like the other Skylake/Kaby Lake
Thinkpad ports. This breaks the DEV_PTR(dgpu) reference in cfr.c,
causing the following build error if CONFIG_DRIVERS_OPTION_CFR is set:

In file included from src/mainboard/lenovo/sklkbl_thinkpad/cfr.c:9:
src/mainboard/lenovo/sklkbl_thinkpad/cfr.c: In function 'update_dgpu':
build/static.h:11:33: error: '_dev_dgpu_ptr' undeclared (first use in this function); did you mean '_dev_igpu_ptr'?
   11 | #define DEV_PTR(_alias)         _dev_##_alias##_ptr
      |                                 ^~~~~
src/mainboard/lenovo/sklkbl_thinkpad/cfr.c:14:31: note: in expansion of macro 'DEV_PTR'
   14 |         struct device *dgpu = DEV_PTR(dgpu);
      |                               ^~~~~~~
build/static.h:11:33: note: each undeclared identifier is reported only once for each function it appears in
   11 | #define DEV_PTR(_alias)         _dev_##_alias##_ptr
      |                                 ^~~~~
src/mainboard/lenovo/sklkbl_thinkpad/cfr.c:14:31: note: in expansion of macro 'DEV_PTR'
   14 |         struct device *dgpu = DEV_PTR(dgpu);
      |                               ^~~~~~~
make: *** [Makefile:431: build/ramstage/mainboard/lenovo/sklkbl_thinkpad/cfr.o] Error 1

Fix this by declaring a WEAK_DEV_PTR for the dgpu device, which will be
overridden by the compiled devicetree if the board variant declares a
dgpu device in its overridetree.

TEST=X280 builds successfully with the following defconfig:

CONFIG_VENDOR_LENOVO=y
CONFIG_BOARD_LENOVO_X280=y
CONFIG_DRIVERS_OPTION_CFR=y

Change-Id: I18cc18a88851bb943de8ab6d2d1fdcbf0f4aea86
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90674
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
This commit is contained in:
Nicholas Chin 2026-01-02 07:23:08 -07:00 committed by Matt DeVillier
commit ae7b75fb0d

View file

@ -8,6 +8,8 @@
#include <soc/cfr.h>
#include <static.h>
WEAK_DEV_PTR(dgpu);
/* Hide the dGPU CFR entry if dGPU not present */
static void update_dgpu(struct sm_object *new)
{