soc/intel/common/p2sb: Add helper function to determine p2sb state
Change-Id: I1d6f9c18160806e289e98c2fa5d290c61434112f Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/47530 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Christian Walter <christian.walter@9elements.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
7ba970aa78
commit
a8798a3179
|
@ -15,6 +15,18 @@
|
||||||
|
|
||||||
#define HIDE_BIT (1 << 0)
|
#define HIDE_BIT (1 << 0)
|
||||||
|
|
||||||
|
static bool p2sb_is_hidden(void)
|
||||||
|
{
|
||||||
|
const uint16_t pci_vid = pci_read_config16(PCH_DEV_P2SB, PCI_VENDOR_ID);
|
||||||
|
|
||||||
|
if (pci_vid == 0xffff)
|
||||||
|
return true;
|
||||||
|
if (pci_vid == PCI_VENDOR_ID_INTEL)
|
||||||
|
return false;
|
||||||
|
printk(BIOS_ERR, "P2SB PCI_VENDOR_ID is invalid, unknown if hidden\n");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void p2sb_enable_bar(void)
|
void p2sb_enable_bar(void)
|
||||||
{
|
{
|
||||||
/* Enable PCR Base address in PCH */
|
/* Enable PCR Base address in PCH */
|
||||||
|
@ -59,8 +71,7 @@ void p2sb_unhide(void)
|
||||||
{
|
{
|
||||||
p2sb_set_hide_bit(0);
|
p2sb_set_hide_bit(0);
|
||||||
|
|
||||||
if (pci_read_config16(PCH_DEV_P2SB, PCI_VENDOR_ID) !=
|
if (p2sb_is_hidden())
|
||||||
PCI_VENDOR_ID_INTEL)
|
|
||||||
die_with_post_code(POST_HW_INIT_FAILURE,
|
die_with_post_code(POST_HW_INIT_FAILURE,
|
||||||
"Unable to unhide PCH_DEV_P2SB device !\n");
|
"Unable to unhide PCH_DEV_P2SB device !\n");
|
||||||
}
|
}
|
||||||
|
@ -69,8 +80,7 @@ void p2sb_hide(void)
|
||||||
{
|
{
|
||||||
p2sb_set_hide_bit(1);
|
p2sb_set_hide_bit(1);
|
||||||
|
|
||||||
if (pci_read_config16(PCH_DEV_P2SB, PCI_VENDOR_ID) !=
|
if (!p2sb_is_hidden())
|
||||||
0xFFFF)
|
|
||||||
die_with_post_code(POST_HW_INIT_FAILURE,
|
die_with_post_code(POST_HW_INIT_FAILURE,
|
||||||
"Unable to hide PCH_DEV_P2SB device !\n");
|
"Unable to hide PCH_DEV_P2SB device !\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue