Message ID | 1389135041-16062-6-git-send-email-fkan@apm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tuesday 07 January 2014, Feng Kan wrote: > Enable the X-Gene reboot driver to use either the ACPI or the DTS > resource using the platform driver method. > > Signed-off-by: Feng Kan <fkan@apm.com> > --- > drivers/power/reset/xgene-reboot.c | 33 ++++++++++++++++++++++++++++----- > 1 files changed, 28 insertions(+), 5 deletions(-) > Shouldn't an ACPI based system always be able to reboot through the UEFI reset_system call? I really don't think we want to support ACPI on non-UEFI systems. Arnd
On Wed, Jan 8, 2014 at 1:43 PM, Arnd Bergmann <arnd@arndb.de> wrote: > On Tuesday 07 January 2014, Feng Kan wrote: >> Enable the X-Gene reboot driver to use either the ACPI or the DTS >> resource using the platform driver method. >> >> Signed-off-by: Feng Kan <fkan@apm.com> >> --- >> drivers/power/reset/xgene-reboot.c | 33 ++++++++++++++++++++++++++++----- >> 1 files changed, 28 insertions(+), 5 deletions(-) >> > > Shouldn't an ACPI based system always be able to reboot through the > UEFI reset_system call? I really don't think we want to support > ACPI on non-UEFI systems. > > Arnd Thanks Arnd, I will retract the ACPI support for now. We are still trying to figure out how best to support ACPI. The larger problem seems to be the fact that UEFI and ACPI were originally made for x86 and is ill suited for the arm64. I will see if I can find a better path for this patch.
On Thursday 09 January 2014, Feng Kan wrote: > On Wed, Jan 8, 2014 at 1:43 PM, Arnd Bergmann <arnd@arndb.de> wrote: > > On Tuesday 07 January 2014, Feng Kan wrote: > >> Enable the X-Gene reboot driver to use either the ACPI or the DTS > >> resource using the platform driver method. > >> > >> Signed-off-by: Feng Kan <fkan@apm.com> > >> --- > >> drivers/power/reset/xgene-reboot.c | 33 ++++++++++++++++++++++++++++----- > >> 1 files changed, 28 insertions(+), 5 deletions(-) > >> > > > > Shouldn't an ACPI based system always be able to reboot through the > > UEFI reset_system call? I really don't think we want to support > > ACPI on non-UEFI systems. > > > > Arnd > Thanks Arnd, I will retract the ACPI support for now. We are still > trying to figure out how best to support ACPI. Ok, that makes sense. > The larger problem seems to be the fact that > UEFI and ACPI were originally made for x86 and is ill suited for the > arm64. I will see if I can find a better path for this patch. I would strongly recommend to implement the standard UEFI reset mechanism on arm64-linux and then ensure your firmware provides the appropriate methods. Note that any proper arm64 system that you want a standard Linux distro to run on will likely need to implement UEFI anyway. Regarding ACPI, I'm well aware of the problems you are facing, but they have less to do with the intruction set (x86 vs arm64) and much more with the lack of a standard hardware platform. There is work underway to support a standardized subset of arm64 servers with ACPI, but X-Gene is rather unlikely to fit into that subset because of how it's just a collection of homegrown hardware blocks that are attached in seemingly random ways without a clear structure and certainly not following any standard. This is not unusual for ARM SoCs, and we can have learned to deal with it, but as we have no intention of supporting multiple incompatible ACPI implementations in Linux, you should not spend too much time thinking about ACPI on your platform. Arnd
diff --git a/drivers/power/reset/xgene-reboot.c b/drivers/power/reset/xgene-reboot.c index 683238c..e3223c2 100644 --- a/drivers/power/reset/xgene-reboot.c +++ b/drivers/power/reset/xgene-reboot.c @@ -30,6 +30,8 @@ #include <linux/platform_device.h> #include <linux/stat.h> #include <linux/slab.h> +#include <linux/acpi.h> +#include <linux/efi.h> #include <asm/system_misc.h> struct xgene_reboot_context { @@ -59,6 +61,14 @@ static void xgene_restart(enum reboot_mode reboot_mode, const char *cmd) static int xgene_reboot_probe(struct platform_device *pdev) { struct xgene_reboot_context *ctx; + struct resource *res; + int rc; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(&pdev->dev, "no resource address\n"); + return -ENODEV; + } ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) { @@ -66,20 +76,27 @@ static int xgene_reboot_probe(struct platform_device *pdev) return -ENODEV; } - ctx->csr = of_iomap(pdev->dev.of_node, 0); + ctx->csr = devm_ioremap_resource(&pdev->dev, res); if (!ctx->csr) { - devm_kfree(&pdev->dev, ctx); - dev_err(&pdev->dev, "can not map resource\n"); - return -ENODEV; + dev_err(&pdev->dev, "can't map CSR resource\n"); + rc = -ENOMEM; + goto error; } ctx->mask = 0x1; + dev_info(&pdev->dev, "X-Gene register reboot driver\n"); + ctx->pdev = pdev; arm_pm_restart = xgene_restart; xgene_restart_ctx = ctx; - return 0; + +error: + if (ctx->csr) + devm_iounmap(&pdev->dev, ctx->csr); + devm_kfree(&pdev->dev, ctx); + return rc; } static struct of_device_id xgene_reboot_of_match[] = { @@ -87,11 +104,17 @@ static struct of_device_id xgene_reboot_of_match[] = { {} }; +static const struct acpi_device_id xgene_reset_acpi_ids[] = { + { "APMC0D08", 0 }, + {} +}; + static struct platform_driver xgene_reboot_driver = { .probe = xgene_reboot_probe, .driver = { .name = "xgene-reboot", .of_match_table = xgene_reboot_of_match, + .acpi_match_table = ACPI_PTR(xgene_reset_acpi_ids), }, };
Enable the X-Gene reboot driver to use either the ACPI or the DTS resource using the platform driver method. Signed-off-by: Feng Kan <fkan@apm.com> --- drivers/power/reset/xgene-reboot.c | 33 ++++++++++++++++++++++++++++----- 1 files changed, 28 insertions(+), 5 deletions(-)