Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [v2,4/5] MIPS: Malta PCI changes for PCI 2.1 compatibility and conflicts.
@ 2012-04-06 20:07 Steven J. Hill
  2012-05-24 11:25 ` Ralf Baechle
  0 siblings, 1 reply; 3+ messages in thread
From: Steven J. Hill @ 2012-04-06 20:07 UTC (permalink / raw)
  To: linux-mips, ralf; +Cc: Steven J. Hill

From: "Steven J. Hill" <sjhill@mips.com>

Turns on PCI 2.1 compatibility for the Malta platform for the
PIIX4 controller. Change start address to avoid conflicts with
the ACPI and SMB devices.

Signed-off-by: Steven J. Hill <sjhill@mips.com>
---
 arch/mips/mti-malta/malta-pci.c   |    5 +++--
 arch/mips/mti-malta/malta-setup.c |   14 ++++++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/arch/mips/mti-malta/malta-pci.c b/arch/mips/mti-malta/malta-pci.c
index bf80921..afeb619 100644
--- a/arch/mips/mti-malta/malta-pci.c
+++ b/arch/mips/mti-malta/malta-pci.c
@@ -241,8 +241,9 @@ void __init mips_pcibios_init(void)
 		return;
 	}
 
-	if (controller->io_resource->start < 0x00001000UL)	/* FIXME */
-		controller->io_resource->start = 0x00001000UL;
+	/* Change start address to avoid conflicts with ACPI and SMB devices */
+	if (controller->io_resource->start < 0x00002000UL)	/* FIXME */
+		controller->io_resource->start = 0x00002000UL;
 
 	iomem_resource.end &= 0xfffffffffULL;			/* 64 GB */
 	ioport_resource.end = controller->io_resource->end;
diff --git a/arch/mips/mti-malta/malta-setup.c b/arch/mips/mti-malta/malta-setup.c
index b7f37d4..b45b343 100644
--- a/arch/mips/mti-malta/malta-setup.c
+++ b/arch/mips/mti-malta/malta-setup.c
@@ -222,3 +222,17 @@ void __init plat_mem_setup(void)
 	board_be_init = malta_be_init;
 	board_be_handler = malta_be_handler;
 }
+
+/* Enable PCI 2.1 compatibility in PIIX4. */
+static void __init quirk_dlcsetup(struct pci_dev *dev)
+{
+	u8 dlc;
+
+	/* Enable passive releases and delayed transactions. */
+	(void) pci_read_config_byte(dev, 0x82, &dlc);
+	dlc |= 7;
+	(void) pci_write_config_byte(dev, 0x82, dlc);
+}
+
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0,
+			quirk_dlcsetup);
-- 
1.7.9.6

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [v2,4/5] MIPS: Malta PCI changes for PCI 2.1 compatibility and conflicts.
  2012-04-06 20:07 [v2,4/5] MIPS: Malta PCI changes for PCI 2.1 compatibility and conflicts Steven J. Hill
@ 2012-05-24 11:25 ` Ralf Baechle
  2012-05-24 12:56   ` Maciej W. Rozycki
  0 siblings, 1 reply; 3+ messages in thread
From: Ralf Baechle @ 2012-05-24 11:25 UTC (permalink / raw)
  To: Steven J. Hill, Maciej W. Rozycki; +Cc: linux-mips

On Fri, Apr 06, 2012 at 03:07:49PM -0500, Steven J. Hill wrote:

> diff --git a/arch/mips/mti-malta/malta-pci.c b/arch/mips/mti-malta/malta-pci.c
> index bf80921..afeb619 100644
> --- a/arch/mips/mti-malta/malta-pci.c
> +++ b/arch/mips/mti-malta/malta-pci.c
> @@ -241,8 +241,9 @@ void __init mips_pcibios_init(void)
>  		return;
>  	}
>  
> -	if (controller->io_resource->start < 0x00001000UL)	/* FIXME */
> -		controller->io_resource->start = 0x00001000UL;
> +	/* Change start address to avoid conflicts with ACPI and SMB devices */
> +	if (controller->io_resource->start < 0x00002000UL)	/* FIXME */
> +		controller->io_resource->start = 0x00002000UL;

I think raising this value to 0x2000 solves the FIXME which is there since
Maciej's 66d9ad704b25287bfee7e86a5af50b92642b9c72 commit in 2005.  Maciej,
do you recall you added the FIXME?

>  	iomem_resource.end &= 0xfffffffffULL;			/* 64 GB */
>  	ioport_resource.end = controller->io_resource->end;
> diff --git a/arch/mips/mti-malta/malta-setup.c b/arch/mips/mti-malta/malta-setup.c
> index b7f37d4..b45b343 100644
> --- a/arch/mips/mti-malta/malta-setup.c
> +++ b/arch/mips/mti-malta/malta-setup.c
> @@ -222,3 +222,17 @@ void __init plat_mem_setup(void)
>  	board_be_init = malta_be_init;
>  	board_be_handler = malta_be_handler;
>  }
> +
> +/* Enable PCI 2.1 compatibility in PIIX4. */
> +static void __init quirk_dlcsetup(struct pci_dev *dev)
> +{
> +	u8 dlc;
> +
> +	/* Enable passive releases and delayed transactions. */
> +	(void) pci_read_config_byte(dev, 0x82, &dlc);
> +	dlc |= 7;
> +	(void) pci_write_config_byte(dev, 0x82, dlc);
> +}
> +
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0,
> +			quirk_dlcsetup);

See 9ead526ca4e6f3d9c7e6b79bb3fda113bd3b0eeb.  It would appear that your
patch turned stale about two and a half years before it was posted ;-)

  Ralf

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [v2,4/5] MIPS: Malta PCI changes for PCI 2.1 compatibility and conflicts.
  2012-05-24 11:25 ` Ralf Baechle
@ 2012-05-24 12:56   ` Maciej W. Rozycki
  0 siblings, 0 replies; 3+ messages in thread
From: Maciej W. Rozycki @ 2012-05-24 12:56 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Steven J. Hill, linux-mips

On Thu, 24 May 2012, Ralf Baechle wrote:

> > diff --git a/arch/mips/mti-malta/malta-pci.c b/arch/mips/mti-malta/malta-pci.c
> > index bf80921..afeb619 100644
> > --- a/arch/mips/mti-malta/malta-pci.c
> > +++ b/arch/mips/mti-malta/malta-pci.c
> > @@ -241,8 +241,9 @@ void __init mips_pcibios_init(void)
> >  		return;
> >  	}
> >  
> > -	if (controller->io_resource->start < 0x00001000UL)	/* FIXME */
> > -		controller->io_resource->start = 0x00001000UL;
> > +	/* Change start address to avoid conflicts with ACPI and SMB devices */
> > +	if (controller->io_resource->start < 0x00002000UL)	/* FIXME */
> > +		controller->io_resource->start = 0x00002000UL;
> 
> I think raising this value to 0x2000 solves the FIXME which is there since
> Maciej's 66d9ad704b25287bfee7e86a5af50b92642b9c72 commit in 2005.  Maciej,
> do you recall you added the FIXME?

 Vaguely.  I reckon the bump was required because PIIX4 ACPI/SMB didn't 
reserve their resources that are not properly set/announced with standard 
PCI BARs in the PCI configuration space.  Chances therefore were something 
else would take this range and I reckon this was of course exactly what 
happened, ruining everything in a weird way.

 And I think it was the other way round -- I think bumping it up yet more 
is the wrong way of "fixing this up" (why is it needed anyway, did the 
assignment change? -- I don't remember if power-on defaults are used on 
Malta or if that is YAMON that initialises these).  I am fairly sure if I 
added that FIXME it was meant as a reminder to fix that properly and not 
do something as trivial as this.  And a proper fix is IMO either of these:

1. If there is a proper PIIX4 ACPI/SMB driver available then it should 
   reserve these resources to avoid the conflict.

2. Otherwise a PCI quirk should do that based on the PCI ID of the device 
   and the resource ranges obtained directly from the device (I reckon 
   they still use BARs, but in the vendor-specific space, they're not 
   fixed assignments), pretty much like some PC/AT legacy resources are 
   reserved (82xx series PIC, PIT, etc).

I don't remember why I didn't do either of these, sorry.

  Maciej

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-24 12:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-06 20:07 [v2,4/5] MIPS: Malta PCI changes for PCI 2.1 compatibility and conflicts Steven J. Hill
2012-05-24 11:25 ` Ralf Baechle
2012-05-24 12:56   ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox