A PL061 is a simple 8 pin GPIO controller. This GPIO device is used to signal an internal request for shutdown on some virtual machines including Arm-based Amazon EC2 instances.
Details
- Reviewers
cperciva alisaidi_amazon.com manu - Group Reviewers
arm64 ARM - Commits
- rS365450: Add a GPIO driver for the Arm pl061 controller
This change is dependent on a change from Andrew that doesn't greedily allocate all irqsrc for all possible gicv3 ITS MSIs so that some are available for the gpio device. In addition to the gpio driver some additional support is required in the acpi implementation to make this an ACPI event that can trigger a power button device and I haven't started to work on that.
I've tested this by loading the driver, seeing the 8 gpio pins as input, confirming that if the gpio device signals an edge on one pin the driver sees this and that the pins can be changed to output and written to. Other than hacking the driver to register an interrupt for a pin and confirming that pl061_intr() ends up being called in this case I haven't found a way to test the interrupt generation and handling in the code yet. Any pointers on how to do this would be appreciated.
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
sys/dev/gpio/pl061.c | ||
---|---|---|
94 | You need to return the intr caps (GPIO_INTR_LEVEL_* GPIO_INTR_EDGE_*) for the type of supported interrupts in getcaps but you only return this. |
sys/dev/gpio/pl061.c | ||
---|---|---|
94 | I had tried that originally, but when I do that gpioctl says it doesn't know the other CAPs which made be think that since the direction it set via gpio_pin_setflags and the interrupt handing is set in pic_setup_intr that it the level/edge CAPS shouldn't be returned from gpio_pin_getcaps For example when providing all the caps gpioctl returns the following: pin 00: 0 p0<IN>, caps:<IN,OUT,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN> pin 01: 0 p1<IN>, caps:<IN,OUT,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN> pin 02: 0 p2<IN>, caps:<IN,OUT,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN> pin 03: 0 p3<IN>, caps:<IN,OUT,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN> pin 04: 0 p4<IN>, caps:<IN,OUT,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN> pin 05: 0 p5<IN>, caps:<IN,OUT,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN> pin 06: 0 p6<IN>, caps:<IN,OUT,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN> pin 07: 0 p7<IN>, caps:<IN,OUT,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN> I'm happy to make the change if you believe this is still correct. |
sys/dev/gpio/pl061.c | ||
---|---|---|
94 | Great! Will fix the CAPS to be correct here. |
sys/dev/gpio/pl061.c | ||
---|---|---|
5 | Minor aside, we've dropped the "All rights reserved." from our standard templates. If it's here only because you found it in a template or copied the header block from an existing file feel free to remove it. You are of course free to include it on files you create if your policy requires it. |
sys/modules/Makefile | ||
---|---|---|
578 | The pl061 module directory is missing. |
sys/modules/Makefile | ||
---|---|---|
578 | Sorry, I'm missing something basic here I imagine. I don't see a hierarchy of directories with other modules when I make or install them. What am I missing? |
sys/modules/Makefile | ||
---|---|---|
578 | I think andrew is saying that you've added "pl061" to the list of subdirectories which sys/modules/Makefile should recurse into, but sys/modules/pl061 isn't included in this patch (which means that buildkernel will fail when it tries to build the module). |