Skip to content

Commit ae3e6eb

Browse files
kawasakiij-intel
authored andcommitted
p2sb: Introduce the global flag p2sb_hidden_by_bios
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 <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent 9244524 commit ae3e6eb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/platform/x86/p2sb.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ struct p2sb_res_cache {
4343
};
4444

4545
static struct p2sb_res_cache p2sb_resources[NR_P2SB_RES_CACHE];
46+
static bool p2sb_hidden_by_bios;
4647

4748
static void p2sb_get_devfn(unsigned int *devfn)
4849
{
@@ -158,13 +159,14 @@ static int p2sb_cache_resources(void)
158159
* Unhide the P2SB device here, if needed.
159160
*/
160161
pci_bus_read_config_dword(bus, devfn_p2sb, P2SBC, &value);
161-
if (value & P2SBC_HIDE)
162+
p2sb_hidden_by_bios = value & P2SBC_HIDE;
163+
if (p2sb_hidden_by_bios)
162164
pci_bus_write_config_dword(bus, devfn_p2sb, P2SBC, 0);
163165

164166
ret = p2sb_scan_and_cache(bus, devfn_p2sb);
165167

166168
/* Hide the P2SB device, if it was hidden */
167-
if (value & P2SBC_HIDE)
169+
if (p2sb_hidden_by_bios)
168170
pci_bus_write_config_dword(bus, devfn_p2sb, P2SBC, P2SBC_HIDE);
169171

170172
pci_unlock_rescan_remove();

0 commit comments

Comments
 (0)