On 26/08/31 07:30AM, Saif Abrar wrote: > From: Saif Abrar <[email protected]> > > <...snip...> > --- a/hw/pci-host/pnv_phb4.c > +++ b/hw/pci-host/pnv_phb4.c > @@ -508,6 +508,34 @@ uint32_t get_exp_offset(PCIDevice *pdev) > return rpc->exp_offset; > } > > +/* > + * Config-read the link-status register in the PCI-E macro, > + * convert to LE and check the link-active bit. > + */ > +static uint32_t is_link_active(PnvPHB4 *phb) > +{ > + PCIHostState *pci = PCI_HOST_BRIDGE(phb->phb_base); > + PCIDevice *pdev = pci_find_device(pci->bus, 0, 0); > + uint32_t exp_offset = get_exp_offset(pdev); > + > + return (be16_to_cpu(pnv_phb4_rc_config_read(phb, > + exp_offset + PCI_EXP_LNKSTA, 4)) & > + PCI_EXP_LNKSTA_DLLLA); > +} > + > +/* > + * Apply sticky-mask 's' to the reset-value 'v' and write to the address 'a'. > + * RC-config space values and masks are LE. > + * Method pnv_phb4_rc_config_read() returns BE, hence convert to LE. > + * Compute new value in LE domain. > + * New value computation using sticky-mask is in LE. > + * Convert the computed value from LE to BE before writing back. > + */ > +#define RC_CONFIG_STICKY_RESET(a, v, s) \ > + (pci_set_word(conf + (a), be16_to_cpu( \ > + (be16_to_cpu(pci_get_word(conf + (a))) & (s)) | \ > + ((v) & ~(s)))))
this is already defined in a previous patch in pnv_phb4.h may have somehow gotten added in v6, can remove this - Aditya G
