Esempio n. 1
0
static int
acpi_button_probe(device_t dev)
{
    struct acpi_button_softc *sc;
    char *str;

    if (acpi_disabled("button") ||
	(str = ACPI_ID_PROBE(device_get_parent(dev), dev, btn_ids)) == NULL)
	return (ENXIO);

    sc = device_get_softc(dev);
    if (strcmp(str, "PNP0C0C") == 0) {
	device_set_desc(dev, "Power Button");
	sc->button_type = ACPI_POWER_BUTTON;
    } else if (strcmp(str, "ACPI_FPB") == 0) {
	device_set_desc(dev, "Power Button (fixed)");
	sc->button_type = ACPI_POWER_BUTTON;
	sc->fixed = 1;
    } else if (strcmp(str, "PNP0C0E") == 0) {
	device_set_desc(dev, "Sleep Button");
	sc->button_type = ACPI_SLEEP_BUTTON;
    } else if (strcmp(str, "ACPI_FSB") == 0) {
	device_set_desc(dev, "Sleep Button (fixed)");
	sc->button_type = ACPI_SLEEP_BUTTON;
	sc->fixed = 1;
    }

    return (0);
}
Esempio n. 2
0
static int
vmbus_probe(device_t dev) {
	if (ACPI_ID_PROBE(device_get_parent(dev), dev, vmbus_ids) == NULL ||
	    device_get_unit(dev) != 0)
		return (ENXIO);

	device_set_desc(dev, "Vmbus Devices");

	return (BUS_PROBE_DEFAULT);
}
Esempio n. 3
0
static int
aibs_probe(device_t dev)
{
	if (acpi_disabled("aibs") ||
	    ACPI_ID_PROBE(device_get_parent(dev), dev, aibs_hids) == NULL)
		return ENXIO;

	device_set_desc(dev, "ASUSTeK AI Booster (ACPI ASOC ATK0110)");
	return 0;
}
Esempio n. 4
0
static int
tpm_acpi_probe(device_t dev)
{
	if (ACPI_ID_PROBE(device_get_parent(dev), dev, tpm_ids) != NULL) {
		device_set_desc(dev, "Trusted Platform Module");
		return BUS_PROBE_DEFAULT;
	}
	
	return ENXIO;
}
Esempio n. 5
0
static int
acpi_sony_probe(device_t dev)
{
	int ret = ENXIO;

	if (ACPI_ID_PROBE(device_get_parent(dev), dev, sny_id)) {
		device_set_desc(dev, "Sony notebook controller");
		ret = 0;
	}
	return (ret);
}
Esempio n. 6
0
static int
acpi_lid_probe(device_t dev)
{
    static char *lid_ids[] = { "PNP0C0D", NULL };

    if (acpi_disabled("lid") ||
            ACPI_ID_PROBE(device_get_parent(dev), dev, lid_ids) == NULL)
        return (ENXIO);

    device_set_desc(dev, "Control Method Lid Switch");
    return (0);
}
Esempio n. 7
0
static int
acpi_cmbat_probe(device_t dev)
{
    static char *cmbat_ids[] = { "PNP0C0A", NULL };

    if (acpi_disabled("cmbat") ||
	ACPI_ID_PROBE(device_get_parent(dev), dev, cmbat_ids) == NULL)
	return (ENXIO);

    device_set_desc(dev, "ACPI Control Method Battery");
    return (0);
}
static int
acpi_acad_probe(device_t dev)
{
    static char *acad_ids[] = { "ACPI0003", NULL };

    if (acpi_disabled("acad") ||
	ACPI_ID_PROBE(device_get_parent(dev), dev, acad_ids) == NULL)
	return (ENXIO);

    device_set_desc(dev, "AC Adapter");
    return (0);
}
Esempio n. 9
0
static int
intelspi_probe(device_t dev)
{
	static char *gpio_ids[] = { "80860F0E", NULL };

	if (acpi_disabled("spi") ||
	    ACPI_ID_PROBE(device_get_parent(dev), dev, gpio_ids) == NULL)
	return (ENXIO);

	device_set_desc(dev, "Intel SPI Controller");
	return (0);
}
Esempio n. 10
0
static int
bytgpio_probe(device_t dev)
{
	static char *gpio_ids[] = { "INT33FC", NULL };

	if (acpi_disabled("gpio") ||
	    ACPI_ID_PROBE(device_get_parent(dev), dev, gpio_ids) == NULL)
	return (ENXIO);

	device_set_desc(dev, "Intel Baytrail GPIO Controller");
	return (0);
}
Esempio n. 11
0
static
int
ig4iic_acpi_probe(device_t dev)
{

        if (acpi_disabled("ig4iic") ||
            ACPI_ID_PROBE(device_get_parent(dev), dev, ig4iic_ids) == NULL)
                return (ENXIO);

	device_set_desc(dev, "Intel SoC I2C Controller");

	return (BUS_PROBE_DEFAULT);
}
Esempio n. 12
0
static int
acpi_panasonic_probe(device_t dev)
{
	static char *mat_ids[] = { "MAT0019", NULL };

	if (acpi_disabled("panasonic") ||
	    ACPI_ID_PROBE(device_get_parent(dev), dev, mat_ids) == NULL ||
	    device_get_unit(dev) != 0)
		return (ENXIO);

	device_set_desc(dev, "Panasonic Notebook Hotkeys");
	return (0);
}
Esempio n. 13
0
static int
acpi_sysres_probe(device_t dev)
{
    static char *sysres_ids[] = { "PNP0C01", "PNP0C02", NULL };

    if (acpi_disabled("sysresource") ||
	ACPI_ID_PROBE(device_get_parent(dev), dev, sysres_ids) == NULL)
	return (ENXIO);

    device_set_desc(dev, "System Resource");
    device_quiet(dev);
    return (BUS_PROBE_DEFAULT);
}
Esempio n. 14
0
static int
acpi_syscont_probe(device_t dev)
{
    static char *syscont_ids[] = { "ACPI0004", "PNP0A05", "PNP0A06", NULL };
    int rv;

    if (acpi_disabled("syscontainer"))
	return (ENXIO);
    rv = ACPI_ID_PROBE(device_get_parent(dev), dev, syscont_ids, NULL);
    if (rv <= 0)
	device_set_desc(dev, "System Container");
    return (rv);
}
Esempio n. 15
0
static int
acpi_isab_probe(device_t dev)
{
	static char *isa_ids[] = { "PNP0A05", "PNP0A06", NULL };

	if (acpi_disabled("isab") ||
	    ACPI_ID_PROBE(device_get_parent(dev), dev, isa_ids) == NULL ||
	    devclass_get_device(isab_devclass, 0) != dev)
		return (ENXIO);

	device_set_desc(dev, "ACPI Generic ISA bridge");
	return (0);
}
Esempio n. 16
0
static int
acpi_pcib_acpi_probe(device_t dev)
{
    static char *pcib_ids[] = { "PNP0A03", NULL };

    if (acpi_disabled("pcib") ||
	ACPI_ID_PROBE(device_get_parent(dev), dev, pcib_ids) == NULL)
	return (ENXIO);

    if (pci_cfgregopen() == 0)
	return (ENXIO);
    device_set_desc(dev, "ACPI Host-PCI bridge");
    return (0);
}
Esempio n. 17
0
static int
fdc_acpi_probe(device_t dev)
{
    device_t bus;
    static char *fdc_ids[] = { "PNP0700", "PNP0701", NULL };

    bus = device_get_parent(dev);
    if (ACPI_ID_PROBE(bus, dev, fdc_ids) == NULL)
        return (ENXIO);

    if (ACPI_SUCCESS(ACPI_EVALUATE_OBJECT(bus, dev, "_FDE", NULL, NULL)))
        device_set_desc(dev, "floppy drive controller (FDE)");
    else
        device_set_desc(dev, "floppy drive controller");
    return (0);
}
Esempio n. 18
0
static int
acpi_smbat_probe(device_t dev)
{
	static char *smbat_ids[] = {"ACPI0001", "ACPI0005", NULL};
	ACPI_STATUS status;

	if (acpi_disabled("smbat") ||
	    ACPI_ID_PROBE(device_get_parent(dev), dev, smbat_ids) == NULL)
		return (ENXIO);
	status = AcpiEvaluateObject(acpi_get_handle(dev), "_EC", NULL, NULL);
	if (ACPI_FAILURE(status))
		return (ENXIO);

	device_set_desc(dev, "ACPI Smart Battery");
	return (0);
}
Esempio n. 19
0
static int
acpi_fujitsu_probe(device_t dev)
{
	char *name;
	char buffer[64];

	name = ACPI_ID_PROBE(device_get_parent(dev), dev, fujitsu_ids);
	if (acpi_disabled("fujitsu") || name == NULL ||
	    device_get_unit(dev) > 1)
		return (ENXIO);

	sprintf(buffer, "Fujitsu Function Hotkeys %s", name);
	device_set_desc_copy(dev, buffer);

	return (0);
}
Esempio n. 20
0
int
ipmi_acpi_probe(device_t dev)
{
	static char *ipmi_ids[] = {"IPI0001", NULL};

	if (ipmi_attached)
		return (EBUSY);

	if (acpi_disabled("ipmi") ||
	    ACPI_ID_PROBE(device_get_parent(dev), dev, ipmi_ids) == NULL)
		return (ENXIO);

	device_set_desc(dev, "IPMI System Interface");

	return (0);
}
Esempio n. 21
0
static int
acpi_hpet_probe(device_t dev)
{
	ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__);

	if (acpi_disabled("hpet"))
		return ENXIO;

	if (!DEV_HPET(dev) &&
	    (ACPI_ID_PROBE(device_get_parent(dev), dev, hpet_ids) == NULL ||
	     device_get_unit(dev) != 0))
		return ENXIO;

	device_set_desc(dev, "High Precision Event Timer");
	return 0;
}
Esempio n. 22
0
static int
acpi_pcib_acpi_probe(device_t dev)
{
    int error;

    static char *pcib_ids[] = { "PNP0A03", "PNP0A08", NULL };

    if (acpi_disabled("pcib") ||
	ACPI_ID_PROBE(device_get_parent(dev), dev, pcib_ids) == NULL)
	return (ENXIO);

    error = acpi_pcib_probe(dev);
    if (error)
	return (error);

    device_set_desc(dev, "ACPI Host-PCI bridge");
    return (0);
}
Esempio n. 23
0
static int
acpi_pci_link_probe(device_t dev)
{
	char descr[28], name[12];

	/*
	 * We explicitly do not check _STA since not all systems set it to
	 * sensible values.
	 */
	if (acpi_disabled("pci_link") ||
	    ACPI_ID_PROBE(device_get_parent(dev), dev, pci_link_ids) == NULL)
		return (ENXIO);

	if (ACPI_SUCCESS(acpi_short_name(acpi_get_handle(dev), name,
	    sizeof(name)))) {
		snprintf(descr, sizeof(descr), "ACPI PCI Link %s", name);
		device_set_desc_copy(dev, descr);
	} else
		device_set_desc(dev, "ACPI PCI Link");
	device_quiet(dev);
	return (0);
}
Esempio n. 24
0
static int
acpi_ec_probe(device_t dev)
{
    ACPI_BUFFER buf;
    ACPI_HANDLE h;
    ACPI_OBJECT *obj;
    ACPI_STATUS status;
    device_t	peer;
    char	desc[64];
    int		ecdt;
    int		ret;
    struct acpi_ec_params *params;
    static char *ec_ids[] = { "PNP0C09", NULL };

    /* Check that this is a device and that EC is not disabled. */
    if (acpi_get_type(dev) != ACPI_TYPE_DEVICE || acpi_disabled("ec"))
	return (ENXIO);

    /*
     * If probed via ECDT, set description and continue.  Otherwise,
     * we can access the namespace and make sure this is not a
     * duplicate probe.
     */
    ret = ENXIO;
    ecdt = 0;
    buf.Pointer = NULL;
    buf.Length = ACPI_ALLOCATE_BUFFER;
    params = acpi_get_private(dev);
    if (params != NULL) {
	ecdt = 1;
	ret = 0;
    } else if (ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids)) {
	params = kmalloc(sizeof(struct acpi_ec_params), M_TEMP,
			M_WAITOK | M_ZERO);
	h = acpi_get_handle(dev);

	/*
	 * Read the unit ID to check for duplicate attach and the
	 * global lock value to see if we should acquire it when
	 * accessing the EC.
	 */
	status = acpi_GetInteger(h, "_UID", &params->uid);
	if (ACPI_FAILURE(status))
	    params->uid = 0;
	status = acpi_GetInteger(h, "_GLK", &params->glk);
	if (ACPI_FAILURE(status))
	    params->glk = 0;

	/*
	 * Evaluate the _GPE method to find the GPE bit used by the EC to
	 * signal status (SCI).  If it's a package, it contains a reference
	 * and GPE bit, similar to _PRW.
	 */
	status = AcpiEvaluateObject(h, "_GPE", NULL, &buf);
	if (ACPI_FAILURE(status)) {
	    device_printf(dev, "can't evaluate _GPE - %s\n",
			  AcpiFormatException(status));
	    goto out;
	}
	obj = (ACPI_OBJECT *)buf.Pointer;
	if (obj == NULL)
	    goto out;

	switch (obj->Type) {
	case ACPI_TYPE_INTEGER:
	    params->gpe_handle = NULL;
	    params->gpe_bit = obj->Integer.Value;
	    break;
	case ACPI_TYPE_PACKAGE:
	    if (!ACPI_PKG_VALID(obj, 2))
		goto out;
	    params->gpe_handle =
		acpi_GetReference(NULL, &obj->Package.Elements[0]);
	    if (params->gpe_handle == NULL ||
		acpi_PkgInt32(obj, 1, &params->gpe_bit) != 0)
		goto out;
	    break;
	default:
	    device_printf(dev, "_GPE has invalid type %d\n", obj->Type);
	    goto out;
	}

	/* Store the values we got from the namespace for attach. */
	acpi_set_private(dev, params);

	/*
	 * Check for a duplicate probe.  This can happen when a probe
	 * via ECDT succeeded already.  If this is a duplicate, disable
	 * this device.
	 */
	peer = devclass_get_device(acpi_ec_devclass, params->uid);
	if (peer == NULL || !device_is_alive(peer))
	    ret = 0;
	else
	    device_disable(dev);
    }

out:
    if (ret == 0) {
	ksnprintf(desc, sizeof(desc), "Embedded Controller: GPE %#x%s%s",
		 params->gpe_bit, (params->glk) ? ", GLK" : "",
		 ecdt ? ", ECDT" : "");
	device_set_desc_copy(dev, desc);
    }

    if (ret > 0 && params)
	kfree(params, M_TEMP);
    if (buf.Pointer)
	AcpiOsFree(buf.Pointer);
    return (ret);
}