In case the DSDT provides interfaces for both a Smart Battery and a normal one, probe for acpisbs first, if it attaches, make acpibat not match.
Index: dev/acpi/acpi.c =================================================================== RCS file: /cvs/src/sys/dev/acpi/acpi.c,v retrieving revision 1.323 diff -u -p -u -p -r1.323 acpi.c --- dev/acpi/acpi.c 2 Mar 2017 10:38:10 -0000 1.323 +++ dev/acpi/acpi.c 7 Mar 2017 02:34:37 -0000 @@ -116,6 +116,7 @@ void acpi_enable_wakegpes(struct acpi_so int acpi_foundec(struct aml_node *, void *); int acpi_foundsony(struct aml_node *node, void *arg); int acpi_foundhid(struct aml_node *, void *); +int acpi_foundsbs(struct aml_node *node, void *); int acpi_add_device(struct aml_node *node, void *arg); void acpi_thread(void *); @@ -1082,6 +1083,9 @@ acpi_attach(struct device *parent, struc aml_walknodes(&aml_root, AML_WALK_PRE, acpi_add_device, sc); + /* try to find smart battery first */ + aml_find_node(&aml_root, "_HID", acpi_foundsbs, sc); + /* attach battery, power supply and button devices */ aml_find_node(&aml_root, "_HID", acpi_foundhid, sc); @@ -2911,6 +2915,45 @@ acpi_foundvideo(struct aml_node *node, v return (0); } + +int +acpi_foundsbs(struct aml_node *node, void *arg) +{ + struct acpi_softc *sc = (struct acpi_softc *)arg; + struct device *self = (struct device *)arg; + char cdev[32], dev[32]; + struct acpi_attach_args aaa; + int64_t sta; + + if (acpi_parsehid(node, arg, cdev, dev, sizeof(dev)) != 0) + return (0); + + if (aml_evalinteger(sc, node->parent, "_STA", 0, NULL, &sta)) + sta = STA_PRESENT | STA_ENABLED | STA_DEV_OK | 0x1000; + + if ((sta & STA_PRESENT) == 0) + return (0); + + acpi_attach_deps(sc, node->parent); + + if (strcmp(dev, ACPI_DEV_SBS) != 0) + return (0); + + if (node->parent->attached) + return (0); + + memset(&aaa, 0, sizeof(aaa)); + aaa.aaa_iot = sc->sc_iot; + aaa.aaa_memt = sc->sc_memt; + aaa.aaa_node = node->parent; + aaa.aaa_dev = dev; + + config_found(self, &aaa, acpi_print); + node->parent->attached = 1; + + return (0); +} + int acpiopen(dev_t dev, int flag, int mode, struct proc *p) Index: dev/acpi/acpibat.c =================================================================== RCS file: /cvs/src/sys/dev/acpi/acpibat.c,v retrieving revision 1.62 diff -u -p -u -p -r1.62 acpibat.c --- dev/acpi/acpibat.c 14 Mar 2015 03:38:46 -0000 1.62 +++ dev/acpi/acpibat.c 7 Mar 2017 02:34:37 -0000 @@ -54,6 +54,9 @@ acpibat_match(struct device *parent, voi struct acpi_attach_args *aa = aux; struct cfdata *cf = match; + if (((struct acpi_softc *)parent)->sc_havesbs) + return (0); + /* sanity */ return (acpi_matchhids(aa, acpibat_hids, cf->cf_driver->cd_name)); } Index: dev/acpi/acpireg.h =================================================================== RCS file: /cvs/src/sys/dev/acpi/acpireg.h,v retrieving revision 1.38 diff -u -p -u -p -r1.38 acpireg.h --- dev/acpi/acpireg.h 25 Feb 2017 20:09:20 -0000 1.38 +++ dev/acpi/acpireg.h 7 Mar 2017 02:34:37 -0000 @@ -748,10 +748,10 @@ struct acpi_ivrs { #define ACPI_DEV_MEMD "PNP0C80" /* Memory Device */ #define ACPI_DEV_MOUSE "PNP0F13" /* PS/2 Mouse */ #define ACPI_DEV_SHC "ACPI0001" /* SMBus 1.0 Host Controller */ -#define ACPI_DEV_SMS1 "ACPI0002" /* Smart Battery Subsystem */ +#define ACPI_DEV_SBS "ACPI0002" /* Smart Battery Subsystem */ #define ACPI_DEV_AC "ACPI0003" /* AC Device */ #define ACPI_DEV_MD "ACPI0004" /* Module Device */ -#define ACPI_DEV_SMS2 "ACPI0005" /* SMBus 2.0 Host Controller */ +#define ACPI_DEV_SMBUS "ACPI0005" /* SMBus 2.0 Host Controller */ #define ACPI_DEV_GBD "ACPI0006" /* GPE Block Device */ #define ACPI_DEV_PD "ACPI0007" /* Processor Device */ #define ACPI_DEV_ALSD "ACPI0008" /* Ambient Light Sensor Device */ Index: dev/acpi/acpisbs.c =================================================================== RCS file: /cvs/src/sys/dev/acpi/acpisbs.c,v retrieving revision 1.3 diff -u -p -u -p -r1.3 acpisbs.c --- dev/acpi/acpisbs.c 7 Mar 2017 02:27:02 -0000 1.3 +++ dev/acpi/acpisbs.c 7 Mar 2017 02:34:37 -0000 @@ -144,7 +144,7 @@ struct cfdriver acpisbs_cd = { }; const char *acpisbs_hids[] = { - "ACPI0002", + ACPI_DEV_SBS, NULL }; @@ -211,6 +211,8 @@ acpisbs_attach(struct device *parent, st aml_register_notify(sc->sc_devnode, aa->aaa_dev, acpisbs_notify, sc, ACPIDEV_POLL); + + sc->sc_acpi->sc_havesbs = 1; } void Index: dev/acpi/acpivar.h =================================================================== RCS file: /cvs/src/sys/dev/acpi/acpivar.h,v retrieving revision 1.85 diff -u -p -u -p -r1.85 acpivar.h --- dev/acpi/acpivar.h 28 Feb 2017 10:39:07 -0000 1.85 +++ dev/acpi/acpivar.h 7 Mar 2017 02:34:37 -0000 @@ -258,6 +258,7 @@ struct acpi_softc { struct acpi_ac_head sc_ac; struct acpi_bat_head sc_bat; struct acpi_sbs_head sc_sbs; + int sc_havesbs; struct timeout sc_dev_timeout;