Re: [PATCH 0/4, v3] Physical PCI slot objects

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alex Chiang
Date: Thursday, November 29, 2007 - 6:51 pm

Hi Kenji-san,

* Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>:

Thanks for testing. :)


Hm, you are right. On my machine, if I load pciehp first and
acpiphp second (even without loading pci_slot), I will see the
following:

[root@canola slots]# ls
0016_0006  0197_0005  10  3  4  7  8  9

[root@canola slots]# lsmod | grep pci_slot
[root@canola slots]# lsmod | grep hp
acpiphp               115984  0 
pciehp                140616  0 
pci_hotplug           123972  2 acpiphp,pciehp

On the other hand, if I do load pci_slot first, and then pciehp,
you are right, I will see something like this:

[root@canola slots]# ls
1  10  2  3  4  5  6  7  8  9

[root@canola slots]# lsmod | grep pci_slot
pci_slot               74436  0 
[root@canola slots]# lsmod | grep hp
pciehp                140616  0 
pci_hotplug           123972  1 pciehp

But I do agree, people don't need to load pci_slot at all if they
don't want it, and they won't be bothered.


Now this is very curious. The relevant line in pci_slot is:

check_slot()
	status = acpi_evaluate_integer(handle, "_SUN", NULL, sun);
	if (ACPI_FAILURE(status))
		return -1;

Why does your firmware return the error information inside sun,
instead of returning an error in status? That doesn't seem right
to me...


Applying this patch causes me to only detect populated slots in
my system, which isn't what I want -- otherwise, I could have
just enumerated the PCI bus and found the devices that way. :)

Maybe on your machine, checking existence of _STA might do the
right thing, but I don't think we should actually be looking at
any of the actual bits returned. 

If we check ACPI_STA_DEVICE_PRESENT, then we will not detect
empty slots on my system. Can you try this patch to see if at
least the first call to acpi_evaluate_integer helps? If that
doesn't help, maybe the second block will help you, but it breaks
my machine...

Thanks.

/ac


diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c
index 724f4f0..63a4dc8 100644
--- a/drivers/acpi/pci_slot.c
+++ b/drivers/acpi/pci_slot.c
@@ -55,9 +65,21 @@ static struct acpi_pci_driver acpi_pci_slot_driver = {
 static int
 check_slot(acpi_handle handle, int *device, unsigned long *sun)
 {
-       unsigned long adr;
+       unsigned long adr, sta;
        acpi_status status;
 
+       /* Doesn't seem to hurt anything on hp systems */
+       status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
+       if (ACPI_FAILURE(status))
+               return -1;
+
+       /* This code causes us to fail to detect empty slots, so
+        * commented out for now.
+        *
+       if (!(sta & ACPI_STA_DEVICE_PRESENT))
+               return -1;
+        */
+
        status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr);
        if (ACPI_FAILURE(status))
                return -1;
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 3/4, v3] PCI, PCI Hotplug: Introduce pci_slot, Alex Chiang, (Sat Nov 17, 11:37 am)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Kristen Carlson Accardi, (Mon Nov 19, 10:43 am)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Alex Chiang, (Mon Nov 19, 10:57 am)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Alex Chiang, (Mon Nov 19, 3:02 pm)
[PATCH 3/4, v4] PCI, PCI Hotplug: Introduce pci_slot, Alex Chiang, (Mon Nov 19, 3:03 pm)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Matthew Garrett, (Mon Nov 19, 7:04 pm)
[PATCH 3/4, v5] PCI, PCI Hotplug: Introduce pci_slot, Alex Chiang, (Mon Nov 26, 3:26 pm)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Gary Hade, (Mon Nov 26, 8:04 pm)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Kristen Carlson Accardi, (Tue Nov 27, 12:11 pm)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Gary Hade, (Wed Nov 28, 2:31 pm)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Kristen Carlson Accardi, (Wed Nov 28, 5:02 pm)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Gary Hade, (Wed Nov 28, 6:09 pm)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Kenji Kaneshige, (Thu Nov 29, 12:47 am)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Alex Chiang, (Thu Nov 29, 6:19 pm)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Alex Chiang, (Thu Nov 29, 6:51 pm)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Gary Hade, (Fri Nov 30, 12:10 pm)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Kenji Kaneshige, (Sun Dec 2, 8:30 pm)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Alex Chiang, (Mon Dec 3, 3:43 pm)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Kenji Kaneshige, (Tue Dec 4, 5:57 am)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Alex Chiang, (Mon Dec 10, 4:02 pm)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Kristen Carlson Accardi, (Tue Mar 11, 12:15 pm)
Re: [PATCH 0/4, v3] Physical PCI slot objects, Kenji Kaneshige, (Wed Mar 12, 5:25 am)