]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
p2sb: Introduce the global flag p2sb_hidden_by_bios
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Thu, 28 Nov 2024 00:28:34 +0000 (09:28 +0900)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 10 Dec 2024 14:24:48 +0000 (16:24 +0200)
To prepare for the following fix, introduce the global flag
p2sb_hidden_by_bios. Check if the BIOS hides the P2SB device and store
the result in the flag. This allows to refer to the check result across
functions.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20241128002836.373745-3-shinichiro.kawasaki@wdc.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/p2sb.c

index a685781d1272c0befb41a2d396ba7bd675f00435..630068e01f7e08282434e57f20eab9bb29ea081d 100644 (file)
@@ -43,6 +43,7 @@ struct p2sb_res_cache {
 };
 
 static struct p2sb_res_cache p2sb_resources[NR_P2SB_RES_CACHE];
+static bool p2sb_hidden_by_bios;
 
 static void p2sb_get_devfn(unsigned int *devfn)
 {
@@ -158,13 +159,14 @@ static int p2sb_cache_resources(void)
         * Unhide the P2SB device here, if needed.
         */
        pci_bus_read_config_dword(bus, devfn_p2sb, P2SBC, &value);
-       if (value & P2SBC_HIDE)
+       p2sb_hidden_by_bios = value & P2SBC_HIDE;
+       if (p2sb_hidden_by_bios)
                pci_bus_write_config_dword(bus, devfn_p2sb, P2SBC, 0);
 
        ret = p2sb_scan_and_cache(bus, devfn_p2sb);
 
        /* Hide the P2SB device, if it was hidden */
-       if (value & P2SBC_HIDE)
+       if (p2sb_hidden_by_bios)
                pci_bus_write_config_dword(bus, devfn_p2sb, P2SBC, P2SBC_HIDE);
 
        pci_unlock_rescan_remove();