Skip to content

Commit

Permalink
ACPI / nouveau: fix probing regression related to _DSM
Browse files Browse the repository at this point in the history
Fix regression caused by commit b072e53, which breaks loading nouveau
driver on optimus laptops.

On some platforms, ACPI _DSM method (nouveau_op_dsm_muid, function 0)
has special requirements on the fourth parameter, which is different
from ACPI specifications. So revert to the private implementation
to check availability of _DSM functions instead of using common
acpi_check_dsm() interface.

Fixes: b072e53 (ACPI / nouveau: replace open-coded _DSM code with helper functions)
Reported-and-tested-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
[rjw: Subject]
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Jiang Liu authored and Rafael J. Wysocki committed Feb 20, 2014
1 parent 6d0abec commit e284175
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions drivers/gpu/drm/nouveau/nouveau_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,29 @@ static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t *
return 0;
}

/*
* On some platforms, _DSM(nouveau_op_dsm_muid, func0) has special
* requirements on the fourth parameter, so a private implementation
* instead of using acpi_check_dsm().
*/
static int nouveau_check_optimus_dsm(acpi_handle handle)
{
int result;

/*
* Function 0 returns a Buffer containing available functions.
* The args parameter is ignored for function 0, so just put 0 in it
*/
if (nouveau_optimus_dsm(handle, 0, 0, &result))
return 0;

/*
* ACPI Spec v4 9.14.1: if bit 0 is zero, no function is supported.
* If the n-th bit is enabled, function n is supported
*/
return result & 1 && result & (1 << NOUVEAU_DSM_OPTIMUS_CAPS);
}

static int nouveau_dsm(acpi_handle handle, int func, int arg)
{
int ret = 0;
Expand Down Expand Up @@ -207,8 +230,7 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev)
1 << NOUVEAU_DSM_POWER))
retval |= NOUVEAU_DSM_HAS_MUX;

if (acpi_check_dsm(dhandle, nouveau_op_dsm_muid, 0x00000100,
1 << NOUVEAU_DSM_OPTIMUS_CAPS))
if (nouveau_check_optimus_dsm(dhandle))
retval |= NOUVEAU_DSM_HAS_OPT;

if (retval & NOUVEAU_DSM_HAS_OPT) {
Expand Down

0 comments on commit e284175

Please sign in to comment.