示例#1
0
int
toshiba_get_brightness(struct acpitoshiba_softc *sc, u_int32_t *brightness)
{
	struct aml_value args[HCI_WORDS];
	struct aml_value res;
	int i;

	bzero(args, sizeof(args));
	bzero(&res, sizeof(res));

	for (i = 0; i < HCI_WORDS; ++i)
		args[i].type = AML_OBJTYPE_INTEGER;

	args[HCI_REG_AX].v_integer = HCI_GET;
	args[HCI_REG_BX].v_integer = HCI_REG_LCD_BRIGHTNESS;

	if (aml_evalname(sc->sc_acpi, sc->sc_devnode, METHOD_HCI,
	    i, args, &res)) {
		printf("%s: get brightness failed\n", DEVNAME(sc));
		return (HCI_FAILURE);
	}

	/*
	 * We receive a package type so we need to get the event
	 * value from the HCI_REG_CX.
	 */
	*brightness = aml_val2int(res.v_package[HCI_REG_CX]);

	*brightness >>= HCI_LCD_BRIGHTNESS_SHIFT;

	aml_freevalue(&res);

	return (HCI_SUCCESS);
}
示例#2
0
int
toshiba_read_events(struct acpitoshiba_softc *sc)
{
	struct aml_value args[HCI_WORDS];
	struct aml_value res;
	int i, val;

	bzero(args, sizeof(args));
	bzero(&res, sizeof(res));

	for (i = 0; i < HCI_WORDS; ++i)
		args[i].type = AML_OBJTYPE_INTEGER;

	args[HCI_REG_AX].v_integer = HCI_GET;
	args[HCI_REG_BX].v_integer = HCI_REG_SYSTEM_EVENT;

	if (aml_evalname(sc->sc_acpi, sc->sc_devnode, METHOD_HCI,
		    i, args, &res)) {
		printf("%s: couldn't toggle METHOD_HCI\n", DEVNAME(sc));
		return (HCI_FAILURE);
	}

	/*
	 * We receive a package type so we need to get the event
	 * value from the HCI_REG_CX.
	 */
	val = aml_val2int(res.v_package[HCI_REG_CX]);
	aml_freevalue(&res);

	return (val);
}
示例#3
0
int
toshiba_get_video_output(struct acpitoshiba_softc *sc, u_int32_t *video_output)
{
	struct aml_value res, args[HCI_WORDS];
	int i;

	bzero(args, sizeof(args));
	bzero(&res, sizeof(res));

	for (i = 0; i < HCI_WORDS; ++i)
		args[i].type = AML_OBJTYPE_INTEGER;

	args[HCI_REG_AX].v_integer = HCI_GET;
	args[HCI_REG_BX].v_integer = HCI_REG_VIDEO_OUTPUT;

	if (aml_evalname(sc->sc_acpi, sc->sc_devnode, METHOD_HCI,
	    i, args, &res)) {
		printf("%s: get video output failed\n", DEVNAME(sc));
		return (HCI_FAILURE);
	}

	/*
	 * We receive a package type so we need to get the event
	 * value from the HCI_REG_CX.
	 */
	*video_output = aml_val2int(res.v_package[HCI_REG_CX]);

	*video_output &= 0xff;

	aml_freevalue(&res);

	return (HCI_SUCCESS);
}
示例#4
0
int
acpisony_get_brightness(struct acpisony_softc *sc)
{
	struct aml_value res;
	int val;

	aml_evalname(sc->sc_acpi, sc->sc_devnode, "GBRT", 0, NULL, &res);
	val = aml_val2int(&res);
	aml_freevalue(&res);

	return val;
}
示例#5
0
int
acpibat_getbst(struct acpibat_softc *sc)
{
	struct aml_value	res;
	int			rv = EINVAL;

	if (!sc->sc_bat_present) {
		memset(&sc->sc_bst, 0, sizeof(sc->sc_bst));
		return (0);
	}

	if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_BST", 0, NULL, &res)) {
		dnprintf(10, "%s: no _BST\n", DEVNAME(sc));
		goto out;
	}

	if (res.length != 4) {
		dnprintf(10, "%s: invalid _BST, battery status not saved\n",
		    DEVNAME(sc));
		goto out;
	}

	sc->sc_bst.bst_state = aml_val2int(res.v_package[0]);
	sc->sc_bst.bst_rate = aml_val2int(res.v_package[1]);
	sc->sc_bst.bst_capacity = aml_val2int(res.v_package[2]);
	sc->sc_bst.bst_voltage = aml_val2int(res.v_package[3]);

	dnprintf(60, "state: %u rate: %u cap: %u volt: %u ",
	    sc->sc_bst.bst_state,
	    sc->sc_bst.bst_rate,
	    sc->sc_bst.bst_capacity,
	    sc->sc_bst.bst_voltage);

	rv = 0;
out:
	aml_freevalue(&res);
	return (rv);
}
示例#6
0
void
acpivideo_set_policy(struct acpivideo_softc *sc, int policy)
{
	struct aml_value args, res;

	memset(&args, 0, sizeof(args));
	args.v_integer = policy;
	args.type = AML_OBJTYPE_INTEGER;

	aml_evalname(sc->sc_acpi, sc->sc_devnode, "_DOS", 1, &args, &res);
	DPRINTF(("%s: set policy to %X\n", DEVNAME(sc), aml_val2int(&res)));

	aml_freevalue(&res);
}
示例#7
0
int
acpitz_getreading(struct acpitz_softc *sc, char *name)
{
	struct aml_value	res;
	int			rv = -1;

	if (aml_evalname(sc->sc_acpi, sc->sc_devnode, name, 0, NULL, &res)) {
		dnprintf(10, "%s: no %s\n", DEVNAME(sc), name);
		goto out;
	}
	rv = aml_val2int(&res);
 out:
	aml_freevalue(&res);
	return (rv);
}
示例#8
0
int
acpivout_get_brightness(struct acpivout_softc *sc)
{
    struct aml_value res;
    int level;

    aml_evalname(sc->sc_acpi, sc->sc_devnode, "_BQC", 0, NULL, &res);
    level = aml_val2int(&res);
    aml_freevalue(&res);
    DPRINTF(("%s: BQC = %d\n", DEVNAME(sc), level));

    if (level < sc->sc_bcl[0] || level > sc->sc_bcl[sc->sc_bcl_len -1])
        level = -1;

    return (level);
}
示例#9
0
int
acpisony_find_offset(struct acpisony_softc *sc, int key)
{
	struct aml_value arg, res;
	int val;

	bzero(&arg, sizeof(arg));
	arg.type = AML_OBJTYPE_INTEGER;

	for (arg.v_integer = 0x20; arg.v_integer < 0x30; arg.v_integer++) {
		aml_evalname(sc->sc_acpi, sc->sc_devnode, "SN00", 1, &arg, &res);
		val = aml_val2int(&res);
		aml_freevalue(&res);
		if (val == key) {
			DPRINTF(("Matched key %X\n", val));
			return arg.v_integer - 0x20;
		}
	}

	return -1;
}
示例#10
0
int
acpisony_set_hotkey(struct acpisony_softc *sc, int key, int val)
{
	int off, rc = -1;
	struct aml_value res, arg;

	bzero(&arg, sizeof(arg));
	arg.type = AML_OBJTYPE_INTEGER;

	off = acpisony_find_offset(sc, key);
	DPRINTF(("off = %X\n", off));
	if (off < 0)
		return rc;

	arg.v_integer = off | val;
	aml_evalname(sc->sc_acpi, sc->sc_devnode, "SN07", 1, &arg, &res);
	rc = aml_val2int(&res);
	aml_freevalue(&res);

	return rc;
}
示例#11
0
void
acpivout_get_bcl(struct acpivout_softc *sc)
{
    int	i, j, value;
    struct aml_value res;

    DPRINTF(("Getting _BCL!"));
    aml_evalname(sc->sc_acpi, sc->sc_devnode, "_BCL", 0, NULL, &res);
    if (res.type != AML_OBJTYPE_PACKAGE) {
        sc->sc_bcl_len = 0;
        goto err;
    }
    /*
     * Per the ACPI spec section B.6.2 the _BCL method returns a package.
     * The first integer in the package is the brightness level
     * when the computer has full power, and the second is the
     * brightness level when the computer is on batteries.
     * All other levels may be used by OSPM.
     * So we skip the first two integers in the package.
     */
    if (res.length <= 2) {
        sc->sc_bcl_len = 0;
        goto err;
    }
    sc->sc_bcl_len = res.length - 2;

    sc->sc_bcl = mallocarray(sc->sc_bcl_len, sizeof(int), M_DEVBUF,
                             M_WAITOK | M_ZERO);

    for (i = 0; i < sc->sc_bcl_len; i++) {
        /* Sort darkest to brightest */
        value = aml_val2int(res.v_package[i + 2]);
        for (j = i; j > 0 && sc->sc_bcl[j - 1] > value; j--)
            sc->sc_bcl[j] = sc->sc_bcl[j - 1];
        sc->sc_bcl[j] = value;
    }

err:
    aml_freevalue(&res);
}
示例#12
0
int
acpicpu_getpss(struct acpicpu_softc *sc)
{
    struct aml_value	res;
    int			i;

    if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_PSS", 0, NULL, &res)) {
        dnprintf(20, "%s: no _PSS\n", DEVNAME(sc));
        return (1);
    }

    if (sc->sc_pss)
        free(sc->sc_pss, M_DEVBUF);

    sc->sc_pss = malloc(res.length * sizeof *sc->sc_pss, M_DEVBUF,
                        M_WAITOK);

    memset(sc->sc_pss, 0, res.length * sizeof *sc->sc_pss);

    for (i = 0; i < res.length; i++) {
        sc->sc_pss[i].pss_core_freq = aml_val2int(
                                          res.v_package[i]->v_package[0]);
        sc->sc_pss[i].pss_power = aml_val2int(
                                      res.v_package[i]->v_package[1]);
        sc->sc_pss[i].pss_trans_latency = aml_val2int(
                                              res.v_package[i]->v_package[2]);
        sc->sc_pss[i].pss_bus_latency = aml_val2int(
                                            res.v_package[i]->v_package[3]);
        sc->sc_pss[i].pss_ctrl = aml_val2int(
                                     res.v_package[i]->v_package[4]);
        sc->sc_pss[i].pss_status = aml_val2int(
                                       res.v_package[i]->v_package[5]);
    }
    aml_freevalue(&res);

    sc->sc_pss_len = res.length;

    return (0);
}
示例#13
0
void
acpiprt_prt_add(struct acpiprt_softc *sc, struct aml_value *v)
{
	struct aml_node	*node;
	struct aml_value res, *pp;
	u_int64_t addr;
	int pin, irq, sta;
#if NIOAPIC > 0
	struct mp_intr_map *map;
	struct ioapic_softc *apic;
#endif
	pci_chipset_tag_t pc = NULL;
	pcitag_t tag;
	pcireg_t reg;
	int bus, dev, func, nfuncs;

	if (v->type != AML_OBJTYPE_PACKAGE || v->length != 4) {
		printf("invalid mapping object\n");
		return;
	}

	addr = aml_val2int(v->v_package[0]);
	pin = aml_val2int(v->v_package[1]);
	if (pin > 3) {
		return;
	}

	pp = v->v_package[2];
	if (pp->type == AML_OBJTYPE_NAMEREF) {
		node = aml_searchname(sc->sc_devnode, pp->v_nameref);
		if (node == NULL) {
			printf("Invalid device!\n");
			return;
		}
		pp = node->value;
	}
	if (pp->type == AML_OBJTYPE_OBJREF) {
		pp = pp->v_objref.ref;
	}
	if (pp->type == AML_OBJTYPE_DEVICE) {
		node = pp->node;
		if (aml_evalname(sc->sc_acpi, node, "_STA", 0, NULL, &res))
			printf("no _STA method\n");

		sta = aml_val2int(&res) & STA_ENABLED;
		aml_freevalue(&res);
		if (sta == 0)
			return;

		if (aml_evalname(sc->sc_acpi, node, "_CRS", 0, NULL, &res))
			printf("no _CRS method\n");

		if (res.type != AML_OBJTYPE_BUFFER || res.length < 6) {
			printf("invalid _CRS object\n");
			aml_freevalue(&res);
			return;
		}
		aml_parse_resource(res.length, res.v_buffer,
		    acpiprt_getirq, &irq);
		aml_freevalue(&res);
	} else {
		irq = aml_val2int(v->v_package[3]);
	}

#ifdef ACPI_DEBUG
	printf("%s: %s addr 0x%llx pin %d irq %d\n",
	    DEVNAME(sc), aml_nodename(pp->node), addr, pin, irq);
#endif

#if NIOAPIC > 0
	if (nioapics > 0) {
		apic = ioapic_find_bybase(irq);
		if (apic == NULL) {
			printf("%s: no apic found for irq %d\n", DEVNAME(sc), irq);
			return;
		}

		map = malloc(sizeof (struct mp_intr_map), M_DEVBUF, M_NOWAIT);
		if (map == NULL)
			return;

		memset(map, 0, sizeof *map);
		map->ioapic = apic;
		map->ioapic_pin = irq - apic->sc_apic_vecbase;
		map->bus_pin = ((addr >> 14) & 0x7c) | (pin & 0x3);
		map->redir = IOAPIC_REDLO_ACTLO | IOAPIC_REDLO_LEVEL;
		map->redir |= (IOAPIC_REDLO_DEL_LOPRI << IOAPIC_REDLO_DEL_SHIFT);

		map->ioapic_ih = APIC_INT_VIA_APIC |
		    ((apic->sc_apicid << APIC_INT_APIC_SHIFT) |
		    (map->ioapic_pin << APIC_INT_PIN_SHIFT));

		apic->sc_pins[map->ioapic_pin].ip_map = map;

		map->next = mp_busses[sc->sc_bus].mb_intrs;
		mp_busses[sc->sc_bus].mb_intrs = map;

		return;
	}
示例#14
0
int
acpicpu_getpct(struct acpicpu_softc *sc)
{
    struct aml_value	res;
    int			rv = 1;

    if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_PPC", 0, NULL, &res)) {
        dnprintf(20, "%s: no _PPC\n", DEVNAME(sc));
        printf("%s: no _PPC\n", DEVNAME(sc));
        return (1);
    }

    dnprintf(10, "_PPC: %d\n", aml_val2int(&res));
    aml_freevalue(&res);

    if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_PCT", 0, NULL, &res)) {
        printf("%s: no _PCT\n", DEVNAME(sc));
        return (1);
    }

    if (res.length != 2) {
        printf("%s: %s: invalid _PCT length\n", DEVNAME(sc),
               sc->sc_devnode->name);
        return (1);
    }

    memcpy(&sc->sc_pct.pct_ctrl, res.v_package[0]->v_buffer,
           sizeof sc->sc_pct.pct_ctrl);
    if (sc->sc_pct.pct_ctrl.grd_gas.address_space_id ==
            GAS_FUNCTIONAL_FIXED) {
        printf("CTRL GASIO is CPU manufacturer overridden\n");
        goto bad;
    }

    memcpy(&sc->sc_pct.pct_status, res.v_package[1]->v_buffer,
           sizeof sc->sc_pct.pct_status);
    if (sc->sc_pct.pct_status.grd_gas.address_space_id ==
            GAS_FUNCTIONAL_FIXED) {
        printf("STATUS GASIO is CPU manufacturer overridden\n");
        goto bad;
    }

    dnprintf(10, "_PCT(ctrl)  : %02x %04x %02x %02x %02x %02x %016x\n",
             sc->sc_pct.pct_ctrl.grd_descriptor,
             sc->sc_pct.pct_ctrl.grd_length,
             sc->sc_pct.pct_ctrl.grd_gas.address_space_id,
             sc->sc_pct.pct_ctrl.grd_gas.register_bit_width,
             sc->sc_pct.pct_ctrl.grd_gas.register_bit_offset,
             sc->sc_pct.pct_ctrl.grd_gas.access_size,
             sc->sc_pct.pct_ctrl.grd_gas.address);

    dnprintf(10, "_PCT(status): %02x %04x %02x %02x %02x %02x %016x\n",
             sc->sc_pct.pct_status.grd_descriptor,
             sc->sc_pct.pct_status.grd_length,
             sc->sc_pct.pct_status.grd_gas.address_space_id,
             sc->sc_pct.pct_status.grd_gas.register_bit_width,
             sc->sc_pct.pct_status.grd_gas.register_bit_offset,
             sc->sc_pct.pct_status.grd_gas.access_size,
             sc->sc_pct.pct_status.grd_gas.address);

    rv = 0;
bad:
    aml_freevalue(&res);
    return (rv);
}
示例#15
0
int
acpibat_getbif(struct acpibat_softc *sc)
{
	struct aml_value	res;
	int			rv = EINVAL;

	if (!sc->sc_bat_present) {
		memset(&sc->sc_bif, 0, sizeof(sc->sc_bif));
		return (0);
	}

	if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_BIF", 0, NULL, &res)) {
		dnprintf(10, "%s: no _BIF\n", DEVNAME(sc));
		goto out;
	}

	if (res.length != 13) {
		dnprintf(10, "%s: invalid _BIF, battery info not saved\n",
		    DEVNAME(sc));
		goto out;
	}

	sc->sc_bif.bif_power_unit = aml_val2int(res.v_package[0]);
	sc->sc_bif.bif_capacity = aml_val2int(res.v_package[1]);
	sc->sc_bif.bif_last_capacity = aml_val2int(res.v_package[2]);
	sc->sc_bif.bif_technology = aml_val2int(res.v_package[3]);
	sc->sc_bif.bif_voltage = aml_val2int(res.v_package[4]);
	sc->sc_bif.bif_warning = aml_val2int(res.v_package[5]);
	sc->sc_bif.bif_low = aml_val2int(res.v_package[6]);
	sc->sc_bif.bif_cap_granu1 = aml_val2int(res.v_package[7]);
	sc->sc_bif.bif_cap_granu2 = aml_val2int(res.v_package[8]);

	strlcpy(sc->sc_bif.bif_model, aml_val_to_string(res.v_package[9]),
		sizeof(sc->sc_bif.bif_model));
	strlcpy(sc->sc_bif.bif_serial, aml_val_to_string(res.v_package[10]),
		sizeof(sc->sc_bif.bif_serial));
	strlcpy(sc->sc_bif.bif_type, aml_val_to_string(res.v_package[11]),
		sizeof(sc->sc_bif.bif_type));
	strlcpy(sc->sc_bif.bif_oem, aml_val_to_string(res.v_package[12]),
		sizeof(sc->sc_bif.bif_oem));

	dnprintf(60, "power_unit: %u capacity: %u last_cap: %u tech: %u "
	    "volt: %u warn: %u low: %u gran1: %u gran2: %d model: %s "
	    "serial: %s type: %s oem: %s\n",
	    sc->sc_bif.bif_power_unit,
	    sc->sc_bif.bif_capacity,
	    sc->sc_bif.bif_last_capacity,
	    sc->sc_bif.bif_technology,
	    sc->sc_bif.bif_voltage,
	    sc->sc_bif.bif_warning,
	    sc->sc_bif.bif_low,
	    sc->sc_bif.bif_cap_granu1,
	    sc->sc_bif.bif_cap_granu2,
	    sc->sc_bif.bif_model,
	    sc->sc_bif.bif_serial,
	    sc->sc_bif.bif_type,
	    sc->sc_bif.bif_oem);

	rv = 0;
out:
	aml_freevalue(&res);
	return (rv);
}
示例#16
0
int
acpitz_setfan(struct acpitz_softc *sc, int i, char *method)
{
	struct aml_value	res0, res1, res2, *ref;
	char			name[8];
	int			rv = 1, x, y;

	dnprintf(20, "%s: acpitz_setfan(%d, %s)\n", DEVNAME(sc), i, method);

	snprintf(name, sizeof name, "_AL%d", i);
	if (aml_evalname(sc->sc_acpi, sc->sc_devnode, name, 0, NULL, &res0)) {
		dnprintf(20, "%s: %s failed\n", DEVNAME(sc), name);
		goto out;
	}

	if (res0.type != AML_OBJTYPE_PACKAGE) {
		printf("%s: %s not a package\n", DEVNAME(sc), name);
		goto out;
	}

	for (x = 0; x < res0.length; x++) {
		if (res0.v_package[x]->type != AML_OBJTYPE_OBJREF) {
			printf("%s: %s[%d] not a object ref\n", DEVNAME(sc),
			    name, x);
			continue;
		}
		ref = res0.v_package[x]->v_objref.ref;
		if (aml_evalname(sc->sc_acpi, ref->node, "_PR0",0 , NULL,
		    &res1)) {
			printf("%s: %s[%d] _PR0 failed\n", DEVNAME(sc),
			    name, x);
			aml_freevalue(&res1);
			continue;
		}
		if (res1.type != AML_OBJTYPE_PACKAGE) {
			printf("%s: %s[%d] _PR0 not a package\n", DEVNAME(sc),
			    name, x);
			aml_freevalue(&res1);
			continue;
		}
		for (y = 0; y < res1.length; y++) {
			if (res1.v_package[y]->type != AML_OBJTYPE_OBJREF) {
				printf("%s: %s[%d.%d] _PR0 not a package\n",
				    DEVNAME(sc), name, x, y);
				continue;
			}
			ref = res1.v_package[y]->v_objref.ref;
			if (aml_evalname(sc->sc_acpi, ref->node, method, 0,
			    NULL, NULL))
				printf("%s: %s[%d.%d] %s fails\n",
				    DEVNAME(sc), name, x, y, method);

			/* save off status of fan */
			if (aml_evalname(sc->sc_acpi, ref->node, "_STA", 0,
			    NULL, &res2))
				printf("%s: %s[%d.%d] _STA fails\n",
				    DEVNAME(sc), name, x, y);
			else {
				sc->sc_ac_stat[i] = aml_val2int(&res2);
				aml_freevalue(&res2);
			}
		}
		aml_freevalue(&res1);
	}
	rv = 0;
out:
	aml_freevalue(&res0);
	return (rv);
}
示例#17
0
int
acpiec_getcrs(struct acpiec_softc *sc, struct acpi_attach_args *aa)
{
	struct aml_value	res;
	bus_size_t		ec_sc, ec_data;
	int			type1, type2;
	char			*buf;
	int			size, ret;

	if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_GPE", 0, NULL, &res)) {
		dnprintf(10, "%s: no _GPE\n", DEVNAME(sc));
		return (1);
	}

	sc->sc_gpe = aml_val2int(&res);
	aml_freevalue(&res);

	if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_CRS", 0, NULL, &res)) {
		dnprintf(10, "%s: no _CRS\n", DEVNAME(sc));
		return (1);
	}

	/* Parse CRS to get control and data registers */

	if (res.type != AML_OBJTYPE_BUFFER) {
		dnprintf(10, "%s: unknown _CRS type %d\n",
		    DEVNAME(sc), res.type);
		aml_freevalue(&res);
		return (1);
	}

	size = res.length;
	buf = res.v_buffer;

	ret = acpiec_getregister(buf, size, &type1, &ec_data);
	if (ret <= 0) {
		dnprintf(10, "%s: failed to read DATA from _CRS\n",
		    DEVNAME(sc));
		aml_freevalue(&res);
		return (1);
	}

	buf += ret;
	size -= ret;

	ret = acpiec_getregister(buf, size, &type2,  &ec_sc);
	if (ret <= 0) {
		dnprintf(10, "%s: failed to read S/C from _CRS\n",
		    DEVNAME(sc));
		aml_freevalue(&res);
		return (1);
	}

	buf += ret;
	size -= ret;

	if (size != 2 || *buf != RES_TYPE_ENDTAG) {
		dnprintf(10, "%s: no _CRS end tag\n", DEVNAME(sc));
		aml_freevalue(&res);
		return (1);
	}
	aml_freevalue(&res);

	/* XXX: todo - validate _CRS checksum? */

	dnprintf(10, "%s: Data: 0x%x, S/C: 0x%x\n",
	    DEVNAME(sc), ec_data, ec_sc);

	if (type1 == GAS_SYSTEM_IOSPACE)
		sc->sc_cmd_bt = aa->aaa_iot;
	else
		sc->sc_cmd_bt = aa->aaa_memt;

	if (bus_space_map(sc->sc_cmd_bt, ec_sc, 1, 0, &sc->sc_cmd_bh)) {
		dnprintf(10, "%s: failed to map S/C reg.\n", DEVNAME(sc));
		return (1);
	}

	if (type2 == GAS_SYSTEM_IOSPACE)
		sc->sc_data_bt = aa->aaa_iot;
	else
		sc->sc_data_bt = aa->aaa_memt;

	if (bus_space_map(sc->sc_data_bt, ec_data, 1, 0, &sc->sc_data_bh)) {
		dnprintf(10, "%s: failed to map DATA reg.\n", DEVNAME(sc));
		bus_space_unmap(sc->sc_cmd_bt, sc->sc_cmd_bh, 1);
		return (1);
	}

	return (0);
}