From owner-cvs-all Fri Oct 5 1:51: 0 2001 Delivered-To: cvs-all@freebsd.org Received: from nasu.utsunomiya-u.ac.jp (nasu.utsunomiya-u.ac.jp [160.12.128.3]) by hub.freebsd.org (Postfix) with ESMTP id 94DE737B401; Fri, 5 Oct 2001 01:50:38 -0700 (PDT) Received: from nantai.utsunomiya-u.ac.jp by nasu.utsunomiya-u.ac.jp (8.11.2/1.1.29.3/26Jan01-1134AM) id f958YK575901; Fri, 5 Oct 2001 17:34:20 +0900 (JST) Received: from zodiac.mech.utsunomiya-u.ac.jp by nantai.utsunomiya-u.ac.jp (8.11.2/1.1.29.3/30Jan01-0241PM) id f958YKE40347; Fri, 5 Oct 2001 17:34:20 +0900 (JST) Received: from zodiac.mech.utsunomiya-u.ac.jp (IDENT:X0xhO5wSbS/m/oVRvKCWZEA7o5GM2huw@zodiac.mech.utsunomiya-u.ac.jp [160.12.43.7]) by zodiac.mech.utsunomiya-u.ac.jp (8.9.3+3.2W/3.7W/zodiac-May2000) with ESMTP id RAA28994; Fri, 5 Oct 2001 17:44:10 +0900 (JST) Message-Id: <200110050844.RAA28994@zodiac.mech.utsunomiya-u.ac.jp> To: Doug Rabson Cc: , , msmith@freebsd.org, yokota@zodiac.mech.utsunomiya-u.ac.jp Subject: Re: cvs commit: src/sys/dev/acpica acpi.c In-reply-to: Your message of "Thu, 04 Oct 2001 13:32:51 +0100." <20011004132820.D1298-100000@salmon.nlsystems.com> References: <20011004132820.D1298-100000@salmon.nlsystems.com> Date: Fri, 05 Oct 2001 17:44:09 +0900 From: Kazutaka YOKOTA Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG >> >dfr 2001/10/04 01:31:17 PDT >> > >> > Modified files: >> > sys/dev/acpica acpi.c >> > Log: >> > Check the compatible ID as well as the hardware ID in acpi_MatchHid. >> > >> > Revision Changes Path >> > 1.41 +6 -1 src/sys/dev/acpica/acpi.c >> >> I think we had better be careful when matching against compatible IDs. >> We should distinguish the case when the hardware ID matches, and the >> case when the compatible ID matches. >> >> If we don't distinguish the hardware ID match and the compatible ID >> match, the following will happen. >> >> The device X has a hardware PnP ID of XXXYYYY and a compatible ID of >> PNPWWWW. >> >> The device driver A supports PNPWWWW device. >> >> The device driver B supports XXXYYYY device. >> >> When the driver A gets at the device X before the device B does, we >> will have the driver A installed for this device, instead of the >> driver B, which offers specific support for PNPWWWW. XXXYYYY >> >> We need to make the probe routine in the device drivers return 0 >> (exact match) when the hardware ID exactly matches, and return a >> negative value (lower priority) when the compatible ID matches. > >Good point. How do you think we should tackle this? I guess I could add an >argument to acpi_MatchHid which could be used to return a priority value. >Perhaps something like this? Or, make acpi_MatchHid() return 3 values, rather than boolean. 0 for exact match with the 'hardware ID' 1 for no match -1 for match with the 'compatible' ID We also need to re-think the implementation of acpi_isa_pnp_probe(), so that the device driver calling this method can distinguish match with the hardware ID and the compatible ID. 0 for exact match with the 'hardware' ID ENXIO for no match -1 for match with the 'compatible' ID # Then, /sys/isa/isa_common.c:isa_pnp_probe() need to be modified too... # 0 for exact match with the logical ID # ENXIO for no match # ENOENT if the device node doesn't have a logical ID # -1 for match with the 'compatible' ID Kazu >Index: acpi.c >=================================================================== >RCS file: /home/ncvs/src/sys/dev/acpica/acpi.c,v >retrieving revision 1.41 >diff -u -r1.41 acpi.c >--- acpi.c 2001/10/04 08:31:17 1.41 >+++ acpi.c 2001/10/04 12:31:37 >@@ -906,7 +906,7 @@ > * Match a HID string against a device > */ > BOOLEAN >-acpi_MatchHid(device_t dev, char *hid) >+acpi_MatchHid(device_t dev, char *hid, int *prio_return) > { > ACPI_HANDLE h; > ACPI_DEVICE_INFO devinfo; >@@ -921,12 +921,16 @@ > return(FALSE); > if ((error = AcpiGetObjectInfo(h, &devinfo)) != AE_OK) > return(FALSE); >- if ((devinfo.Valid & ACPI_VALID_HID) && !strcmp(hid, devinfo.HardwareId)) >+ if ((devinfo.Valid & ACPI_VALID_HID) && !strcmp(hid, devinfo.HardwareId)) > { >+ *prio_return = 0; > return(TRUE); >+ } > if ((error = acpi_EvaluateInteger(h, "_CID", &cid)) != AE_OK) > return(FALSE); >- if (cid == PNP_EISAID(hid)) >+ if (cid == PNP_EISAID(hid)) { >+ *prio_return = -1; > return(TRUE); >+ } > return(FALSE); > } > > >-- >Doug Rabson Mail: dfr@nlsystems.com > Phone: +44 20 8348 6160 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message