Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/acpi_support/acpi_asus.c
Show First 20 Lines • Show All 543 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
struct acpi_asus_model *model; | struct acpi_asus_model *model; | ||||
struct acpi_asus_softc *sc; | struct acpi_asus_softc *sc; | ||||
struct sbuf *sb; | struct sbuf *sb; | ||||
ACPI_BUFFER Buf; | ACPI_BUFFER Buf; | ||||
ACPI_OBJECT Arg, *Obj; | ACPI_OBJECT Arg, *Obj; | ||||
ACPI_OBJECT_LIST Args; | ACPI_OBJECT_LIST Args; | ||||
static char *asus_ids[] = { "ATK0100", "ASUS010", NULL }; | static char *asus_ids[] = { "ATK0100", "ASUS010", NULL }; | ||||
int rv; | |||||
char *rstr; | char *rstr; | ||||
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); | ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); | ||||
if (acpi_disabled("asus")) | if (acpi_disabled("asus")) | ||||
return (ENXIO); | return (ENXIO); | ||||
rstr = ACPI_ID_PROBE(device_get_parent(dev), dev, asus_ids); | rv = ACPI_ID_PROBE(device_get_parent(dev), dev, asus_ids, &rstr); | ||||
if (rstr == NULL) { | if (rv > 0) { | ||||
return (ENXIO); | return (rv); | ||||
} | } | ||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
sc->dev = dev; | sc->dev = dev; | ||||
sc->handle = acpi_get_handle(dev); | sc->handle = acpi_get_handle(dev); | ||||
Arg.Type = ACPI_TYPE_INTEGER; | Arg.Type = ACPI_TYPE_INTEGER; | ||||
Arg.Integer.Value = 0; | Arg.Integer.Value = 0; | ||||
Show All 21 Lines | if (ACPI_FAILURE(status)) { | ||||
AcpiOsFree(Buf.Pointer); | AcpiOsFree(Buf.Pointer); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
if (strncmp("ODEM", th.OemTableId, 4) == 0) { | if (strncmp("ODEM", th.OemTableId, 4) == 0) { | ||||
sc->model = &acpi_samsung_models[0]; | sc->model = &acpi_samsung_models[0]; | ||||
device_set_desc(dev, "Samsung P30 Laptop Extras"); | device_set_desc(dev, "Samsung P30 Laptop Extras"); | ||||
AcpiOsFree(Buf.Pointer); | AcpiOsFree(Buf.Pointer); | ||||
return (0); | return (rv); | ||||
} | } | ||||
/* EeePC */ | /* EeePC */ | ||||
if (strncmp("ASUS010", rstr, 7) == 0) { | if (strncmp("ASUS010", rstr, 7) == 0) { | ||||
sc->model = &acpi_eeepc_models[0]; | sc->model = &acpi_eeepc_models[0]; | ||||
device_set_desc(dev, "ASUS EeePC"); | device_set_desc(dev, "ASUS EeePC"); | ||||
AcpiOsFree(Buf.Pointer); | AcpiOsFree(Buf.Pointer); | ||||
return (0); | return (rv); | ||||
} | } | ||||
} | } | ||||
sb = sbuf_new_auto(); | sb = sbuf_new_auto(); | ||||
if (sb == NULL) | if (sb == NULL) | ||||
return (ENOMEM); | return (ENOMEM); | ||||
/* | /* | ||||
* Asus laptops are simply identified by name, easy! | * Asus laptops are simply identified by name, easy! | ||||
*/ | */ | ||||
for (model = acpi_asus_models; model->name != NULL; model++) { | for (model = acpi_asus_models; model->name != NULL; model++) { | ||||
if (strncmp(Obj->String.Pointer, model->name, 3) == 0) { | if (strncmp(Obj->String.Pointer, model->name, 3) == 0) { | ||||
good: | good: | ||||
sbuf_printf(sb, "Asus %s Laptop Extras", | sbuf_printf(sb, "Asus %s Laptop Extras", | ||||
Obj->String.Pointer); | Obj->String.Pointer); | ||||
sbuf_finish(sb); | sbuf_finish(sb); | ||||
sc->model = model; | sc->model = model; | ||||
device_set_desc_copy(dev, sbuf_data(sb)); | device_set_desc_copy(dev, sbuf_data(sb)); | ||||
sbuf_delete(sb); | sbuf_delete(sb); | ||||
AcpiOsFree(Buf.Pointer); | AcpiOsFree(Buf.Pointer); | ||||
return (0); | return (rv); | ||||
} | } | ||||
/* | /* | ||||
* Some models look exactly the same as other models, but have | * Some models look exactly the same as other models, but have | ||||
* their own ids. If we spot these, set them up with the same | * their own ids. If we spot these, set them up with the same | ||||
* details as the models they're like, possibly dealing with | * details as the models they're like, possibly dealing with | ||||
* small differences. | * small differences. | ||||
* | * | ||||
▲ Show 20 Lines • Show All 647 Lines • Show Last 20 Lines |