Re: [PATCH v10 06/59] PCI: Kill wrong quirk about M7101

2016-04-25 Thread Bjorn Helgaas
Hi Yinghai & Meelis,

On Sat, Mar 12, 2016 at 10:39:15AM +0200, Meelis Roos wrote:
> > On Fri, Mar 11, 2016 at 11:52 PM, Meelis Roos  wrote:
> > >> On Thu, Mar 10, 2016 at 9:40 AM, Bjorn Helgaas  
> > >> wrote:
> > >> > On Wed, Feb 24, 2016 at 06:11:57PM -0800, Yinghai Lu wrote:
> > >> >> Meelis reported that qla2000 driver does not get loaded on one sparc 
> > >> >> system.
> > >> >>
> > >> >> schizo f00732d0: PCI host bridge to bus 0001:00
> > >> >> pci_bus 0001:00: root bus resource [io  0x7fe0100-0x7fe01ff] 
> > >> >> (bus address [0x-0xff])
> > >> >> pci 0001:00:06.0: quirk: [io  0x7fe01000800-0x7fe0100083f] claimed by 
> > >> >> ali7101 ACPI
> > >> >> pci 0001:00:06.0: quirk: [io  0x7fe01000600-0x7fe0100061f] claimed by 
> > >> >> ali7101 SMB
> > >> >> pci 0001:00:07.0: can't claim BAR 0 [io  
> > >> >> 0x7fe0100-0x7fe0100]: address conflict with 0001:00:06.0 [io  
> > >> >> 0x7fe01000600-0x7fe0100061f]
> > >> >>
> > >> >> So the quirk for M7101 claim the io range early.
> > >
> > > But why did it work until 4.2 and only with 4.3 the allocations broke?
> > >
> > 
> > My understanding is we really install the root bus resource and try to
> > do the sanitary checking
> > for device resource.
> > 
> > Or did you find exact commit between 4.2 and 4.3 cause the problem ?
> 
> No, I have not bisected that.

I'm confused again.

I opened https://bugzilla.kernel.org/show_bug.cgi?id=117191 and
attached dmesg logs and lspci output from Meelis' original bug report,
since you included URLs in the changelog (thank you for that), and I
don't want Meelis to have to worry about keeping the URLs alive.

I extracted the following from the v210 dmesg and lspci attached there
(I used these because they're the only matching pair of dmesg & lspci
I saw):

  PCI: Scanning PBM /pci@1e,60
  schizo f00732d0: PCI host bridge to bus 0001:00
  pci_bus 0001:00: root bus resource [io  0x7fe0100-0x7fe01ff] (bus 
address [0x-0xff])
  pci_bus 0001:00: root bus resource [mem 0x7ff-0x7ff] (bus 
address [0x-0x])
  pci_bus 0001:00: root bus resource [bus 00]
  pci 0001:00:06.0: quirk: [io  0x7fe01000800-0x7fe0100083f] claimed by ali7101 
ACPI
  pci 0001:00:06.0: quirk: [io  0x7fe01000600-0x7fe0100061f] claimed by ali7101 
SMB
  pci 0001:00:07.0: can't claim BAR 0 [io  0x7fe0100-0x7fe0100]: 
address conflict with 0001:00:06.0 [io  0x7fe01000600-0x7fe0100061f]
  pci 0001:00:07.0: can't claim BAR 1 [mem 0x7ff-0x7ff000f]: 
address conflict with Video RAM area [??? 0x7ff000a-0x7ff000b flags 
0x8000]
  pci 0001:00:07.0: can't claim BAR 2 [mem 0x7ff-0x7ff000f]: 
address conflict with Video RAM area [??? 0x7ff000a-0x7ff000b flags 
0x8000]

  0001:00:06.0 Non-VGA unclassified device: ULi Electronics Inc. M7101 Power 
Management Controller [PMU]
  Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- 
Stepping- SERR- FastB2B- DisINTx-
  Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- 
SERR-  [size=16]
  00: b9 10 01 71 00 00 00 02 00 00 00 00 00 00 00 00
  10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

  0001:00:07.0 ISA bridge: ULi Electronics Inc. M1533/M1535/M1543 PCI to ISA 
Bridge [Aladdin IV/V/V+]
  Control: I/O+ Mem+ BusMaster+ SpecCycle+ MemWINV- VGASnoop- ParErr- 
Stepping- SERR- FastB2B- DisINTx-
  Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- 
SERR- 

[PATCH v11 08/60] PCI: Kill wrong quirk about M7101

2016-04-07 Thread Yinghai Lu
Meelis reported that qla2000 driver does not get loaded on one sparc system.

schizo f00732d0: PCI host bridge to bus 0001:00
pci_bus 0001:00: root bus resource [io  0x7fe0100-0x7fe01ff] (bus 
address [0x-0xff])
pci 0001:00:06.0: quirk: [io  0x7fe01000800-0x7fe0100083f] claimed by ali7101 
ACPI
pci 0001:00:06.0: quirk: [io  0x7fe01000600-0x7fe0100061f] claimed by ali7101 
SMB
pci 0001:00:07.0: can't claim BAR 0 [io  0x7fe0100-0x7fe0100]: address 
conflict with 0001:00:06.0 [io  0x7fe01000600-0x7fe0100061f]

So the quirk for M7101 claim the io range early.

According to spec with M7101 in M1543 page 103/104,
http://www.versalogic.com/Support/Downloads/pdf/ali1543.pdf
0xe0, and 0xe2 do not include address info for acpi/smb.

We can not find how the code got there. But per Linus
we should remove that quirk according to the datasheet.

Kill wrong quirk about them.

Link: http://kodu.ut.ee/~mroos/dm/dm.v240
Link: http://kodu.ut.ee/~mroos/dm/dm.sb100
Reported-by: Meelis Roos 
Cc: Meelis Roos 
Signed-off-by: Yinghai Lu 
Tested-by: Khalid Aziz 
Cc: Linus Torvalds 
---
 drivers/pci/quirks.c | 18 --
 1 file changed, 18 deletions(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 8e67802..21d545d 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -445,24 +445,6 @@ static void quirk_amd_nl_class(struct pci_dev *pdev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB,
quirk_amd_nl_class);
 
-/*
- * Let's make the southbridge information explicit instead
- * of having to worry about people probing the ACPI areas,
- * for example.. (Yes, it happens, and if you read the wrong
- * ACPI register it will put the machine to sleep with no
- * way of waking it up again. Bummer).
- *
- * ALI M7101: Two IO regions pointed to by words at
- * 0xE0 (64 bytes of ACPI registers)
- * 0xE2 (32 bytes of SMB registers)
- */
-static void quirk_ali7101_acpi(struct pci_dev *dev)
-{
-   quirk_io_region(dev, 0xE0, 64, PCI_BRIDGE_RESOURCES, "ali7101 ACPI");
-   quirk_io_region(dev, 0xE2, 32, PCI_BRIDGE_RESOURCES+1, "ali7101 SMB");
-}
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, 
quirk_ali7101_acpi);
-
 static void piix4_io_quirk(struct pci_dev *dev, const char *name, unsigned int 
port, unsigned int enable)
 {
u32 devres;
-- 
1.8.4.5



Re: [PATCH v10 06/59] PCI: Kill wrong quirk about M7101

2016-03-12 Thread Meelis Roos
> On Fri, Mar 11, 2016 at 11:52 PM, Meelis Roos  wrote:
> >> On Thu, Mar 10, 2016 at 9:40 AM, Bjorn Helgaas  wrote:
> >> > On Wed, Feb 24, 2016 at 06:11:57PM -0800, Yinghai Lu wrote:
> >> >> Meelis reported that qla2000 driver does not get loaded on one sparc 
> >> >> system.
> >> >>
> >> >> schizo f00732d0: PCI host bridge to bus 0001:00
> >> >> pci_bus 0001:00: root bus resource [io  0x7fe0100-0x7fe01ff] 
> >> >> (bus address [0x-0xff])
> >> >> pci 0001:00:06.0: quirk: [io  0x7fe01000800-0x7fe0100083f] claimed by 
> >> >> ali7101 ACPI
> >> >> pci 0001:00:06.0: quirk: [io  0x7fe01000600-0x7fe0100061f] claimed by 
> >> >> ali7101 SMB
> >> >> pci 0001:00:07.0: can't claim BAR 0 [io  0x7fe0100-0x7fe0100]: 
> >> >> address conflict with 0001:00:06.0 [io  0x7fe01000600-0x7fe0100061f]
> >> >>
> >> >> So the quirk for M7101 claim the io range early.
> >
> > But why did it work until 4.2 and only with 4.3 the allocations broke?
> >
> 
> My understanding is we really install the root bus resource and try to
> do the sanitary checking
> for device resource.
> 
> Or did you find exact commit between 4.2 and 4.3 cause the problem ?

No, I have not bisected that.

-- 
Meelis Roos (mr...@linux.ee)


Re: [PATCH v10 06/59] PCI: Kill wrong quirk about M7101

2016-03-12 Thread Yinghai Lu
On Fri, Mar 11, 2016 at 11:52 PM, Meelis Roos  wrote:
>> On Thu, Mar 10, 2016 at 9:40 AM, Bjorn Helgaas  wrote:
>> > On Wed, Feb 24, 2016 at 06:11:57PM -0800, Yinghai Lu wrote:
>> >> Meelis reported that qla2000 driver does not get loaded on one sparc 
>> >> system.
>> >>
>> >> schizo f00732d0: PCI host bridge to bus 0001:00
>> >> pci_bus 0001:00: root bus resource [io  0x7fe0100-0x7fe01ff] (bus 
>> >> address [0x-0xff])
>> >> pci 0001:00:06.0: quirk: [io  0x7fe01000800-0x7fe0100083f] claimed by 
>> >> ali7101 ACPI
>> >> pci 0001:00:06.0: quirk: [io  0x7fe01000600-0x7fe0100061f] claimed by 
>> >> ali7101 SMB
>> >> pci 0001:00:07.0: can't claim BAR 0 [io  0x7fe0100-0x7fe0100]: 
>> >> address conflict with 0001:00:06.0 [io  0x7fe01000600-0x7fe0100061f]
>> >>
>> >> So the quirk for M7101 claim the io range early.
>
> But why did it work until 4.2 and only with 4.3 the allocations broke?
>

My understanding is we really install the root bus resource and try to
do the sanitary checking
for device resource.

Or did you find exact commit between 4.2 and 4.3 cause the problem ?

Thanks

Yinghai


Re: [PATCH v10 06/59] PCI: Kill wrong quirk about M7101

2016-03-11 Thread Meelis Roos
> On Thu, Mar 10, 2016 at 9:40 AM, Bjorn Helgaas  wrote:
> > On Wed, Feb 24, 2016 at 06:11:57PM -0800, Yinghai Lu wrote:
> >> Meelis reported that qla2000 driver does not get loaded on one sparc 
> >> system.
> >>
> >> schizo f00732d0: PCI host bridge to bus 0001:00
> >> pci_bus 0001:00: root bus resource [io  0x7fe0100-0x7fe01ff] (bus 
> >> address [0x-0xff])
> >> pci 0001:00:06.0: quirk: [io  0x7fe01000800-0x7fe0100083f] claimed by 
> >> ali7101 ACPI
> >> pci 0001:00:06.0: quirk: [io  0x7fe01000600-0x7fe0100061f] claimed by 
> >> ali7101 SMB
> >> pci 0001:00:07.0: can't claim BAR 0 [io  0x7fe0100-0x7fe0100ffff]: 
> >> address conflict with 0001:00:06.0 [io  0x7fe01000600-0x7fe0100061f]
> >>
> >> So the quirk for M7101 claim the io range early.

But why did it work until 4.2 and only with 4.3 the allocations broke?


> >>
> >> According to spec with M7101 in M1543 page 103/104,
> >>   http://www.versalogic.com/Support/Downloads/pdf/ali1543.pdf
> >> 0xe0, and 0xe2 do not include address info for acpi/smb.
> >>
> >> Kill wrong quirk about them.
> >
> > This needs an explanation for why the quirk was added in the first
> > place, and why it is now safe to remove it.
> 
> The related commit does not tell much about why it is there exactly.
> But it is added the same time with intel piix4.
> 
> Maybe Linus could have some hint about that quirk?
> 
> commit 34f550135e349102bd065488ea217ab27f0d
> Author: Linus Torvalds 
> Date:   Fri Nov 23 15:32:20 2007 -0500
> 
> Import 2.3.49pre2
> 
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index cda39a5..8029b19 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -113,6 +113,55 @@ static void __init quirk_s3_64M(struct pci_dev *dev)
> }
>  }
> 
> +static void __init quirk_io_region(struct pci_dev *dev, unsigned region, 
> unsign
> ed size, int nr)
> +{
> +   region &= ~(size-1);
> +   if (region) {
> +   struct resource *res = dev->resource + nr;
> +
> +   res->name = dev->name;
> +   res->start = region;
> +   res->end = region + size - 1;
> +   res->flags = IORESOURCE_IO;
> +   pci_claim_resource(dev, nr);
> +   }
> +}
> +
> +/*
> + * Let's make the southbridge information explicit instead
> + * of having to worry about people probing the ACPI areas,
> + * for example.. (Yes, it happens, and if you read the wrong
> + * ACPI register it will put the machine to sleep with no
> + * way of waking it up again. Bummer).
> + *
> + * ALI M7101: Two IO regions pointed to by words at
> + * 0xE0 (64 bytes of ACPI registers)
> + * 0xE2 (32 bytes of SMB registers)
> + */
> +static void __init quirk_ali7101(struct pci_dev *dev)
> +{
> +   u16 region;
> +
> +   pci_read_config_word(dev, 0xE0, ®ion);
> +   quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES);
> +   pci_read_config_word(dev, 0xE2, ®ion);
> +   quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1);
> +}
> +
> +/*
> + * PIIX4 ACPI: Two IO regions pointed to by longwords at
> + * 0x40 (64 bytes of ACPI registers)
> + * 0x90 (32 bytes of SMB registers)
> + */
> +static void __init quirk_piix4acpi(struct pci_dev *dev)
> +{
> +   u32 region;
> +
> +   pci_read_config_dword(dev, 0x40, ®ion);
> +   quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES);
> +   pci_read_config_dword(dev, 0x90, ®ion);
> +   quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1);
> +}
> 
>  /*
>   *  The main table of quirks.
> @@ -143,6 +192,8 @@ static struct pci_fixup pci_fixups[] __initdata = {
> { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_INTEL,
> PCI_DEVICE_ID_INTEL_82443BX_2,  quirk_natoma },
> { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_SI,
> PCI_DEVICE_ID_SI_5597,  quirk_nopcipci },
> { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_SI,
> PCI_DEVICE_ID_SI_496,   quirk_nopcipci },
> +   { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_INTEL,
> PCI_DEVICE_ID_INTEL_82371AB_3,  quirk_piix4acpi },
> +   { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_AL,
> PCI_DEVICE_ID_AL_M7101, quirk_ali7101 },
> { 0 }
>  };
> 

-- 
Meelis Roos (mr...@linux.ee)


Re: [PATCH v10 06/59] PCI: Kill wrong quirk about M7101

2016-03-11 Thread Linus Torvalds
On Fri, Mar 11, 2016 at 2:08 PM, Yinghai Lu  wrote:
>
> Maybe Linus could have some hint about that quirk?
>
> commit 34f550135e349102bd065488ea217ab27f0d
> Author: Linus Torvalds 
> Date:   Fri Nov 23 15:32:20 2007 -0500
>
> Import 2.3.49pre2

Gah. That's marked as 2007, but that's an import of a much older
change, and 2.3.49 is way back in the last century.

But I looked at the datasheet for the M1543 PMU, and can confirm that
there's nothing at e0/e2 according to that datasheet. The PMU IO bases
show up at 0x10, and the SMB IO base at 0x14 in that doc..

Those kinds of things sometimes change between revisions, and it's
possible that there were versions that had them at that e0/e2 area,
and it got moved to the standard PCI BAR locations later.

I was definitely involved in these things, but my memory just doesn't
go back far enough to haev a clue what is going on. The only one I
remember working on myself was the PIIX4 one.

Removing it based on current datasheets and a failure of a known sparc
setup sounds reasonable.

Linus


Re: [PATCH v10 06/59] PCI: Kill wrong quirk about M7101

2016-03-11 Thread Yinghai Lu
On Thu, Mar 10, 2016 at 9:40 AM, Bjorn Helgaas  wrote:
> On Wed, Feb 24, 2016 at 06:11:57PM -0800, Yinghai Lu wrote:
>> Meelis reported that qla2000 driver does not get loaded on one sparc system.
>>
>> schizo f00732d0: PCI host bridge to bus 0001:00
>> pci_bus 0001:00: root bus resource [io  0x7fe0100-0x7fe01ff] (bus 
>> address [0x-0xff])
>> pci 0001:00:06.0: quirk: [io  0x7fe01000800-0x7fe0100083f] claimed by 
>> ali7101 ACPI
>> pci 0001:00:06.0: quirk: [io  0x7fe01000600-0x7fe0100061f] claimed by 
>> ali7101 SMB
>> pci 0001:00:07.0: can't claim BAR 0 [io  0x7fe0100-0x7fe0100]: 
>> address conflict with 0001:00:06.0 [io  0x7fe01000600-0x7fe0100061f]
>>
>> So the quirk for M7101 claim the io range early.
>>
>> According to spec with M7101 in M1543 page 103/104,
>>   http://www.versalogic.com/Support/Downloads/pdf/ali1543.pdf
>> 0xe0, and 0xe2 do not include address info for acpi/smb.
>>
>> Kill wrong quirk about them.
>
> This needs an explanation for why the quirk was added in the first
> place, and why it is now safe to remove it.

The related commit does not tell much about why it is there exactly.
But it is added the same time with intel piix4.

Maybe Linus could have some hint about that quirk?

commit 34f550135e349102bd065488ea217ab27f0d
Author: Linus Torvalds 
Date:   Fri Nov 23 15:32:20 2007 -0500

Import 2.3.49pre2

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index cda39a5..8029b19 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -113,6 +113,55 @@ static void __init quirk_s3_64M(struct pci_dev *dev)
}
 }

+static void __init quirk_io_region(struct pci_dev *dev, unsigned region, unsign
ed size, int nr)
+{
+   region &= ~(size-1);
+   if (region) {
+   struct resource *res = dev->resource + nr;
+
+   res->name = dev->name;
+   res->start = region;
+   res->end = region + size - 1;
+   res->flags = IORESOURCE_IO;
+   pci_claim_resource(dev, nr);
+   }
+}
+
+/*
+ * Let's make the southbridge information explicit instead
+ * of having to worry about people probing the ACPI areas,
+ * for example.. (Yes, it happens, and if you read the wrong
+ * ACPI register it will put the machine to sleep with no
+ * way of waking it up again. Bummer).
+ *
+ * ALI M7101: Two IO regions pointed to by words at
+ * 0xE0 (64 bytes of ACPI registers)
+ * 0xE2 (32 bytes of SMB registers)
+ */
+static void __init quirk_ali7101(struct pci_dev *dev)
+{
+   u16 region;
+
+   pci_read_config_word(dev, 0xE0, ®ion);
+   quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES);
+   pci_read_config_word(dev, 0xE2, ®ion);
+   quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1);
+}
+
+/*
+ * PIIX4 ACPI: Two IO regions pointed to by longwords at
+ * 0x40 (64 bytes of ACPI registers)
+ * 0x90 (32 bytes of SMB registers)
+ */
+static void __init quirk_piix4acpi(struct pci_dev *dev)
+{
+   u32 region;
+
+   pci_read_config_dword(dev, 0x40, ®ion);
+   quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES);
+   pci_read_config_dword(dev, 0x90, ®ion);
+   quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1);
+}

 /*
  *  The main table of quirks.
@@ -143,6 +192,8 @@ static struct pci_fixup pci_fixups[] __initdata = {
{ PCI_FIXUP_FINAL,  PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_82443BX_2,  quirk_natoma },
{ PCI_FIXUP_FINAL,  PCI_VENDOR_ID_SI,
PCI_DEVICE_ID_SI_5597,  quirk_nopcipci },
{ PCI_FIXUP_FINAL,  PCI_VENDOR_ID_SI,
PCI_DEVICE_ID_SI_496,   quirk_nopcipci },
+   { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_82371AB_3,  quirk_piix4acpi },
+   { PCI_FIXUP_FINAL,  PCI_VENDOR_ID_AL,
PCI_DEVICE_ID_AL_M7101, quirk_ali7101 },
{ 0 }
 };


Re: [PATCH v10 06/59] PCI: Kill wrong quirk about M7101

2016-03-10 Thread Bjorn Helgaas
On Wed, Feb 24, 2016 at 06:11:57PM -0800, Yinghai Lu wrote:
> Meelis reported that qla2000 driver does not get loaded on one sparc system.
> 
> schizo f00732d0: PCI host bridge to bus 0001:00
> pci_bus 0001:00: root bus resource [io  0x7fe0100-0x7fe01ff] (bus 
> address [0x-0xff])
> pci 0001:00:06.0: quirk: [io  0x7fe01000800-0x7fe0100083f] claimed by ali7101 
> ACPI
> pci 0001:00:06.0: quirk: [io  0x7fe01000600-0x7fe0100061f] claimed by ali7101 
> SMB
> pci 0001:00:07.0: can't claim BAR 0 [io  0x7fe0100-0x7fe0100]: 
> address conflict with 0001:00:06.0 [io  0x7fe01000600-0x7fe0100061f]
> 
> So the quirk for M7101 claim the io range early.
> 
> According to spec with M7101 in M1543 page 103/104,
>   http://www.versalogic.com/Support/Downloads/pdf/ali1543.pdf
> 0xe0, and 0xe2 do not include address info for acpi/smb.
> 
> Kill wrong quirk about them.

This needs an explanation for why the quirk was added in the first
place, and why it is now safe to remove it.

> Link: http://kodu.ut.ee/~mroos/dm/dm.v240
> Link: http://kodu.ut.ee/~mroos/dm/dm.sb100
> Reported-by: Meelis Roos 
> Cc: Meelis Roos 
> Signed-off-by: Yinghai Lu 
> Tested-by: Khalid Aziz 
> ---
>  drivers/pci/quirks.c | 18 --
>  1 file changed, 18 deletions(-)
> 
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index 0575a1e..051999e 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -445,24 +445,6 @@ static void quirk_amd_nl_class(struct pci_dev *pdev)
>  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB,
>   quirk_amd_nl_class);
>  
> -/*
> - * Let's make the southbridge information explicit instead
> - * of having to worry about people probing the ACPI areas,
> - * for example.. (Yes, it happens, and if you read the wrong
> - * ACPI register it will put the machine to sleep with no
> - * way of waking it up again. Bummer).
> - *
> - * ALI M7101: Two IO regions pointed to by words at
> - *   0xE0 (64 bytes of ACPI registers)
> - *   0xE2 (32 bytes of SMB registers)
> - */
> -static void quirk_ali7101_acpi(struct pci_dev *dev)
> -{
> - quirk_io_region(dev, 0xE0, 64, PCI_BRIDGE_RESOURCES, "ali7101 ACPI");
> - quirk_io_region(dev, 0xE2, 32, PCI_BRIDGE_RESOURCES+1, "ali7101 SMB");
> -}
> -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL,   PCI_DEVICE_ID_AL_M7101, 
> quirk_ali7101_acpi);
> -
>  static void piix4_io_quirk(struct pci_dev *dev, const char *name, unsigned 
> int port, unsigned int enable)
>  {
>   u32 devres;
> -- 
> 1.8.4.5
> 


[PATCH v10 06/59] PCI: Kill wrong quirk about M7101

2016-02-24 Thread Yinghai Lu
Meelis reported that qla2000 driver does not get loaded on one sparc system.

schizo f00732d0: PCI host bridge to bus 0001:00
pci_bus 0001:00: root bus resource [io  0x7fe0100-0x7fe01ff] (bus 
address [0x-0xff])
pci 0001:00:06.0: quirk: [io  0x7fe01000800-0x7fe0100083f] claimed by ali7101 
ACPI
pci 0001:00:06.0: quirk: [io  0x7fe01000600-0x7fe0100061f] claimed by ali7101 
SMB
pci 0001:00:07.0: can't claim BAR 0 [io  0x7fe0100-0x7fe0100]: address 
conflict with 0001:00:06.0 [io  0x7fe01000600-0x7fe0100061f]

So the quirk for M7101 claim the io range early.

According to spec with M7101 in M1543 page 103/104,
http://www.versalogic.com/Support/Downloads/pdf/ali1543.pdf
0xe0, and 0xe2 do not include address info for acpi/smb.

Kill wrong quirk about them.

Link: http://kodu.ut.ee/~mroos/dm/dm.v240
Link: http://kodu.ut.ee/~mroos/dm/dm.sb100
Reported-by: Meelis Roos 
Cc: Meelis Roos 
Signed-off-by: Yinghai Lu 
Tested-by: Khalid Aziz 
---
 drivers/pci/quirks.c | 18 --
 1 file changed, 18 deletions(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 0575a1e..051999e 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -445,24 +445,6 @@ static void quirk_amd_nl_class(struct pci_dev *pdev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB,
quirk_amd_nl_class);
 
-/*
- * Let's make the southbridge information explicit instead
- * of having to worry about people probing the ACPI areas,
- * for example.. (Yes, it happens, and if you read the wrong
- * ACPI register it will put the machine to sleep with no
- * way of waking it up again. Bummer).
- *
- * ALI M7101: Two IO regions pointed to by words at
- * 0xE0 (64 bytes of ACPI registers)
- * 0xE2 (32 bytes of SMB registers)
- */
-static void quirk_ali7101_acpi(struct pci_dev *dev)
-{
-   quirk_io_region(dev, 0xE0, 64, PCI_BRIDGE_RESOURCES, "ali7101 ACPI");
-   quirk_io_region(dev, 0xE2, 32, PCI_BRIDGE_RESOURCES+1, "ali7101 SMB");
-}
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, 
quirk_ali7101_acpi);
-
 static void piix4_io_quirk(struct pci_dev *dev, const char *name, unsigned int 
port, unsigned int enable)
 {
u32 devres;
-- 
1.8.4.5



[PATCH v9 06/60] PCI: Kill wrong quirk about M7101

2015-12-10 Thread Yinghai Lu
Meelis reported that qla2000 driver does not get loaded on one sparc system.

schizo f00732d0: PCI host bridge to bus 0001:00
pci_bus 0001:00: root bus resource [io  0x7fe0100-0x7fe01ff] (bus 
address [0x-0xff])
pci 0001:00:06.0: quirk: [io  0x7fe01000800-0x7fe0100083f] claimed by ali7101 
ACPI
pci 0001:00:06.0: quirk: [io  0x7fe01000600-0x7fe0100061f] claimed by ali7101 
SMB
pci 0001:00:07.0: can't claim BAR 0 [io  0x7fe0100-0x7fe0100]: address 
conflict with 0001:00:06.0 [io  0x7fe01000600-0x7fe0100061f]

So the quirk for M7101 claim the io range early.

According to spec with M7101 in M1543 page 103/104,
http://www.versalogic.com/Support/Downloads/pdf/ali1543.pdf
0xe0, and 0xe2 do not include address info for acpi/smb.

Kill wrong quirk about them.

Link: http://kodu.ut.ee/~mroos/dm/dm.v240
Link: http://kodu.ut.ee/~mroos/dm/dm.sb100
Reported-by: Meelis Roos 
Cc: Meelis Roos 
Signed-off-by: Yinghai Lu 
Tested-by: Khalid Aziz 
---
 drivers/pci/quirks.c | 18 --
 1 file changed, 18 deletions(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 7e32730..7354127 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -433,24 +433,6 @@ static void quirk_amd_nl_class(struct pci_dev *pdev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB,
quirk_amd_nl_class);
 
-/*
- * Let's make the southbridge information explicit instead
- * of having to worry about people probing the ACPI areas,
- * for example.. (Yes, it happens, and if you read the wrong
- * ACPI register it will put the machine to sleep with no
- * way of waking it up again. Bummer).
- *
- * ALI M7101: Two IO regions pointed to by words at
- * 0xE0 (64 bytes of ACPI registers)
- * 0xE2 (32 bytes of SMB registers)
- */
-static void quirk_ali7101_acpi(struct pci_dev *dev)
-{
-   quirk_io_region(dev, 0xE0, 64, PCI_BRIDGE_RESOURCES, "ali7101 ACPI");
-   quirk_io_region(dev, 0xE2, 32, PCI_BRIDGE_RESOURCES+1, "ali7101 SMB");
-}
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, 
quirk_ali7101_acpi);
-
 static void piix4_io_quirk(struct pci_dev *dev, const char *name, unsigned int 
port, unsigned int enable)
 {
u32 devres;
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 07/61] PCI: Kill wrong quirk about M7101

2015-10-27 Thread Yinghai Lu
Meelis reported that qla2000 driver does not get loaded on one sparc system.

schizo f00732d0: PCI host bridge to bus 0001:00
pci_bus 0001:00: root bus resource [io  0x7fe0100-0x7fe01ff] (bus 
address [0x-0xff])
pci 0001:00:06.0: quirk: [io  0x7fe01000800-0x7fe0100083f] claimed by ali7101 
ACPI
pci 0001:00:06.0: quirk: [io  0x7fe01000600-0x7fe0100061f] claimed by ali7101 
SMB
pci 0001:00:07.0: can't claim BAR 0 [io  0x7fe0100-0x7fe0100]: address 
conflict with 0001:00:06.0 [io  0x7fe01000600-0x7fe0100061f]

So the quirk for M7101 claim the io range early.

According to spec with M7101 in M1543 page 103/104,
http://www.versalogic.com/Support/Downloads/pdf/ali1543.pdf
0xe0, and 0xe2 do not include address info for acpi/smb.

Kill wrong quirk about them.

Link: http://kodu.ut.ee/~mroos/dm/dm.v240
Link: http://kodu.ut.ee/~mroos/dm/dm.sb100
Reported-by: Meelis Roos 
Cc: Meelis Roos 
Signed-off-by: Yinghai Lu 
Tested-by: Khalid Aziz 
---
 drivers/pci/quirks.c | 18 --
 1 file changed, 18 deletions(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index b03373f..55bb661 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -433,24 +433,6 @@ static void quirk_amd_nl_class(struct pci_dev *pdev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB,
quirk_amd_nl_class);
 
-/*
- * Let's make the southbridge information explicit instead
- * of having to worry about people probing the ACPI areas,
- * for example.. (Yes, it happens, and if you read the wrong
- * ACPI register it will put the machine to sleep with no
- * way of waking it up again. Bummer).
- *
- * ALI M7101: Two IO regions pointed to by words at
- * 0xE0 (64 bytes of ACPI registers)
- * 0xE2 (32 bytes of SMB registers)
- */
-static void quirk_ali7101_acpi(struct pci_dev *dev)
-{
-   quirk_io_region(dev, 0xE0, 64, PCI_BRIDGE_RESOURCES, "ali7101 ACPI");
-   quirk_io_region(dev, 0xE2, 32, PCI_BRIDGE_RESOURCES+1, "ali7101 SMB");
-}
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, 
quirk_ali7101_acpi);
-
 static void piix4_io_quirk(struct pci_dev *dev, const char *name, unsigned int 
port, unsigned int enable)
 {
u32 devres;
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v7 07/60] PCI: kill wrong quirk about M7101

2015-10-12 Thread Yinghai Lu
On Mon, Oct 12, 2015 at 12:46 PM, Meelis Roos  wrote:
>
> Does your for-pci-v4.4-next patchset in your git repo already contain
> that? On V240 it seemed to be applied in your git.

Yes.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v7 07/60] PCI: kill wrong quirk about M7101

2015-10-12 Thread Meelis Roos
> Meelis reported that qla2000 driver does not get loaded on one sparc system.
> 
> schizo f00732d0: PCI host bridge to bus 0001:00
> pci_bus 0001:00: root bus resource [io  0x7fe0100-0x7fe01ff] (bus 
> address [0x-0xff])
> pci 0001:00:06.0: quirk: [io  0x7fe01000800-0x7fe0100083f] claimed by ali7101 
> ACPI
> pci 0001:00:06.0: quirk: [io  0x7fe01000600-0x7fe0100061f] claimed by ali7101 
> SMB
> pci 0001:00:07.0: can't claim BAR 0 [io  0x7fe0100-0x7fe0100]: 
> address conflict with 0001:00:06.0 [io  0x7fe01000600-0x7fe0100061f]
> 
> So the quirk for M7101 claim the io range early.
> 
> According to spec with M7101 in M1543 page 103/104,
>   http://www.versalogic.com/Support/Downloads/pdf/ali1543.pdf
> 0xe0, and 0xe2 do not include address info for acpi/smb.
> 
> Kill wrong quirk about them.
> 
> Link: http://kodu.ut.ee/~mroos/dm/dm.v240
> Link: http://kodu.ut.ee/~mroos/dm/dm.sb100
> Reported-by: Meelis Roos 
> Cc: Meelis Roos 
> Signed-off-by: Yinghai Lu 

I tested it on Sub Blade 100 on top of 4.3-rc5 without your other 
patchset. The quirk messages are gone but now there are even more BAR 
allocation messages:

http://kodu.ut.ee/~mroos/dm/dm.sb100+quirkpatch

Does your for-pci-v4.4-next patchset in your git repo already contain 
that? On V240 it seemed to be applied in your git.

-- 
Meelis Roos (mr...@linux.ee)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v7 07/60] PCI: kill wrong quirk about M7101

2015-10-09 Thread Khalid Aziz
On Thu, 2015-10-08 at 14:38 -0700, Yinghai Lu wrote:
> Meelis reported that qla2000 driver does not get loaded on one sparc system.
> 
> schizo f00732d0: PCI host bridge to bus 0001:00
> pci_bus 0001:00: root bus resource [io  0x7fe0100-0x7fe01ff] (bus 
> address [0x-0xff])
> pci 0001:00:06.0: quirk: [io  0x7fe01000800-0x7fe0100083f] claimed by ali7101 
> ACPI
> pci 0001:00:06.0: quirk: [io  0x7fe01000600-0x7fe0100061f] claimed by ali7101 
> SMB
> pci 0001:00:07.0: can't claim BAR 0 [io  0x7fe0100-0x7fe0100]: 
> address conflict with 0001:00:06.0 [io  0x7fe01000600-0x7fe0100061f]
> 
> So the quirk for M7101 claim the io range early.
> 
> According to spec with M7101 in M1543 page 103/104,
>   http://www.versalogic.com/Support/Downloads/pdf/ali1543.pdf
> 0xe0, and 0xe2 do not include address info for acpi/smb.
> 
> Kill wrong quirk about them.
> 
> Link: http://kodu.ut.ee/~mroos/dm/dm.v240
> Link: http://kodu.ut.ee/~mroos/dm/dm.sb100
> Reported-by: Meelis Roos 
> Cc: Meelis Roos 
> Signed-off-by: Yinghai Lu 


Tested on sparc platforms

Tested-by: Khalid Aziz  


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v7 07/60] PCI: kill wrong quirk about M7101

2015-10-08 Thread Yinghai Lu
Meelis reported that qla2000 driver does not get loaded on one sparc system.

schizo f00732d0: PCI host bridge to bus 0001:00
pci_bus 0001:00: root bus resource [io  0x7fe0100-0x7fe01ff] (bus 
address [0x-0xff])
pci 0001:00:06.0: quirk: [io  0x7fe01000800-0x7fe0100083f] claimed by ali7101 
ACPI
pci 0001:00:06.0: quirk: [io  0x7fe01000600-0x7fe0100061f] claimed by ali7101 
SMB
pci 0001:00:07.0: can't claim BAR 0 [io  0x7fe0100-0x7fe0100]: address 
conflict with 0001:00:06.0 [io  0x7fe01000600-0x7fe0100061f]

So the quirk for M7101 claim the io range early.

According to spec with M7101 in M1543 page 103/104,
http://www.versalogic.com/Support/Downloads/pdf/ali1543.pdf
0xe0, and 0xe2 do not include address info for acpi/smb.

Kill wrong quirk about them.

Link: http://kodu.ut.ee/~mroos/dm/dm.v240
Link: http://kodu.ut.ee/~mroos/dm/dm.sb100
Reported-by: Meelis Roos 
Cc: Meelis Roos 
Signed-off-by: Yinghai Lu 
---
 drivers/pci/quirks.c | 18 --
 1 file changed, 18 deletions(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index b03373f..55bb661 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -433,24 +433,6 @@ static void quirk_amd_nl_class(struct pci_dev *pdev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_NL_USB,
quirk_amd_nl_class);
 
-/*
- * Let's make the southbridge information explicit instead
- * of having to worry about people probing the ACPI areas,
- * for example.. (Yes, it happens, and if you read the wrong
- * ACPI register it will put the machine to sleep with no
- * way of waking it up again. Bummer).
- *
- * ALI M7101: Two IO regions pointed to by words at
- * 0xE0 (64 bytes of ACPI registers)
- * 0xE2 (32 bytes of SMB registers)
- */
-static void quirk_ali7101_acpi(struct pci_dev *dev)
-{
-   quirk_io_region(dev, 0xE0, 64, PCI_BRIDGE_RESOURCES, "ali7101 ACPI");
-   quirk_io_region(dev, 0xE2, 32, PCI_BRIDGE_RESOURCES+1, "ali7101 SMB");
-}
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, 
quirk_ali7101_acpi);
-
 static void piix4_io_quirk(struct pci_dev *dev, const char *name, unsigned int 
port, unsigned int enable)
 {
u32 devres;
-- 
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: M7101

2005-02-12 Thread Jean Delvare
Hi,

> Will m7101.c be modified once quirks enabling the device?

m7101.c is for 2.4 kernels while the proposed quirk is to be merged into
2.6 kernels, so m7101.c will still be needed as is. That said, if
cleanups are made on the way to 2.6 and someone offers a patch that
ports these cleanups back to m7101.c, I'll be happy to apply it, of
course.

Thanks,
-- 
Jean Delvare
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: M7101

2005-02-08 Thread Ondrej Zary
Ivan Kokshaysky wrote:
On Sun, Feb 06, 2005 at 03:06:11PM +, Matthew Wilcox wrote:
Looks pretty good to me.  For clarity, I'd change:
-   m7101 = pci_scan_single_device(dev->bus, 0x18);
+   m7101 = pci_scan_single_device(dev->bus, PCI_DEVFN(3, 0));

No, it's pretty broken regardless of the change. The integrated devices
on ALi southbridges (IDE, PMU, USB etc.) have programmable IDSELs,
so using hardcoded devfn is just dangerous. We must figure out what
the device number PMU will have before we turn it on.
Something like this:
// NOTE: These values are for m1543. Someone must verify whether
// they are the same for m1533 or not.
static char pmu_idsels[4] __devinitdata = { 28, 29, 14, 15 };
...
/* Get IDSEL mapping for PMU (bits 2-3 of 0x72). */
pci_read_config_byte(dev, 0x72, &val);
devnum = pmu_idsel[(val >> 2) & 3] - 11;
m7101 = pci_get_slot(dev->bus, PCI_DEVFN(devnum, 0));
if (m7101) {
/* Failure - there is another device with the same number. */
pci_dev_put(m7101);
return;
}
/* Enable PMU. */
...
m7101 = pci_scan_single_device(dev->bus, PCI_DEVFN(devnum, 0));
...
In fact, the patch is completely wrong for M1533 south bridge, it will 
work only with M1543.
M1533 has different PCI config. register layout - the bit 2 of 0x5F 
register is not used for enabling/disabling M7101 but for "on-chip 
arbiter control". M7101 can be enabled/disabled using bit 6 of 0x5D 
register... M1533 has also different M7101 registers.
The best thing about this is that these two M7101s have the same PCI 
device IDs (0x7101).
The south bridges have the same PCI IDs too (0x1533 used by both M1533 
and M1543). But according to the datasheet, M1543 should have revision 
number at least 0xC0.

--
Ondrej Zary
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: M7101

2005-02-08 Thread Ivan Kokshaysky
On Sun, Feb 06, 2005 at 03:06:11PM +, Matthew Wilcox wrote:
> Looks pretty good to me.  For clarity, I'd change:
> 
> - m7101 = pci_scan_single_device(dev->bus, 0x18);
> + m7101 = pci_scan_single_device(dev->bus, PCI_DEVFN(3, 0));

No, it's pretty broken regardless of the change. The integrated devices
on ALi southbridges (IDE, PMU, USB etc.) have programmable IDSELs,
so using hardcoded devfn is just dangerous. We must figure out what
the device number PMU will have before we turn it on.
Something like this:

// NOTE: These values are for m1543. Someone must verify whether
// they are the same for m1533 or not.
static char pmu_idsels[4] __devinitdata = { 28, 29, 14, 15 };

...

/* Get IDSEL mapping for PMU (bits 2-3 of 0x72). */
pci_read_config_byte(dev, 0x72, &val);
devnum = pmu_idsel[(val >> 2) & 3] - 11;
m7101 = pci_get_slot(dev->bus, PCI_DEVFN(devnum, 0));
if (m7101) {
/* Failure - there is another device with the same number. */
pci_dev_put(m7101);
return;
}

    /* Enable PMU. */
...

m7101 = pci_scan_single_device(dev->bus, PCI_DEVFN(devnum, 0));
...

Ivan.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: M7101

2005-02-07 Thread Greg KH
On Sun, Feb 06, 2005 at 03:26:15PM +0100, Jean Delvare wrote:
> Hi Enrico,
> 
> Sorry for the delay.
> 
> > I have a board with the ALI M7101 chip, but I can't activate it in
> > BIOS.  I tried to compile the prog/hotplug/m7101.c but I seen that
> > this is only  for 2.4 Kernels. Is there a module for 2.6?
> 
> The prog/hotplug/m7101.c (from the lm_sensors project) was a quick hack
> and only works with 2.4 kernels, as you noticed. For 2.6 kernels, the
> prefered solution is known as PCI quirks (drivers/pci/quirks.c). I can
> see that you already found that and proposed a patch for the 2.6 kernel
> here:
> http://marc.theaimsgroup.com/?l=linux-kernel&m=110606482902883
> 
> Maarten Deprez then converted it to the proper kernel coding-style:
> http://marc.theaimsgroup.com/?l=linux-kernel&m=110726276414532
> 
> I invite you to test the new patch and confirm that it works for you.
> 
> Any chance we could get the PCI folks to review the code and push it
> upwards if it is OK?

I need it resent with the fixes, and a "Signed-off-by:" line to do that
:)

Also, a pci_get_* is called without a matching put.

thanks,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: M7101

2005-02-06 Thread Grant Grundler
On Sun, Feb 06, 2005 at 03:26:15PM +0100, Jean Delvare wrote:
> Maarten Deprez then converted it to the proper kernel coding-style:
> http://marc.theaimsgroup.com/?l=linux-kernel&m=110726276414532
...
> Any chance we could get the PCI folks to review the code and push it
> upwards if it is OK?

I'm not the maintainer, but it looks fine to me except for use
of numeric constants (e.g 0x5f, 0x18) instead of adding #defines
to name the values. But if no one knows what those offsets are for
we'll just have to leave it.


> For reference, here are links to the original m7101 unhiding driver code
> and help file:
> http://www2.lm-sensors.nu/~lm78/cvs/lm_sensors2/prog/hotplug/m7101.c

Unfortunately, I didn't anything documenting 0x5f and 0x18.

Will m7101.c be modified once quirks enabling the device?

hth,
grant
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: M7101

2005-02-06 Thread Matthew Wilcox
On Sun, Feb 06, 2005 at 03:26:15PM +0100, Jean Delvare wrote:
> Maarten Deprez then converted it to the proper kernel coding-style:
> http://marc.theaimsgroup.com/?l=linux-kernel&m=110726276414532
> 
> I invite you to test the new patch and confirm that it works for you.
> 
> Any chance we could get the PCI folks to review the code and push it
> upwards if it is OK?

Looks pretty good to me.  For clarity, I'd change:

-   m7101 = pci_scan_single_device(dev->bus, 0x18);
+   m7101 = pci_scan_single_device(dev->bus, PCI_DEVFN(3, 0));

and then test m7101 for being NULL -- if it fails, you'll get a NULL
ptr dereference from pci_read_config_byte():

-   if (pci_read_config_byte(m7101, 0x5B, &val)) {
+   if (!m7101 || pci_read_config_byte(m7101, 0x5B, &val)) {

I don't think you need to bother checking the subsequent write for failure:

if (val & 0x06) {
-   if (pci_write_config_byte(m7101, 0x5B, val & ~0x06)) {
-   printk(KERN_INFO "PCI: Failed to enable M7101 SMBus 
Controller\n");
-       return;
-   }
+   pci_write_config_byte(m7101, 0x5B, val & ~0x06);
}

So conceptually, I approve, just some details need fixing.

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: M7101

2005-02-06 Thread Jean Delvare
Hi Enrico,

Sorry for the delay.

> I have a board with the ALI M7101 chip, but I can't activate it in
> BIOS.  I tried to compile the prog/hotplug/m7101.c but I seen that
> this is only  for 2.4 Kernels. Is there a module for 2.6?

The prog/hotplug/m7101.c (from the lm_sensors project) was a quick hack
and only works with 2.4 kernels, as you noticed. For 2.6 kernels, the
prefered solution is known as PCI quirks (drivers/pci/quirks.c). I can
see that you already found that and proposed a patch for the 2.6 kernel
here:
http://marc.theaimsgroup.com/?l=linux-kernel&m=110606482902883

Maarten Deprez then converted it to the proper kernel coding-style:
http://marc.theaimsgroup.com/?l=linux-kernel&m=110726276414532

I invite you to test the new patch and confirm that it works for you.

Any chance we could get the PCI folks to review the code and push it
upwards if it is OK?

For reference, here are links to the original m7101 unhiding driver code
and help file:
http://www2.lm-sensors.nu/~lm78/cvs/lm_sensors2/prog/hotplug/m7101.c
http://www2.lm-sensors.nu/~lm78/cvs/lm_sensors2/prog/hotplug/README

Thanks,
-- 
Jean Delvare
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


M7101 unhiding patch

2005-02-01 Thread maartendeprez
Can this patch to drivers/pci/quirks.c be incorporated into the kernel? It 
fixes a bug in some BIOSes that hide the M7101 PMU and SMBUS device and is 
needed for some boards to use the i2c-ali15x3 driver. lm_sensors includes a 
module that makes that device visible. i got this patch from the kernel mailing 
list and adapted it to the kernel coding style.

Maarten Deprez
--- linux-2.6.11-rc2-mm1/drivers/pci/quirks.c.orig  2005-01-28 
10:55:20.524801664 +0100
+++ linux-2.6.11-rc2-mm1/drivers/pci/quirks.c   2005-01-28 11:24:34.626137728 
+0100
@@ -281,6 +281,55 @@
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, 
quirk_ali7101_acpi );
 
 /*
+ * ALi 1533 fixup to enable the M7101 SMBus Controller
+ *  ported from prog/hotplug of the lm_sensors
+ *  package
+ */
+static void __devinit quirk_ali1533_smbus(struct pci_dev *dev)
+{
+   u8 val = 0;
+   struct pci_dev *m7101;
+
+   m7101 = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, NULL);
+
+   if (m7101)
+   return;
+
+   /* enable device */
+
+   pci_read_config_byte(dev, 0x5F, &val);
+
+   if (val & 0x04) {
+   pci_write_config_byte(dev, 0x5F, val & ~0x04);
+   pci_read_config_byte(dev, 0x5F, &val);
+
+   if (val & 0x4) {
+   printk(KERN_INFO "PCI: Failed to enable M7101 SMBus 
Controller\n");
+   return;
+       }
+   }
+
+   m7101 = pci_scan_single_device(dev->bus, 0x18);
+
+   /* unlock registers */
+
+   if (pci_read_config_byte(m7101, 0x5B, &val)) {
+   printk(KERN_INFO "PCI: Failed to enable M7101 SMBus 
Controller\n");
+   return;
+   }
+
+   if (val & 0x06) {
+   if (pci_write_config_byte(m7101, 0x5B, val & ~0x06)) {
+   printk(KERN_INFO "PCI: Failed to enable M7101 SMBus 
Controller\n");
+   return;
+       }
+   }
+
+   printk(KERN_INFO "PCI: Enabled M7101 SMBus Controller\n");
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, 
quirk_ali1533_smbus );
+
+/*
  * PIIX4 ACPI: Two IO regions pointed to by longwords at
  * 0x40 (64 bytes of ACPI registers)
  * 0x90 (32 bytes of SMB registers)


PATCH for 2.6: Enabling disabled M7101 device (quirks.c)

2005-01-18 Thread Enrico Bartky
Hello,

I have ported the prog/hotplug/m7101.c module from lm_sensors for kernel 2.6. 
Here is the patch.

EnricoB
__
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193

i2c.diff
Description: Binary data