From nobody Sun Feb 27 16:47:39 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 63EFA19E9740; Sun, 27 Feb 2022 16:47:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K68ZM49f7z4lwy; Sun, 27 Feb 2022 16:47:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645980459; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sGlCxkE3W7fnHaHrSHjN8a4van1DvHIlBxBhB8nkzpg=; b=lQtlpmwhFMogFsYAMQbVVM5qROqq1P3ST8QD7iqOb5Axxv6m4KW1vfro7WmWYXpDK1Gvy3 GO8YfVuTRGez8/8XS2FMrwmBK1poR62LMxnlHK4b9pkzJgtvugNHYlQTotCdmlSv2fgvkd dSqjYFxUkzyQbZv6RwwZzf2gFXF9o7fACwMlQK52isyWYOHMTuinJ1BMLxInjweznozrlQ oY6T73NEvROSbMzGt6PFezZu+rXSdlFL0IAHxjbourJBMknPhrPkg70BE83L23iBuD8Adr /mtg+BxteoMwcrig04M2rcVSW5lUcUvuTkn15RntqEHzDv0d42+AqDrHFSR7AA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 594902ACC; Sun, 27 Feb 2022 16:47:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21RGldDX036727; Sun, 27 Feb 2022 16:47:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21RGlddw036726; Sun, 27 Feb 2022 16:47:39 GMT (envelope-from git) Date: Sun, 27 Feb 2022 16:47:39 GMT Message-Id: <202202271647.21RGlddw036726@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: e8fc7f11896a - main - libefivar: Add BluetoothLe device path node support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e8fc7f11896a3a3a6937198c60756a0f142e0bb0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1645980459; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sGlCxkE3W7fnHaHrSHjN8a4van1DvHIlBxBhB8nkzpg=; b=B1VKeLjZWmCrGp+kbGZAybFERbyAiiZr2XEgXUzK8ygC9Itb8p9KVtCXhaYyieWyI3/XKf 7eYGc/NEmNcagxIem6zcdx6V8bre4mASSPXGkPTtE/28gjqv/GP+D34CwqeFIHCAPrE/1E U087vzMz/XPDIW4m6HKMsoxV8oZpMBI2i6CUSrFKOHDegswM5XQvNeY4Fhpu8O01wTRHMn bTJN3nQnzJftyUEAxDLxYstGiLXlSclM7/B/IFKfGk+I+OllWhyPeaH434K3MLZq/MERbk uEPTKCwuQx6KXWjTJLLaW7Hslec8bZFjE1ENoZRfdk2uhjGVPl4aFoI6lXd8cA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1645980459; a=rsa-sha256; cv=none; b=M3SexwLZ/w5lm9/CVt4hvjNhwpJ00/IhbebexmOQ335I/bCEiZlZejBqnXjHGboHX40Ejj SLbfSfIphrTXUmfAP4GmOexxt7ziTNaHUTNOwJYm0M/rxrILFHxMJr+H6ASqjcaspwNsh2 KP5K7CImsyAYRxGhWTWJz18K5IZvlnHzqRkHKvrYlGtT7HfxvLKJwa9t0sjxogrv2QbTcr eptCyrjEIzMylSqIlwiOIJ0+JWiUHgV7QGKjeM0JJNGulk/udlWAqA475gDf4IYHhv7cmf 4tuK8WjNvwVP2W13LfRwsYMAAJwFfNcbBAFeG3oZRdneqaezyzk00Qkn+uuNlA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e8fc7f11896a3a3a6937198c60756a0f142e0bb0 commit e8fc7f11896a3a3a6937198c60756a0f142e0bb0 Author: Jose Luis Duran AuthorDate: 2022-02-23 20:55:23 +0000 Commit: Warner Losh CommitDate: 2022-02-27 16:12:25 +0000 libefivar: Add BluetoothLe device path node support Obtained from: https://github.com/tianocore/edk2/commit/ff5623e990782ad62c5f6943087ebafb17afe8ba Pull Request: https://github.com/freebsd/freebsd-src/pull/581 --- lib/libefivar/efivar-dp-format.c | 38 ++++++++++++++++++++++++++++++++++++++ lib/libefivar/efivar-dp-parse.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/lib/libefivar/efivar-dp-format.c b/lib/libefivar/efivar-dp-format.c index eaff7754019c..667a794b34db 100644 --- a/lib/libefivar/efivar-dp-format.c +++ b/lib/libefivar/efivar-dp-format.c @@ -1721,6 +1721,43 @@ DevPathToTextWiFi ( UefiDevicePathLibCatPrint (Str, "Wi-Fi(%s)", SSId); } +/** + Converts a Bluetooth device path structure to its string representative. + + @param Str The string representative of input device. + @param DevPath The input device path structure. + @param DisplayOnly If DisplayOnly is TRUE, then the shorter text representation + of the display node is used, where applicable. If DisplayOnly + is FALSE, then the longer text representation of the display node + is used. + @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut forms of text + representation for a device node can be used, where applicable. + +**/ +static VOID +DevPathToTextBluetoothLE ( + IN OUT POOL_PRINT *Str, + IN VOID *DevPath, + IN BOOLEAN DisplayOnly, + IN BOOLEAN AllowShortcuts + ) +{ + BLUETOOTH_LE_DEVICE_PATH *BluetoothLE; + + BluetoothLE = DevPath; + UefiDevicePathLibCatPrint ( + Str, + "BluetoothLE(%02x%02x%02x%02x%02x%02x,0x%02x)", + BluetoothLE->Address.Address[0], + BluetoothLE->Address.Address[1], + BluetoothLE->Address.Address[2], + BluetoothLE->Address.Address[3], + BluetoothLE->Address.Address[4], + BluetoothLE->Address.Address[5], + BluetoothLE->Address.Type + ); +} + /** Converts a URI device path structure to its string representative. @@ -2257,6 +2294,7 @@ static const DEVICE_PATH_TO_TEXT_TABLE mUefiDevicePathLibToTextTable[] = { {MESSAGING_DEVICE_PATH, MSG_URI_DP, DevPathToTextUri }, {MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_DP, DevPathToTextBluetooth }, {MESSAGING_DEVICE_PATH, MSG_WIFI_DP, DevPathToTextWiFi }, + {MESSAGING_DEVICE_PATH, MSG_BLUETOOTH_LE_DP, DevPathToTextBluetoothLE }, {MEDIA_DEVICE_PATH, MEDIA_HARDDRIVE_DP, DevPathToTextHardDrive }, {MEDIA_DEVICE_PATH, MEDIA_CDROM_DP, DevPathToTextCDROM }, {MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP, DevPathToTextVendor }, diff --git a/lib/libefivar/efivar-dp-parse.c b/lib/libefivar/efivar-dp-parse.c index ea78d5a1f930..80270aad1d5c 100644 --- a/lib/libefivar/efivar-dp-parse.c +++ b/lib/libefivar/efivar-dp-parse.c @@ -2838,6 +2838,40 @@ DevPathFromTextWiFi ( return (EFI_DEVICE_PATH_PROTOCOL *) WiFiDp; } +/** + Converts a text device path node to Bluetooth LE device path structure. + + @param TextDeviceNode The input Text device path node. + + @return A pointer to the newly-created Bluetooth LE device path structure. + +**/ +static +EFI_DEVICE_PATH_PROTOCOL * +DevPathFromTextBluetoothLE ( + IN CHAR16 *TextDeviceNode + ) +{ + CHAR16 *BluetoothLeAddrStr; + CHAR16 *BluetoothLeAddrTypeStr; + BLUETOOTH_LE_DEVICE_PATH *BluetoothLeDp; + + BluetoothLeAddrStr = GetNextParamStr (&TextDeviceNode); + BluetoothLeAddrTypeStr = GetNextParamStr (&TextDeviceNode); + BluetoothLeDp = (BLUETOOTH_LE_DEVICE_PATH *) CreateDeviceNode ( + MESSAGING_DEVICE_PATH, + MSG_BLUETOOTH_LE_DP, + (UINT16) sizeof (BLUETOOTH_LE_DEVICE_PATH) + ); + + BluetoothLeDp->Address.Type = (UINT8) Strtoi (BluetoothLeAddrTypeStr); + StrHexToBytes ( + BluetoothLeAddrStr, sizeof (BluetoothLeDp->Address.Address) * 2, + BluetoothLeDp->Address.Address, sizeof (BluetoothLeDp->Address.Address) + ); + return (EFI_DEVICE_PATH_PROTOCOL *) BluetoothLeDp; +} + /** Converts a text device path node to URI device path structure. @@ -3544,6 +3578,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED DEVICE_PATH_FROM_TEXT_TABLE mUefiDevicePathLibDevP {"Uri", DevPathFromTextUri }, {"Bluetooth", DevPathFromTextBluetooth }, {"Wi-Fi", DevPathFromTextWiFi }, + {"BluetoothLE", DevPathFromTextBluetoothLE }, {"MediaPath", DevPathFromTextMediaPath }, {"HD", DevPathFromTextHD }, {"CDROM", DevPathFromTextCDROM },