Message ID | 20210603035317.6814-6-thorpej@me.com |
---|---|
State | New |
Headers | show |
Series | PALcode fixes required to run NetBSD/alpha. | expand |
Hi Jason, On 6/3/21 5:53 AM, Jason Thorpe wrote: > Only program a BAR as a 64-bit MEM BAR if it really is a 64-bit MEM BAR. > Fixes an issue with the CMD646 IDE controller under NetBSD. OK for this fix, > > Improve some debug/info messages. but I'm not sure why you changed the format. Better split in 2 patches. > > Signed-off-by: Jason Thorpe <thorpej@me.com> > --- > pci.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/pci.c b/pci.c > index ba05adb..5e9c906 100644 > --- a/pci.c > +++ b/pci.c > @@ -84,7 +84,7 @@ pci_setup_device(int bdf, uint32_t *p_io_base, uint32_t *p_mem_base) > device_id = pci_config_readw(bdf, PCI_DEVICE_ID); > class_id = pci_config_readw(bdf, PCI_CLASS_DEVICE); > > - printf("PCI: %02x:%02x:%x class %04x id %04x:%04x\r\n", > + printf("PCI: %d:%d:%d class %04x id %04x:%04x\r\n", > PCI_BUS(bdf), PCI_SLOT(bdf), PCI_FUNC(bdf), > class_id, vendor_id, device_id); > > @@ -118,9 +118,10 @@ pci_setup_device(int bdf, uint32_t *p_io_base, uint32_t *p_mem_base) > *p_base = addr + size; > pci_config_writel(bdf, ofs, addr); > > - printf("PCI: region %d: %08x\r\n", region, addr); > + printf("PCI: region %d (BAR %02x): %08x\r\n", region, ofs, addr); > > - if ((val & PCI_BASE_ADDRESS_MEM_TYPE_MASK) > + if ((old & PCI_BASE_ADDRESS_SPACE_IO) == 0 && > + (old & PCI_BASE_ADDRESS_MEM_TYPE_MASK) > == PCI_BASE_ADDRESS_MEM_TYPE_64) > { > pci_config_writel(bdf, ofs + 4, 0); >
> On Jun 3, 2021, at 2:24 AM, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote: > > Hi Jason, > > On 6/3/21 5:53 AM, Jason Thorpe wrote: >> Only program a BAR as a 64-bit MEM BAR if it really is a 64-bit MEM BAR. >> Fixes an issue with the CMD646 IDE controller under NetBSD. > > OK for this fix, > >> >> Improve some debug/info messages. > > but I'm not sure why you changed the format. > Better split in 2 patches. I'm not particularly wedded to the printf format changes. I tweaked them when I was debugging the problem. I'll update the patch with the printf format changes elided. -- thorpej
On 6/2/21 8:53 PM, Jason Thorpe wrote: > - if ((val & PCI_BASE_ADDRESS_MEM_TYPE_MASK) > + if ((old & PCI_BASE_ADDRESS_SPACE_IO) == 0 && The correct test is (old & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_MEMORY Bitwise it's the same thing. I'll fix it up while applying. r~
diff --git a/pci.c b/pci.c index ba05adb..5e9c906 100644 --- a/pci.c +++ b/pci.c @@ -84,7 +84,7 @@ pci_setup_device(int bdf, uint32_t *p_io_base, uint32_t *p_mem_base) device_id = pci_config_readw(bdf, PCI_DEVICE_ID); class_id = pci_config_readw(bdf, PCI_CLASS_DEVICE); - printf("PCI: %02x:%02x:%x class %04x id %04x:%04x\r\n", + printf("PCI: %d:%d:%d class %04x id %04x:%04x\r\n", PCI_BUS(bdf), PCI_SLOT(bdf), PCI_FUNC(bdf), class_id, vendor_id, device_id); @@ -118,9 +118,10 @@ pci_setup_device(int bdf, uint32_t *p_io_base, uint32_t *p_mem_base) *p_base = addr + size; pci_config_writel(bdf, ofs, addr); - printf("PCI: region %d: %08x\r\n", region, addr); + printf("PCI: region %d (BAR %02x): %08x\r\n", region, ofs, addr); - if ((val & PCI_BASE_ADDRESS_MEM_TYPE_MASK) + if ((old & PCI_BASE_ADDRESS_SPACE_IO) == 0 && + (old & PCI_BASE_ADDRESS_MEM_TYPE_MASK) == PCI_BASE_ADDRESS_MEM_TYPE_64) { pci_config_writel(bdf, ofs + 4, 0);
Only program a BAR as a 64-bit MEM BAR if it really is a 64-bit MEM BAR. Fixes an issue with the CMD646 IDE controller under NetBSD. Improve some debug/info messages. Signed-off-by: Jason Thorpe <thorpej@me.com> --- pci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)