Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Oct 2018 00:05:47 +0000 (UTC)
From:      Takanori Watanabe <takawata@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r339754 - in head/sys/dev: acpi_support acpica amdgpio asmc fdc gpio hyperv/vmbus ichiic intel ipmi sdhci tpm
Message-ID:  <201810260005.w9Q05lud042824@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: takawata
Date: Fri Oct 26 00:05:46 2018
New Revision: 339754
URL: https://svnweb.freebsd.org/changeset/base/339754

Log:
  Distinguish _CID match and _HID match and make lower priority probe
  when _CID match.
  
  Reviewed by: jhb, imp
  Differential Revision:https://reviews.freebsd.org/D16468

Modified:
  head/sys/dev/acpi_support/acpi_asus.c
  head/sys/dev/acpi_support/acpi_fujitsu.c
  head/sys/dev/acpi_support/acpi_ibm.c
  head/sys/dev/acpi_support/acpi_panasonic.c
  head/sys/dev/acpi_support/acpi_rapidstart.c
  head/sys/dev/acpi_support/acpi_sony.c
  head/sys/dev/acpi_support/acpi_toshiba.c
  head/sys/dev/acpi_support/acpi_wmi.c
  head/sys/dev/acpi_support/atk0110.c
  head/sys/dev/acpica/acpi.c
  head/sys/dev/acpica/acpi_acad.c
  head/sys/dev/acpica/acpi_button.c
  head/sys/dev/acpica/acpi_cmbat.c
  head/sys/dev/acpica/acpi_container.c
  head/sys/dev/acpica/acpi_cpu.c
  head/sys/dev/acpica/acpi_ec.c
  head/sys/dev/acpica/acpi_hpet.c
  head/sys/dev/acpica/acpi_if.m
  head/sys/dev/acpica/acpi_isab.c
  head/sys/dev/acpica/acpi_lid.c
  head/sys/dev/acpica/acpi_pci_link.c
  head/sys/dev/acpica/acpi_resource.c
  head/sys/dev/acpica/acpi_smbat.c
  head/sys/dev/acpica/acpivar.h
  head/sys/dev/amdgpio/amdgpio.c
  head/sys/dev/asmc/asmc.c
  head/sys/dev/fdc/fdc_acpi.c
  head/sys/dev/gpio/bytgpio.c
  head/sys/dev/gpio/chvgpio.c
  head/sys/dev/hyperv/vmbus/vmbus_res.c
  head/sys/dev/ichiic/ig4_acpi.c
  head/sys/dev/intel/spi.c
  head/sys/dev/ipmi/ipmi_acpi.c
  head/sys/dev/sdhci/sdhci_acpi.c
  head/sys/dev/tpm/tpm_acpi.c

Modified: head/sys/dev/acpi_support/acpi_asus.c
==============================================================================
--- head/sys/dev/acpi_support/acpi_asus.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpi_support/acpi_asus.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -549,15 +549,16 @@ acpi_asus_probe(device_t dev)
 	ACPI_OBJECT		Arg, *Obj;
 	ACPI_OBJECT_LIST	Args;
 	static char		*asus_ids[] = { "ATK0100", "ASUS010", NULL };
+	int rv;
 	char *rstr;
 
 	ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
 	if (acpi_disabled("asus"))
 		return (ENXIO);
-	rstr = ACPI_ID_PROBE(device_get_parent(dev), dev, asus_ids);
-	if (rstr == NULL) {
-		return (ENXIO);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, asus_ids, &rstr);
+	if (rv > 0) {
+		return (rv);
 	}
 
 	sc = device_get_softc(dev);
@@ -595,7 +596,7 @@ acpi_asus_probe(device_t dev)
 			sc->model = &acpi_samsung_models[0];
 			device_set_desc(dev, "Samsung P30 Laptop Extras");
 			AcpiOsFree(Buf.Pointer);
-			return (0);
+			return (rv);
 		}
 
 		/* EeePC */
@@ -603,7 +604,7 @@ acpi_asus_probe(device_t dev)
 			sc->model = &acpi_eeepc_models[0];
 			device_set_desc(dev, "ASUS EeePC");
 			AcpiOsFree(Buf.Pointer);
-			return (0);
+			return (rv);
 		}
 	}
 
@@ -627,7 +628,7 @@ good:
 
 			sbuf_delete(sb);
 			AcpiOsFree(Buf.Pointer);
-			return (0);
+			return (rv);
 		}
 		
 		/*

Modified: head/sys/dev/acpi_support/acpi_fujitsu.c
==============================================================================
--- head/sys/dev/acpi_support/acpi_fujitsu.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpi_support/acpi_fujitsu.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -228,16 +228,15 @@ acpi_fujitsu_probe(device_t dev)
 {
 	char *name;
 	char buffer[64];
+	int rv;
 
-	name = ACPI_ID_PROBE(device_get_parent(dev), dev, fujitsu_ids);
-	if (acpi_disabled("fujitsu") || name == NULL ||
-	    device_get_unit(dev) > 1)
+	rv =  ACPI_ID_PROBE(device_get_parent(dev), dev, fujitsu_ids, &name);
+	if (acpi_disabled("fujitsu") || rv > 0 || device_get_unit(dev) > 1)
 		return (ENXIO);
-
 	sprintf(buffer, "Fujitsu Function Hotkeys %s", name);
 	device_set_desc_copy(dev, buffer);
 
-	return (0);
+	return (rv);
 }
 
 static int

Modified: head/sys/dev/acpi_support/acpi_ibm.c
==============================================================================
--- head/sys/dev/acpi_support/acpi_ibm.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpi_support/acpi_ibm.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -411,14 +411,17 @@ acpi_ibm_mic_led_set (struct acpi_ibm_softc *sc, int a
 static int
 acpi_ibm_probe(device_t dev)
 {
+	int rv;
+
 	if (acpi_disabled("ibm") ||
-	    ACPI_ID_PROBE(device_get_parent(dev), dev, ibm_ids) == NULL ||
 	    device_get_unit(dev) != 0)
 		return (ENXIO);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, ibm_ids, NULL);
 
-	device_set_desc(dev, "IBM ThinkPad ACPI Extras");
-
-	return (0);
+	if (rv <= 0) 
+		device_set_desc(dev, "IBM ThinkPad ACPI Extras");
+	
+	return (rv);
 }
 
 static int

Modified: head/sys/dev/acpi_support/acpi_panasonic.c
==============================================================================
--- head/sys/dev/acpi_support/acpi_panasonic.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpi_support/acpi_panasonic.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -137,14 +137,16 @@ static int
 acpi_panasonic_probe(device_t dev)
 {
 	static char *mat_ids[] = { "MAT0019", NULL };
-
+	int rv;
+	
 	if (acpi_disabled("panasonic") ||
-	    ACPI_ID_PROBE(device_get_parent(dev), dev, mat_ids) == NULL ||
 	    device_get_unit(dev) != 0)
 		return (ENXIO);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, mat_ids, NULL);
 
-	device_set_desc(dev, "Panasonic Notebook Hotkeys");
-	return (0);
+	if (rv <= 0)
+		device_set_desc(dev, "Panasonic Notebook Hotkeys");
+	return (rv);
 }
 
 static int

Modified: head/sys/dev/acpi_support/acpi_rapidstart.c
==============================================================================
--- head/sys/dev/acpi_support/acpi_rapidstart.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpi_support/acpi_rapidstart.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -62,14 +62,16 @@ static char    *rapidstart_ids[] = {"INT3392", NULL};
 static int
 acpi_rapidstart_probe(device_t dev)
 {
+	int rv;
+
 	if (acpi_disabled("rapidstart") ||
-	    ACPI_ID_PROBE(device_get_parent(dev), dev, rapidstart_ids) == NULL ||
 	    device_get_unit(dev) != 0)
 		return (ENXIO);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, rapidstart_ids, NULL);
+	if (rv <= 0)
+		device_set_desc(dev, "Intel Rapid Start ACPI device");
 
-	device_set_desc(dev, "Intel Rapid Start ACPI device");
-
-	return (0);
+	return (rv);
 	
 }
 

Modified: head/sys/dev/acpi_support/acpi_sony.c
==============================================================================
--- head/sys/dev/acpi_support/acpi_sony.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpi_support/acpi_sony.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -114,11 +114,11 @@ static char    *sny_id[] = {"SNY5001", NULL};
 static int
 acpi_sony_probe(device_t dev)
 {
-	int ret = ENXIO;
+	int ret;
 
-	if (ACPI_ID_PROBE(device_get_parent(dev), dev, sny_id)) {
+	ret = ACPI_ID_PROBE(device_get_parent(dev), dev, sny_id, NULL);
+	if (ret <= 0) {
 		device_set_desc(dev, "Sony notebook controller");
-		ret = 0;
 	}
 	return (ret);
 }

Modified: head/sys/dev/acpi_support/acpi_toshiba.c
==============================================================================
--- head/sys/dev/acpi_support/acpi_toshiba.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpi_support/acpi_toshiba.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -220,14 +220,15 @@ static int
 acpi_toshiba_probe(device_t dev)
 {
 	static char *tosh_ids[] = { "TOS6200", "TOS6207", "TOS6208", NULL };
+	int rv;
 
 	if (acpi_disabled("toshiba") ||
-	    ACPI_ID_PROBE(device_get_parent(dev), dev, tosh_ids) == NULL ||
 	    device_get_unit(dev) != 0)
 		return (ENXIO);
-
-	device_set_desc(dev, "Toshiba HCI Extras");
-	return (0);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, tosh_ids, NULL);
+	if (rv <= 0)
+		device_set_desc(dev, "Toshiba HCI Extras");
+	return (rv);
 }
 
 static int
@@ -543,15 +544,17 @@ static int
 acpi_toshiba_video_probe(device_t dev)
 {
 	static char *vid_ids[] = { "TOS6201", NULL };
+	int rv;
 
 	if (acpi_disabled("toshiba") ||
-	    ACPI_ID_PROBE(device_get_parent(dev), dev, vid_ids) == NULL ||
 	    device_get_unit(dev) != 0)
 		return (ENXIO);
 
 	device_quiet(dev);
-	device_set_desc(dev, "Toshiba Video");
-	return (0);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, vid_ids, NULL);
+	if (rv <= 0)
+		device_set_desc(dev, "Toshiba Video");
+	return (rv);
 }
 
 static int

Modified: head/sys/dev/acpi_support/acpi_wmi.c
==============================================================================
--- head/sys/dev/acpi_support/acpi_wmi.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpi_support/acpi_wmi.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -208,12 +208,15 @@ static char *wmi_ids[] = {"PNP0C14", NULL};
 static int
 acpi_wmi_probe(device_t dev)
 {
-	if (acpi_disabled("wmi") ||
-	    ACPI_ID_PROBE(device_get_parent(dev), dev, wmi_ids) == NULL)
+	int rv; 
+
+	if (acpi_disabled("wmi"))
 		return (ENXIO);
-	device_set_desc(dev, "ACPI-WMI mapping");
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, wmi_ids, NULL);
+	if (rv <= 0)
+		device_set_desc(dev, "ACPI-WMI mapping");
 
-	return (0);
+	return (rv);
 }
 
 /*

Modified: head/sys/dev/acpi_support/atk0110.c
==============================================================================
--- head/sys/dev/acpi_support/atk0110.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpi_support/atk0110.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -122,11 +122,13 @@ static char* aibs_hids[] = {
 static int
 aibs_probe(device_t dev)
 {
-	if (acpi_disabled("aibs") ||
-	    ACPI_ID_PROBE(device_get_parent(dev), dev, aibs_hids) == NULL)
-		return (ENXIO);
+	int rv;
 
-	device_set_desc(dev, "ASUSTeK AI Booster (ACPI ASOC ATK0110)");
+	if (acpi_disabled("aibs"))
+		return (ENXIO);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, aibs_hids, NULL);
+	if (rv <= 0 )
+		device_set_desc(dev, "ASUSTeK AI Booster (ACPI ASOC ATK0110)");
 	return (0);
 }
 

Modified: head/sys/dev/acpica/acpi.c
==============================================================================
--- head/sys/dev/acpica/acpi.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpica/acpi.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -140,7 +140,7 @@ static void	acpi_delete_resource(device_t bus, device_
 		    int rid);
 static uint32_t	acpi_isa_get_logicalid(device_t dev);
 static int	acpi_isa_get_compatid(device_t dev, uint32_t *cids, int count);
-static char	*acpi_device_id_probe(device_t bus, device_t dev, char **ids);
+static int	acpi_device_id_probe(device_t bus, device_t dev, char **ids, char **match);
 static ACPI_STATUS acpi_device_eval_obj(device_t bus, device_t dev,
 		    ACPI_STRING pathname, ACPI_OBJECT_LIST *parameters,
 		    ACPI_BUFFER *ret);
@@ -1183,7 +1183,7 @@ acpi_sysres_alloc(device_t dev)
     if (device_get_children(dev, &children, &child_count) != 0)
 	return (ENXIO);
     for (i = 0; i < child_count; i++) {
-	if (ACPI_ID_PROBE(dev, children[i], sysres_ids) != NULL)
+	if (ACPI_ID_PROBE(dev, children[i], sysres_ids, NULL) <= 0)
 	    device_probe_and_attach(children[i]);
     }
     free(children, M_TEMP);
@@ -1242,7 +1242,7 @@ acpi_reserve_resources(device_t dev)
 	rl = &ad->ad_rl;
 
 	/* Don't reserve system resources. */
-	if (ACPI_ID_PROBE(dev, children[i], sysres_ids) != NULL)
+	if (ACPI_ID_PROBE(dev, children[i], sysres_ids, NULL) <= 0)
 	    continue;
 
 	STAILQ_FOREACH(rle, rl, link) {
@@ -1292,7 +1292,8 @@ acpi_set_resource(device_t dev, device_t child, int ty
     rman_res_t end;
     
     /* Ignore IRQ resources for PCI link devices. */
-    if (type == SYS_RES_IRQ && ACPI_ID_PROBE(dev, child, pcilink_ids) != NULL)
+    if (type == SYS_RES_IRQ &&
+	ACPI_ID_PROBE(dev, child, pcilink_ids, NULL) <= 0)
 	return (0);
 
     /*
@@ -1335,7 +1336,7 @@ acpi_set_resource(device_t dev, device_t child, int ty
 	return (0);
 
     /* Don't reserve system resources. */
-    if (ACPI_ID_PROBE(dev, child, sysres_ids) != NULL)
+    if (ACPI_ID_PROBE(dev, child, sysres_ids, NULL) <= 0)
 	return (0);
 
     /*
@@ -1640,26 +1641,34 @@ acpi_isa_get_compatid(device_t dev, uint32_t *cids, in
     return_VALUE (valid);
 }
 
-static char *
-acpi_device_id_probe(device_t bus, device_t dev, char **ids) 
+static int
+acpi_device_id_probe(device_t bus, device_t dev, char **ids, char **match) 
 {
     ACPI_HANDLE h;
     ACPI_OBJECT_TYPE t;
+    int rv;
     int i;
 
     h = acpi_get_handle(dev);
     if (ids == NULL || h == NULL)
-	return (NULL);
+	return (ENXIO);
     t = acpi_get_type(dev);
     if (t != ACPI_TYPE_DEVICE && t != ACPI_TYPE_PROCESSOR)
-	return (NULL);
+	return (ENXIO);
 
     /* Try to match one of the array of IDs with a HID or CID. */
     for (i = 0; ids[i] != NULL; i++) {
-	if (acpi_MatchHid(h, ids[i]))
-	    return (ids[i]);
+	rv = acpi_MatchHid(h, ids[i]);
+	if (rv == ACPI_MATCHHID_NOMATCH)
+	    continue;
+	
+	if (match != NULL) {
+	    *match = ids[i];
+	}
+	return ((rv == ACPI_MATCHHID_HID)?
+		    BUS_PROBE_DEFAULT : BUS_PROBE_LOW_PRIORITY);
     }
-    return (NULL);
+    return (ENXIO);
 }
 
 static ACPI_STATUS
@@ -2285,8 +2294,11 @@ acpi_has_hid(ACPI_HANDLE h)
 
 /*
  * Match a HID string against a handle
+ * returns ACPI_MATCHHID_HID if _HID match
+ *         ACPI_MATCHHID_CID if _CID match and not _HID match.
+ *         ACPI_MATCHHID_NOMATCH=0 if no match.
  */
-BOOLEAN
+int
 acpi_MatchHid(ACPI_HANDLE h, const char *hid) 
 {
     ACPI_DEVICE_INFO	*devinfo;
@@ -2295,16 +2307,16 @@ acpi_MatchHid(ACPI_HANDLE h, const char *hid) 
 
     if (hid == NULL || h == NULL ||
 	ACPI_FAILURE(AcpiGetObjectInfo(h, &devinfo)))
-	return (FALSE);
+	return (ACPI_MATCHHID_NOMATCH);
 
     ret = FALSE;
     if ((devinfo->Valid & ACPI_VALID_HID) != 0 &&
 	strcmp(hid, devinfo->HardwareId.String) == 0)
-	    ret = TRUE;
+	    ret = ACPI_MATCHHID_HID;
     else if ((devinfo->Valid & ACPI_VALID_CID) != 0)
 	for (i = 0; i < devinfo->CompatibleIdList.Count; i++) {
 	    if (strcmp(hid, devinfo->CompatibleIdList.Ids[i].String) == 0) {
-		ret = TRUE;
+		ret = ACPI_MATCHHID_CID;
 		break;
 	    }
 	}

Modified: head/sys/dev/acpica/acpi_acad.c
==============================================================================
--- head/sys/dev/acpica/acpi_acad.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpica/acpi_acad.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -142,13 +142,14 @@ static int
 acpi_acad_probe(device_t dev)
 {
     static char *acad_ids[] = { "ACPI0003", NULL };
+    int rv;
 
-    if (acpi_disabled("acad") ||
-	ACPI_ID_PROBE(device_get_parent(dev), dev, acad_ids) == NULL)
+    if (acpi_disabled("acad"))
 	return (ENXIO);
-
-    device_set_desc(dev, "AC Adapter");
-    return (0);
+    rv = ACPI_ID_PROBE(device_get_parent(dev), dev, acad_ids, NULL);
+    if (rv <= 0)
+	device_set_desc(dev, "AC Adapter");
+    return (rv);
 }
 
 static int

Modified: head/sys/dev/acpica/acpi_button.c
==============================================================================
--- head/sys/dev/acpica/acpi_button.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpica/acpi_button.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -98,11 +98,14 @@ acpi_button_probe(device_t dev)
 {
     struct acpi_button_softc *sc;
     char *str; 
+    int rv;
 
-    if (acpi_disabled("button") ||
-	(str = ACPI_ID_PROBE(device_get_parent(dev), dev, btn_ids)) == NULL)
+    if (acpi_disabled("button"))
 	return (ENXIO);
-
+    rv = ACPI_ID_PROBE(device_get_parent(dev), dev, btn_ids, &str);
+    if (rv > 0)
+	return (ENXIO);
+    
     sc = device_get_softc(dev);
     if (strcmp(str, "PNP0C0C") == 0) {
 	device_set_desc(dev, "Power Button");
@@ -120,7 +123,7 @@ acpi_button_probe(device_t dev)
 	sc->fixed = 1;
     }
 
-    return (0);
+    return (rv);
 }
 
 static int

Modified: head/sys/dev/acpica/acpi_cmbat.c
==============================================================================
--- head/sys/dev/acpica/acpi_cmbat.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpica/acpi_cmbat.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -116,13 +116,14 @@ 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)
+    int rv;
+    
+    if (acpi_disabled("cmbat"))
 	return (ENXIO);
-
-    device_set_desc(dev, "ACPI Control Method Battery");
-    return (0);
+    rv = ACPI_ID_PROBE(device_get_parent(dev), dev, cmbat_ids, NULL);
+    if (rv <= 0)
+	device_set_desc(dev, "ACPI Control Method Battery");
+    return (rv);
 }
 
 static int

Modified: head/sys/dev/acpica/acpi_container.c
==============================================================================
--- head/sys/dev/acpica/acpi_container.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpica/acpi_container.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -98,13 +98,14 @@ static int
 acpi_syscont_probe(device_t dev)
 {
     static char *syscont_ids[] = { "ACPI0004", "PNP0A05", "PNP0A06", NULL };
+    int rv;
 
-    if (acpi_disabled("syscontainer") ||
-	ACPI_ID_PROBE(device_get_parent(dev), dev, syscont_ids) == NULL)
+    if (acpi_disabled("syscontainer"))
 	return (ENXIO);
-
-    device_set_desc(dev, "System Container");
-    return (BUS_PROBE_DEFAULT);
+    rv = ACPI_ID_PROBE(device_get_parent(dev), dev, syscont_ids, NULL);
+    if (rv <= 0)
+	device_set_desc(dev, "System Container");
+    return (rv);
 }
 
 static int

Modified: head/sys/dev/acpica/acpi_cpu.c
==============================================================================
--- head/sys/dev/acpica/acpi_cpu.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpica/acpi_cpu.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -252,7 +252,7 @@ acpi_cpu_probe(device_t dev)
     if (type != ACPI_TYPE_PROCESSOR && type != ACPI_TYPE_DEVICE)
 	return (ENXIO);
     if (type == ACPI_TYPE_DEVICE &&
-	ACPI_ID_PROBE(device_get_parent(dev), dev, cpudev_ids) == NULL)
+	ACPI_ID_PROBE(device_get_parent(dev), dev, cpudev_ids, NULL) >= 0)
 	return (ENXIO);
 
     handle = acpi_get_handle(dev);

Modified: head/sys/dev/acpica/acpi_ec.c
==============================================================================
--- head/sys/dev/acpica/acpi_ec.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpica/acpi_ec.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -362,7 +362,10 @@ acpi_ec_probe(device_t dev)
     if (params != NULL) {
 	ecdt = 1;
 	ret = 0;
-    } else if (ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids)) {
+    } else {
+	ret = ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids, NULL);
+	if (ret > 0)
+	    goto out;
 	params = malloc(sizeof(struct acpi_ec_params), M_TEMP,
 			M_WAITOK | M_ZERO);
 	h = acpi_get_handle(dev);
@@ -422,14 +425,14 @@ acpi_ec_probe(device_t dev)
 	 * this device.
 	 */
 	peer = devclass_get_device(acpi_ec_devclass, params->uid);
-	if (peer == NULL || !device_is_alive(peer))
-	    ret = 0;
-	else
+	if (peer != NULL && device_is_alive(peer)){
+	    ret = ENXIO;
 	    device_disable(dev);
+	}
     }
 
 out:
-    if (ret == 0) {
+    if (ret <= 0) {
 	snprintf(desc, sizeof(desc), "Embedded Controller: GPE %#x%s%s",
 		 params->gpe_bit, (params->glk) ? ", GLK" : "",
 		 ecdt ? ", ECDT" : "");

Modified: head/sys/dev/acpica/acpi_hpet.c
==============================================================================
--- head/sys/dev/acpica/acpi_hpet.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpica/acpi_hpet.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -450,16 +450,15 @@ hpet_identify(driver_t *driver, device_t parent)
 static int
 hpet_probe(device_t dev)
 {
-	ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__);
+	int rv;
 
+	ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__);
 	if (acpi_disabled("hpet") || acpi_hpet_disabled)
 		return (ENXIO);
-	if (acpi_get_handle(dev) != NULL &&
-	    ACPI_ID_PROBE(device_get_parent(dev), dev, hpet_ids) == NULL)
-		return (ENXIO);
-
-	device_set_desc(dev, "High Precision Event Timer");
-	return (0);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, hpet_ids, NULL);
+	if (rv <= 0)
+	   device_set_desc(dev, "High Precision Event Timer");
+	return (rv);
 }
 
 static int

Modified: head/sys/dev/acpica/acpi_if.m
==============================================================================
--- head/sys/dev/acpica/acpi_if.m	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpica/acpi_if.m	Fri Oct 26 00:05:46 2018	(r339754)
@@ -78,12 +78,19 @@ CODE {
 #
 # char **ids:  array of ID strings to consider
 #
-# Returns:  ID string matched or NULL if no match
+# char **match:  Pointer to store ID string matched or NULL if no match
+#                pass NULL if not needed.
 #
-METHOD char * id_probe {
+# Returns: BUS_PROBE_DEFAULT if _HID match
+#          BUS_PROBE_LOW_PRIORITY  if _CID match and not _HID match
+#          ENXIO if no match.
+#
+
+METHOD int id_probe {
 	device_t	bus;
 	device_t	dev;
 	char		**ids;
+	char 		**match;
 } DEFAULT acpi_generic_id_probe;
 
 #

Modified: head/sys/dev/acpica/acpi_isab.c
==============================================================================
--- head/sys/dev/acpica/acpi_isab.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpica/acpi_isab.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -92,14 +92,15 @@ static int
 acpi_isab_probe(device_t dev)
 {
 	static char *isa_ids[] = { "PNP0A05", "PNP0A06", NULL };
-
+	int rv;
+	
 	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);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, isa_ids, NULL);
+	if (rv <= 0)
+		device_set_desc(dev, "ACPI Generic ISA bridge");
+	return (rv);
 }
 
 static int

Modified: head/sys/dev/acpica/acpi_lid.c
==============================================================================
--- head/sys/dev/acpica/acpi_lid.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpica/acpi_lid.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -88,13 +88,14 @@ static int
 acpi_lid_probe(device_t dev)
 {
     static char *lid_ids[] = { "PNP0C0D", NULL };
+    int rv;
 
-    if (acpi_disabled("lid") ||
-	ACPI_ID_PROBE(device_get_parent(dev), dev, lid_ids) == NULL)
+    if (acpi_disabled("lid"))
 	return (ENXIO);
-
-    device_set_desc(dev, "Control Method Lid Switch");
-    return (0);
+    rv = ACPI_ID_PROBE(device_get_parent(dev), dev, lid_ids, NULL);
+    if (rv <= 0)
+	device_set_desc(dev, "Control Method Lid Switch");
+    return (rv);
 }
 
 static int

Modified: head/sys/dev/acpica/acpi_pci_link.c
==============================================================================
--- head/sys/dev/acpica/acpi_pci_link.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpica/acpi_pci_link.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -146,15 +146,18 @@ static int
 acpi_pci_link_probe(device_t dev)
 {
 	char descr[28], name[12];
+	int rv;
 
 	/*
 	 * 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_disabled("pci_link"))
+	    return (ENXIO);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, pci_link_ids, NULL);
+	if (rv > 0)
+	  return (rv);
+	
 	if (ACPI_SUCCESS(acpi_short_name(acpi_get_handle(dev), name,
 	    sizeof(name)))) {
 		snprintf(descr, sizeof(descr), "ACPI PCI Link %s", name);
@@ -162,7 +165,7 @@ acpi_pci_link_probe(device_t dev)
 	} else
 		device_set_desc(dev, "ACPI PCI Link");
 	device_quiet(dev);
-	return (0);
+	return (rv);
 }
 
 static ACPI_STATUS

Modified: head/sys/dev/acpica/acpi_resource.c
==============================================================================
--- head/sys/dev/acpica/acpi_resource.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpica/acpi_resource.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -696,14 +696,17 @@ static int
 acpi_sysres_probe(device_t dev)
 {
     static char *sysres_ids[] = { "PNP0C01", "PNP0C02", NULL };
+    int rv;
 
-    if (acpi_disabled("sysresource") ||
-	ACPI_ID_PROBE(device_get_parent(dev), dev, sysres_ids) == NULL)
+    if (acpi_disabled("sysresource"))
 	return (ENXIO);
-
+    rv = ACPI_ID_PROBE(device_get_parent(dev), dev, sysres_ids, NULL);
+    if (rv > 0){
+	return (rv);
+    }
     device_set_desc(dev, "System Resource");
     device_quiet(dev);
-    return (BUS_PROBE_DEFAULT);
+    return (rv);
 }
 
 static int

Modified: head/sys/dev/acpica/acpi_smbat.c
==============================================================================
--- head/sys/dev/acpica/acpi_smbat.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpica/acpi_smbat.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -107,16 +107,18 @@ acpi_smbat_probe(device_t dev)
 {
 	static char *smbat_ids[] = {"ACPI0001", "ACPI0005", NULL};
 	ACPI_STATUS status;
+	int rv;
 
-	if (acpi_disabled("smbat") ||
-	    ACPI_ID_PROBE(device_get_parent(dev), dev, smbat_ids) == NULL)
+	if (acpi_disabled("smbat"))
 		return (ENXIO);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, smbat_ids, NULL);
+	if (rv > 0)
+	  return (rv);
 	status = AcpiEvaluateObject(acpi_get_handle(dev), "_EC", NULL, NULL);
 	if (ACPI_FAILURE(status))
 		return (ENXIO);
-
 	device_set_desc(dev, "ACPI Smart Battery");
-	return (0);
+	return (rv);
 }
 
 static int

Modified: head/sys/dev/acpica/acpivar.h
==============================================================================
--- head/sys/dev/acpica/acpivar.h	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/acpica/acpivar.h	Fri Oct 26 00:05:46 2018	(r339754)
@@ -371,7 +371,11 @@ int		acpi_bus_alloc_gas(device_t dev, int *type, int *
 		    u_int flags);
 void		acpi_walk_subtables(void *first, void *end,
 		    acpi_subtable_handler *handler, void *arg);
-BOOLEAN		acpi_MatchHid(ACPI_HANDLE h, const char *hid);
+int		acpi_MatchHid(ACPI_HANDLE h, const char *hid);
+#define ACPI_MATCHHID_NOMATCH 0
+#define ACPI_MATCHHID_HID 1
+#define ACPI_MATCHHID_CID 2
+
 
 struct acpi_parse_resource_set {
     void	(*set_init)(device_t dev, void *arg, void **context);

Modified: head/sys/dev/amdgpio/amdgpio.c
==============================================================================
--- head/sys/dev/amdgpio/amdgpio.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/amdgpio/amdgpio.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -344,13 +344,16 @@ static int
 amdgpio_probe(device_t dev)
 {
 	static char *gpio_ids[] = { "AMD0030", "AMDI0030", NULL };
-
-	if (acpi_disabled("gpio") ||
-		ACPI_ID_PROBE(device_get_parent(dev), dev, gpio_ids) == NULL)
-	return (ENXIO);
-
-	device_set_desc(dev, "AMD GPIO Controller");
-	return (0);
+	int rv;
+	
+	if (acpi_disabled("gpio"))
+		return (ENXIO);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, gpio_ids, NULL);
+	
+	if (rv <= 0)
+		device_set_desc(dev, "AMD GPIO Controller");
+	
+	return (rv);
 }
 
 static int

Modified: head/sys/dev/asmc/asmc.c
==============================================================================
--- head/sys/dev/asmc/asmc.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/asmc/asmc.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -374,11 +374,13 @@ static int
 asmc_probe(device_t dev)
 {
 	struct asmc_model *model;
+	int rv;
 
 	if (resource_disabled("asmc", 0))
 		return (ENXIO);
-	if (ACPI_ID_PROBE(device_get_parent(dev), dev, asmc_ids) == NULL)
-		return (ENXIO);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, asmc_ids, NULL);
+	if (rv > 0)
+		return (rv);
 
 	model = asmc_match(dev);
 	if (!model) {
@@ -387,7 +389,7 @@ asmc_probe(device_t dev)
 	}
 	device_set_desc(dev, model->smc_desc);
 
-	return (BUS_PROBE_DEFAULT);
+	return (rv);
 }
 
 static int

Modified: head/sys/dev/fdc/fdc_acpi.c
==============================================================================
--- head/sys/dev/fdc/fdc_acpi.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/fdc/fdc_acpi.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -81,16 +81,18 @@ fdc_acpi_probe(device_t dev)
 {
 	device_t bus;
 	static char *fdc_ids[] = { "PNP0700", "PNP0701", NULL };
+	int rv;
 
 	bus = device_get_parent(dev);
-	if (ACPI_ID_PROBE(bus, dev, fdc_ids) == NULL)
-		return (ENXIO);
+	rv = ACPI_ID_PROBE(bus, dev, fdc_ids, NULL);
+	if (rv > 0)
+		return (rv);
 
 	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);
+	return (rv);
 }
 
 static int

Modified: head/sys/dev/gpio/bytgpio.c
==============================================================================
--- head/sys/dev/gpio/bytgpio.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/gpio/bytgpio.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -541,13 +541,14 @@ static int
 bytgpio_probe(device_t dev)
 {
 	static char *gpio_ids[] = { "INT33FC", NULL };
+	int rv;
 
-	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);
+	if (acpi_disabled("gpio"))
+		return (ENXIO);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, gpio_ids, NULL);
+	if (rv <= 0)
+		device_set_desc(dev, "Intel Baytrail GPIO Controller");
+	return (rv);
 }
 
 static int

Modified: head/sys/dev/gpio/chvgpio.c
==============================================================================
--- head/sys/dev/gpio/chvgpio.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/gpio/chvgpio.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -343,12 +343,14 @@ static char *chvgpio_hids[] = {
 static int
 chvgpio_probe(device_t dev)
 {
-    if (acpi_disabled("chvgpio") ||
-    ACPI_ID_PROBE(device_get_parent(dev), dev, chvgpio_hids) == NULL)
+    int rv;
+    
+    if (acpi_disabled("chvgpio"))
         return (ENXIO);
-
-    device_set_desc(dev, "Intel Cherry View GPIO");
-    return (0);
+    rv = ACPI_ID_PROBE(device_get_parent(dev), dev, chvgpio_hids, NULL);
+    if (rv <= 0)
+	device_set_desc(dev, "Intel Cherry View GPIO");
+    return (rv);
 }
 
 static int

Modified: head/sys/dev/hyperv/vmbus/vmbus_res.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/vmbus_res.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/hyperv/vmbus/vmbus_res.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -73,14 +73,15 @@ static int
 vmbus_res_probe(device_t dev)
 {
 	char *id[] = { "VMBUS", NULL };
-
-	if (ACPI_ID_PROBE(device_get_parent(dev), dev, id) == NULL ||
-	    device_get_unit(dev) != 0 || vm_guest != VM_GUEST_HV ||
+	int rv;
+	
+	if (device_get_unit(dev) != 0 || vm_guest != VM_GUEST_HV ||
 	    (hyperv_features & CPUID_HV_MSR_SYNIC) == 0)
 		return (ENXIO);
-
-	device_set_desc(dev, "Hyper-V Vmbus Resource");
-	return (BUS_PROBE_DEFAULT);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, id, NULL);
+	if (rv <= 0)
+		device_set_desc(dev, "Hyper-V Vmbus Resource");
+	return (rv);
 }
 
 static int

Modified: head/sys/dev/ichiic/ig4_acpi.c
==============================================================================
--- head/sys/dev/ichiic/ig4_acpi.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/ichiic/ig4_acpi.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -70,21 +70,23 @@ ig4iic_acpi_probe(device_t dev)
 {
 	ig4iic_softc_t *sc;
 	char *hid;
-
+	int rv;
 	sc = device_get_softc(dev);
 
 	if (acpi_disabled("ig4iic"))
 		return (ENXIO);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, ig4iic_ids, &hid);
+	if (rv > 0){
+		return (rv);
+	}	
 
-	hid = ACPI_ID_PROBE(device_get_parent(dev), dev, ig4iic_ids);
-	if (hid == NULL)
-		return (ENXIO);
+        if (strcmp("AMDI0010", hid) == 0)
+                sc->access_intr_mask = 1;
 
-	if (strcmp("AMDI0010", hid) == 0)
-		sc->access_intr_mask = 1;
-
-	device_set_desc(dev, "Designware I2C Controller");
-	return (0);
+	
+	if (rv <= 0)
+		device_set_desc(dev, "Designware I2C Controller");
+	return (rv);
 }
 
 static int

Modified: head/sys/dev/intel/spi.c
==============================================================================
--- head/sys/dev/intel/spi.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/intel/spi.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -423,13 +423,14 @@ 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);
+	int rv;
+	
+	if (acpi_disabled("spi") )
+		return (ENXIO);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, gpio_ids, NULL);
+	if (rv <= 0)
+		device_set_desc(dev, "Intel SPI Controller");
+	return (rv);
 }
 
 static int

Modified: head/sys/dev/ipmi/ipmi_acpi.c
==============================================================================
--- head/sys/dev/ipmi/ipmi_acpi.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/ipmi/ipmi_acpi.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -61,17 +61,18 @@ int
 ipmi_acpi_probe(device_t dev)
 {
 	static char *ipmi_ids[] = {"IPI0001", NULL};
+	int rv;
 
 	if (ipmi_attached)
 		return (EBUSY);
 
-	if (acpi_disabled("ipmi") ||
-	    ACPI_ID_PROBE(device_get_parent(dev), dev, ipmi_ids) == NULL)
+	if (acpi_disabled("ipmi"))
 		return (ENXIO);
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, ipmi_ids, NULL);
+	if (rv <= 0)
+		device_set_desc(dev, "IPMI System Interface");
 
-	device_set_desc(dev, "IPMI System Interface");
-
-	return (0);
+	return (rv);
 }
 
 static int

Modified: head/sys/dev/sdhci/sdhci_acpi.c
==============================================================================
--- head/sys/dev/sdhci/sdhci_acpi.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/sdhci/sdhci_acpi.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -192,13 +192,14 @@ sdhci_acpi_write_multi_4(device_t dev, struct sdhci_sl
 static const struct sdhci_acpi_device *
 sdhci_acpi_find_device(device_t dev)
 {
-	const char *hid;
+	char *hid;
 	int i, uid;
 	ACPI_HANDLE handle;
 	ACPI_STATUS status;
+	int rv;
 
-	hid = ACPI_ID_PROBE(device_get_parent(dev), dev, sdhci_ids);
-	if (hid == NULL)
+	rv =  ACPI_ID_PROBE(device_get_parent(dev), dev, sdhci_ids, &hid);
+	if (rv > 0)
 		return (NULL);
 
 	handle = acpi_get_handle(dev);

Modified: head/sys/dev/tpm/tpm_acpi.c
==============================================================================
--- head/sys/dev/tpm/tpm_acpi.c	Fri Oct 26 00:00:13 2018	(r339753)
+++ head/sys/dev/tpm/tpm_acpi.c	Fri Oct 26 00:05:46 2018	(r339754)
@@ -52,12 +52,13 @@ char *tpm_ids[] = {"ATM1200",  "BCM0102", "INTC0102", 
 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;
-	}
+	int rv;
 	
-	return ENXIO;
+	rv = ACPI_ID_PROBE(device_get_parent(dev), dev, tpm_ids, NULL);
+	if (rv <= 0)
+		device_set_desc(dev, "Trusted Platform Module");
+		
+	return (rv);
 }
 
 static device_method_t tpm_acpi_methods[] = {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201810260005.w9Q05lud042824>