Sadik, Pallathu
2004-10-10 02:15:37 UTC
Hello,
I am am familiar with linux kernel. I have ported
linux to IDT's MIPS based platforms and have written device
drivers for their integrated ethernet controllers.
Currently, I am working on developing a driver
for a PCI express switch that have one upstream and
multiple downstream ports with hotplug capability.
I am totally new to PCI express and hotplug. I have
gone through various kernel documents, source code
and tutorials to understand the linux support for PCI
express, particularly the hotplug feature support.
I have some understanding of a PCI/PCI express driver
structure in linux (from pm.txt, pci.txt and power/pci.txt
etc of ~linux/Documentation). This clearly explains how
to write a driver for a PCI/PCIexpress device/endpoint.
However, I am not able to figure out whether these
are applicable in the case of a switch.
My hardware setup is as follows:
PCI express switch:
As I have mentioned above, the switch is going to
have one upstream and multiple downstream ports.
The downstream ports have implemented hotpulg feature
(Attention indicator, power indicator, attention button,
MRL sensor etc). They are capable of generating interrupts
on the hotplug events.
The upstream port has implemented Attention button input
that sends ATTENTION_BUTTON_PRESSED message to the root
complex, Attention indicator output and power indicator output.
Motherboard :
Supermicro X6DH8-G2. Please see the URL:
http://www.supermicro.com/products/motherboard/Xeon800/E7520/X6DH8-G2.cfm
This board can accommodate two CPUs, but I have only one.
It uses Intel E7520 MCH and 82801 ER I/O controller hub (ICH5R).
Processor :
Xeon with 800 MB FSB
Kernel version : linux-2.6.9-rc3. I installed Fedora Core 3 test 1
and upgraded the kernel later. The kernel boots with ACPI (with
ACPI off, the kernel refuses to boot).
My questions are as follows:
1. Do I need to write a driver for this device? I couldn't locate a
driver for PCI to PCI bridge in the linux code and functionally a
PCI express switch is not that much different from a PCI bridge.
2. Hotplug handling
The PCI express swith evaluation board will support two modes
1. The devices that are plugged into downstream ports
are hotpluggable
My assumption is that the user will press the attention button
located near to a downstream port, that will generate an interrupt.
The interrupt handler is run by the kernel, which should identify the
device(s) under the slot, power them off and then power off the
port itself.
2. The entire board along with the devices can be plugged out.
In the second case, the user press the attention button
located near the upstream port, that will generate an
ATTENTION_BUTTON_PRESSED event. (I know that, this message
ill end up at the root complex, but I don't know whether
the root complex will generate an event. Please let me
know the interrupt mechanism in this case).
I have gone through the source code and found different kinds of
hotplug drivers under ~linux/drivers/pci/hotplug directory, namely
pci_hotplug, shpchp, pciehp, acpiphp. I experimentally found out
that the pci_hotplug module is required for the rest of the modules
to load. However, I am not sure which one I should select.
As I understand acpiphp is for ACPI based hotplug control and
pciehp is for PCI express native hotplug. Is that true? Do I need
both of them for the correct operation?
2. Interrupt handler
I have gone through the MCH manual to see how the interrupts are
routed on this system. I was not able to figure it out yet. My question
is, when the hotplug interrupt is generated by the downstream port
of the switch, where does it end up? What IRQ number? Do the hotplug
drivers above have the handler for this interrupt? Also, when the
upstream port generates ATTENTION_BUTTON_PRESSED message, it goes
to the root complex (MCH). Does that generate an interrupt to the CPU?
3. ACPI
I read that ACPI driver takes care of the system power management events
like button pressed etc. cat /proc/interrupts shows that IRQ 9 is
dedicated to acpi. To experiment, I killed the acpid and run
cat /proc/acpi/event. Then I pressed the power button and the
followig message appeared:
button/power PWRF 00000080 00000001
A similar behaviour should happen with the hotplug attention button
is pressed, either at the upstream or downstream, right? Who is doing
this? Only in the case of pciephp driver, I could see a request_irq.
Is it that, the other ones rely on the acpi driver to handle interrupts?
Also, there should be an entry under /sys or /proc for the hotplug
by which a user should be able to power down the port. I loaded one
of the hotplug drivers mentioned earlier and did see some entries for
slot power control. Right now, I have a syskonnect PCI express NIC
card on the system. I tried to bring it down through the /sys interface,
but nothing happened. Am I doing something wrong?
4. Application code.
I looked at Greg's website (www.kroah.com), and see that the pcihpview
can be used to display all hotplug slots and enable/disable particular
slots. Will this utility automatically detect the switch and control
a switch?
Please let me know if you would like to get more clarification, as I am
not sure whether the questions I asked above is clear or not.
My sincere apologies if you find this mail too long
to read. I wanted to write down everything I know and
the things I don't know.
Thanks and regards,
Sadik.
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
I am am familiar with linux kernel. I have ported
linux to IDT's MIPS based platforms and have written device
drivers for their integrated ethernet controllers.
Currently, I am working on developing a driver
for a PCI express switch that have one upstream and
multiple downstream ports with hotplug capability.
I am totally new to PCI express and hotplug. I have
gone through various kernel documents, source code
and tutorials to understand the linux support for PCI
express, particularly the hotplug feature support.
I have some understanding of a PCI/PCI express driver
structure in linux (from pm.txt, pci.txt and power/pci.txt
etc of ~linux/Documentation). This clearly explains how
to write a driver for a PCI/PCIexpress device/endpoint.
However, I am not able to figure out whether these
are applicable in the case of a switch.
My hardware setup is as follows:
PCI express switch:
As I have mentioned above, the switch is going to
have one upstream and multiple downstream ports.
The downstream ports have implemented hotpulg feature
(Attention indicator, power indicator, attention button,
MRL sensor etc). They are capable of generating interrupts
on the hotplug events.
The upstream port has implemented Attention button input
that sends ATTENTION_BUTTON_PRESSED message to the root
complex, Attention indicator output and power indicator output.
Motherboard :
Supermicro X6DH8-G2. Please see the URL:
http://www.supermicro.com/products/motherboard/Xeon800/E7520/X6DH8-G2.cfm
This board can accommodate two CPUs, but I have only one.
It uses Intel E7520 MCH and 82801 ER I/O controller hub (ICH5R).
Processor :
Xeon with 800 MB FSB
Kernel version : linux-2.6.9-rc3. I installed Fedora Core 3 test 1
and upgraded the kernel later. The kernel boots with ACPI (with
ACPI off, the kernel refuses to boot).
My questions are as follows:
1. Do I need to write a driver for this device? I couldn't locate a
driver for PCI to PCI bridge in the linux code and functionally a
PCI express switch is not that much different from a PCI bridge.
2. Hotplug handling
The PCI express swith evaluation board will support two modes
1. The devices that are plugged into downstream ports
are hotpluggable
My assumption is that the user will press the attention button
located near to a downstream port, that will generate an interrupt.
The interrupt handler is run by the kernel, which should identify the
device(s) under the slot, power them off and then power off the
port itself.
2. The entire board along with the devices can be plugged out.
In the second case, the user press the attention button
located near the upstream port, that will generate an
ATTENTION_BUTTON_PRESSED event. (I know that, this message
ill end up at the root complex, but I don't know whether
the root complex will generate an event. Please let me
know the interrupt mechanism in this case).
I have gone through the source code and found different kinds of
hotplug drivers under ~linux/drivers/pci/hotplug directory, namely
pci_hotplug, shpchp, pciehp, acpiphp. I experimentally found out
that the pci_hotplug module is required for the rest of the modules
to load. However, I am not sure which one I should select.
As I understand acpiphp is for ACPI based hotplug control and
pciehp is for PCI express native hotplug. Is that true? Do I need
both of them for the correct operation?
2. Interrupt handler
I have gone through the MCH manual to see how the interrupts are
routed on this system. I was not able to figure it out yet. My question
is, when the hotplug interrupt is generated by the downstream port
of the switch, where does it end up? What IRQ number? Do the hotplug
drivers above have the handler for this interrupt? Also, when the
upstream port generates ATTENTION_BUTTON_PRESSED message, it goes
to the root complex (MCH). Does that generate an interrupt to the CPU?
3. ACPI
I read that ACPI driver takes care of the system power management events
like button pressed etc. cat /proc/interrupts shows that IRQ 9 is
dedicated to acpi. To experiment, I killed the acpid and run
cat /proc/acpi/event. Then I pressed the power button and the
followig message appeared:
button/power PWRF 00000080 00000001
A similar behaviour should happen with the hotplug attention button
is pressed, either at the upstream or downstream, right? Who is doing
this? Only in the case of pciephp driver, I could see a request_irq.
Is it that, the other ones rely on the acpi driver to handle interrupts?
Also, there should be an entry under /sys or /proc for the hotplug
by which a user should be able to power down the port. I loaded one
of the hotplug drivers mentioned earlier and did see some entries for
slot power control. Right now, I have a syskonnect PCI express NIC
card on the system. I tried to bring it down through the /sys interface,
but nothing happened. Am I doing something wrong?
4. Application code.
I looked at Greg's website (www.kroah.com), and see that the pcihpview
can be used to display all hotplug slots and enable/disable particular
slots. Will this utility automatically detect the switch and control
a switch?
Please let me know if you would like to get more clarification, as I am
not sure whether the questions I asked above is clear or not.
My sincere apologies if you find this mail too long
to read. I wanted to write down everything I know and
the things I don't know.
Thanks and regards,
Sadik.
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl