Skip to contentSkip to conversation

Bluetooth: Query LE tx power on startup broke Bluetooth on MacBookPro16,1

regression In review Orlando Chamberlain 7 participants 87 messages Sep 29, 2021 – Dec 21, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Commit 7c395ea521e6 made Bluetooth stop working on the MacBookPro16,1. I

believe this also affected the iMac20,1. The patch below introduces a quirk

disabling Read LE Min/Max Tx Power for affected computers, based off the brcm chip
id 150.

I think there are a couple of issues with this patch that I don't have the

knowledge to resolve:

1. I don't know how accurate the description of the quirk is, I based it off

the commit message of 7c395ea521e6m, however I don't understand much about

how Bluetooth works. Other Bluetooth quirks also have explanations as to

why they are needed, I don't know why this quirk is needed (is it that

these chips incorrectly say they support read le minmax tx power? I just

don't know).

2. It may be a bug in the min max le tx power code that could be fixed instead

of disabling it for the affected devices.

I haven't had much success in figuring out exactly why reading le minmax tx

power stops Bluetooth from working. I have noticed that these lines are not

present in dmesg when Bluetooth is not working due to this issue:

Bluetooth: RFCOMM TTY layer initialized

Bluetooth: RFCOMM socket layer initialized

Bluetooth: RFCOMM ver 1.11

I have also added some logging around the changes in 7c395ea521e6, the two

patches (one with bt working one without) I tried and their associated dmesgs

are here https://gist.github.com/Redecorating/8330bb58a7cb8730be3956058ba4599f

Regards,

Orlando Chamberlain

---

 drivers/bluetooth/btbcm.c   | 4 ++++
 include/net/bluetooth/hci.h | 9 +++++++++
 net/bluetooth/hci_core.c    | 3 ++-
 3 files changed, 15 insertions(+), 1 deletion(-)
drivers/bluetooth/btbcm.c +0 -0

index e4182acee488..4ecc50d93107 100644

--- a/drivers/bluetooth/btbcm.c

+++ b/drivers/bluetooth/btbcm.c

@@ -353,6 +353,10 @@ static int btbcm_read_info(struct hci_dev *hdev)

return PTR_ERR(skb);

bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]);

+

+ if (skb->data[1] == 150)

+ set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);

+

kfree_skb(skb);

/* Read Controller Features */

include/net/bluetooth/hci.h +0 -0

index b80415011dcd..9ce46cb8564d 100644

--- a/include/net/bluetooth/hci.h

+++ b/include/net/bluetooth/hci.h

@@ -246,6 +246,15 @@ enum {

* HCI after resume.

*/

HCI_QUIRK_NO_SUSPEND_NOTIFIER,

+

+ /*

+ * When this quirk is set, LE tx power is not queried on startup

+ * and the min/max tx power values default to HCI_TX_POWER_INVALID.

+ *

+ * This quirk can be set before hci_register_dev is called or

+ * during the hdev->setup vendor callback.

+ */

+ HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,

};

/* HCI device flags */

net/bluetooth/hci_core.c +0 -0

index 8a47a3017d61..9a23fe7c8d67 100644

--- a/net/bluetooth/hci_core.c

+++ b/net/bluetooth/hci_core.c

@@ -742,7 +742,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)

hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);

}

- if (hdev->commands[38] & 0x80) {

+ if (hdev->commands[38] & 0x80 &&

+ !test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {

/* Read LE Min/Max Tx Power*/

hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,

0, NULL);

--

2.33.0

#1 lore raw
Quoted 7 lines · Orlando Chamberlain

Commit 7c395ea521e6 made Bluetooth stop working on the MacBookPro16,1. I

believe this also affected the iMac20,1. The patch below introduces a quirk

disabling Read LE Min/Max Tx Power for affected computers, based off the brcm chip
id 150.

Feel free to ignore this message. I write it to make regzbot track above issue. Regzbot is the regression tracking bot I'm working on. It's still in the early stages and this is still one of the first few regression I make it track to get started and things tested in the field. That also why I'm sending the mail just to the regressions list (it will do its fully magic nevertheless). For details see:
https://linux-regtracking.leemhuis.info/post/inital-regzbot-running/
https://linux-regtracking.leemhuis.info/post/regzbot-approach/

#regzbot ^introduced 7c395ea521e6

Ciao, Thorsten

#2 lore raw
In reply to Orlando Chamberlain

I've realised that thunderbird has added empty lines between each line in my previous email, but here's the same patch I sent before that adds a quirk disabling querying LE tx power for affected controllers, but this time without the aforementioned extra empty lines (I'm using git send-email now).

---
 drivers/bluetooth/btbcm.c   | 4 ++++
 include/net/bluetooth/hci.h | 9 +++++++++
 net/bluetooth/hci_core.c    | 3 ++-
 3 files changed, 15 insertions(+), 1 deletion(-)
drivers/bluetooth/btbcm.c +4 -0
index e4182acee488..4ecc50d93107 100644
@@ -353,6 +353,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 		return PTR_ERR(skb);
 
 	bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]);
+
+	if (skb->data[1] == 150)
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	kfree_skb(skb);
 
 	/* Read Controller Features */
include/net/bluetooth/hci.h +9 -0
index b80415011dcd..9ce46cb8564d 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -1
index 8a47a3017d61..9a23fe7c8d67 100644
@@ -742,7 +742,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if (hdev->commands[38] & 0x80 &&
+	    	!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);

--
2.33.0

maintainer
#3 lore raw
Quoted 61 lines · Orlando Chamberlain

I've realised that thunderbird has added empty lines between each line in my previous email, but here's the same patch I sent before that adds a quirk disabling querying LE tx power for affected controllers, but this time without the aforementioned extra empty lines (I'm using git send-email now).

---
 drivers/bluetooth/btbcm.c   | 4 ++++
 include/net/bluetooth/hci.h | 9 +++++++++
 net/bluetooth/hci_core.c    | 3 ++-
 3 files changed, 15 insertions(+), 1 deletion(-)
drivers/bluetooth/btbcm.c +4 -0
index e4182acee488..4ecc50d93107 100644
@@ -353,6 +353,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 		return PTR_ERR(skb);
 
 	bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]);
+
+	if (skb->data[1] == 150)
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	kfree_skb(skb);
 
 	/* Read Controller Features */
include/net/bluetooth/hci.h +9 -0
index b80415011dcd..9ce46cb8564d 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -2
index 8a47a3017d61..9a23fe7c8d67 100644
@@ -742,7 +742,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if (hdev->commands[38] & 0x80 &&
+	    	!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);
--
Quoted 3 lines

2.33.0

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.

You are receiving this message because of the following common error(s) as indicated below:

- Your patch does not have a Signed-off-by: line. Please read the kernel file, Documentation/SubmittingPatches and resend it after adding that line. Note, the line needs to be in the body of the email, before the patch, not at the bottom of the patch or in the email signature.

If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.

thanks,

greg k-h's patch email bot

#4 lore raw

PATCH 1/1 Bluetooth: add quirk disabling query LE tx power

In reply to Orlando Chamberlain

Querying LE tx power on startup broke Bluetooth on some Broadcom chips in Apple computers (at least MacBookPro16,1 and iMac20,1). Added a quirk disabling this query for affected devices, based off their common chip id 150. Affected devices will not be able to query LE tx power, however they were not doing this before.

Fixes 7c395ea521e6m ("Bluetooth: Query LE tx power on startup")
---
 drivers/bluetooth/btbcm.c   | 4 ++++
 include/net/bluetooth/hci.h | 8 ++++++++
 net/bluetooth/hci_core.c    | 3 ++-
 3 files changed, 14 insertions(+), 1 deletion(-)
drivers/bluetooth/btbcm.c +4 -0
index e4182acee488..4ecc50d93107 100644
@@ -353,6 +353,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 		return PTR_ERR(skb);
 
 	bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]);
+
+	if (skb->data[1] == 150)
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	kfree_skb(skb);
 
 	/* Read Controller Features */
include/net/bluetooth/hci.h +8 -0
index b80415011dcd..5e0dd0c39ade 100644
@@ -246,6 +246,14 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -1
index 8a47a3017d61..16e39739c662 100644
@@ -742,7 +742,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if (hdev->commands[38] & 0x80 &&
+			!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);
Signature · 1 line
2.33.0
#5 lore raw

Re: [PATCH] Bluetooth: add quirk disabling query LE tx power

Quoted 8 lines · Orlando Chamberlain

Querying LE tx power on startup broke Bluetooth on some Broadcom chips in Apple computers (at least MacBookPro16,1 and iMac20,1). Added a quirk disabling this query for affected devices, based off their common chip id 150. Affected devices will not be able to query LE tx power, however they were not doing this before.

Fixes 7c395ea521e6m ("Bluetooth: Query LE tx power on startup")

FWIW, if you need to respin this for some reason, could you do me a favour and add the following after the "Fixes" line please:

Link:
https://lore.kernel.org/r/[email protected]

That makes is easier to find related discussions and rationale behind a certain change, as explained here:
https://www.kernel.org/doc/html/latest/maintainer/configure-git.html

This line is not crucial, but it makes my life easier as well, as I slowly start to track regressions again. And this time I'm doing it with the help of a software I wrote just for this purpose. I used your report as one of the first few to give this "regzbot" a test, hence the issue can now be seen in the webinterface (which is still a bit ugly, but it does the job):

https://linux-regtracking.leemhuis.info/regzbot/mainline.html

And the thing is: when regzbot sees a patch with above Link:-tag hit mainline it will automatically mark the issue as resolved, saving me some work.

Thx!

Ciao, Thorsten

maintainer
#6 lore raw

Re: [PATCH] Bluetooth: add quirk disabling query LE tx power

In reply to Orlando Chamberlain

Hi Orlando,

Quoted 53 lines

Querying LE tx power on startup broke Bluetooth on some Broadcom chips in Apple computers (at least MacBookPro16,1 and iMac20,1). Added a quirk disabling this query for affected devices, based off their common chip id 150. Affected devices will not be able to query LE tx power, however they were not doing this before.

Fixes 7c395ea521e6m ("Bluetooth: Query LE tx power on startup")

---

drivers/bluetooth/btbcm.c   | 4 ++++
include/net/bluetooth/hci.h | 8 ++++++++
net/bluetooth/hci_core.c    | 3 ++-
3 files changed, 14 insertions(+), 1 deletion(-)
drivers/bluetooth/btbcm.c +4 -0
index e4182acee488..4ecc50d93107 100644
@@ -353,6 +353,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 		return PTR_ERR(skb);
 
 	bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]);
+
+	if (skb->data[1] == 150)
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	kfree_skb(skb);
 
 	/* Read Controller Features */
include/net/bluetooth/hci.h +8 -0
index b80415011dcd..5e0dd0c39ade 100644
@@ -246,6 +246,14 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +0 -0
index 8a47a3017d61..16e39739c662 100644

net/bluetooth/hci_core.c static int hci_init3_req(struct hci_request *req, unsigned long opt) · line 749

Quoted 9 lines
net/bluetooth/hci_core.c +2 -1
@@ -742,7 +742,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if (hdev->commands[38] & 0x80 &&
+			!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);

so I really need the btmon traces from the device init (so unload and reload the module) and we need to see what commands are supported and what commands are failing.

Since you say this is on a MacBook, I assume this is an UART based Broadcom chip. Sometimes Broadcom has been really flaky with their actually implemented commands. However in some cases firmware updates do fix this. So any chance you can boot OS X and check that the latest firmware is loaded.

Regards

Marcel

#7 lore raw

Re: [PATCH] Bluetooth: add quirk disabling query LE tx power

Quoted 1 line · Marcel Holtmann

so I really need the btmon traces from the device init (so unload and reload the module) and we need to see what commands are supported and what commands are failing.

I'll attach the full file I got with btmon -w MacBookPro16,1.btsnoop, but these seem like the important bits:

< HCI Command: Read Local Supported Commands (0x04|0x0002) plen 0 #43 [hci0] 9.217379

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 68 #44 [hci0] 9.218033

Read Local Supported Commands (0x04|0x0002) ncmd 1

Status: Success (0x00)

Commands: 223 entries
## many many lines here ##
LE Read Transmit Power (Octet 38 - Bit 7) LE Read RF Path Compensation (Octet 39 - Bit 0)

LE Write RF Path Compensation (Octet 39 - Bit 1)

LE Set Privacy Mode (Octet 39 - Bit 2)

Read Local Simple Pairing Options (Octet 41 - Bit

At the end of the trace:

< HCI Command: LE Read Transmit Power (0x08|0x004b) plen 0 #69 [hci0] 9.226953

Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4 #70 [hci0] 9.227515

      LE Read Transmit Power (0x08|0x004b) ncmd 1
        Status: Unknown HCI Command (0x01)

= Close Index: F8:FF:C2:06:46:63 [hci0] 9.227666

I'm guessing that this means it reports that it supports the command but it doesn't, so if this is the case, I'd have to change the description of the quirk to clarify that.

Quoted 1 line

Since you say this is on a MacBook, I assume this is an UART based Broadcom chip. Sometimes Broadcom has been really flaky with their actually implemented commands. However in some cases firmware updates do fix this. So any chance you can boot OS X and check that the latest firmware is loaded.

Bluetooth for this device is indeed through uart:

# lspci -vvvnnd '8086:a328'
00:1e.0 Communication controller [0780]: Intel Corporation Cannon Lake PCH Serial IO UART Host Controller    [8086:a328] (rev 10)

Subsystem: Intel Corporation Device [8086:7270]

Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-

Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-

Latency: 0, Cache Line Size: 256 bytes

Interrupt: pin A routed to IRQ 20

IOMMU group: 8

Region 0: Memory at 4000000000 (64-bit, non-prefetchable) [size=4K]

Capabilities: [80] Power Management version 3

Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)

Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-

Capabilities: [90] Vendor Specific Information: Len=14 <?>

Kernel driver in use: intel-lpss

Kernel modules: intel_lpss_pci

$ cat /sys/bus/pci/devices/0000:00:1e.0/dw-apb-uart.0/serial0/serial0-0/modalias

acpi:BCM2E7C:APPLE-UART-BLTH:

I've just updated macOS to 11.6, which should have updated firmware. The issue is still present.

#8 lore raw

PATCH v2 1/1 Bluetooth: quirk disabling LE Read Transmit Power

The LE Read Transmit Power command is Advertised on some Broadcom controlers, but not supported. Using this command breaks Bluetooth on the MacBookPro16,1 and iMac20,1. Added a quirk disabling LE Read Transmit Power for these devices, based off their common chip id 150.

---
v1->v2: Clarified quirk description

 drivers/bluetooth/btbcm.c   |  4 ++++
 include/net/bluetooth/hci.h | 11 +++++++++++
 net/bluetooth/hci_core.c    |  3 ++-
 3 files changed, 17 insertions(+), 1 deletion(-)
drivers/bluetooth/btbcm.c +4 -0
index e4182acee488..4ecc50d93107 100644
@@ -353,6 +353,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 		return PTR_ERR(skb);
 
 	bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]);
+
+	if (skb->data[1] == 150)
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	kfree_skb(skb);
 
 	/* Read Controller Features */
include/net/bluetooth/hci.h +11 -0
index b80415011dcd..6da9bd6b7259 100644
@@ -246,6 +246,17 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/* When this quirk is set, LE Read Transmit Power is disabled.
+	 * This is mainly due to the fact that the HCI LE Read Transmit
+	 * Power command is advertised, but not supported; these
+	 * controllers often reply with unknown command and need a hard
+	 * reset.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -1
index 8a47a3017d61..9a23fe7c8d67 100644
@@ -742,7 +742,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if (hdev->commands[38] & 0x80 &&
+			!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);
Signature · 1 line
2.33.0
maintainer
#9 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Hi Orlando,

Quoted 20 lines

The LE Read Transmit Power command is Advertised on some Broadcom controlers, but not supported. Using this command breaks Bluetooth on the MacBookPro16,1 and iMac20,1. Added a quirk disabling LE Read Transmit Power for these devices, based off their common chip id 150.

---
v1->v2: Clarified quirk description

drivers/bluetooth/btbcm.c   |  4 ++++
include/net/bluetooth/hci.h | 11 +++++++++++
net/bluetooth/hci_core.c    |  3 ++-
3 files changed, 17 insertions(+), 1 deletion(-)
drivers/bluetooth/btbcm.c +0 -0
index e4182acee488..4ecc50d93107 100644

drivers/bluetooth/btbcm.c static int btbcm_read_info(struct hci_dev *hdev) · line 360

Quoted 8 lines
drivers/bluetooth/btbcm.c +4 -0
@@ -353,6 +353,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 		return PTR_ERR(skb);
 
 	bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]);
+
+	if (skb->data[1] == 150)
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	kfree_skb(skb);

I would really prefer to do that via the ACPI table matching in hci_bcm.c and not via some magic chip id check. We actually don’t know how Broadcom assigns their chip ids.

Regards

Marcel

#10 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Quoted 2 lines · On Fri, 01 Oct 2021 19:35:16 +1000 "Marcel Holtmann" <[email protected]>…

I would really prefer to do that via the ACPI table matching in hci_bcm.c and not via some magic chip id check.

Initially I thought we may be able to do this based off BCM2E7C (which is in the DSDT table which I'll attach), however it seems like many Macs also have that (i.e. MacBookPro14,1, MacBookAir8,1, MacBook9,1), so unless all these don't support LE Read Transmit Power, (which would be hard to determine), I don't know if BCM2E7C can be used to quirk it.

I'll try to see if I can find something else in the ACPI tables that can be used as a quirk. (I'll see if I can get the table of a similar model that wasn't affected and compare the BLTH sections)

If ACPI tables other than DSDT could be relevant, I can send them too. These are the ones that are present:
APIC DMAR DSDT ECDT FACP FACS HPET MCFG SBST SSDT1 SSDT10 SSDT11 SSDT12 SSDT13 SSDT14 SSDT15 SSDT2 SSDT3 SSDT4 SSDT5 SSDT6 SSDT7 SSDT8 SSDT9 VFCT

Quoted 1 line

We actually don’t know how Broadcom assigns their chip ids.

That's a good point. I've seen 150, 123 and 133 in some recent Macs, but I also don't know what they refer to or how they are assigned.

/*
* Intel ACPI Component Architecture
* AML/ASL+ Disassembler version 20210730 (64-bit version)
* Copyright (c) 2000 - 2021 Intel Corporation
*
* Disassembling to symbolic ASL+ operators
*
* Disassembly of DSDT, Fri Oct 1 20:45:18 2021 *
* Original Table Header:

 *     Signature        "DSDT"
 *     Length           0x000072C3 (29379)
 *     Revision         0x02
 *     Checksum         0xFD
 *     OEM ID           "APPLE "
 *     OEM Table ID     "MacXX"
 *     OEM Revision     0x00150001 (1376257)
 *     Compiler ID      "INTL"
 *     Compiler Version 0x20160930 (538315056)
 */
DefinitionBlock ("", "DSDT", 2, "APPLE ", "MacXX", 0x00150001)
{
    External (_PR_.CFGD, UnknownObj)
    External (_PR_.CPPC, FieldUnitObj)
    External (_PR_.CPU0._PPC, IntObj)
    External (_SB_.PCI0.IGPU.CLID, UnknownObj)
    External (_SB_.PCI0.IGPU.GEFC, UnknownObj)
    External (_SB_.PCI0.IGPU.GSCI, MethodObj)    // 0 Arguments
    External (_SB_.PCI0.IGPU.GSSE, UnknownObj)
    External (_SB_.PCI0.IGPU.IDSM, MethodObj)    // 4 Arguments
    External (_SB_.PCI0.IGPU.SCIE, UnknownObj)
    External (_SB_.PCI0.PEG0.EGP0.EGP1.GFX0, UnknownObj)
    External (_SB_.PCI0.PEG1.DTFP, MethodObj)    // 0 Arguments
    External (_SB_.PCI0.PEG1.ICMB, MethodObj)    // 1 Arguments
    External (_SB_.PCI0.PEG1.UPSB.LSTX, MethodObj)    // 2 Arguments
    External (_SB_.PCI0.PEG2.DTFP, MethodObj)    // 0 Arguments
    External (_SB_.PCI0.PEG2.ICMB, MethodObj)    // 1 Arguments
    External (_SB_.PCI0.PEG2.UPSB.LSTX, MethodObj)    // 2 Arguments
    External (_SB_.PCI0.TGPE, MethodObj)    // 0 Arguments
    External (_SB_.PCI0.XHC1, DeviceObj)
    External (ADP1, DeviceObj)
    External (ADSP, UnknownObj)    // Conflicts with a later declaration
    External (BT19, UnknownObj)    // Conflicts with a later declaration
    External (D318, FieldUnitObj)
    External (D319, FieldUnitObj)
    External (D31A, FieldUnitObj)
    External (D31C, FieldUnitObj)
    External (D320, FieldUnitObj)
    External (D324, FieldUnitObj)
    External (D418, FieldUnitObj)
    External (D419, FieldUnitObj)
    External (D41A, FieldUnitObj)
    External (D41C, FieldUnitObj)
    External (D420, FieldUnitObj)
    External (D424, FieldUnitObj)
    External (D518, FieldUnitObj)
    External (D519, FieldUnitObj)
    External (D51A, FieldUnitObj)
    External (D51C, FieldUnitObj)
    External (D520, FieldUnitObj)
    External (D524, FieldUnitObj)
    External (D618, FieldUnitObj)
    External (D619, FieldUnitObj)
    External (D61A, FieldUnitObj)
    External (D61C, FieldUnitObj)
    External (D620, FieldUnitObj)
    External (D624, FieldUnitObj)
    External (DP18, FieldUnitObj)
    External (DP19, FieldUnitObj)
    External (DP1A, FieldUnitObj)
    External (DP1C, FieldUnitObj)
    External (DP20, FieldUnitObj)
    External (DP24, FieldUnitObj)
    External (GSMI, UnknownObj)
    External (LID0, DeviceObj)
    External (LIDS, UnknownObj)
    External (LVME, UnknownObj)    // Conflicts with a later declaration
    External (M64B, UnknownObj)
    External (M64L, UnknownObj)
    External (NH10, FieldUnitObj)
    External (NH14, FieldUnitObj)
    External (NPKA, UnknownObj)    // Conflicts with a later declaration
    External (PDC0, UnknownObj)
    External (PDC1, UnknownObj)
    External (PDC2, UnknownObj)
    External (PDC3, UnknownObj)
    External (PDC4, UnknownObj)
    External (PDC5, UnknownObj)
    External (PDC6, UnknownObj)
    External (PDC7, UnknownObj)
    External (R_20, FieldUnitObj)
    External (R_24, FieldUnitObj)
    External (SMCB, FieldUnitObj)
    External (UP18, FieldUnitObj)
    External (UP19, FieldUnitObj)
    External (UP1A, FieldUnitObj)
    External (UP1C, FieldUnitObj)
    External (UP20, FieldUnitObj)
    External (UP24, FieldUnitObj)

    Name (SP2O, 0x4E)
    Name (SP1O, 0x164E)
    Name (IO1B, 0x0600)
    Name (IO1L, 0x70)
    Name (IO2B, 0x0680)
    Name (IO2L, 0x20)
    Name (IO3B, 0x0290)
    Name (IO3L, 0x10)
    Name (SP3O, 0x2E)
    Name (IO4B, 0x0A20)
    Name (IO4L, 0x20)
    Name (MCHB, 0xFED10000)
    Name (MCHL, 0x4000)
    Name (EGPB, 0xFED19000)
    Name (EGPL, 0x1000)
    Name (DMIB, 0xFED18000)
    Name (DMIL, 0x1000)
    Name (IFPB, 0xFED14000)
    Name (IFPL, 0x1000)
    Name (PEBS, 0xE0000000)
    Name (PELN, 0x04000000)
    Name (TTTB, 0xFED20000)
    Name (TTTL, 0x00020000)
    Name (SMBS, 0xEFA0)
    Name (SMBL, 0x10)
    Name (PBLK, 0x1810)
    Name (LVL2, 0x1814)
    Name (LVL3, 0x1815)
    Name (LVL4, 0x1816)
    Name (SMIP, 0xB2)
    Name (GPBS, 0x0800)
    Name (GPLN, 0x80)
    Name (APCB, 0xFEC00000)
    Name (APCL, 0x1000)
    Name (PM30, 0x1830)
    Name (SUSW, 0xFF)
    Name (HPTC, 0xFED1C404)
    Name (ACPH, 0xDE)
    Name (ASSB, Zero)
    Name (AOTB, Zero)
    Name (AAXB, Zero)
    Name (PEHP, One)
    Name (SHPC, One)
    Name (PEPM, One)
    Name (PEER, One)
    Name (PECS, One)
    Name (ITKE, Zero)
    Name (DSSP, Zero)
    Name (FHPP, One)
    Name (FMBL, One)
    Name (FDTP, 0x02)
    Name (BSH, Zero)
    Name (BEL, One)
    Name (BEH, 0x02)
    Name (BRH, 0x03)
    Name (BTF, 0x04)
    Name (BHC, 0x05)
    Name (BYB, 0x06)
    Name (BPH, 0x07)
    Name (BSHS, 0x08)
    Name (BELS, 0x09)
    Name (BRHS, 0x0A)
    Name (BTFS, 0x0B)
    Name (BEHS, 0x0C)
    Name (BPHS, 0x0D)
    Name (BTL, 0x10)
    Name (BOF, 0x20)
    Name (BEF, 0x21)
    Name (BLLE, 0x22)
    Name (BLLC, 0x23)
    Name (BLCA, 0x24)
    Name (TCGM, One)
    Name (TRTP, One)
    Name (TRTD, 0x02)
    Name (TRTI, 0x03)
    Name (GCDD, One)
    Name (DSTA, 0x0A)
    Name (DSLO, 0x0C)
    Name (DSLC, 0x0E)
    Name (PITS, 0x10)
    Name (SBCS, 0x12)
    Name (SALS, 0x13)
    Name (LSSS, 0x2A)
    Name (SOOT, 0x35)
    Name (PDBR, 0x4D)
    Name (WOWE, Zero)
    Name (TAPD, Zero)
    OperationRegion (GNVS, SystemMemory, 0x7AF34E18, 0x0185)
    Field (GNVS, AnyAcc, Lock, Preserve)
    {
        OSYS,   16, 
        SMIF,   8, 
        PRM0,   8, 
        PRM1,   8, 
        SCIF,   8, 
        PRM2,   8, 
        PRM3,   8, 
        LCKF,   8, 
        PRM4,   8, 
        PRM5,   8, 
        P80D,   32, 
        Offset (0x10), 
        PWRS,   8, 
        DBGS,   8, 
        THOF,   8, 
        ACT1,   8, 
        ACTT,   8, 
        PSVT,   8, 
        TC1V,   8, 
        TC2V,   8, 
        TSPV,   8, 
        CRTT,   8, 
        DTSE,   8, 
        DTS1,   8, 
        DTS2,   8, 
        DTSF,   8, 
        Offset (0x25), 
        REVN,   8, 
        Offset (0x28), 
        APIC,   8, 
        TCNT,   8, 
        PCP0,   8, 
        PCP1,   8, 
        PPCM,   8, 
        PPMF,   32, 
        C67L,   8, 
        NATP,   8, 
        CMAP,   8, 
        CMBP,   8, 
        LPTP,   8, 
        FDCP,   8, 
        CMCP,   8, 
        CIRP,   8, 
        SMSC,   8, 
        W381,   8, 
        SMC1,   8, 
        EMAE,   8, 
        EMAP,   16, 
        EMAL,   16, 
        Offset (0x42), 
        MEFE,   8, 
        DSTS,   8, 
        Offset (0x46), 
        TPMP,   8, 
        TPME,   8, 
        MORD,   8, 
        TCGP,   8, 
        PPRP,   32, 
        PPRQ,   8, 
        LPPR,   8, 
        GTF0,   56, 
        GTF2,   56, 
        IDEM,   8, 
        GTF1,   56, 
        BDID,   8, 
        Offset (0x78), 
        OSCC,   8, 
        NEXP,   8, 
        SDGV,   8, 
        SDDV,   8, 
        Offset (0x81), 
        DSEN,   8, 
        ECON,   8, 
        GPIC,   8, 
        CTYP,   8, 
        L01C,   8, 
        VFN0,   8, 
        VFN1,   8, 
        ATMC,   8, 
        PTMC,   8, 
        ATRA,   8, 
        PTRA,   8, 
        PNHM,   32, 
        TBAB,   32, 
        TBAH,   32, 
        RTIP,   8, 
        TSOD,   8, 
        ATPC,   8, 
        PTPC,   8, 
        PFLV,   8, 
        BREV,   8, 
        DPBM,   8, 
        DPCM,   8, 
        DPDM,   8, 
        SDID,   8, 
        BLCP,   8, 
        BLCC,   8, 
        LDSB,   8, 
        BLCT,   32, 
        BLCB,   32, 
        BICM,   1, 
        ISWI,   1, 
        USBD,   1, 
        Offset (0xAE), 
        U2OP,   8, 
        Offset (0xBA), 
        GVNV,   32, 
        MM64,   8, 
        MFIX,   8, 
        Offset (0xDC), 
        NVME,   8, 
        Offset (0xDE), 
        DFUW,   8, 
        SMCB,   32, 
        Offset (0x12C), 
        BIC1,   8, 
        BIC2,   8, 
        NHI1,   32, 
        T2P1,   32, 
        TUP1,   32, 
        TDB1,   32, 
        TNH1,   32, 
        TD11,   32, 
        TD21,   32, 
        TD41,   32, 
        NHI2,   32, 
        T2P2,   32, 
        TUP2,   32, 
        TDB2,   32, 
        TNH2,   32, 
        TD12,   32, 
        TD22,   32, 
        TD42,   32, 
        ABRV,   8, 
        ABID,   64, 
        MAC0,   8, 
        MAC1,   8, 
        MAC2,   8, 
        MAC3,   8, 
        MAC4,   8, 
        MAC5,   8, 
        AGID,   32, 
        RWC0,   8, 
        RWC1,   8, 
        RWC2,   8, 
        RWC3,   8
    }

    Scope (_SB)
    {
        Name (PR00, Package (0x21)
        {
            Package (0x04)
            {
                0x001FFFFF, 
                Zero, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0x001FFFFF, 
                One, 
                LNKB, 
                Zero
            }, 

            Package (0x04)
            {
                0x001FFFFF, 
                0x02, 
                LNKC, 
                Zero
            }, 

            Package (0x04)
            {
                0x001FFFFF, 
                0x03, 
                LNKD, 
                Zero
            }, 

            Package (0x04)
            {
                0x001DFFFF, 
                Zero, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0x001DFFFF, 
                One, 
                LNKB, 
                Zero
            }, 

            Package (0x04)
            {
                0x001DFFFF, 
                0x02, 
                LNKC, 
                Zero
            }, 

            Package (0x04)
            {
                0x001DFFFF, 
                0x03, 
                LNKD, 
                Zero
            }, 

            Package (0x04)
            {
                0x001CFFFF, 
                Zero, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0x001CFFFF, 
                One, 
                LNKB, 
                Zero
            }, 

            Package (0x04)
            {
                0x001CFFFF, 
                0x02, 
                LNKC, 
                Zero
            }, 

            Package (0x04)
            {
                0x001CFFFF, 
                0x03, 
                LNKD, 
                Zero
            }, 

            Package (0x04)
            {
                0x001BFFFF, 
                Zero, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0x001BFFFF, 
                One, 
                LNKB, 
                Zero
            }, 

            Package (0x04)
            {
                0x001BFFFF, 
                0x02, 
                LNKC, 
                Zero
            }, 

            Package (0x04)
            {
                0x001BFFFF, 
                0x03, 
                LNKD, 
                Zero
            }, 

            Package (0x04)
            {
                0x0017FFFF, 
                Zero, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0x0016FFFF, 
                Zero, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0x0016FFFF, 
                One, 
                LNKB, 
                Zero
            }, 

            Package (0x04)
            {
                0x0016FFFF, 
                0x02, 
                LNKC, 
                Zero
            }, 

            Package (0x04)
            {
                0x0016FFFF, 
                0x03, 
                LNKD, 
                Zero
            }, 

            Package (0x04)
            {
                0x0014FFFF, 
                Zero, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0x0014FFFF, 
                One, 
                LNKB, 
                Zero
            }, 

            Package (0x04)
            {
                0x0014FFFF, 
                0x02, 
                LNKC, 
                Zero
            }, 

            Package (0x04)
            {
                0x0014FFFF, 
                0x03, 
                LNKD, 
                Zero
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                Zero, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                One, 
                LNKB, 
                Zero
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x02, 
                LNKC, 
                Zero
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x03, 
                LNKD, 
                Zero
            }, 

            Package (0x04)
            {
                0x0002FFFF, 
                Zero, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0x0004FFFF, 
                Zero, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0x0005FFFF, 
                Zero, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0x0008FFFF, 
                Zero, 
                LNKA, 
                Zero
            }
        })
        Name (AR00, Package (0x2D)
        {
            Package (0x04)
            {
                0x001FFFFF, 
                Zero, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0x001FFFFF, 
                One, 
                Zero, 
                0x11
            }, 

            Package (0x04)
            {
                0x001FFFFF, 
                0x02, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0x001FFFFF, 
                0x03, 
                Zero, 
                0x13
            }, 

            Package (0x04)
            {
                0x001EFFFF, 
                Zero, 
                Zero, 
                0x14
            }, 

            Package (0x04)
            {
                0x001EFFFF, 
                One, 
                Zero, 
                0x15
            }, 

            Package (0x04)
            {
                0x001EFFFF, 
                0x02, 
                Zero, 
                0x16
            }, 

            Package (0x04)
            {
                0x001EFFFF, 
                0x03, 
                Zero, 
                0x17
            }, 

            Package (0x04)
            {
                0x001DFFFF, 
                Zero, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0x001DFFFF, 
                One, 
                Zero, 
                0x11
            }, 

            Package (0x04)
            {
                0x001DFFFF, 
                0x02, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0x001DFFFF, 
                0x03, 
                Zero, 
                0x13
            }, 

            Package (0x04)
            {
                0x001CFFFF, 
                Zero, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0x001CFFFF, 
                One, 
                Zero, 
                0x11
            }, 

            Package (0x04)
            {
                0x001CFFFF, 
                0x02, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0x001CFFFF, 
                0x03, 
                Zero, 
                0x13
            }, 

            Package (0x04)
            {
                0x001BFFFF, 
                Zero, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0x001BFFFF, 
                One, 
                Zero, 
                0x11
            }, 

            Package (0x04)
            {
                0x001BFFFF, 
                0x02, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0x001BFFFF, 
                0x03, 
                Zero, 
                0x13
            }, 

            Package (0x04)
            {
                0x0019FFFF, 
                Zero, 
                Zero, 
                0x15
            }, 

            Package (0x04)
            {
                0x0019FFFF, 
                One, 
                Zero, 
                0x16
            }, 

            Package (0x04)
            {
                0x0019FFFF, 
                0x02, 
                Zero, 
                0x17
            }, 

            Package (0x04)
            {
                0x0017FFFF, 
                Zero, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0x0016FFFF, 
                Zero, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0x0016FFFF, 
                One, 
                Zero, 
                0x11
            }, 

            Package (0x04)
            {
                0x0016FFFF, 
                0x02, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0x0016FFFF, 
                0x03, 
                Zero, 
                0x13
            }, 

            Package (0x04)
            {
                0x0015FFFF, 
                Zero, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0x0015FFFF, 
                One, 
                Zero, 
                0x11
            }, 

            Package (0x04)
            {
                0x0015FFFF, 
                0x02, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0x0015FFFF, 
                0x03, 
                Zero, 
                0x13
            }, 

            Package (0x04)
            {
                0x0014FFFF, 
                Zero, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0x0014FFFF, 
                One, 
                Zero, 
                0x11
            }, 

            Package (0x04)
            {
                0x0014FFFF, 
                0x02, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0x0014FFFF, 
                0x03, 
                Zero, 
                0x13
            }, 

            Package (0x04)
            {
                0x0013FFFF, 
                Zero, 
                Zero, 
                0x14
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                Zero, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                One, 
                Zero, 
                0x11
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x02, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x03, 
                Zero, 
                0x13
            }, 

            Package (0x04)
            {
                0x0002FFFF, 
                Zero, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0x0004FFFF, 
                Zero, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0x0005FFFF, 
                Zero, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0x0008FFFF, 
                Zero, 
                Zero, 
                0x10
            }
        })
        Name (PR04, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                LNKB, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                LNKC, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                LNKD, 
                Zero
            }
        })
        Name (AR04, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                Zero, 
                0x11
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                Zero, 
                0x13
            }
        })
        Name (PR05, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                LNKB, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                LNKC, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                LNKD, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                LNKA, 
                Zero
            }
        })
        Name (AR05, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                Zero, 
                0x11
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                Zero, 
                0x13
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                Zero, 
                0x10
            }
        })
        Name (PR06, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                LNKC, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                LNKD, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                LNKB, 
                Zero
            }
        })
        Name (AR06, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                Zero, 
                0x13
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                Zero, 
                0x11
            }
        })
        Name (PR07, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                LNKD, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                LNKB, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                LNKC, 
                Zero
            }
        })
        Name (AR07, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                Zero, 
                0x13
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                Zero, 
                0x11
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                Zero, 
                0x12
            }
        })
        Name (PR08, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                LNKB, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                LNKC, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                LNKD, 
                Zero
            }
        })
        Name (AR08, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                Zero, 
                0x11
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                Zero, 
                0x13
            }
        })
        Name (PR09, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                LNKB, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                LNKC, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                LNKD, 
                Zero
            }
        })
        Name (AR09, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                Zero, 
                0x11
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                Zero, 
                0x13
            }
        })
        Name (PR0E, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                LNKC, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                LNKD, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                LNKB, 
                Zero
            }
        })
        Name (AR0E, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                Zero, 
                0x13
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                Zero, 
                0x11
            }
        })
        Name (PR0F, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                LNKD, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                LNKB, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                LNKC, 
                Zero
            }
        })
        Name (AR0F, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                Zero, 
                0x13
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                Zero, 
                0x11
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                Zero, 
                0x12
            }
        })
        Name (PR02, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                LNKB, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                LNKC, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                LNKD, 
                Zero
            }
        })
        Name (AR02, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                Zero, 
                0x11
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                Zero, 
                0x13
            }
        })
        Name (PR0A, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                LNKB, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                LNKC, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                LNKD, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                LNKA, 
                Zero
            }
        })
        Name (AR0A, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                Zero, 
                0x11
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                Zero, 
                0x13
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                Zero, 
                0x10
            }
        })
        Name (PR0B, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                LNKC, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                LNKD, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                LNKB, 
                Zero
            }
        })
        Name (AR0B, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                Zero, 
                0x13
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                Zero, 
                0x11
            }
        })
        Name (PR0C, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                LNKD, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                LNKA, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                LNKB, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                LNKC, 
                Zero
            }
        })
        Name (AR0C, Package (0x04)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                Zero, 
                0x13
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                Zero, 
                0x10
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                Zero, 
                0x11
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                Zero, 
                0x12
            }
        })
        Name (PR01, Package (0x0C)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                LNKF, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                LNKG, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                LNKH, 
                Zero
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                LNKE, 
                Zero
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                Zero, 
                LNKG, 
                Zero
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                One, 
                LNKF, 
                Zero
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x02, 
                LNKE, 
                Zero
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x03, 
                LNKH, 
                Zero
            }, 

            Package (0x04)
            {
                0x0005FFFF, 
                Zero, 
                LNKC, 
                Zero
            }, 

            Package (0x04)
            {
                0x0005FFFF, 
                One, 
                LNKE, 
                Zero
            }, 

            Package (0x04)
            {
                0x0005FFFF, 
                0x02, 
                LNKG, 
                Zero
            }, 

            Package (0x04)
            {
                0x0005FFFF, 
                0x03, 
                LNKF, 
                Zero
            }
        })
        Name (AR01, Package (0x0C)
        {
            Package (0x04)
            {
                0xFFFF, 
                Zero, 
                Zero, 
                0x15
            }, 

            Package (0x04)
            {
                0xFFFF, 
                One, 
                Zero, 
                0x16
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x02, 
                Zero, 
                0x17
            }, 

            Package (0x04)
            {
                0xFFFF, 
                0x03, 
                Zero, 
                0x14
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                Zero, 
                Zero, 
                0x16
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                One, 
                Zero, 
                0x15
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x02, 
                Zero, 
                0x14
            }, 

            Package (0x04)
            {
                0x0001FFFF, 
                0x03, 
                Zero, 
                0x17
            }, 

            Package (0x04)
            {
                0x0005FFFF, 
                Zero, 
                Zero, 
                0x12
            }, 

            Package (0x04)
            {
                0x0005FFFF, 
                One, 
                Zero, 
                0x14
            }, 

            Package (0x04)
            {
                0x0005FFFF, 
                0x02, 
                Zero, 
                0x16
            }, 

            Package (0x04)
            {
                0x0005FFFF, 
                0x03, 
                Zero, 
                0x15
            }
        })
        Name (PRSA, ResourceTemplate ()
        {
            IRQ (Level, ActiveLow, Shared, )
                {3,4,5,6,7,10,11,12,14,15}
        })
        Alias (PRSA, PRSB)
        Alias (PRSA, PRSC)
        Alias (PRSA, PRSD)
        Alias (PRSA, PRSE)
        Alias (PRSA, PRSF)
        Alias (PRSA, PRSG)
        Alias (PRSA, PRSH)
        Device (PCI0)
        {
            Name (_HID, EisaId ("PNP0A08") /* PCI Express Bus */)  // _HID: Hardware ID
            Name (_CID, EisaId ("PNP0A03") /* PCI Bus */)  // _CID: Compatible ID
            Name (_ADR, Zero)  // _ADR: Address
            Method (^BN00, 0, NotSerialized)
            {
                Return (Zero)
            }

            Method (_BBN, 0, NotSerialized)  // _BBN: BIOS Bus Number
            {
                Return (BN00 ())
            }

            Name (_UID, Zero)  // _UID: Unique ID
            Method (_PRT, 0, NotSerialized)  // _PRT: PCI Routing Table
            {
                If (PICM)
                {
                    Return (AR00 ())
                }

                Return (PR00 ())
            }

            OperationRegion (HBUS, PCI_Config, Zero, 0x0100)
            Field (HBUS, DWordAcc, NoLock, Preserve)
            {
                Offset (0x40), 
                EPEN,   1, 
                    ,   11, 
                EPBR,   20, 
                Offset (0x48), 
                MHEN,   1, 
                    ,   14, 
                MHBR,   17, 
                Offset (0x50), 
                GCLK,   1, 
                Offset (0x54), 
                D0EN,   1, 
                Offset (0x60), 
                PXEN,   1, 
                PXSZ,   2, 
                    ,   23, 
                PXBR,   6, 
                Offset (0x68), 
                DIEN,   1, 
                    ,   11, 
                DIBR,   20, 
                Offset (0x70), 
                    ,   20, 
                MEBR,   12, 
                Offset (0x80), 
                    ,   4, 
                PM0H,   2, 
                Offset (0x81), 
                PM1L,   2, 
                    ,   2, 
                PM1H,   2, 
                Offset (0x82), 
                PM2L,   2, 
                    ,   2, 
                PM2H,   2, 
                Offset (0x83), 
                PM3L,   2, 
                    ,   2, 
                PM3H,   2, 
                Offset (0x84), 
                PM4L,   2, 
                    ,   2, 
                PM4H,   2, 
                Offset (0x85), 
                PM5L,   2, 
                    ,   2, 
                PM5H,   2, 
                Offset (0x86), 
                PM6L,   2, 
                    ,   2, 
                PM6H,   2, 
                Offset (0x87), 
                Offset (0xA8), 
                    ,   20, 
                TUUD,   19, 
                Offset (0xBC), 
                    ,   20, 
                TLUD,   12, 
                Offset (0xC8), 
                    ,   7, 
                HTSE,   1
            }

            OperationRegion (MCHT, SystemMemory, 0xFED10000, 0x6000)
            Field (MCHT, ByteAcc, NoLock, Preserve)
            {
                Offset (0x5994), 
                RPSL,   8, 
                Offset (0x5998), 
                RP0C,   8, 
                RP1C,   8, 
                RPNC,   8
            }

            Name (BUF0, ResourceTemplate ()
            {
                WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
                    0x0000,             // Granularity
                    0x0000,             // Range Minimum
                    0x00FF,             // Range Maximum
                    0x0000,             // Translation Offset
                    0x0100,             // Length
                    ,, )
                DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
                    0x00000000,         // Granularity
                    0x00000000,         // Range Minimum
                    0x00000CF7,         // Range Maximum
                    0x00000000,         // Translation Offset
                    0x00000CF8,         // Length
                    ,, , TypeStatic, DenseTranslation)
                IO (Decode16,
                    0x0CF8,             // Range Minimum
                    0x0CF8,             // Range Maximum
                    0x01,               // Alignment
                    0x08,               // Length
                    )
                DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
                    0x00000000,         // Granularity
                    0x00000D00,         // Range Minimum
                    0x0000FFFF,         // Range Maximum
                    0x00000000,         // Translation Offset
                    0x0000F300,         // Length
                    ,, , TypeStatic, DenseTranslation)
                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                    0x00000000,         // Granularity
                    0x000A0000,         // Range Minimum
                    0x000BFFFF,         // Range Maximum
                    0x00000000,         // Translation Offset
                    0x00020000,         // Length
                    ,, , AddressRangeMemory, TypeStatic)
                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                    0x00000000,         // Granularity
                    0x000C0000,         // Range Minimum
                    0x000C3FFF,         // Range Maximum
                    0x00000000,         // Translation Offset
                    0x00004000,         // Length
                    ,, _Y00, AddressRangeMemory, TypeStatic)
                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                    0x00000000,         // Granularity
                    0x000C4000,         // Range Minimum
                    0x000C7FFF,         // Range Maximum
                    0x00000000,         // Translation Offset
                    0x00004000,         // Length
                    ,, _Y01, AddressRangeMemory, TypeStatic)
                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                    0x00000000,         // Granularity
                    0x000C8000,         // Range Minimum
                    0x000CBFFF,         // Range Maximum
                    0x00000000,         // Translation Offset
                    0x00004000,         // Length
                    ,, _Y02, AddressRangeMemory, TypeStatic)
                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                    0x00000000,         // Granularity
                    0x000CC000,         // Range Minimum
                    0x000CFFFF,         // Range Maximum
                    0x00000000,         // Translation Offset
                    0x00004000,         // Length
                    ,, _Y03, AddressRangeMemory, TypeStatic)
                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                    0x00000000,         // Granularity
                    0x000D0000,         // Range Minimum
                    0x000D3FFF,         // Range Maximum
                    0x00000000,         // Translation Offset
                    0x00004000,         // Length
                    ,, _Y04, AddressRangeMemory, TypeStatic)
                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                    0x00000000,         // Granularity
                    0x000D4000,         // Range Minimum
                    0x000D7FFF,         // Range Maximum
                    0x00000000,         // Translation Offset
                    0x00004000,         // Length
                    ,, _Y05, AddressRangeMemory, TypeStatic)
                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                    0x00000000,         // Granularity
                    0x000D8000,         // Range Minimum
                    0x000DBFFF,         // Range Maximum
                    0x00000000,         // Translation Offset
                    0x00004000,         // Length
                    ,, _Y06, AddressRangeMemory, TypeStatic)
                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                    0x00000000,         // Granularity
                    0x000DC000,         // Range Minimum
                    0x000DFFFF,         // Range Maximum
                    0x00000000,         // Translation Offset
                    0x00004000,         // Length
                    ,, _Y07, AddressRangeMemory, TypeStatic)
                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                    0x00000000,         // Granularity
                    0x000E0000,         // Range Minimum
                    0x000E3FFF,         // Range Maximum
                    0x00000000,         // Translation Offset
                    0x00004000,         // Length
                    ,, _Y08, AddressRangeMemory, TypeStatic)
                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                    0x00000000,         // Granularity
                    0x000E4000,         // Range Minimum
                    0x000E7FFF,         // Range Maximum
                    0x00000000,         // Translation Offset
                    0x00004000,         // Length
                    ,, _Y09, AddressRangeMemory, TypeStatic)
                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                    0x00000000,         // Granularity
                    0x000E8000,         // Range Minimum
                    0x000EBFFF,         // Range Maximum
                    0x00000000,         // Translation Offset
                    0x00004000,         // Length
                    ,, _Y0A, AddressRangeMemory, TypeStatic)
                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                    0x00000000,         // Granularity
                    0x000EC000,         // Range Minimum
                    0x000EFFFF,         // Range Maximum
                    0x00000000,         // Translation Offset
                    0x00004000,         // Length
                    ,, _Y0B, AddressRangeMemory, TypeStatic)
                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                    0x00000000,         // Granularity
                    0x000F0000,         // Range Minimum
                    0x000FFFFF,         // Range Maximum
                    0x00000000,         // Translation Offset
                    0x00010000,         // Length
                    ,, _Y0C, AddressRangeMemory, TypeStatic)
                DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
                    0x00000000,         // Granularity
                    0x00000000,         // Range Minimum
                    0xFEAFFFFF,         // Range Maximum
                    0x00000000,         // Translation Offset
                    0xFEB00000,         // Length
                    ,, _Y0D, AddressRangeMemory, TypeStatic)
                QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, NonCacheable, ReadWrite,
                    0x0000000000000000, // Granularity
                    0x0000000000010000, // Range Minimum
                    0x000000000001FFFF, // Range Maximum
                    0x0000000000000000, // Translation Offset
                    0x0000000000010000, // Length
                    ,, _Y0E, AddressRangeMemory, TypeStatic)
            })
            Method (_CRS, 0, Serialized)  // _CRS: Current Resource Settings
            {
                If (PM1L)
                {
                    CreateDWordField (BUF0, \_SB.PCI0._Y00._LEN, C0LN)  // _LEN: Length
                    C0LN = Zero
                }

                If ((PM1L == One))
                {
                    CreateBitField (BUF0, \_SB.PCI0._Y00._RW, C0RW)  // _RW_: Read-Write Status
                    C0RW = Zero
                }

                If (PM1H)
                {
                    CreateDWordField (BUF0, \_SB.PCI0._Y01._LEN, C4LN)  // _LEN: Length
                    C4LN = Zero
                }

                If ((PM1H == One))
                {
                    CreateBitField (BUF0, \_SB.PCI0._Y01._RW, C4RW)  // _RW_: Read-Write Status
                    C4RW = Zero
                }

                If (PM2L)
                {
                    CreateDWordField (BUF0, \_SB.PCI0._Y02._LEN, C8LN)  // _LEN: Length
                    C8LN = Zero
                }

                If ((PM2L == One))
                {
                    CreateBitField (BUF0, \_SB.PCI0._Y02._RW, C8RW)  // _RW_: Read-Write Status
                    C8RW = Zero
                }

                If (PM2H)
                {
                    CreateDWordField (BUF0, \_SB.PCI0._Y03._LEN, CCLN)  // _LEN: Length
                    CCLN = Zero
                }

                If ((PM2H == One))
                {
                    CreateBitField (BUF0, \_SB.PCI0._Y03._RW, CCRW)  // _RW_: Read-Write Status
                    CCRW = Zero
                }

                If (PM3L)
                {
                    CreateDWordField (BUF0, \_SB.PCI0._Y04._LEN, D0LN)  // _LEN: Length
                    D0LN = Zero
                }

                If ((PM3L == One))
                {
                    CreateBitField (BUF0, \_SB.PCI0._Y04._RW, D0RW)  // _RW_: Read-Write Status
                    D0RW = Zero
                }

                If (PM3H)
                {
                    CreateDWordField (BUF0, \_SB.PCI0._Y05._LEN, D4LN)  // _LEN: Length
                    D4LN = Zero
                }

                If ((PM3H == One))
                {
                    CreateBitField (BUF0, \_SB.PCI0._Y05._RW, D4RW)  // _RW_: Read-Write Status
                    D4RW = Zero
                }

                If (PM4L)
                {
                    CreateDWordField (BUF0, \_SB.PCI0._Y06._LEN, D8LN)  // _LEN: Length
                    D8LN = Zero
                }

                If ((PM4L == One))
                {
                    CreateBitField (BUF0, \_SB.PCI0._Y06._RW, D8RW)  // _RW_: Read-Write Status
                    D8RW = Zero
                }

                If (PM4H)
                {
                    CreateDWordField (BUF0, \_SB.PCI0._Y07._LEN, DCLN)  // _LEN: Length
                    DCLN = Zero
                }

                If ((PM4H == One))
                {
                    CreateBitField (BUF0, \_SB.PCI0._Y07._RW, DCRW)  // _RW_: Read-Write Status
                    DCRW = Zero
                }

                If (PM5L)
                {
                    CreateDWordField (BUF0, \_SB.PCI0._Y08._LEN, E0LN)  // _LEN: Length
                    E0LN = Zero
                }

                If ((PM5L == One))
                {
                    CreateBitField (BUF0, \_SB.PCI0._Y08._RW, E0RW)  // _RW_: Read-Write Status
                    E0RW = Zero
                }

                If (PM5H)
                {
                    CreateDWordField (BUF0, \_SB.PCI0._Y09._LEN, E4LN)  // _LEN: Length
                    E4LN = Zero
                }

                If ((PM5H == One))
                {
                    CreateBitField (BUF0, \_SB.PCI0._Y09._RW, E4RW)  // _RW_: Read-Write Status
                    E4RW = Zero
                }

                If (PM6L)
                {
                    CreateDWordField (BUF0, \_SB.PCI0._Y0A._LEN, E8LN)  // _LEN: Length
                    E8LN = Zero
                }

                If ((PM6L == One))
                {
                    CreateBitField (BUF0, \_SB.PCI0._Y0A._RW, E8RW)  // _RW_: Read-Write Status
                    E8RW = Zero
                }

                If (PM6H)
                {
                    CreateDWordField (BUF0, \_SB.PCI0._Y0B._LEN, ECLN)  // _LEN: Length
                    ECLN = Zero
                }

                If ((PM6H == One))
                {
                    CreateBitField (BUF0, \_SB.PCI0._Y0B._RW, ECRW)  // _RW_: Read-Write Status
                    ECRW = Zero
                }

                If (PM0H)
                {
                    CreateDWordField (BUF0, \_SB.PCI0._Y0C._LEN, F0LN)  // _LEN: Length
                    F0LN = Zero
                }

                If ((PM0H == One))
                {
                    CreateBitField (BUF0, \_SB.PCI0._Y0C._RW, F0RW)  // _RW_: Read-Write Status
                    F0RW = Zero
                }

                CreateDWordField (BUF0, \_SB.PCI0._Y0D._MIN, M1MN)  // _MIN: Minimum Base Address
                CreateDWordField (BUF0, \_SB.PCI0._Y0D._MAX, M1MX)  // _MAX: Maximum Base Address
                CreateDWordField (BUF0, \_SB.PCI0._Y0D._LEN, M1LN)  // _LEN: Length
                M1MN = (TLUD << 0x14)
                M1LN = ((M1MX - M1MN) + One)
                If ((M64L == Zero))
                {
                    CreateQWordField (BUF0, \_SB.PCI0._Y0E._LEN, MSLN)  // _LEN: Length
                    MSLN = Zero
                }
                Else
                {
                    CreateQWordField (BUF0, \_SB.PCI0._Y0E._LEN, M2LN)  // _LEN: Length
                    CreateQWordField (BUF0, \_SB.PCI0._Y0E._MIN, M2MN)  // _MIN: Minimum Base Address
                    CreateQWordField (BUF0, \_SB.PCI0._Y0E._MAX, M2MX)  // _MAX: Maximum Base Address
                    M2LN = M64L /* External reference */
                    M2MN = M64B /* External reference */
                    M2MX = ((M2MN + M2LN) - One)
                }

                Return (BUF0) /* \_SB_.PCI0.BUF0 */
            }

            Method (NHPG, 0, Serialized)
            {
            }

            Method (NPME, 0, Serialized)
            {
            }

            Name (GUID, ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */)
            Name (SUPP, Zero)
            Name (CTRL, Zero)
            Method (_OSC, 4, Serialized)  // _OSC: Operating System Capabilities
            {
                Local0 = Arg3
                CreateDWordField (Local0, Zero, CDW1)
                CreateDWordField (Local0, 0x04, CDW2)
                CreateDWordField (Local0, 0x08, CDW3)
                SUPP = CDW2 /* \_SB_.PCI0._OSC.CDW2 */
                CTRL = CDW3 /* \_SB_.PCI0._OSC.CDW3 */
                If ((One == OSDW ()))
                {
                    If (((Arg0 == GUID) && NEXP))
                    {
                        If (~(CDW1 & One))
                        {
                            If ((CTRL & 0x02))
                            {
                                NHPG ()
                            }

                            If ((CTRL & 0x04))
                            {
                                NPME ()
                            }
                        }

                        If ((Arg1 != One))
                        {
                            CDW1 |= 0x08
                        }

                        If ((CDW3 != CTRL))
                        {
                            CDW1 |= 0x10
                        }

                        CDW3 = CTRL /* \_SB_.PCI0.CTRL */
                        OSCC = CTRL /* \_SB_.PCI0.CTRL */
                        Return (Local0)
                    }
                    Else
                    {
                        CDW1 |= 0x04
                        Return (Local0)
                    }
                }
                Else
                {
                    If ((Arg0 == GUID)){}
                    Return (Local0)
                }
            }

            Scope (\_SB.PCI0)
            {
                Method (AR00, 0, NotSerialized)
                {
                    Return (^^AR00) /* \_SB_.AR00 */
                }

                Method (PR00, 0, NotSerialized)
                {
                    Return (^^PR00) /* \_SB_.PR00 */
                }

                Method (AR01, 0, NotSerialized)
                {
                    Return (^^AR01) /* \_SB_.AR01 */
                }

                Method (PR01, 0, NotSerialized)
                {
                    Return (^^PR01) /* \_SB_.PR01 */
                }

                Method (AR02, 0, NotSerialized)
                {
                    Return (^^AR02) /* \_SB_.AR02 */
                }

                Method (PR02, 0, NotSerialized)
                {
                    Return (^^PR02) /* \_SB_.PR02 */
                }

                Method (AR04, 0, NotSerialized)
                {
                    Return (^^AR04) /* \_SB_.AR04 */
                }

                Method (PR04, 0, NotSerialized)
                {
                    Return (^^PR04) /* \_SB_.PR04 */
                }

                Method (AR05, 0, NotSerialized)
                {
                    Return (^^AR05) /* \_SB_.AR05 */
                }

                Method (PR05, 0, NotSerialized)
                {
                    Return (^^PR05) /* \_SB_.PR05 */
                }

                Method (AR06, 0, NotSerialized)
                {
                    Return (^^AR06) /* \_SB_.AR06 */
                }

                Method (PR06, 0, NotSerialized)
                {
                    Return (^^PR06) /* \_SB_.PR06 */
                }

                Method (AR07, 0, NotSerialized)
                {
                    Return (^^AR07) /* \_SB_.AR07 */
                }

                Method (PR07, 0, NotSerialized)
                {
                    Return (^^PR07) /* \_SB_.PR07 */
                }

                Method (AR08, 0, NotSerialized)
                {
                    Return (^^AR08) /* \_SB_.AR08 */
                }

                Method (PR08, 0, NotSerialized)
                {
                    Return (^^PR08) /* \_SB_.PR08 */
                }

                Method (AR09, 0, NotSerialized)
                {
                    Return (^^AR09) /* \_SB_.AR09 */
                }

                Method (PR09, 0, NotSerialized)
                {
                    Return (^^PR09) /* \_SB_.PR09 */
                }

                Method (AR0A, 0, NotSerialized)
                {
                    Return (^^AR0A) /* \_SB_.AR0A */
                }

                Method (PR0A, 0, NotSerialized)
                {
                    Return (^^PR0A) /* \_SB_.PR0A */
                }

                Method (AR0B, 0, NotSerialized)
                {
                    Return (^^AR0B) /* \_SB_.AR0B */
                }

                Method (PR0B, 0, NotSerialized)
                {
                    Return (^^PR0B) /* \_SB_.PR0B */
                }
            }

            Device (MCHC)
            {
                Name (_ADR, Zero)  // _ADR: Address
            }

            Device (PEG0)
            {
                Name (_ADR, 0x00010000)  // _ADR: Address
                Method (_PRW, 0, NotSerialized)  // _PRW: Power Resources for Wake
                {
                    If (OSDW ())
                    {
                        Return (Package (0x02)
                        {
                            0x69, 
                            0x03
                        })
                    }
                    Else
                    {
                        Return (Package (0x02)
                        {
                            0x69, 
                            0x03
                        })
                    }
                }

                Method (_PRT, 0, NotSerialized)  // _PRT: PCI Routing Table
                {
                    If (PICM)
                    {
                        Return (AR02 ())
                    }

                    Return (PR02 ())
                }
            }

            Device (PEG1)
            {
                Name (_ADR, 0x00010001)  // _ADR: Address
                Method (_PRW, 0, NotSerialized)  // _PRW: Power Resources for Wake
                {
                    If (OSDW ())
                    {
                        Return (Package (0x02)
                        {
                            0x69, 
                            0x03
                        })
                    }
                    Else
                    {
                        Return (Package (0x02)
                        {
                            0x69, 
                            0x03
                        })
                    }
                }

                Method (_PRT, 0, NotSerialized)  // _PRT: PCI Routing Table
                {
                    If (PICM)
                    {
                        Return (AR0A ())
                    }

                    Return (PR0A ())
                }
            }

            Device (PEG2)
            {
                Name (_ADR, 0x00010002)  // _ADR: Address
                Method (_PRW, 0, NotSerialized)  // _PRW: Power Resources for Wake
                {
                    If (OSDW ())
                    {
                        Return (Package (0x02)
                        {
                            0x69, 
                            0x03
                        })
                    }
                    Else
                    {
                        Return (Package (0x02)
                        {
                            0x69, 
                            0x03
                        })
                    }
                }

                Method (_PRT, 0, NotSerialized)  // _PRT: PCI Routing Table
                {
                    If (PICM)
                    {
                        Return (AR0B ())
                    }

                    Return (PR0B ())
                }
            }

            Device (IGPU)
            {
                Name (_ADR, 0x00020000)  // _ADR: Address
                OperationRegion (GFXH, PCI_Config, Zero, 0x40)
                Field (GFXH, ByteAcc, NoLock, Preserve)
                {
                    VID0,   16, 
                    DID0,   16
                }

                Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                {
                    IDSM (Arg0, Arg1, Arg2, Arg3)
                    Return (Zero)
                }

                Method (_PS0, 0, Serialized)  // _PS0: Power State 0
                {
                    If (OSDW ())
                    {
                        LVME = Zero
                        BT19 = One
                        ADSP = Zero
                        NPKA = One
                    }
                }

                Method (_PS3, 0, Serialized)  // _PS3: Power State 3
                {
                    If (OSDW ())
                    {
                        NPKA = Zero
                        ADSP = One
                        BT19 = Zero
                        LVME = One
                    }
                }
            }

            Device (IPU0)
            {
                Name (_ADR, 0x00050000)  // _ADR: Address
            }

            Device (IMEI)
            {
                Name (_ADR, 0x00160000)  // _ADR: Address
            }

            Device (RP01)
            {
                Name (_ADR, 0x001C0000)  // _ADR: Address
                Method (_PRW, 0, NotSerialized)  // _PRW: Power Resources for Wake
                {
                    If (OSDW ())
                    {
                        Return (Package (0x02)
                        {
                            0x69, 
                            0x03
                        })
                    }
                    Else
                    {
                        Return (Package (0x02)
                        {
                            0x69, 
                            0x04
                        })
                    }
                }

                Method (_PRT, 0, NotSerialized)  // _PRT: PCI Routing Table
                {
                    If (PICM)
                    {
                        Return (AR04 ())
                    }

                    Return (PR04 ())
                }

                Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                {
                    If ((Arg0 == ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b") /* Unknown UUID */))
                    {
                        Local0 = Package (0x02)
                            {
                                "reg-ltrovr", 
                                Buffer (0x08)
                                {
                                     0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                }
                            }
                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                        Return (Local0)
                    }

                    Return (Zero)
                }
            }

            Device (RP17)
            {
                Name (_ADR, 0x001B0000)  // _ADR: Address
                Method (_PRW, 0, NotSerialized)  // _PRW: Power Resources for Wake
                {
                    If (OSDW ())
                    {
                        Return (Package (0x02)
                        {
                            0x69, 
                            0x03
                        })
                    }
                    Else
                    {
                        Return (Package (0x02)
                        {
                            0x69, 
                            0x03
                        })
                    }
                }

                Method (_PRT, 0, NotSerialized)  // _PRT: PCI Routing Table
                {
                    If (PICM)
                    {
                        Return (AR04 ())
                    }

                    Return (PR04 ())
                }

                Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                {
                    If ((Arg0 == ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b") /* Unknown UUID */))
                    {
                        Local0 = Package (0x04)
                            {
                                "reg-ltrovr", 
                                Buffer (0x08)
                                {
                                     0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                }, 

                                "apple-coprocessor-version", 
                                Buffer (0x08)
                                {
                                     0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                }
                            }
                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                        Return (Local0)
                    }

                    Return (Zero)
                }
            }

            Device (LPCB)
            {
                Name (_ADR, 0x001F0000)  // _ADR: Address
                Scope (\_SB)
                {
                    OperationRegion (PCI0.LPCB.LPC1, PCI_Config, 0x40, 0xC0)
                    Field (PCI0.LPCB.LPC1, AnyAcc, NoLock, Preserve)
                    {
                        Offset (0x20), 
                        PARC,   8, 
                        PBRC,   8, 
                        PCRC,   8, 
                        PDRC,   8, 
                        Offset (0x28), 
                        PERC,   8, 
                        PFRC,   8, 
                        PGRC,   8, 
                        PHRC,   8
                    }

                    Device (LNKA)
                    {
                        Name (_HID, EisaId ("PNP0C0F") /* PCI Interrupt Link Device */)  // _HID: Hardware ID
                        Name (_UID, One)  // _UID: Unique ID
                        Method (_DIS, 0, Serialized)  // _DIS: Disable Device
                        {
                            PARC |= 0x80
                        }

                        Name (_PRS, ResourceTemplate ()  // _PRS: Possible Resource Settings
                        {
                            IRQ (Level, ActiveLow, Shared, )
                                {1,3,4,5,6,7,10,12,14,15}
                        })
                        Method (_CRS, 0, Serialized)  // _CRS: Current Resource Settings
                        {
                            Name (RTLA, ResourceTemplate ()
                            {
                                IRQ (Level, ActiveLow, Shared, )
                                    {}
                            })
                            CreateWordField (RTLA, One, IRQ0)
                            IRQ0 = Zero
                            IRQ0 = (One << (PARC & 0x0F))
                            Return (RTLA) /* \_SB_.LNKA._CRS.RTLA */
                        }

                        Method (_SRS, 1, Serialized)  // _SRS: Set Resource Settings
                        {
                            CreateWordField (Arg0, One, IRQ0)
                            FindSetRightBit (IRQ0, Local0)
                            Local0--
                            PARC = Local0
                        }

                        Method (_STA, 0, Serialized)  // _STA: Status
                        {
                            If ((PARC & 0x80))
                            {
                                Return (0x09)
                            }
                            Else
                            {
                                Return (0x0B)
                            }
                        }
                    }

                    Device (LNKB)
                    {
                        Name (_HID, EisaId ("PNP0C0F") /* PCI Interrupt Link Device */)  // _HID: Hardware ID
                        Name (_UID, 0x02)  // _UID: Unique ID
                        Method (_DIS, 0, Serialized)  // _DIS: Disable Device
                        {
                            PBRC |= 0x80
                        }

                        Name (_PRS, ResourceTemplate ()  // _PRS: Possible Resource Settings
                        {
                            IRQ (Level, ActiveLow, Shared, )
                                {1,3,4,5,6,7,11,12,14,15}
                        })
                        Method (_CRS, 0, Serialized)  // _CRS: Current Resource Settings
                        {
                            Name (RTLB, ResourceTemplate ()
                            {
                                IRQ (Level, ActiveLow, Shared, )
                                    {}
                            })
                            CreateWordField (RTLB, One, IRQ0)
                            IRQ0 = Zero
                            IRQ0 = (One << (PBRC & 0x0F))
                            Return (RTLB) /* \_SB_.LNKB._CRS.RTLB */
                        }

                        Method (_SRS, 1, Serialized)  // _SRS: Set Resource Settings
                        {
                            CreateWordField (Arg0, One, IRQ0)
                            FindSetRightBit (IRQ0, Local0)
                            Local0--
                            PBRC = Local0
                        }

                        Method (_STA, 0, Serialized)  // _STA: Status
                        {
                            If ((PBRC & 0x80))
                            {
                                Return (0x09)
                            }
                            Else
                            {
                                Return (0x0B)
                            }
                        }
                    }

                    Device (LNKC)
                    {
                        Name (_HID, EisaId ("PNP0C0F") /* PCI Interrupt Link Device */)  // _HID: Hardware ID
                        Name (_UID, 0x03)  // _UID: Unique ID
                        Method (_DIS, 0, Serialized)  // _DIS: Disable Device
                        {
                            PCRC |= 0x80
                        }

                        Name (_PRS, ResourceTemplate ()  // _PRS: Possible Resource Settings
                        {
                            IRQ (Level, ActiveLow, Shared, )
                                {1,3,4,5,6,7,10,12,14,15}
                        })
                        Method (_CRS, 0, Serialized)  // _CRS: Current Resource Settings
                        {
                            Name (RTLC, ResourceTemplate ()
                            {
                                IRQ (Level, ActiveLow, Shared, )
                                    {}
                            })
                            CreateWordField (RTLC, One, IRQ0)
                            IRQ0 = Zero
                            IRQ0 = (One << (PCRC & 0x0F))
                            Return (RTLC) /* \_SB_.LNKC._CRS.RTLC */
                        }

                        Method (_SRS, 1, Serialized)  // _SRS: Set Resource Settings
                        {
                            CreateWordField (Arg0, One, IRQ0)
                            FindSetRightBit (IRQ0, Local0)
                            Local0--
                            PCRC = Local0
                        }

                        Method (_STA, 0, Serialized)  // _STA: Status
                        {
                            If ((PCRC & 0x80))
                            {
                                Return (0x09)
                            }
                            Else
                            {
                                Return (0x0B)
                            }
                        }
                    }

                    Device (LNKD)
                    {
                        Name (_HID, EisaId ("PNP0C0F") /* PCI Interrupt Link Device */)  // _HID: Hardware ID
                        Name (_UID, 0x04)  // _UID: Unique ID
                        Method (_DIS, 0, Serialized)  // _DIS: Disable Device
                        {
                            PDRC |= 0x80
                        }

                        Name (_PRS, ResourceTemplate ()  // _PRS: Possible Resource Settings
                        {
                            IRQ (Level, ActiveLow, Shared, )
                                {1,3,4,5,6,7,11,12,14,15}
                        })
                        Method (_CRS, 0, Serialized)  // _CRS: Current Resource Settings
                        {
                            Name (RTLD, ResourceTemplate ()
                            {
                                IRQ (Level, ActiveLow, Shared, )
                                    {}
                            })
                            CreateWordField (RTLD, One, IRQ0)
                            IRQ0 = Zero
                            IRQ0 = (One << (PDRC & 0x0F))
                            Return (RTLD) /* \_SB_.LNKD._CRS.RTLD */
                        }

                        Method (_SRS, 1, Serialized)  // _SRS: Set Resource Settings
                        {
                            CreateWordField (Arg0, One, IRQ0)
                            FindSetRightBit (IRQ0, Local0)
                            Local0--
                            PDRC = Local0
                        }

                        Method (_STA, 0, Serialized)  // _STA: Status
                        {
                            If ((PDRC & 0x80))
                            {
                                Return (0x09)
                            }
                            Else
                            {
                                Return (0x0B)
                            }
                        }
                    }

                    Device (LNKE)
                    {
                        Name (_HID, EisaId ("PNP0C0F") /* PCI Interrupt Link Device */)  // _HID: Hardware ID
                        Name (_UID, 0x05)  // _UID: Unique ID
                        Method (_DIS, 0, Serialized)  // _DIS: Disable Device
                        {
                            PERC |= 0x80
                        }

                        Name (_PRS, ResourceTemplate ()  // _PRS: Possible Resource Settings
                        {
                            IRQ (Level, ActiveLow, Shared, )
                                {1,3,4,5,6,7,10,12,14,15}
                        })
                        Method (_CRS, 0, Serialized)  // _CRS: Current Resource Settings
                        {
                            Name (RTLE, ResourceTemplate ()
                            {
                                IRQ (Level, ActiveLow, Shared, )
                                    {}
                            })
                            CreateWordField (RTLE, One, IRQ0)
                            IRQ0 = Zero
                            IRQ0 = (One << (PERC & 0x0F))
                            Return (RTLE) /* \_SB_.LNKE._CRS.RTLE */
                        }

                        Method (_SRS, 1, Serialized)  // _SRS: Set Resource Settings
                        {
                            CreateWordField (Arg0, One, IRQ0)
                            FindSetRightBit (IRQ0, Local0)
                            Local0--
                            PERC = Local0
                        }

                        Method (_STA, 0, Serialized)  // _STA: Status
                        {
                            If ((PERC & 0x80))
                            {
                                Return (0x09)
                            }
                            Else
                            {
                                Return (0x0B)
                            }
                        }
                    }

                    Device (LNKF)
                    {
                        Name (_HID, EisaId ("PNP0C0F") /* PCI Interrupt Link Device */)  // _HID: Hardware ID
                        Name (_UID, 0x06)  // _UID: Unique ID
                        Method (_DIS, 0, Serialized)  // _DIS: Disable Device
                        {
                            PFRC |= 0x80
                        }

                        Name (_PRS, ResourceTemplate ()  // _PRS: Possible Resource Settings
                        {
                            IRQ (Level, ActiveLow, Shared, )
                                {1,3,4,5,6,7,11,12,14,15}
                        })
                        Method (_CRS, 0, Serialized)  // _CRS: Current Resource Settings
                        {
                            Name (RTLF, ResourceTemplate ()
                            {
                                IRQ (Level, ActiveLow, Shared, )
                                    {}
                            })
                            CreateWordField (RTLF, One, IRQ0)
                            IRQ0 = Zero
                            IRQ0 = (One << (PFRC & 0x0F))
                            Return (RTLF) /* \_SB_.LNKF._CRS.RTLF */
                        }

                        Method (_SRS, 1, Serialized)  // _SRS: Set Resource Settings
                        {
                            CreateWordField (Arg0, One, IRQ0)
                            FindSetRightBit (IRQ0, Local0)
                            Local0--
                            PFRC = Local0
                        }

                        Method (_STA, 0, Serialized)  // _STA: Status
                        {
                            If ((PFRC & 0x80))
                            {
                                Return (0x09)
                            }
                            Else
                            {
                                Return (0x0B)
                            }
                        }
                    }

                    Device (LNKG)
                    {
                        Name (_HID, EisaId ("PNP0C0F") /* PCI Interrupt Link Device */)  // _HID: Hardware ID
                        Name (_UID, 0x07)  // _UID: Unique ID
                        Method (_DIS, 0, Serialized)  // _DIS: Disable Device
                        {
                            PGRC |= 0x80
                        }

                        Name (_PRS, ResourceTemplate ()  // _PRS: Possible Resource Settings
                        {
                            IRQ (Level, ActiveLow, Shared, )
                                {1,3,4,5,6,7,10,12,14,15}
                        })
                        Method (_CRS, 0, Serialized)  // _CRS: Current Resource Settings
                        {
                            Name (RTLG, ResourceTemplate ()
                            {
                                IRQ (Level, ActiveLow, Shared, )
                                    {}
                            })
                            CreateWordField (RTLG, One, IRQ0)
                            IRQ0 = Zero
                            IRQ0 = (One << (PGRC & 0x0F))
                            Return (RTLG) /* \_SB_.LNKG._CRS.RTLG */
                        }

                        Method (_SRS, 1, Serialized)  // _SRS: Set Resource Settings
                        {
                            CreateWordField (Arg0, One, IRQ0)
                            FindSetRightBit (IRQ0, Local0)
                            Local0--
                            PGRC = Local0
                        }

                        Method (_STA, 0, Serialized)  // _STA: Status
                        {
                            If ((PGRC & 0x80))
                            {
                                Return (0x09)
                            }
                            Else
                            {
                                Return (0x0B)
                            }
                        }
                    }

                    Device (LNKH)
                    {
                        Name (_HID, EisaId ("PNP0C0F") /* PCI Interrupt Link Device */)  // _HID: Hardware ID
                        Name (_UID, 0x08)  // _UID: Unique ID
                        Method (_DIS, 0, Serialized)  // _DIS: Disable Device
                        {
                            PHRC |= 0x80
                        }

                        Name (_PRS, ResourceTemplate ()  // _PRS: Possible Resource Settings
                        {
                            IRQ (Level, ActiveLow, Shared, )
                                {1,3,4,5,6,7,11,12,14,15}
                        })
                        Method (_CRS, 0, Serialized)  // _CRS: Current Resource Settings
                        {
                            Name (RTLH, ResourceTemplate ()
                            {
                                IRQ (Level, ActiveLow, Shared, )
                                    {}
                            })
                            CreateWordField (RTLH, One, IRQ0)
                            IRQ0 = Zero
                            IRQ0 = (One << (PHRC & 0x0F))
                            Return (RTLH) /* \_SB_.LNKH._CRS.RTLH */
                        }

                        Method (_SRS, 1, Serialized)  // _SRS: Set Resource Settings
                        {
                            CreateWordField (Arg0, One, IRQ0)
                            FindSetRightBit (IRQ0, Local0)
                            Local0--
                            PHRC = Local0
                        }

                        Method (_STA, 0, Serialized)  // _STA: Status
                        {
                            If ((PHRC & 0x80))
                            {
                                Return (0x09)
                            }
                            Else
                            {
                                Return (0x0B)
                            }
                        }
                    }
                }

                OperationRegion (LPC0, PCI_Config, 0x40, 0xC0)
                Field (LPC0, AnyAcc, NoLock, Preserve)
                {
                    Offset (0x40), 
                    IOD0,   8, 
                    IOD1,   8, 
                    Offset (0xB0), 
                    RAEN,   1, 
                        ,   13
                }

                Device (DMAC)
                {
                    Name (_HID, EisaId ("PNP0200") /* PC-class DMA Controller */)  // _HID: Hardware ID
                    Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                    {
                        IO (Decode16,
                            0x0000,             // Range Minimum
                            0x0000,             // Range Maximum
                            0x01,               // Alignment
                            0x20,               // Length
                            )
                        IO (Decode16,
                            0x0081,             // Range Minimum
                            0x0081,             // Range Maximum
                            0x01,               // Alignment
                            0x11,               // Length
                            )
                        IO (Decode16,
                            0x0093,             // Range Minimum
                            0x0093,             // Range Maximum
                            0x01,               // Alignment
                            0x0D,               // Length
                            )
                        IO (Decode16,
                            0x00C0,             // Range Minimum
                            0x00C0,             // Range Maximum
                            0x01,               // Alignment
                            0x20,               // Length
                            )
                        DMA (Compatibility, NotBusMaster, Transfer8_16, )
                            {4}
                    })
                }

                Device (FWHD)
                {
                    Name (_HID, EisaId ("INT0800") /* Intel 82802 Firmware Hub Device */)  // _HID: Hardware ID
                    Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                    {
                        Memory32Fixed (ReadOnly,
                            0xFF000000,         // Address Base
                            0x01000000,         // Address Length
                            )
                    })
                }

                Device (HPET)
                {
                    Name (_HID, EisaId ("PNP0103") /* HPET System Timer */)  // _HID: Hardware ID
                    Name (_CID, EisaId ("PNP0C01") /* System Board */)  // _CID: Compatible ID
                    Name (BUF0, ResourceTemplate ()
                    {
                        IRQNoFlags ()
                            {0}
                        IRQNoFlags ()
                            {8}
                        Memory32Fixed (ReadWrite,
                            0xFED00000,         // Address Base
                            0x00004000,         // Address Length
                            )
                    })
                    Method (_STA, 0, NotSerialized)  // _STA: Status
                    {
                        If (OSDW ())
                        {
                            Return (Zero)
                        }

                        If ((OSYS >= 0x07D1))
                        {
                            Return (0x0F)
                        }
                        Else
                        {
                            Return (0x0B)
                        }

                        Return (Zero)
                    }

                    Method (_CRS, 0, Serialized)  // _CRS: Current Resource Settings
                    {
                        Return (BUF0) /* \_SB_.PCI0.LPCB.HPET.BUF0 */
                    }
                }

                Device (IPIC)
                {
                    Name (_HID, EisaId ("PNP0000") /* 8259-compatible Programmable Interrupt Controller */)  // _HID: Hardware ID
                    Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                    {
                        IO (Decode16,
                            0x0020,             // Range Minimum
                            0x0020,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x0024,             // Range Minimum
                            0x0024,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x0028,             // Range Minimum
                            0x0028,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x002C,             // Range Minimum
                            0x002C,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x0030,             // Range Minimum
                            0x0030,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x0034,             // Range Minimum
                            0x0034,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x0038,             // Range Minimum
                            0x0038,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x003C,             // Range Minimum
                            0x003C,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x00A0,             // Range Minimum
                            0x00A0,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x00A4,             // Range Minimum
                            0x00A4,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x00A8,             // Range Minimum
                            0x00A8,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x00AC,             // Range Minimum
                            0x00AC,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x00B0,             // Range Minimum
                            0x00B0,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x00B4,             // Range Minimum
                            0x00B4,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x00B8,             // Range Minimum
                            0x00B8,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x00BC,             // Range Minimum
                            0x00BC,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x04D0,             // Range Minimum
                            0x04D0,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IRQNoFlags ()
                            {2}
                    })
                }

                Device (MATH)
                {
                    Name (_HID, EisaId ("PNP0C04") /* x87-compatible Floating Point Processing Unit */)  // _HID: Hardware ID
                    Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                    {
                        IO (Decode16,
                            0x00F0,             // Range Minimum
                            0x00F0,             // Range Maximum
                            0x01,               // Alignment
                            0x01,               // Length
                            )
                        IRQNoFlags ()
                            {13}
                    })
                }

                Device (LDRC)
                {
                    Name (_HID, EisaId ("PNP0C02") /* PNP Motherboard Resources */)  // _HID: Hardware ID
                    Name (_UID, 0x02)  // _UID: Unique ID
                    Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                    {
                        IO (Decode16,
                            0x002E,             // Range Minimum
                            0x002E,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x004E,             // Range Minimum
                            0x004E,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0x0061,             // Range Minimum
                            0x0061,             // Range Maximum
                            0x01,               // Alignment
                            0x01,               // Length
                            )
                        IO (Decode16,
                            0x0063,             // Range Minimum
                            0x0063,             // Range Maximum
                            0x01,               // Alignment
                            0x01,               // Length
                            )
                        IO (Decode16,
                            0x0065,             // Range Minimum
                            0x0065,             // Range Maximum
                            0x01,               // Alignment
                            0x01,               // Length
                            )
                        IO (Decode16,
                            0x0067,             // Range Minimum
                            0x0067,             // Range Maximum
                            0x01,               // Alignment
                            0x01,               // Length
                            )
                        IO (Decode16,
                            0x0080,             // Range Minimum
                            0x0080,             // Range Maximum
                            0x01,               // Alignment
                            0x01,               // Length
                            )
                        IO (Decode16,
                            0x0092,             // Range Minimum
                            0x0092,             // Range Maximum
                            0x01,               // Alignment
                            0x01,               // Length
                            )
                        IO (Decode16,
                            0x00B2,             // Range Minimum
                            0x00B2,             // Range Maximum
                            0x01,               // Alignment
                            0x02,               // Length
                            )
                        IO (Decode16,
                            0xFFFF,             // Range Minimum
                            0xFFFF,             // Range Maximum
                            0x01,               // Alignment
                            0x01,               // Length
                            )
                        IO (Decode16,
                            0x1800,             // Range Minimum
                            0x1800,             // Range Maximum
                            0x01,               // Alignment
                            0xFF,               // Length
                            )
                        IO (Decode16,
                            0x0800,             // Range Minimum
                            0x0800,             // Range Maximum
                            0x01,               // Alignment
                            0x80,               // Length
                            )
                    })
                }

                Device (ARTC)
                {
                    Name (_HID, "ACPI000E" /* Time and Alarm Device */)  // _HID: Hardware ID
                    Method (_GCP, 0, NotSerialized)  // _GCP: Get Capabilities
                    {
                        Return (0x05)
                    }

                    Method (_GRT, 0, Serialized)  // _GRT: Get Real Time
                    {
                        Name (BUFF, Buffer (0x10){})
                        BUFF [Zero] = ^^EC.YRLB /* \_SB_.PCI0.LPCB.EC__.YRLB */
                        BUFF [One] = ^^EC.YRMB /* \_SB_.PCI0.LPCB.EC__.YRMB */
                        BUFF [0x02] = ^^EC.MNTH /* \_SB_.PCI0.LPCB.EC__.MNTH */
                        BUFF [0x03] = ^^EC.DAYB /* \_SB_.PCI0.LPCB.EC__.DAYB */
                        BUFF [0x04] = ^^EC.HOUR /* \_SB_.PCI0.LPCB.EC__.HOUR */
                        BUFF [0x05] = ^^EC.MINT /* \_SB_.PCI0.LPCB.EC__.MINT */
                        BUFF [0x06] = ^^EC.SECD /* \_SB_.PCI0.LPCB.EC__.SECD */
                        BUFF [0x07] = ^^EC.PAD0 /* \_SB_.PCI0.LPCB.EC__.PAD0 */
                        BUFF [0x08] = ^^EC.MSLB /* \_SB_.PCI0.LPCB.EC__.MSLB */
                        BUFF [0x09] = ^^EC.MSMB /* \_SB_.PCI0.LPCB.EC__.MSMB */
                        BUFF [0x0A] = ^^EC.TZLB /* \_SB_.PCI0.LPCB.EC__.TZLB */
                        BUFF [0x0B] = ^^EC.TZMB /* \_SB_.PCI0.LPCB.EC__.TZMB */
                        BUFF [0x0C] = ^^EC.DAYL /* \_SB_.PCI0.LPCB.EC__.DAYL */
                        BUFF [0x0D] = ^^EC.PAD1 /* \_SB_.PCI0.LPCB.EC__.PAD1 */
                        BUFF [0x0E] = ^^EC.PAD2 /* \_SB_.PCI0.LPCB.EC__.PAD2 */
                        BUFF [0x0F] = ^^EC.PAD3 /* \_SB_.PCI0.LPCB.EC__.PAD3 */
                        Return (BUFF) /* \_SB_.PCI0.LPCB.ARTC._GRT.BUFF */
                    }

                    Method (_SRT, 1, Serialized)  // _SRT: Set Real Time
                    {
                        ^^EC.YRLB = DerefOf (Arg0 [Zero])
                        ^^EC.YRMB = DerefOf (Arg0 [One])
                        ^^EC.MNTH = DerefOf (Arg0 [0x02])
                        ^^EC.DAYB = DerefOf (Arg0 [0x03])
                        ^^EC.HOUR = DerefOf (Arg0 [0x04])
                        ^^EC.MINT = DerefOf (Arg0 [0x05])
                        ^^EC.SECD = DerefOf (Arg0 [0x06])
                        ^^EC.MSLB = DerefOf (Arg0 [0x08])
                        ^^EC.MSMB = DerefOf (Arg0 [0x09])
                        ^^EC.TZLB = DerefOf (Arg0 [0x0A])
                        ^^EC.TZMB = DerefOf (Arg0 [0x0B])
                        ^^EC.DAYL = DerefOf (Arg0 [0x0C])
                        Return (Zero)
                    }

                    Method (_STV, 2, Serialized)  // _STV: Set Timer Value
                    {
                        ^^EC.ALR0 = (Arg1 & 0xFF)
                        ^^EC.ALR1 = ((Arg1 >> 0x08) & 0xFF)
                        ^^EC.ALR2 = ((Arg1 >> 0x10) & 0xFF)
                        ^^EC.ALR3 = ((Arg1 >> 0x18) & 0xFF)
                        Return (Zero)
                    }

                    Method (_CWS, 1, Serialized)  // _CWS: Clear Wake Alarm Status
                    {
                        ^^EC.TMRF = Zero
                        ^^EC.TMRW = Zero
                        Return (Zero)
                    }
                }

                Device (TIMR)
                {
                    Name (_HID, EisaId ("PNP0100") /* PC-class System Timer */)  // _HID: Hardware ID
                    Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                    {
                        IO (Decode16,
                            0x0040,             // Range Minimum
                            0x0040,             // Range Maximum
                            0x01,               // Alignment
                            0x04,               // Length
                            )
                        IO (Decode16,
                            0x0050,             // Range Minimum
                            0x0050,             // Range Maximum
                            0x10,               // Alignment
                            0x04,               // Length
                            )
                    })
                }

                Device (SMC)
                {
                    Name (_HID, EisaId ("APP0001"))  // _HID: Hardware ID
                    Name (_CID, "smc-huronriver")  // _CID: Compatible ID
                    Name (_STA, 0x0B)  // _STA: Status
                    Name (BUF0, ResourceTemplate ()
                    {
                        IO (Decode16,
                            0x0300,             // Range Minimum
                            0x0300,             // Range Maximum
                            0x01,               // Alignment
                            0x20,               // Length
                            )
                        Memory32Fixed (ReadWrite,
                            0x00000000,         // Address Base
                            0x00010000,         // Address Length
                            _Y0F)
                        IRQNoFlags ()
                            {6}
                    })
                    Method (_CRS, 0, Serialized)  // _CRS: Current Resource Settings
                    {
                        CreateDWordField (BUF0, \_SB.PCI0.LPCB.SMC._Y0F._BAS, SBA0)  // _BAS: Base Address
                        SBA0 = SMCB /* \SMCB */
                        Return (BUF0) /* \_SB_.PCI0.LPCB.SMC_.BUF0 */
                    }
                }

                Device (EC)
                {
                    Name (_HID, EisaId ("PNP0C09") /* Embedded Controller Device */)  // _HID: Hardware ID
                    Name (_UID, Zero)  // _UID: Unique ID
                    Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                    {
                        IO (Decode16,
                            0x0062,             // Range Minimum
                            0x0062,             // Range Maximum
                            0x00,               // Alignment
                            0x01,               // Length
                            )
                        IO (Decode16,
                            0x0066,             // Range Minimum
                            0x0066,             // Range Maximum
                            0x00,               // Alignment
                            0x01,               // Length
                            )
                    })
                    Name (_GPE, 0x6E)  // _GPE: General Purpose Events
                    Method (_PRW, 0, NotSerialized)  // _PRW: Power Resources for Wake
                    {
                        If (OSDW ())
                        {
                            Return (Package (0x02)
                            {
                                0x6F, 
                                0x04
                            })
                        }
                        Else
                        {
                            Return (Package (0x02)
                            {
                                0x6F, 
                                0x03
                            })
                        }
                    }

                    Name (ECOK, Zero)
                    OperationRegion (ECOR, EmbeddedControl, Zero, 0xFF)
                    Field (ECOR, ByteAcc, NoLock, Preserve)
                    {
                        ECVS,   8, 
                        Offset (0x02), 
                        Offset (0x03), 
                        G3HT,   1, 
                            ,   5, 
                        LVME,   1, 
                        PRST,   1, 
                        WBCB,   1, 
                        DSLP,   1, 
                        Offset (0x05), 
                        Offset (0x06), 
                        WKRS,   8, 
                        Offset (0x09), 
                        LDSB,   8, 
                        Offset (0x0B), 
                        TBPW,   4, 
                        Offset (0x0C), 
                        Offset (0x0D), 
                        CMDS,   8, 
                        DATA,   8, 
                        INDX,   8, 
                        ECSS,   8, 
                        RRST,   8, 
                        ALB0,   8, 
                        ALB1,   8, 
                        WTLB,   8, 
                        WTMB,   8, 
                        Offset (0x20), 
                        SPTR,   8, 
                        SSTS,   8, 
                        SADR,   8, 
                        SCMD,   8, 
                        SBFR,   256, 
                        SCNT,   8, 
                        SAAD,   8, 
                        SAD0,   8, 
                        SAD1,   8, 
                        SMUX,   8, 
                        Offset (0x54), 
                        POR0,   8, 
                        POR1,   8, 
                        POR2,   8, 
                        POR3,   8, 
                        PWRP,   8, 
                        PWQP,   8, 
                        PSRP,   8, 
                        PSQP,   8, 
                        Offset (0x60), 
                        ELSW,   1, 
                        EACP,   1, 
                        ECDI,   1, 
                        ENMI,   1, 
                        Offset (0x61), 
                        EMHP,   1, 
                        PSOC,   1, 
                        PCIR,   1, 
                        TBPS,   1, 
                        Offset (0x62), 
                        Offset (0x63), 
                        Offset (0x64), 
                        SWLO,   1, 
                        SWLC,   1, 
                        SWAI,   1, 
                        SWAR,   1, 
                        SWCI,   1, 
                        SWCE,   1, 
                        SWMI,   1, 
                        SWMR,   1, 
                        SWPB,   1, 
                        SWGP,   1, 
                        SWPM,   1, 
                        SWWT,   1, 
                        SWLB,   1, 
                        SWTP,   1, 
                        SWWL,   1, 
                        Offset (0x66), 
                        SWUC,   1, 
                            ,   1, 
                        SWBT,   1, 
                        SWDF,   1, 
                        SWSD,   1, 
                        SWOL,   1, 
                        SWEP,   1, 
                        SWTB,   1, 
                        SWCL,   1, 
                        Offset (0x68), 
                        EWLO,   1, 
                        EWLC,   1, 
                        EWAI,   1, 
                        EWAR,   1, 
                        EWCI,   1, 
                        EWCE,   1, 
                        EWMI,   1, 
                        EWMR,   1, 
                        EWPB,   1, 
                        EWGP,   1, 
                        EWPM,   1, 
                        ENWT,   1, 
                        EWLB,   1, 
                        EWDK,   1, 
                        EWLN,   1, 
                        Offset (0x6A), 
                        EWUC,   1, 
                            ,   1, 
                        EWBT,   1, 
                        EWDF,   1, 
                        EWSD,   1, 
                        EWOL,   1, 
                        EWEP,   1, 
                        EWTB,   1, 
                        EWCL,   1, 
                        Offset (0x6C), 
                        LWLO,   1, 
                        LWLC,   1, 
                        LWAI,   1, 
                        LWAR,   1, 
                        LWCI,   1, 
                        LWCE,   1, 
                        LWMI,   1, 
                        LWMR,   1, 
                        LWPB,   1, 
                        LWGP,   1, 
                        LWPM,   1, 
                        LWWT,   1, 
                        LWLB,   1, 
                        LWTP,   1, 
                        LWLN,   1, 
                        Offset (0x6E), 
                        LWUC,   1, 
                            ,   1, 
                        LWBT,   1, 
                        LWDF,   1, 
                        LWSD,   1, 
                        LWOL,   1, 
                        LWEP,   1, 
                        LWTB,   1, 
                        Offset (0x70), 
                        LWSR,   1, 
                        LWPN,   1, 
                        LWCL,   1, 
                            ,   8, 
                            ,   8, 
                            ,   8, 
                            ,   8, 
                        Offset (0x7C), 
                        ALRA,   1, 
                        ALRD,   1, 
                        GSRT,   1, 
                        RTMS,   1, 
                        Offset (0x7D), 
                        TMRF,   1, 
                        TMRW,   1, 
                        Offset (0x80), 
                        YRLB,   8, 
                        YRMB,   8, 
                        MNTH,   8, 
                        DAYB,   8, 
                        HOUR,   8, 
                        MINT,   8, 
                        SECD,   8, 
                        PAD0,   8, 
                        MSLB,   8, 
                        MSMB,   8, 
                        TZLB,   8, 
                        TZMB,   8, 
                        DAYL,   8, 
                        PAD1,   8, 
                        PAD2,   8, 
                        PAD3,   8, 
                        ALR0,   8, 
                        ALR1,   8, 
                        ALR2,   8, 
                        ALR3,   8
                    }

                    Field (ECOR, ByteAcc, Lock, Preserve)
                    {
                        Offset (0x03), 
                        G3AD,   1, 
                        BLOD,   1, 
                        S4WE,   1, 
                        APWC,   1, 
                        BTPC,   1, 
                        SOCR,   1, 
                        Offset (0x04), 
                        Offset (0x0A), 
                        SDPW,   1, 
                            ,   1, 
                        BTDW,   1, 
                        Offset (0x0B), 
                        Offset (0x6C), 
                        LWE0,   8, 
                        LWE1,   8, 
                        LWE2,   8, 
                        LWE3,   8, 
                        LWE4,   8, 
                        LWE5,   8, 
                        LWE6,   8, 
                        LWE7,   8
                    }

                    Field (ECOR, ByteAcc, NoLock, Preserve)
                    {
                        Offset (0x24), 
                        SBDW,   16, 
                        Offset (0x46), 
                        SADW,   16
                    }

                    Method (RSTB, 2, Serialized)
                    {
                        Local0 = Arg1
                        Local0 += (Arg0 << 0x05)
                        RRST = Local0
                        Local1 = Zero
                        While ((RRST == Local0))
                        {
                            If ((Local1 > 0x64))
                            {
                                Local1 = One
                                Break
                            }

                            Sleep (0x0A)
                            Local1++
                        }

                        Return (RRST) /* \_SB_.PCI0.LPCB.EC__.RRST */
                    }

                    Method (WAKE, 0, NotSerialized)
                    {
                        If (ECOK)
                        {
                            Return (WKRS) /* \_SB_.PCI0.LPCB.EC__.WKRS */
                        }
                        Else
                        {
                            Return (Zero)
                        }
                    }

                    Method (SETP, 3, NotSerialized)
                    {
                        If ((Arg0 == Zero))
                        {
                            If ((Arg1 == Zero))
                            {
                                PWRP = Arg2
                            }
                            ElseIf ((Arg1 == One))
                            {
                                PWQP = Arg2
                            }
                        }
                        ElseIf ((Arg0 == One))
                        {
                            If ((Arg1 == Zero))
                            {
                                PSRP = Arg2
                            }
                            ElseIf ((Arg1 == One))
                            {
                                PSQP = Arg2
                            }
                        }
                    }

                    Method (RQOP, 1, NotSerialized)
                    {
                        Local0 = (Arg0 & 0xFF)
                        POR0 = Local0
                        Local0 = ((Arg0 >> 0x08) & 0xFF)
                        POR1 = Local0
                        Local0 = ((Arg0 >> 0x10) & 0xFF)
                        POR2 = Local0
                        Local0 = ((Arg0 >> 0x18) & 0xFF)
                        POR3 = Local0
                    }

                    Method (QROP, 0, NotSerialized)
                    {
                        Local0 = POR0 /* \_SB_.PCI0.LPCB.EC__.POR0 */
                        Local1 = POR1 /* \_SB_.PCI0.LPCB.EC__.POR1 */
                        Local0 += (Local1 << 0x08)
                        Local1 = POR2 /* \_SB_.PCI0.LPCB.EC__.POR2 */
                        Local0 += (Local1 << 0x10)
                        Local1 = POR3 /* \_SB_.PCI0.LPCB.EC__.POR3 */
                        Local0 += (Local1 << 0x18)
                        Return (Local0)
                    }

                    Method (PORS, 2, NotSerialized)
                    {
                        If ((Arg0 == Zero))
                        {
                            If ((Arg1 == Zero))
                            {
                                Return (PWRP) /* \_SB_.PCI0.LPCB.EC__.PWRP */
                            }
                            ElseIf ((Arg1 == One))
                            {
                                Return (PWQP) /* \_SB_.PCI0.LPCB.EC__.PWQP */
                            }
                        }
                        ElseIf ((Arg0 == One))
                        {
                            If ((Arg1 == Zero))
                            {
                                Return (PSRP) /* \_SB_.PCI0.LPCB.EC__.PSRP */
                            }
                            ElseIf ((Arg1 == One))
                            {
                                Return (PSQP) /* \_SB_.PCI0.LPCB.EC__.PSQP */
                            }
                        }

                        Return (0xFF)
                    }

                    Device (SMB0)
                    {
                        Name (_HID, "ACPI0001" /* SMBus 1.0 Host Controller */)  // _HID: Hardware ID
                        Name (_EC, 0x2010)  // _EC_: Embedded Controller
                        Mutex (SMTX, 0x00)
                        Method (_STA, 0, NotSerialized)  // _STA: Status
                        {
                            If (OSDW ())
                            {
                                Return (0x0F)
                            }
                            Else
                            {
                                Return (Zero)
                            }
                        }

                        Device (SBS0)
                        {
                            Name (_HID, "ACPI0002" /* Smart Battery Subsystem */)  // _HID: Hardware ID
                            Name (_SBS, One)  // _SBS: Smart Battery Subsystem
                        }

                        Method (SBPC, 1, NotSerialized)
                        {
                            Local0 = Arg0
                            While (Local0)
                            {
                                If ((SPTR == Zero))
                                {
                                    Return ((SSTS & 0x1F))
                                }

                                Sleep (One)
                                Local0--
                            }

                            Return (0x18)
                        }

                        Method (SBRW, 3, NotSerialized)
                        {
                            Local0 = One
                            If (!Acquire (SMTX, 0xFFFF))
                            {
                                If ((SPTR == Zero))
                                {
                                    SADR = (Arg0 << One)
                                    SCMD = Arg1
                                    SPTR = 0x09
                                    Local0 = SBPC (0x03E8)
                                    If (!Local0)
                                    {
                                        Arg2 = SBDW /* \_SB_.PCI0.LPCB.EC__.SBDW */
                                    }
                                }

                                Release (SMTX)
                            }

                            Return (Local0)
                        }

                        Method (SBRB, 3, NotSerialized)
                        {
                            Local0 = One
                            Local1 = Buffer (One)
                                {
                                     0x00                                             // .
                                }
                            If (!Acquire (SMTX, 0xFFFF))
                            {
                                If ((SPTR == Zero))
                                {
                                    SADR = (Arg0 << One)
                                    SCMD = Arg1
                                    SPTR = 0x0B
                                    Local0 = SBPC (0x03E8)
                                    If (!Local0)
                                    {
                                        Arg2 = SBFR /* \_SB_.PCI0.LPCB.EC__.SBFR */
                                    }
                                }

                                Release (SMTX)
                            }

                            Return (Local0)
                        }
                    }

                    Method (_Q10, 0, NotSerialized)  // _Qxx: EC Query, xx=0x00-0xFF
                    {
                        If (OSDW ())
                        {
                            Notify (SMB0, 0x80) // Status Change
                        }
                        ElseIf ((SSTS & 0x40))
                        {
                            If (!Acquire (^SMB0.SMTX, 0xFFFF))
                            {
                                Local0 = (SAAD >> One)
                                If ((Local0 == 0x0A))
                                {
                                    ^^^^BAT0.BNOT (SADW)
                                }

                                SSTS = Zero
                                Release (^SMB0.SMTX)
                            }
                        }
                    }

                    Method (_Q11, 0, NotSerialized)  // _Qxx: EC Query, xx=0x00-0xFF
                    {
                        Notify (EC, 0x83) // Device-Specific Change
                    }

                    Method (_Q12, 0, NotSerialized)  // _Qxx: EC Query, xx=0x00-0xFF
                    {
                        Notify (EC, 0x84) // Reserved
                    }

                    Method (_Q20, 0, NotSerialized)  // _Qxx: EC Query, xx=0x00-0xFF
                    {
                        LIDS = ELSW /* \_SB_.PCI0.LPCB.EC__.ELSW */
                        ^^^IGPU.CLID = ELSW /* \_SB_.PCI0.LPCB.EC__.ELSW */
                        Notify (LID0, 0x80) // Status Change
                    }

                    Method (_Q21, 0, NotSerialized)  // _Qxx: EC Query, xx=0x00-0xFF
                    {
                        If (EACP)
                        {
                            PWRS = One
                        }
                        Else
                        {
                            PWRS = Zero
                        }

                        Notify (ADP1, 0x80) // Status Change
                        PNOT ()
                    }

                    Method (_Q5A, 0, NotSerialized)  // _Qxx: EC Query, xx=0x00-0xFF
                    {
                        Notify (SLPB, 0x80) // Status Change
                    }

                    Method (_Q80, 0, NotSerialized)  // _Qxx: EC Query, xx=0x00-0xFF
                    {
                        \_PR.CPPC = CPLT /* \CPLT */
                        Notify (\_PR.CPU0, 0x80) // Performance Capability Change
                        Notify (\_PR.CPU1, 0x80) // Performance Capability Change
                        Notify (\_PR.CPU2, 0x80) // Performance Capability Change
                        Notify (\_PR.CPU3, 0x80) // Performance Capability Change
                        Notify (\_PR.CPU4, 0x80) // Performance Capability Change
                        Notify (\_PR.CPU5, 0x80) // Performance Capability Change
                        Notify (\_PR.CPU6, 0x80) // Performance Capability Change
                        Notify (\_PR.CPU7, 0x80) // Performance Capability Change
                        Notify (\_PR.CPU8, 0x80) // Performance Capability Change
                        Notify (\_PR.CPU9, 0x80) // Performance Capability Change
                        Notify (\_PR.CPUA, 0x80) // Performance Capability Change
                        Notify (\_PR.CPUB, 0x80) // Performance Capability Change
                        Notify (\_PR.CPUC, 0x80) // Performance Capability Change
                        Notify (\_PR.CPUD, 0x80) // Performance Capability Change
                        Notify (\_PR.CPUE, 0x80) // Performance Capability Change
                        Notify (\_PR.CPUF, 0x80) // Performance Capability Change
                        If ((^^^IGPU.VID0 == 0x8086))
                        {
                            Local0 = IGPS /* \IGPS */
                            Local0 = (RP0C - Local0)
                            RPSL = Local0
                        }
                        Else
                        {
                            Notify (^^^PEG0.EGP0.EGP1.GFX0, 0x81) // Information Change
                        }
                    }

                    Method (_QCE, 0, NotSerialized)  // _Qxx: EC Query, xx=0x00-0xFF
                    {
                    }

                    Method (_QCF, 0, NotSerialized)  // _Qxx: EC Query, xx=0x00-0xFF
                    {
                        If (!OSDW ())
                        {
                            Notify (SLPB, 0x80) // Status Change
                        }
                    }

                    Method (_QD0, 0, NotSerialized)  // _Qxx: EC Query, xx=0x00-0xFF
                    {
                    }

                    Method (_REG, 2, NotSerialized)  // _REG: Region Availability
                    {
                        If (((Arg0 == 0x03) || (OSYS >= 0x07D6)))
                        {
                            ECOK = Arg1
                            If ((Arg1 == One))
                            {
                                ECSS = Zero
                                LIDS = ELSW /* \_SB_.PCI0.LPCB.EC__.ELSW */
                                ^^^IGPU.CLID = ELSW /* \_SB_.PCI0.LPCB.EC__.ELSW */
                                PWRS = EACP /* \_SB_.PCI0.LPCB.EC__.EACP */
                                Notify (ADP1, 0x80) // Status Change
                            }
                        }
                    }
                }

                Scope (\_SB)
                {
                    Device (BAT0)
                    {
                        Name (_HID, EisaId ("PNP0C0A") /* Control Method Battery */)  // _HID: Hardware ID
                        Name (_UID, Zero)  // _UID: Unique ID
                        Name (_PCL, Package (0x01)  // _PCL: Power Consumer List
                        {
                            _SB
                        })
                        Name (BSSW, 0xFFFF)
                        Name (PBIF, Package (0x0D)
                        {
                            Zero, 
                            0xFFFFFFFF, 
                            0xFFFFFFFF, 
                            One, 
                            0xFFFFFFFF, 
                            0xFA, 
                            0x64, 
                            0x0A, 
                            0x0A, 
                            " ", 
                            " ", 
                            " ", 
                            " "
                        })
                        Name (PBST, Package (0x04)
                        {
                            Zero, 
                            0xFFFFFFFF, 
                            0xFFFFFFFF, 
                            0xFFFFFFFF
                        })
                        Method (_STA, 0, NotSerialized)  // _STA: Status
                        {
                            If (OSDW ())
                            {
                                Return (Zero)
                            }

                            If (^^PCI0.LPCB.EC.ECOK)
                            {
                                UBSS ()
                                If ((BSSW & One))
                                {
                                    Return (0x1F)
                                }
                                Else
                                {
                                    Return (0x0F)
                                }
                            }
                            Else
                            {
                                Return (0x0F)
                            }
                        }

                        Method (_BST, 0, NotSerialized)  // _BST: Battery Status
                        {
                            If ((BSSW & One))
                            {
                                UBST ()
                            }
                            Else
                            {
                                PBST [Zero] = Zero
                                PBST [One] = 0xFFFFFFFF
                                PBST [0x02] = 0xFFFFFFFF
                            }

                            Return (PBST) /* \_SB_.BAT0.PBST */
                        }

                        Method (_BIF, 0, NotSerialized)  // _BIF: Battery Information
                        {
                            If ((BSSW & One))
                            {
                                UBIF ()
                            }

                            Return (PBIF) /* \_SB_.BAT0.PBIF */
                        }

                        Method (BNOT, 1, NotSerialized)
                        {
                            Local0 = BSSW /* \_SB_.BAT0.BSSW */
                            BSSW = Arg0
                            Notify (BAT0, 0x80) // Status Change
                            If (((Local0 ^ Arg0) & One))
                            {
                                Notify (BAT0, 0x81) // Information Change
                            }
                        }

                        Method (UBSS, 0, NotSerialized)
                        {
                            ^^PCI0.LPCB.EC.SMB0.SBRW (0x0A, One, RefOf (BSSW))
                        }

                        Method (UBIF, 0, NotSerialized)
                        {
                            ^^PCI0.LPCB.EC.SMB0.SBRW (0x0B, 0x18, RefOf (Local0))
                            PBIF [One] = (Local0 * 0x0A)
                            ^^PCI0.LPCB.EC.SMB0.SBRW (0x0B, 0x10, RefOf (Local0))
                            PBIF [0x02] = (Local0 * 0x0A)
                            ^^PCI0.LPCB.EC.SMB0.SBRW (0x0B, 0x19, RefOf (Local0))
                            PBIF [0x04] = Local0
                            ^^PCI0.LPCB.EC.SMB0.SBRB (0x0B, 0x21, RefOf (Local0))
                            PBIF [0x09] = Local0
                            PBIF [0x0A] = Buffer (One)
                                {
                                     0x00                                             // .
                                }
                            ^^PCI0.LPCB.EC.SMB0.SBRB (0x0B, 0x22, RefOf (Local0))
                            PBIF [0x0B] = Local0
                            ^^PCI0.LPCB.EC.SMB0.SBRB (0x0B, 0x20, RefOf (Local0))
                            PBIF [0x0C] = Local0
                        }

                        Method (UBST, 0, NotSerialized)
                        {
                            ^^PCI0.LPCB.EC.SMB0.SBRW (0x0B, 0x09, RefOf (Local2))
                            PBST [0x03] = Local2
                            ^^PCI0.LPCB.EC.SMB0.SBRW (0x0B, 0x0A, RefOf (Local0))
                            If ((Local0 & 0x8000))
                            {
                                Local0 = ~Local0
                                Local0 = (Local0++ & 0xFFFF)
                            }

                            Local0 *= Local2
                            PBST [One] = (Local0 / 0x03E8)
                            ^^PCI0.LPCB.EC.SMB0.SBRW (0x0B, 0x0F, RefOf (Local0))
                            PBST [0x02] = (Local0 * 0x0A)
                            Local1 = Zero
                            If (PWRS)
                            {
                                ^^PCI0.LPCB.EC.SMB0.SBRW (0x0B, 0x16, RefOf (Local0))
                                If (!(Local0 & 0x40))
                                {
                                    Local1 = 0x02
                                }
                            }
                            Else
                            {
                                Local1 = One
                            }

                            PBST [Zero] = Local1
                        }
                    }
                }

                Device (GPUC)
                {
                    Name (_HID, EisaId ("APP000B"))  // _HID: Hardware ID
                    Name (_CID, "gpuc")  // _CID: Compatible ID
                    Name (_STA, 0x0B)  // _STA: Status
                    Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                    {
                        Memory32Fixed (ReadWrite,
                            0xFE0B0200,         // Address Base
                            0x00000008,         // Address Length
                            )
                    })
                    Method (_PRW, 0, NotSerialized)  // _PRW: Power Resources for Wake
                    {
                        If (OSDW ())
                        {
                            Return (Package (0x02)
                            {
                                0x15, 
                                0x03
                            })
                        }

                        Return (Package (0x02)
                        {
                            0x15, 
                            0x03
                        })
                    }

                    Scope (\_GPE)
                    {
                        Method (_L15, 0, NotSerialized)  // _Lxx: Level-Triggered GPE, xx=0x00-0xFF
                        {
                            If (OSDW ())
                            {
                                Notify (\_SB.PCI0.LPCB.GPUC, 0x80) // Status Change
                            }
                            ElseIf ((\_SB.GGII (0x03000015) == One))
                            {
                                \_SB.SGII (0x03000015, Zero)
                            }
                            Else
                            {
                                \_SB.SGII (0x03000015, One)
                            }
                        }
                    }

                    Name (GMGP, 0x15)
                    Method (GMSP, 1, NotSerialized)
                    {
                        If ((Arg0 <= One))
                        {
                            SGII (0x03000015, Arg0)
                        }
                    }

                    Method (GMLV, 0, NotSerialized)
                    {
                        Return (GGIV (0x03000015))
                    }
                }
            }

            Device (PMCR)
            {
                Name (_HID, EisaId ("APP9876"))  // _HID: Hardware ID
                Name (_STA, 0x0B)  // _STA: Status
                Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
                {
                    Memory32Fixed (ReadWrite,
                        0xFE000000,         // Address Base
                        0x00010000,         // Address Length
                        )
                })
            }

            Device (SBUS)
            {
                Name (_ADR, 0x001F0004)  // _ADR: Address
                OperationRegion (SMBP, PCI_Config, 0x40, 0xC0)
                Field (SMBP, DWordAcc, NoLock, Preserve)
                {
                        ,   2, 
                    I2CE,   1
                }

                OperationRegion (SMPB, PCI_Config, 0x20, 0x04)
                Field (SMPB, DWordAcc, NoLock, Preserve)
                {
                        ,   5, 
                    SBAR,   11
                }

                OperationRegion (SMBI, SystemIO, (SBAR << 0x05), 0x10)
                Field (SMBI, ByteAcc, NoLock, Preserve)
                {
                    HSTS,   8, 
                    Offset (0x02), 
                    HCON,   8, 
                    HCOM,   8, 
                    TXSA,   8, 
                    DAT0,   8, 
                    DAT1,   8, 
                    HBDR,   8, 
                    PECR,   8, 
                    RXSA,   8, 
                    SDAT,   16
                }

                Method (SSXB, 2, Serialized)
                {
                    If (STRT ())
                    {
                        Return (Zero)
                    }

                    I2CE = Zero
                    HSTS = 0xBF
                    TXSA = Arg0
                    HCOM = Arg1
                    HCON = 0x48
                    If (COMP ())
                    {
                        HSTS |= 0xFF
                        Return (One)
                    }

                    Return (Zero)
                }

                Method (SRXB, 1, Serialized)
                {
                    If (STRT ())
                    {
                        Return (0xFFFF)
                    }

                    I2CE = Zero
                    HSTS = 0xBF
                    TXSA = (Arg0 | One)
                    HCON = 0x44
                    If (COMP ())
                    {
                        HSTS |= 0xFF
                        Return (DAT0) /* \_SB_.PCI0.SBUS.DAT0 */
                    }

                    Return (0xFFFF)
                }

                Method (SWRB, 3, Serialized)
                {
                    If (STRT ())
                    {
                        Return (Zero)
                    }

                    I2CE = Zero
                    HSTS = 0xBF
                    TXSA = Arg0
                    HCOM = Arg1
                    DAT0 = Arg2
                    HCON = 0x48
                    If (COMP ())
                    {
                        HSTS |= 0xFF
                        Return (One)
                    }

                    Return (Zero)
                }

                Method (SRDB, 2, Serialized)
                {
                    If (STRT ())
                    {
                        Return (0xFFFF)
                    }

                    I2CE = Zero
                    HSTS = 0xBF
                    TXSA = (Arg0 | One)
                    HCOM = Arg1
                    HCON = 0x48
                    If (COMP ())
                    {
                        HSTS |= 0xFF
                        Return (DAT0) /* \_SB_.PCI0.SBUS.DAT0 */
                    }

                    Return (0xFFFF)
                }

                Method (SWRW, 3, Serialized)
                {
                    If (STRT ())
                    {
                        Return (Zero)
                    }

                    I2CE = Zero
                    HSTS = 0xBF
                    TXSA = Arg0
                    HCOM = Arg1
                    DAT1 = (Arg2 & 0xFF)
                    DAT0 = ((Arg2 >> 0x08) & 0xFF)
                    HCON = 0x4C
                    If (COMP ())
                    {
                        HSTS |= 0xFF
                        Return (One)
                    }

                    Return (Zero)
                }

                Method (SRDW, 2, Serialized)
                {
                    If (STRT ())
                    {
                        Return (0xFFFF)
                    }

                    I2CE = Zero
                    HSTS = 0xBF
                    TXSA = (Arg0 | One)
                    HCOM = Arg1
                    HCON = 0x4C
                    If (COMP ())
                    {
                        HSTS |= 0xFF
                        Return (((DAT0 << 0x08) | DAT1))
                    }

                    Return (0xFFFFFFFF)
                }

                Method (SBLW, 4, Serialized)
                {
                    If (STRT ())
                    {
                        Return (Zero)
                    }

                    I2CE = Arg3
                    HSTS = 0xBF
                    TXSA = Arg0
                    HCOM = Arg1
                    DAT0 = SizeOf (Arg2)
                    Local1 = Zero
                    HBDR = DerefOf (Arg2 [Zero])
                    HCON = 0x54
                    While ((SizeOf (Arg2) > Local1))
                    {
                        Local0 = 0x4E20
                        While ((!(HSTS & 0x80) && Local0))
                        {
                            Local0--
                        }

                        If (!Local0)
                        {
                            KILL ()
                            Return (Zero)
                        }

                        Local1++
                        If ((SizeOf (Arg2) > Local1))
                        {
                            HBDR = DerefOf (Arg2 [Local1])
                            HSTS = 0x80
                        }
                    }

                    HSTS = 0x80
                    If (COMP ())
                    {
                        HSTS |= 0xFF
                        Return (One)
                    }

                    Return (Zero)
                }

                Method (SBLR, 3, Serialized)
                {
                    Name (TBUF, Buffer (0x0100){})
                    If (STRT ())
                    {
                        Return (Zero)
                    }

                    I2CE = Arg2
                    HSTS = 0xBF
                    TXSA = (Arg0 | One)
                    HCOM = Arg1
                    HCON = 0x54
                    Local0 = 0x0FA0
                    While ((!(HSTS & 0x80) && Local0))
                    {
                        Local0--
                        Stall (0x32)
                    }

                    If (!Local0)
                    {
                        KILL ()
                        Return (Zero)
                    }

                    TBUF [Zero] = DAT0 /* \_SB_.PCI0.SBUS.DAT0 */
                    HSTS = 0x80
                    Local1 = One
                    While ((Local1 < DerefOf (TBUF [Zero])))
                    {
                        Local0 = 0x0FA0
                        While ((!(HSTS & 0x80) && Local0))
                        {
                            Local0--
                            Stall (0x32)
                        }

                        If (!Local0)
                        {
                            KILL ()
                            Return (Zero)
                        }

                        TBUF [Local1] = HBDR /* \_SB_.PCI0.SBUS.HBDR */
                        HSTS = 0x80
                        Local1++
                    }

                    If (COMP ())
                    {
                        HSTS |= 0xFF
                        Return (TBUF) /* \_SB_.PCI0.SBUS.SBLR.TBUF */
                    }

                    Return (Zero)
                }

                Method (STRT, 0, Serialized)
                {
                    Local0 = 0xC8
                    While (Local0)
                    {
                        If ((HSTS & 0x40))
                        {
                            Local0--
                            Sleep (One)
                            If ((Local0 == Zero))
                            {
                                Return (One)
                            }
                        }
                        Else
                        {
                            Local0 = Zero
                        }
                    }

                    Local0 = 0x0FA0
                    While (Local0)
                    {
                        If ((HSTS & One))
                        {
                            Local0--
                            Stall (0x32)
                            If ((Local0 == Zero))
                            {
                                KILL ()
                            }
                        }
                        Else
                        {
                            Return (Zero)
                        }
                    }

                    Return (One)
                }

                Method (COMP, 0, Serialized)
                {
                    Local0 = 0x0FA0
                    While (Local0)
                    {
                        If ((HSTS & 0x02))
                        {
                            Return (One)
                        }
                        Else
                        {
                            Local0--
                            Stall (0x32)
                            If ((Local0 == Zero))
                            {
                                KILL ()
                            }
                        }
                    }

                    Return (Zero)
                }

                Method (KILL, 0, Serialized)
                {
                    HCON |= 0x02
                    HSTS |= 0xFF
                }

                Device (BUS0)
                {
                    Name (_CID, "smbus")  // _CID: Compatible ID
                    Name (_ADR, Zero)  // _ADR: Address
                }

                Device (BUS1)
                {
                    Name (_CID, "smbus")  // _CID: Compatible ID
                    Name (_ADR, One)  // _ADR: Address
                }
            }

            Device (XSPI)
            {
                Name (_ADR, 0x001F0005)  // _ADR: Address
                Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                {
                    If ((Arg0 == ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b") /* Unknown UUID */))
                    {
                        Local0 = Package (0x02)
                            {
                                "pci-device-hidden", 
                                Buffer (0x08)
                                {
                                     0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                }
                            }
                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                        Return (Local0)
                    }

                    Return (Zero)
                }
            }

            Scope (RP01)
            {
                OperationRegion (A1E0, PCI_Config, Zero, 0x0480)
                Field (A1E0, ByteAcc, NoLock, Preserve)
                {
                    Offset (0x04), 
                    BMIE,   3, 
                    Offset (0x19), 
                    SECB,   8, 
                    SBBN,   8, 
                    Offset (0x1E), 
                        ,   13, 
                    MABT,   1, 
                    Offset (0x4A), 
                        ,   5, 
                    TPEN,   1, 
                    Offset (0x50), 
                        ,   4, 
                    LDIS,   1, 
                        ,   24, 
                    LACT,   1, 
                    Offset (0xA4), 
                    PSTA,   2, 
                    Offset (0xE0), 
                        ,   7, 
                    NCB7,   1, 
                    Offset (0xE2), 
                        ,   2, 
                    L23E,   1, 
                    L23D,   1, 
                    Offset (0x420), 
                        ,   30, 
                    DPGE,   1
                }

                OperationRegion (A1E1, PCI_Config, 0x18, 0x04)
                Field (A1E1, DWordAcc, NoLock, Preserve)
                {
                    BNIR,   32
                }

                Method (_BBN, 0, NotSerialized)  // _BBN: BIOS Bus Number
                {
                    If (((BMIE == Zero) && (SECB == 0xFF)))
                    {
                        Return (SNBS) /* \_SB_.PCI0.RP01.SNBS */
                    }
                    Else
                    {
                        Return (SECB) /* \_SB_.PCI0.RP01.SECB */
                    }
                }

                Method (_STA, 0, NotSerialized)  // _STA: Status
                {
                    Return (0x0F)
                }

                Name (BMIS, Zero)
                Name (SNBS, Zero)
                Name (BNIS, Zero)
                Method (L23R, 1, Serialized)
                {
                    If ((Arg0 == One))
                    {
                        L23E = One
                        Local0 = Zero
                        While (L23E)
                        {
                            If ((Local0 > 0x04))
                            {
                                Break
                            }

                            Sleep (One)
                            Local0++
                        }

                        NCB7 = One
                    }

                    If ((Arg0 == Zero))
                    {
                        If ((NCB7 == One))
                        {
                            DPGE = Zero
                            L23D = One
                            Local0 = Zero
                            While (L23D)
                            {
                                If ((Local0 > 0x04))
                                {
                                    Break
                                }

                                Sleep (One)
                                Local0++
                            }

                            NCB7 = Zero
                            DPGE = One
                        }
                    }
                }

                Method (BUSS, 1, Serialized)
                {
                    If ((Arg0 == One))
                    {
                        If ((((BMIE != Zero) && (BMIE != BMIS)) && (
                            ((SECB != Zero) && (SECB != SNBS)) && ((BNIR != 
                            Zero) && (BNIR != BNIS)))))
                        {
                            BMIS = BMIE /* \_SB_.PCI0.RP01.BMIE */
                            SNBS = SECB /* \_SB_.PCI0.RP01.SECB */
                            BNIS = BNIR /* \_SB_.PCI0.RP01.BNIR */
                        }

                        BMIE = Zero
                        BNIR = 0x00FEFF00
                        Local0 = TPEN /* \_SB_.PCI0.RP01.TPEN */
                    }

                    If ((Arg0 == Zero))
                    {
                        BNIR = BNIS /* \_SB_.PCI0.RP01.BNIS */
                    }
                }

                Method (CKGP, 1, Serialized)
                {
                }

                Method (LNKW, 1, Serialized)
                {
                    Local1 = Zero
                    If ((Arg0 == One))
                    {
                        Local0 = (Timer + 0x00989680)
                        While ((Timer <= Local0))
                        {
                            If ((LACT == Zero))
                            {
                                Local1 = One
                                Break
                            }

                            Sleep (0x0A)
                        }
                    }

                    If ((Arg0 == Zero))
                    {
                        Local2 = (Timer + 0x00989680)
                        While ((Timer <= Local2))
                        {
                            If (((LACT == One) && (^ARPT.AVND != 0xFFFF)))
                            {
                                Local1 = One
                                Break
                            }

                            Sleep (0x0A)
                        }
                    }

                    Return (Local1)
                }

                Method (CLKD, 1, Serialized)
                {
                    If ((Arg0 == One))
                    {
                        Local1 = Zero
                        SPCO (One, Zero)
                    }

                    If ((Arg0 == Zero))
                    {
                        SPCO (One, One)
                    }
                }

                Method (DPWR, 1, Serialized)
                {
                    If (!OSDW ())
                    {
                        Return (0xFF)
                    }

                    If ((Arg0 == Zero))
                    {
                        ^^LPCB.EC.APWC = Zero
                        Return (Zero)
                    }

                    If ((Arg0 == One))
                    {
                        ^^LPCB.EC.APWC = One
                        Return (One)
                    }

                    Return (^^LPCB.EC.APWC) /* \_SB_.PCI0.LPCB.EC__.APWC */
                }

                Method (DRST, 1, Serialized)
                {
                    If (!OSDW ())
                    {
                        Return (0xFF)
                    }

                    If ((Arg0 == Zero))
                    {
                        SGDI (0x03010003)
                        Return (One)
                    }

                    If ((Arg0 == One))
                    {
                        SGOV (0x03010003, Zero)
                        SGDO (0x03010003)
                        Return (Zero)
                    }

                    Return (!GGDV (0x03010003))
                }

                Method (DISO, 1, Serialized)
                {
                    If (!OSDW ())
                    {
                        Return (0xFF)
                    }

                    If ((Arg0 == Zero))
                    {
                        ^ARPT.PSTA = 0x03
                        L23R (One)
                        DRST (One)
                        CLKD (One)
                        BUSS (One)
                        PSTA = 0x03
                        Local0 = TPEN /* \_SB_.PCI0.RP01.TPEN */
                        LNKW (One)
                    }

                    If ((Arg0 == One))
                    {
                        PSTA = Zero
                        BUSS (Zero)
                        CLKD (Zero)
                        DRST (Zero)
                        Sleep (0x64)
                        L23R (Zero)
                        LNKW (Zero)
                    }

                    Return (Zero)
                }

                Method (APPD, 0, Serialized)
                {
                    If (!OSDW ())
                    {
                        Return (Zero)
                    }

                    ^ARPT.PSTA = 0x03
                    L23R (One)
                    DRST (One)
                    If ((SLTP == Zero))
                    {
                        CLKD (One)
                        CKGP (Zero)
                    }

                    BUSS (One)
                    PSTA = 0x03
                    Local0 = TPEN /* \_SB_.PCI0.RP01.TPEN */
                    LNKW (One)
                    Return (Zero)
                }

                Method (APPU, 0, Serialized)
                {
                    If (!OSDW ())
                    {
                        Return (Zero)
                    }

                    PSTA = Zero
                    If ((SECB != 0xFF)){}
                    Else
                    {
                        BNIR = BNIS /* \_SB_.PCI0.RP01.BNIS */
                    }

                    If ((SLTP == Zero))
                    {
                        CKGP (One)
                        CLKD (Zero)
                        DRST (Zero)
                        Sleep (0x64)
                        L23R (Zero)
                    }

                    LNKW (Zero)
                    Return (Zero)
                }

                Method (ALPR, 1, NotSerialized)
                {
                    If ((Arg0 == One))
                    {
                        APPD ()
                    }
                    Else
                    {
                        APPU ()
                    }
                }

                Method (_PS0, 0, Serialized)  // _PS0: Power State 0
                {
                    If (OSDW ())
                    {
                        ALPR (Zero)
                    }
                }

                Method (_PS3, 0, Serialized)  // _PS3: Power State 3
                {
                    If (OSDW ())
                    {
                        ALPR (One)
                    }
                }

                Device (ARPT)
                {
                    Name (_ADR, Zero)  // _ADR: Address
                    Name (_GPE, 0x6F)  // _GPE: General Purpose Events
                    OperationRegion (ARE2, PCI_Config, Zero, 0x80)
                    Field (ARE2, ByteAcc, NoLock, Preserve)
                    {
                        AVND,   16, 
                        ADID,   16, 
                        Offset (0x4C), 
                        PSTA,   2
                    }

                    Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                    {
                        Local0 = Package (0x02)
                            {
                                "module-instance", 
                                "bali"
                            }
                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                        Return (Local0)
                    }

                    Method (_STA, 0, NotSerialized)  // _STA: Status
                    {
                        Return (0x0F)
                    }

                    Method (_PRW, 0, NotSerialized)  // _PRW: Power Resources for Wake
                    {
                        If (OSDW ())
                        {
                            Return (Package (0x02)
                            {
                                0x69, 
                                0x04
                            })
                        }
                        Else
                        {
                            Return (Package (0x02)
                            {
                                0x69, 
                                0x04
                            })
                        }
                    }

                    Method (PRW0, 0, NotSerialized)
                    {
                        Return (Package (0x01)
                        {
                            0x6F
                        })
                    }

                    Method (_RMV, 0, NotSerialized)  // _RMV: Removal Status
                    {
                        Return (Zero)
                    }

                    Method (_PSW, 1, Serialized)  // _PSW: Power State Wake
                    {
                        If ((^^^LPCB.EC.SWWL == One))
                        {
                            If (^^^LPCB.EC.ECOK)
                            {
                                If (OSDW ())
                                {
                                    If (Arg0)
                                    {
                                        ^^^LPCB.EC.EWLN = One
                                    }
                                    Else
                                    {
                                        ^^^LPCB.EC.EWLN = Zero
                                        ^^^LPCB.EC.LWLN = Zero
                                    }
                                }
                            }
                        }
                        Else
                        {
                        }
                    }

                    Method (RWCV, 0, Serialized)
                    {
                        Name (BUF0, Buffer (0x04)
                        {
                             0x00, 0x00, 0x00, 0x00                           // ....
                        })
                        CreateByteField (BUF0, Zero, RW00)
                        CreateByteField (BUF0, One, RW01)
                        CreateByteField (BUF0, 0x02, RW02)
                        CreateByteField (BUF0, 0x03, RW03)
                        RW00 = RWC0 /* \RWC0 */
                        RW01 = RWC1 /* \RWC1 */
                        RW02 = RWC2 /* \RWC2 */
                        RW03 = RWC3 /* \RWC3 */
                        Return (BUF0) /* \_SB_.PCI0.RP01.ARPT.RWCV.BUF0 */
                    }
                }
            }

            Device (I2C2)
            {
                Name (_ADR, 0x00150002)  // _ADR: Address
                Name (_UID, 0x03)  // _UID: Unique ID
                Name (RBUF, ResourceTemplate ()
                {
                    Interrupt (ResourceConsumer, Level, ActiveLow, Shared, ,, )
                    {
                        0x00000012,
                    }
                })
                Method (_STA, 0, NotSerialized)  // _STA: Status
                {
                    Return (0x0F)
                }

                Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                {
                    If ((Arg0 == ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b") /* Unknown UUID */))
                    {
                        Local0 = Package (0x06)
                            {
                                "i2c-channel-number", 
                                Buffer (0x08)
                                {
                                     0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                }, 

                                "i2c-pin-sda", 
                                Buffer (0x08)
                                {
                                     0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                }, 

                                "i2c-pin-scl", 
                                Buffer (0x08)
                                {
                                     0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                }
                            }
                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                        Return (Local0)
                    }

                    Return (Zero)
                }

                Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
                {
                    Return (RBUF) /* \_SB_.PCI0.I2C2.RBUF */
                }
            }

            Device (SPI1)
            {
                Name (_ADR, 0x001E0003)  // _ADR: Address
                Name (_DDN, "Intel(R) Low Power Subsystem SPI Host Controller - 9D2A")  // _DDN: DOS Device Name
                Name (_UID, 0x02)  // _UID: Unique ID
                Name (CSST, 0x28)
                Name (CSHT, 0x0A)
                Name (RBUF, ResourceTemplate ()
                {
                    Interrupt (ResourceConsumer, Level, ActiveLow, Shared, ,, )
                    {
                        0x00000017,
                    }
                })
                Method (_STA, 0, NotSerialized)  // _STA: Status
                {
                    Return (0x0F)
                }

                Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                {
                    If ((Arg0 == ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b") /* Unknown UUID */))
                    {
                        Local0 = Package (0x0E)
                            {
                                "gspi-channel-number", 
                                Buffer (0x08)
                                {
                                     0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                }, 

                                "gspi-channels-count", 
                                Buffer (0x08)
                                {
                                     0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                }, 

                                "gspi-sys-clock-period", 
                                Buffer (0x08)
                                {
                                     0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                }, 

                                "gspi-pin-cs", 
                                Buffer (0x08)
                                {
                                     0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // W.......
                                }, 

                                "gspi-pin-clk", 
                                Buffer (0x08)
                                {
                                     0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // X.......
                                }, 

                                "gspi-pin-mosi", 
                                Buffer (0x08)
                                {
                                     0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // Y.......
                                }, 

                                "gspi-pin-miso", 
                                Buffer (0x08)
                                {
                                     0x5A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // Z.......
                                }
                            }
                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                        Return (Local0)
                    }

                    Return (Zero)
                }

                Name (WBUF, Buffer (0x02)
                {
                     0x79, 0x00                                       // y.
                })
                Name (DBUF, Buffer (0x10)
                {
                    /* 0000 */  0x55, 0x10, 0x00, 0x06, 0x00, 0x02, 0x55, 0x11,  // U.....U.
                    /* 0008 */  0x00, 0x07, 0x00, 0x02, 0x79, 0x00               // ....y.
                })
                Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
                {
                    If (!OSDW ())
                    {
                        Return (WBUF) /* \_SB_.PCI0.SPI1.WBUF */
                    }

                    Return (ConcatenateResTemplate (RBUF, DBUF))
                }
            }

            Device (URT0)
            {
                Name (_ADR, 0x001E0000)  // _ADR: Address
                Name (RBUF, ResourceTemplate ()
                {
                    Interrupt (ResourceConsumer, Level, ActiveLow, Shared, ,, )
                    {
                        0x00000014,
                    }
                })
                Method (_STA, 0, NotSerialized)  // _STA: Status
                {
                    Return (0x0F)
                }

                Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                {
                    If ((Arg0 == ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b") /* Unknown UUID */))
                    {
                        Local0 = Package (0x02)
                            {
                                "uart-channel-number", 
                                Buffer (0x08)
                                {
                                     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                }
                            }
                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                        Return (Local0)
                    }

                    Return (Zero)
                }

                Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
                {
                    Return (RBUF) /* \_SB_.PCI0.URT0.RBUF */
                }
            }

            Device (URT2)
            {
                Name (_ADR, 0x00190002)  // _ADR: Address
                Name (_HID, "INT34BA")  // _HID: Hardware ID
                Method (RBUF, 0, NotSerialized)
                {
                    Name (BUFF, ResourceTemplate ()
                    {
                        Memory32Fixed (ReadWrite,
                            0x00000000,         // Address Base
                            0x00001000,         // Address Length
                            _Y10)
                        Interrupt (ResourceConsumer, Level, ActiveLow, Shared, ,, _Y11)
                        {
                            0x00000014,
                        }
                    })
                    CreateDWordField (BUFF, \_SB.PCI0.URT2.RBUF._Y10._BAS, BVAL)  // _BAS: Base Address
                    CreateDWordField (BUFF, \_SB.PCI0.URT2.RBUF._Y11._INT, IRQN)  // _INT: Interrupts
                    BVAL = SB0B /* \SB0B */
                    IRQN = SIRB /* \SIRB */
                    Return (BUFF) /* \_SB_.PCI0.URT2.RBUF.BUFF */
                }

                Method (_STA, 0, NotSerialized)  // _STA: Status
                {
                    Return (0x0F)
                }

                Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                {
                    If ((Arg0 == ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b") /* Unknown UUID */))
                    {
                        Local0 = Package (0x02)
                            {
                                "uart-channel-number", 
                                Buffer (0x08)
                                {
                                     0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                }
                            }
                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                        Return (Local0)
                    }

                    Return (Zero)
                }

                Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
                {
                    Return (RBUF ())
                }
            }

            Scope (URT0)
            {
                Device (BLTH)
                {
                    Name (_HID, EisaId ("BCM2E7C"))  // _HID: Hardware ID
                    Name (_CID, "apple-uart-blth")  // _CID: Compatible ID
                    Name (_UID, One)  // _UID: Unique ID
                    Name (_ADR, Zero)  // _ADR: Address
                    Method (_STA, 0, NotSerialized)  // _STA: Status
                    {
                        Return (0x0F)
                    }

                    Method (_PRW, 0, NotSerialized)  // _PRW: Power Resources for Wake
                    {
                        If (OSDW ())
                        {
                            Return (Package (0x02)
                            {
                                0x6F, 
                                0x04
                            })
                        }
                        Else
                        {
                            Return (Package (0x02)
                            {
                                0x6F, 
                                0x03
                            })
                        }
                    }

                    Method (_CRS, 0, Serialized)  // _CRS: Current Resource Settings
                    {
                        Name (UBUF, ResourceTemplate ()
                        {
                            UartSerialBusV2 (0x0001C200, DataBitsEight, StopBitsOne,
                                0xC0, LittleEndian, ParityTypeNone, FlowControlHardware,
                                0x0020, 0x0020, "\\_SB.PCI0.URT0",
                                0x00, ResourceProducer, , Exclusive,
                                )
                        })
                        Name (ABUF, Buffer (0x02)
                        {
                             0x79, 0x00                                       // y.
                        })
                        If (!OSDW ())
                        {
                            Return (UBUF) /* \_SB_.PCI0.URT0.BLTH._CRS.UBUF */
                        }

                        Return (ABUF) /* \_SB_.PCI0.URT0.BLTH._CRS.ABUF */
                    }

                    Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                    {
                        If ((Arg0 == ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b") /* Unknown UUID */))
                        {
                            Local0 = Package (0x08)
                                {
                                    "baud", 
                                    Buffer (0x08)
                                    {
                                         0xC0, 0xC6, 0x2D, 0x00, 0x00, 0x00, 0x00, 0x00   // ..-.....
                                    }, 

                                    "parity", 
                                    Buffer (0x08)
                                    {
                                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                    }, 

                                    "dataBits", 
                                    Buffer (0x08)
                                    {
                                         0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                    }, 

                                    "stopBits", 
                                    Buffer (0x08)
                                    {
                                         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                    }
                                }
                            DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                            Return (Local0)
                        }

                        Return (Zero)
                    }

                    Method (BTPU, 0, Serialized)
                    {
                        ^^^LPCB.EC.BTPC = One
                        Sleep (0x0A)
                    }

                    Method (BTPD, 0, Serialized)
                    {
                        ^^^LPCB.EC.BTPC = Zero
                        Sleep (0x0A)
                    }

                    Method (BTRS, 0, Serialized)
                    {
                        BTPD ()
                        BTPU ()
                    }

                    Method (BTLP, 1, Serialized)
                    {
                        If ((Arg0 == Zero))
                        {
                            ^^^LPCB.EC.BTDW = One
                        }

                        If ((Arg0 == One))
                        {
                            ^^^LPCB.EC.BTDW = Zero
                        }
                    }

                    Method (BTRB, 1, Serialized)
                    {
                        If ((Arg0 == Zero))
                        {
                            SGOV (0x0309000A, One)
                            SGDO (0x0309000A)
                        }

                        If ((Arg0 == One))
                        {
                            SGOV (0x0309000A, Zero)
                            SGDO (0x0309000A)
                        }
                    }

                    Method (_PSW, 1, NotSerialized)  // _PSW: Power State Wake
                    {
                        If ((^^^LPCB.EC.SWBT == One))
                        {
                            If (^^^LPCB.EC.ECOK)
                            {
                                If (OSDW ())
                                {
                                    If (Arg0)
                                    {
                                        ^^^LPCB.EC.EWBT = One
                                    }
                                    Else
                                    {
                                        ^^^LPCB.EC.EWBT = Zero
                                        ^^^LPCB.EC.LWBT = Zero
                                    }
                                }
                            }
                        }
                        Else
                        {
                        }
                    }
                }
            }

            Scope (RP17)
            {
                OperationRegion (PCUP, PCI_Config, Zero, 0x0480)
                Field (PCUP, ByteAcc, NoLock, Preserve)
                {
                    Offset (0x52), 
                        ,   13, 
                    LACT,   1, 
                    Offset (0xE0), 
                        ,   7, 
                    NCB7,   1, 
                    Offset (0xE2), 
                        ,   2, 
                    L23E,   1, 
                    L23D,   1, 
                    Offset (0x420), 
                        ,   30, 
                    DPGE,   1
                }

                Method (_PS0, 0, NotSerialized)  // _PS0: Power State 0
                {
                    Local1 = Zero
                    Local0 = (Timer + 0x08F0D180)
                    While ((Timer <= Local0))
                    {
                        If ((^^LPCB.EC.PSOC == One))
                        {
                            Local1 = One
                            Break
                        }

                        Sleep (0x64)
                    }

                    If ((Local1 != One))
                    {
                        Fatal (0x00, 0x436F5350, 0x544F4D54)
                    }

                    SPCO (Zero, One)
                    Sleep (0x64)
                    ^^LPCB.EC.PRST = One
                    Local1 = Zero
                    Local0 = Zero
                    While ((^^LPCB.EC.PCIR != One))
                    {
                        If ((Local0 > 0x96))
                        {
                            Local1 = One
                            Break
                        }

                        Sleep (0x64)
                        Local0++
                    }

                    If ((Local1 != Zero))
                    {
                        Fatal (0x00, 0x65494350, 0x544F4D54)
                    }

                    If ((NCB7 == One))
                    {
                        DPGE = Zero
                        L23D = One
                        Local0 = Zero
                        While (L23D)
                        {
                            If ((Local0 > 0x04))
                            {
                                Break
                            }

                            Sleep (One)
                            Local0++
                        }

                        NCB7 = Zero
                        DPGE = One
                        Local0 = Zero
                        While ((LACT == Zero))
                        {
                            If ((Local0 > 0x08))
                            {
                                Break
                            }

                            Sleep (0x10)
                            Local0++
                        }
                    }

                    Local0 = ^ANS2.PSTA /* \_SB_.PCI0.RP17.ANS2.PSTA */
                    ^ANS2.PSTA = (Local0 & 0xFFFFFFFC)
                    Local0 = ^ANS2.PSTA /* \_SB_.PCI0.RP17.ANS2.PSTA */
                }

                Method (_PS3, 0, NotSerialized)  // _PS3: Power State 3
                {
                    Local0 = ^ANS2.PSTA /* \_SB_.PCI0.RP17.ANS2.PSTA */
                    ^ANS2.PSTA = (Local0 | 0x03)
                    Local0 = ^ANS2.PSTA /* \_SB_.PCI0.RP17.ANS2.PSTA */
                    L23E = One
                    Local0 = Zero
                    While (L23E)
                    {
                        If ((Local0 > 0x04))
                        {
                            Break
                        }

                        Sleep (One)
                        Local0++
                    }

                    NCB7 = One
                    SPCO (Zero, Zero)
                    ^^LPCB.EC.PRST = Zero
                }
            }

            Scope (RP17)
            {
                Device (ANS2)
                {
                    Name (_ADR, Zero)  // _ADR: Address
                    OperationRegion (PCIA, PCI_Config, Zero, 0xFF)
                    Field (PCIA, ByteAcc, NoLock, Preserve)
                    {
                        AVND,   16, 
                        ADID,   16, 
                        Offset (0x44), 
                        PSTA,   32
                    }

                    Method (_STA, 0, NotSerialized)  // _STA: Status
                    {
                        Return (0x0F)
                    }

                    Method (_PS0, 0, NotSerialized)  // _PS0: Power State 0
                    {
                    }

                    Method (_PS3, 0, NotSerialized)  // _PS3: Power State 3
                    {
                    }

                    Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                    {
                        If ((Arg0 == ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b") /* Unknown UUID */))
                        {
                            Local0 = Package (0x02)
                                {
                                    "pci-functions-dependent", 
                                    Buffer (0x08)
                                    {
                                         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                    }
                                }
                            DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                            Return (Local0)
                        }

                        Return (Zero)
                    }
                }
            }

            Scope (RP17)
            {
                Device (IOBC)
                {
                    Name (_ADR, One)  // _ADR: Address
                    OperationRegion (PCIC, PCI_Config, Zero, 0xFF)
                    Field (PCIC, ByteAcc, NoLock, Preserve)
                    {
                        AVND,   16, 
                        ADID,   16, 
                        Offset (0x44), 
                        PSTA,   32
                    }

                    Method (_STA, 0, NotSerialized)  // _STA: Status
                    {
                        Return (0x0F)
                    }

                    Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                    {
                        If ((Arg0 == ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b") /* Unknown UUID */))
                        {
                            Local0 = Package (0x02)
                                {
                                    "pci-msi-flags", 
                                    Buffer (0x08)
                                    {
                                         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                    }
                                }
                            DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                            Return (Local0)
                        }

                        Return (Zero)
                    }

                    Method (_PS0, 0, NotSerialized)  // _PS0: Power State 0
                    {
                        PSTA &= 0xFFFFFFFC
                        Local0 = PSTA /* \_SB_.PCI0.RP17.IOBC.PSTA */
                    }

                    Method (_PS3, 0, NotSerialized)  // _PS3: Power State 3
                    {
                        PSTA |= 0x03
                        Local0 = PSTA /* \_SB_.PCI0.RP17.IOBC.PSTA */
                    }
                }
            }

            Scope (RP17)
            {
                Device (SEPM)
                {
                    Name (_ADR, 0x02)  // _ADR: Address
                    OperationRegion (PCID, PCI_Config, Zero, 0xFF)
                    Field (PCID, ByteAcc, NoLock, Preserve)
                    {
                        AVND,   16, 
                        ADID,   16, 
                        Offset (0x44), 
                        PSTA,   32
                    }

                    Method (_STA, 0, NotSerialized)  // _STA: Status
                    {
                        Return (0x0F)
                    }

                    Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                    {
                        If ((Arg0 == ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b") /* Unknown UUID */))
                        {
                            Local0 = Package (0x02)
                                {
                                    "pci-msi-flags", 
                                    Buffer (0x08)
                                    {
                                         0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00   // ........
                                    }
                                }
                            DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                            Return (Local0)
                        }

                        Return (Zero)
                    }

                    Method (_PS0, 0, NotSerialized)  // _PS0: Power State 0
                    {
                        PSTA &= 0xFFFFFFFC
                        Local0 = PSTA /* \_SB_.PCI0.RP17.SEPM.PSTA */

2,265 lines not shown · raw message

Part of this message is not shown here. View the raw message.

#11 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Quoted 6 lines · On Fri, 01 Oct 2021 23:28:03 +1000 "Orlando Chamberlain"…
Quoted 2 lines · On Fri, 01 Oct 2021 19:35:16 +1000 "Marcel Holtmann" <[email protected]>…

I would really prefer to do that via the ACPI table matching in hci_bcm.c and not via some magic chip id check.

Quoted 6 lines

Initially I thought we may be able to do this based off BCM2E7C (which is in the DSDT table which I'll attach), however it seems like many Macs also have that (i.e. MacBookPro14,1, MacBookAir8,1, MacBook9,1), so unless all these don't support LE Read Transmit Power, (which would be hard to determine), I don't know if BCM2E7C can be used to quirk it.

I think there aren't any Macs that support LE Read Transmit Power.

I checked the Bluetooth spec here
https://www.bluetooth.com/specifications/specs/core-specification-5-1/
and it seems like 5.1 is the first version that mentions LE Read Transmit Power. It says 5.1 was adopted on 21 Jan 2019.

As far as I know, all of the models released after that date that have ever had working Bluetooth were affected, while unaffected models were released before that date (and thus shouldn't support LE Read Transmit Power? This is at least true for the MacBookPro15,1, a 2018 model that doesn't support the command).

I think this means that no Apple computer released so far supports the command, so disabling LE Read Transmit Power for all Apple controllers based off "apple-uart-blth" (probably a better choice than "BCM2E7C") won't affect any controllers that actually support it.

Device (BLTH)
{
Name (_HID, EisaId ("BCM2E7C")) // _HID: Hardware ID Name (_CID, "apple-uart-blth") // _CID: Compatible ID Name (_UID, One) // _UID: Unique ID
Name (_ADR, Zero) // _ADR: Address

As to future Apple computers, they seem to no longer be using UART and instead have a second Broadcom PCI device (the first being for WiFi) that is for Bluetooth. 3 Intel Macs Models have this second device (MacBookPro15,4, MacBookPro16,3 and MacBookAir9,1), and so do the M1 ones.

I can't say that they won't move back to UART at some point and then support LE Read Transmit Power, but if they do, I don't think they would move back to x86_64, so only having this quirk activated when compiling for x86_64 might be an option if that's an issue.

Quoted 3 lines

I'll try to see if I can find something else in the ACPI tables that can be used as a quirk. (I'll see if I can get the table of a similar model that wasn't affected and compare the BLTH sections)

The BLTH sections were the same for affected and unaffected macs.

Would disabling LE Read Transmit Power if the controller is "apple-uart-blth" work for you?

#12 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Lo, this is your Linux kernel regression tracker speaking. I have this regression on the radar of regzbot, my Linux regression tracking bot:
https://linux-regtracking.leemhuis.info/regzbot/regression/[email protected]/

Has any progress been made since below mail? If not: how can we get the ball rolling again and get this regression fixed?

Ciao, Thorsten

P.S.: I have no personal interest in this issue. Hence, feel free to exclude me on further messages in this thread after the first reply, as I'm only posting this mail to hopefully get a status update and things rolling again.

#regzbot poke

Quoted 62 lines · Orlando Chamberlain
Quoted 6 lines · On Fri, 01 Oct 2021 23:28:03 +1000 "Orlando Chamberlain"…
Quoted 2 lines · On Fri, 01 Oct 2021 19:35:16 +1000 "Marcel Holtmann" <[email protected]>…

I would really prefer to do that via the ACPI table matching in hci_bcm.c and not via some magic chip id check.

Quoted 6 lines

Initially I thought we may be able to do this based off BCM2E7C (which is in the DSDT table which I'll attach), however it seems like many Macs also have that (i.e. MacBookPro14,1, MacBookAir8,1, MacBook9,1), so unless all these don't support LE Read Transmit Power, (which would be hard to determine), I don't know if BCM2E7C can be used to quirk it.

I think there aren't any Macs that support LE Read Transmit Power.

I checked the Bluetooth spec here
https://www.bluetooth.com/specifications/specs/core-specification-5-1/
and it seems like 5.1 is the first version that mentions LE Read Transmit Power. It says 5.1 was adopted on 21 Jan 2019.

As far as I know, all of the models released after that date that have ever had working Bluetooth were affected, while unaffected models were released before that date (and thus shouldn't support LE Read Transmit Power? This is at least true for the MacBookPro15,1, a 2018 model that doesn't support the command).

I think this means that no Apple computer released so far supports the command, so disabling LE Read Transmit Power for all Apple controllers based off "apple-uart-blth" (probably a better choice than "BCM2E7C") won't affect any controllers that actually support it.

Device (BLTH)
{
Name (_HID, EisaId ("BCM2E7C")) // _HID: Hardware ID Name (_CID, "apple-uart-blth") // _CID: Compatible ID Name (_UID, One) // _UID: Unique ID
Name (_ADR, Zero) // _ADR: Address

As to future Apple computers, they seem to no longer be using UART and instead have a second Broadcom PCI device (the first being for WiFi) that is for Bluetooth. 3 Intel Macs Models have this second device (MacBookPro15,4, MacBookPro16,3 and MacBookAir9,1), and so do the M1 ones.

I can't say that they won't move back to UART at some point and then support LE Read Transmit Power, but if they do, I don't think they would move back to x86_64, so only having this quirk activated when compiling for x86_64 might be an option if that's an issue.

Quoted 3 lines

I'll try to see if I can find something else in the ACPI tables that can be used as a quirk. (I'll see if I can get the table of a similar model that wasn't affected and compare the BLTH sections)

The BLTH sections were the same for affected and unaffected macs.

Would disabling LE Read Transmit Power if the controller is "apple-uart-blth" work for you?

#13 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

In reply to Orlando Chamberlain

Hi Orlando,

Quoted 68 lines · Orlando Chamberlain

The LE Read Transmit Power command is Advertised on some Broadcom controlers, but not supported. Using this command breaks Bluetooth on the MacBookPro16,1 and iMac20,1. Added a quirk disabling LE Read Transmit Power for these devices, based off their common chip id 150.

---
v1->v2: Clarified quirk description

 drivers/bluetooth/btbcm.c   |  4 ++++
 include/net/bluetooth/hci.h | 11 +++++++++++
 net/bluetooth/hci_core.c    |  3 ++-
 3 files changed, 17 insertions(+), 1 deletion(-)
drivers/bluetooth/btbcm.c +4 -0
index e4182acee488..4ecc50d93107 100644
@@ -353,6 +353,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
                return PTR_ERR(skb);
 
        bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]);
+
+       if (skb->data[1] == 150)
+               set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
        kfree_skb(skb);
 
        /* Read Controller Features */
include/net/bluetooth/hci.h +11 -0
index b80415011dcd..6da9bd6b7259 100644
@@ -246,6 +246,17 @@ enum {
         * HCI after resume.
         */
        HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+       /* When this quirk is set, LE Read Transmit Power is disabled.
+        * This is mainly due to the fact that the HCI LE Read Transmit
+        * Power command is advertised, but not supported; these
+        * controllers often reply with unknown command and need a hard
+        * reset.
+        *
+        * This quirk can be set before hci_register_dev is called or
+        * during the hdev->setup vendor callback.
+        */
+       HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -2
index 8a47a3017d61..9a23fe7c8d67 100644
@@ -742,7 +742,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
                        hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
                }
 
-               if (hdev->commands[38] & 0x80) {
+               if (hdev->commands[38] & 0x80 &&
+                       !test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
                        /* Read LE Min/Max Tx Power*/
                        hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
                                    0, NULL);
--
Quoted 1 line

2.33.0

Nowadays it is possible to treat errors such like this on a per command basis (assuming it is not essential for the init sequence):

include/net/bluetooth/hci.h +1 -0
index 979da5179ff4..f244f42cc609 100644
@@ -551,6 +551,7 @@ enum {
 #define HCI_LK_AUTH_COMBINATION_P256   0x08
 
 /* ---- HCI Error Codes ---- */
+#define HCI_ERROR_UNKNOWN_CMD          0x01
 #define HCI_ERROR_UNKNOWN_CONN_ID      0x02
 #define HCI_ERROR_AUTH_FAILURE         0x05
 #define HCI_ERROR_PIN_OR_KEY_MISSING   0x06
net/bluetooth/hci_sync.c +0 -0
index bb88d31d2212..9c697e058974 100644
@@ -3325,11 +3325,18 @@ static int

hci_le_read_adv_tx_power_sync(struct hci_dev *hdev)
/* Read LE Min/Max Tx Power*/
static int hci_le_read_tx_power_sync(struct hci_dev *hdev) {
+ int status;
+

        if (!(hdev->commands[38] & 0x80))
                return 0;

- return __hci_cmd_sync_status(hdev, HCI_OP_LE_READ_TRANSMIT_POWER,
- 0, NULL, HCI_CMD_TIMEOUT);
+ status = __hci_cmd_sync_status(hdev, HCI_OP_LE_READ_TRANSMIT_POWER,
+ 0, NULL, HCI_CMD_TIMEOUT);
+ /* Ignore if command is not really supported */
+ if (status == HCI_ERROR_UNKNOWN_CMD)
+ return 0;
+
+ return status;
}

/* Read LE Accept List Size */

Anyway, it would probably be worth pointing out to the vendor they have a broken firmware if they do mark the command as supported but return such error.

Signature · 1 line
Luiz Augusto von Dentz
#14 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

net/bluetooth/hci_sync.c

Quoted 94 lines · Luiz Augusto von Dentz

Hi Orlando,

Quoted 68 lines · Orlando Chamberlain

The LE Read Transmit Power command is Advertised on some Broadcom controlers, but not supported. Using this command breaks Bluetooth on the MacBookPro16,1 and iMac20,1. Added a quirk disabling LE Read Transmit Power for these devices, based off their common chip id 150.

---
v1->v2: Clarified quirk description

drivers/bluetooth/btbcm.c   |  4 ++++
include/net/bluetooth/hci.h | 11 +++++++++++
net/bluetooth/hci_core.c    |  3 ++-
3 files changed, 17 insertions(+), 1 deletion(-)
drivers/bluetooth/btbcm.c +4 -0
index e4182acee488..4ecc50d93107 100644
@@ -353,6 +353,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
               return PTR_ERR(skb);
 
       bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]);
+
+       if (skb->data[1] == 150)
+               set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
       kfree_skb(skb);
 
       /* Read Controller Features */
include/net/bluetooth/hci.h +11 -0
index b80415011dcd..6da9bd6b7259 100644
@@ -246,6 +246,17 @@ enum {
        * HCI after resume.
        */
       HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+       /* When this quirk is set, LE Read Transmit Power is disabled.
+        * This is mainly due to the fact that the HCI LE Read Transmit
+        * Power command is advertised, but not supported; these
+        * controllers often reply with unknown command and need a hard
+        * reset.
+        *
+        * This quirk can be set before hci_register_dev is called or
+        * during the hdev->setup vendor callback.
+        */
+       HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -2
index 8a47a3017d61..9a23fe7c8d67 100644
@@ -742,7 +742,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
                       hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
               }
 
-               if (hdev->commands[38] & 0x80) {
+               if (hdev->commands[38] & 0x80 &&
+                       !test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
                       /* Read LE Min/Max Tx Power*/
                       hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
                                   0, NULL);
--
Quoted 1 line

2.33.0

Nowadays it is possible to treat errors such like this on a per command basis (assuming it is not essential for the init sequence):

include/net/bluetooth/hci.h +1 -0
index 979da5179ff4..f244f42cc609 100644
@@ -551,6 +551,7 @@ enum {
 #define HCI_LK_AUTH_COMBINATION_P256   0x08
 
 /* ---- HCI Error Codes ---- */
+#define HCI_ERROR_UNKNOWN_CMD          0x01
 #define HCI_ERROR_UNKNOWN_CONN_ID      0x02
 #define HCI_ERROR_AUTH_FAILURE         0x05
 #define HCI_ERROR_PIN_OR_KEY_MISSING   0x06
net/bluetooth/hci_sync.c +0 -0

This diff cannot be applied to stable 5.15. Could you provide a patch capable of being applied to stable.

Quoted 33 lines

index bb88d31d2212..9c697e058974 100644

net/bluetooth/hci_sync.c +9 -2
@@ -3325,11 +3325,18 @@ static int
 hci_le_read_adv_tx_power_sync(struct hci_dev *hdev)
 /* Read LE Min/Max Tx Power*/
 static int hci_le_read_tx_power_sync(struct hci_dev *hdev)
 {
+       int status;
+
       if (!(hdev->commands[38] & 0x80))
               return 0;
 
-       return __hci_cmd_sync_status(hdev, HCI_OP_LE_READ_TRANSMIT_POWER,
-                                    0, NULL, HCI_CMD_TIMEOUT);
+       status = __hci_cmd_sync_status(hdev, HCI_OP_LE_READ_TRANSMIT_POWER,
+                                      0, NULL, HCI_CMD_TIMEOUT);
+       /* Ignore if command is not really supported */
+       if (status == HCI_ERROR_UNKNOWN_CMD)
+               return 0;
+
+       return status;
 }
 

/* Read LE Accept List Size */

Anyway, it would probably be worth pointing out to the vendor they have a broken firmware if they do mark the command as supported but return such error.

Signature · 1 line
Luiz Augusto von Dentz
maintainer
#15 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Quoted 88 lines · Aditya Garg
Quoted 88 lines · Luiz Augusto von Dentz

Hi Orlando,

Quoted 68 lines · Orlando Chamberlain

The LE Read Transmit Power command is Advertised on some Broadcom controlers, but not supported. Using this command breaks Bluetooth on the MacBookPro16,1 and iMac20,1. Added a quirk disabling LE Read Transmit Power for these devices, based off their common chip id 150.

---
v1->v2: Clarified quirk description

drivers/bluetooth/btbcm.c   |  4 ++++
include/net/bluetooth/hci.h | 11 +++++++++++
net/bluetooth/hci_core.c    |  3 ++-
3 files changed, 17 insertions(+), 1 deletion(-)
drivers/bluetooth/btbcm.c +4 -0
index e4182acee488..4ecc50d93107 100644
@@ -353,6 +353,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
               return PTR_ERR(skb);
 
       bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]);
+
+       if (skb->data[1] == 150)
+               set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
       kfree_skb(skb);
 
       /* Read Controller Features */
include/net/bluetooth/hci.h +11 -0
index b80415011dcd..6da9bd6b7259 100644
@@ -246,6 +246,17 @@ enum {
        * HCI after resume.
        */
       HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+       /* When this quirk is set, LE Read Transmit Power is disabled.
+        * This is mainly due to the fact that the HCI LE Read Transmit
+        * Power command is advertised, but not supported; these
+        * controllers often reply with unknown command and need a hard
+        * reset.
+        *
+        * This quirk can be set before hci_register_dev is called or
+        * during the hdev->setup vendor callback.
+        */
+       HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -2
index 8a47a3017d61..9a23fe7c8d67 100644
@@ -742,7 +742,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
                       hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
               }
 
-               if (hdev->commands[38] & 0x80) {
+               if (hdev->commands[38] & 0x80 &&
+                       !test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
                       /* Read LE Min/Max Tx Power*/
                       hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
                                   0, NULL);
--
Quoted 1 line

2.33.0

Nowadays it is possible to treat errors such like this on a per command basis (assuming it is not essential for the init sequence):

include/net/bluetooth/hci.h +0 -0
index 979da5179ff4..f244f42cc609 100644
@@ -551,6 +551,7 @@ enum {
 #define HCI_LK_AUTH_COMBINATION_P256   0x08
 
Quoted 7 lines

net/bluetooth/hci_sync.c

Quoted 6 lines
include/net/bluetooth/hci.h +1 -0
 /* ---- HCI Error Codes ---- */
+#define HCI_ERROR_UNKNOWN_CMD          0x01
 #define HCI_ERROR_UNKNOWN_CONN_ID      0x02
 #define HCI_ERROR_AUTH_FAILURE         0x05
 #define HCI_ERROR_PIN_OR_KEY_MISSING   0x06
net/bluetooth/hci_sync.c +0 -0

This diff cannot be applied to stable 5.15. Could you provide a patch capable of being applied to stable.

That is not needed until a patch is in Linus's tree. Why do you need it earlier?

thanks,

greg k-h

#16 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Quoted 101 lines · Greg KH
Quoted 88 lines · Aditya Garg
Quoted 88 lines · Luiz Augusto von Dentz

Hi Orlando,

Quoted 68 lines · Orlando Chamberlain

The LE Read Transmit Power command is Advertised on some Broadcom controlers, but not supported. Using this command breaks Bluetooth on the MacBookPro16,1 and iMac20,1. Added a quirk disabling LE Read Transmit Power for these devices, based off their common chip id 150.

---
v1->v2: Clarified quirk description

drivers/bluetooth/btbcm.c   |  4 ++++
include/net/bluetooth/hci.h | 11 +++++++++++
net/bluetooth/hci_core.c    |  3 ++-
3 files changed, 17 insertions(+), 1 deletion(-)
drivers/bluetooth/btbcm.c +4 -0
index e4182acee488..4ecc50d93107 100644
@@ -353,6 +353,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
              return PTR_ERR(skb);
 
      bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]);
+
+       if (skb->data[1] == 150)
+               set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
      kfree_skb(skb);
 
      /* Read Controller Features */
include/net/bluetooth/hci.h +11 -0
index b80415011dcd..6da9bd6b7259 100644
@@ -246,6 +246,17 @@ enum {
       * HCI after resume.
       */
      HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+       /* When this quirk is set, LE Read Transmit Power is disabled.
+        * This is mainly due to the fact that the HCI LE Read Transmit
+        * Power command is advertised, but not supported; these
+        * controllers often reply with unknown command and need a hard
+        * reset.
+        *
+        * This quirk can be set before hci_register_dev is called or
+        * during the hdev->setup vendor callback.
+        */
+       HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -2
index 8a47a3017d61..9a23fe7c8d67 100644
@@ -742,7 +742,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
                      hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
              }
 
-               if (hdev->commands[38] & 0x80) {
+               if (hdev->commands[38] & 0x80 &&
+                       !test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
                      /* Read LE Min/Max Tx Power*/
                      hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
                                  0, NULL);
--
Quoted 1 line

2.33.0

Nowadays it is possible to treat errors such like this on a per command basis (assuming it is not essential for the init sequence):

include/net/bluetooth/hci.h +0 -0
index 979da5179ff4..f244f42cc609 100644
@@ -551,6 +551,7 @@ enum {
 #define HCI_LK_AUTH_COMBINATION_P256   0x08
 
Quoted 7 lines

net/bluetooth/hci_sync.c

Quoted 6 lines
include/net/bluetooth/hci.h +1 -0
 /* ---- HCI Error Codes ---- */
+#define HCI_ERROR_UNKNOWN_CMD          0x01
 #define HCI_ERROR_UNKNOWN_CONN_ID      0x02
 #define HCI_ERROR_AUTH_FAILURE         0x05
 #define HCI_ERROR_PIN_OR_KEY_MISSING   0x06
net/bluetooth/hci_sync.c +0 -0

This diff cannot be applied to stable 5.15. Could you provide a patch capable of being applied to stable.

Quoted 3 lines

That is not needed until a patch is in Linus's tree. Why do you need it earlier?

Well not an emergency, but the issue of Bluetooth not working on some Apple Macs has been there for a long time. BTW, will this patch be there in Linus’s tree in the coming days?

Quoted 3 lines

thanks,

greg k-h

maintainer
#17 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Quoted 101 lines · Aditya Garg
Quoted 101 lines · Greg KH
Quoted 95 lines · Aditya Garg

net/bluetooth/hci_sync.c

Quoted 94 lines · Luiz Augusto von Dentz

Hi Orlando,

Quoted 68 lines · Orlando Chamberlain

The LE Read Transmit Power command is Advertised on some Broadcom controlers, but not supported. Using this command breaks Bluetooth on the MacBookPro16,1 and iMac20,1. Added a quirk disabling LE Read Transmit Power for these devices, based off their common chip id 150.

---
v1->v2: Clarified quirk description

drivers/bluetooth/btbcm.c   |  4 ++++
include/net/bluetooth/hci.h | 11 +++++++++++
net/bluetooth/hci_core.c    |  3 ++-
3 files changed, 17 insertions(+), 1 deletion(-)
drivers/bluetooth/btbcm.c +4 -0
index e4182acee488..4ecc50d93107 100644
@@ -353,6 +353,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
              return PTR_ERR(skb);
 
      bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]);
+
+       if (skb->data[1] == 150)
+               set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
      kfree_skb(skb);
 
      /* Read Controller Features */
include/net/bluetooth/hci.h +11 -0
index b80415011dcd..6da9bd6b7259 100644
@@ -246,6 +246,17 @@ enum {
       * HCI after resume.
       */
      HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+       /* When this quirk is set, LE Read Transmit Power is disabled.
+        * This is mainly due to the fact that the HCI LE Read Transmit
+        * Power command is advertised, but not supported; these
+        * controllers often reply with unknown command and need a hard
+        * reset.
+        *
+        * This quirk can be set before hci_register_dev is called or
+        * during the hdev->setup vendor callback.
+        */
+       HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -2
index 8a47a3017d61..9a23fe7c8d67 100644
@@ -742,7 +742,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
                      hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
              }
 
-               if (hdev->commands[38] & 0x80) {
+               if (hdev->commands[38] & 0x80 &&
+                       !test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
                      /* Read LE Min/Max Tx Power*/
                      hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
                                  0, NULL);
--
Quoted 1 line

2.33.0

Nowadays it is possible to treat errors such like this on a per command basis (assuming it is not essential for the init sequence):

include/net/bluetooth/hci.h +1 -0
index 979da5179ff4..f244f42cc609 100644
@@ -551,6 +551,7 @@ enum {
 #define HCI_LK_AUTH_COMBINATION_P256   0x08
 
 /* ---- HCI Error Codes ---- */
+#define HCI_ERROR_UNKNOWN_CMD          0x01
 #define HCI_ERROR_UNKNOWN_CONN_ID      0x02
 #define HCI_ERROR_AUTH_FAILURE         0x05
 #define HCI_ERROR_PIN_OR_KEY_MISSING   0x06
net/bluetooth/hci_sync.c +0 -0

This diff cannot be applied to stable 5.15. Could you provide a patch capable of being applied to stable.

Quoted 4 lines
Quoted 3 lines

That is not needed until a patch is in Linus's tree. Why do you need it earlier?

Well not an emergency, but the issue of Bluetooth not working on some Apple Macs has been there for a long time. BTW, will this patch be there in Linus’s tree in the coming days?

That is up to the bluetooth maintainers, they have to accept it first.

thanks,

greg k-h

#18 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Hi, this is your Linux kernel regression tracker speaking. To make this easy and quick to read for everyone I for once rely on top-posting:

Bluetooth maintainers, what's the status here? The proposed patch is fixing a regression. It's not a recent one (it afaics was introduced in v5.11-rc1). Nevertheless it would be good to get this finally resolved. But this thread seems inactive for more than a week now. Or was progress made, but is only visible somewhere else?

Ciao, Thorsten (carrying his Linux kernel regression tracker hat)

P.S.: As a Linux kernel regression tracker I'm getting a lot of reports on my table. I can only look briefly into most of them. Therefore I unfortunately will get things wrong or miss something important. I hope that's not the case here; if you think it is, don't hesitate to tell me about it in a public reply. That's in everyone's interest, as what I wrote above might be misleading to everyone reading this, which is something I'd like to avoid.

BTW, I have no personal interest in this issue, which is tracked using regzbot, my Linux kernel regression tracking bot
(https://linux-regtracking.leemhuis.info/regzbot/). I'm only posting this mail to hopefully get things rolling again and hence don't need to be CC on all further activities wrt to this regression. Also feel free to ignore the following lines, they are meant for regzbot:

#regzbot poke

Quoted 106 lines · Greg KH
Quoted 93 lines · Aditya Garg
Quoted 93 lines · Greg KH
Quoted 90 lines · Aditya Garg

net/bluetooth/hci_sync.c

Quoted 89 lines · Luiz Augusto von Dentz
Quoted 68 lines · Orlando Chamberlain

The LE Read Transmit Power command is Advertised on some Broadcom controlers, but not supported. Using this command breaks Bluetooth on the MacBookPro16,1 and iMac20,1. Added a quirk disabling LE Read Transmit Power for these devices, based off their common chip id 150.

---
v1->v2: Clarified quirk description

drivers/bluetooth/btbcm.c   |  4 ++++
include/net/bluetooth/hci.h | 11 +++++++++++
net/bluetooth/hci_core.c    |  3 ++-
3 files changed, 17 insertions(+), 1 deletion(-)
drivers/bluetooth/btbcm.c +4 -0
index e4182acee488..4ecc50d93107 100644
@@ -353,6 +353,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
              return PTR_ERR(skb);
 
      bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]);
+
+       if (skb->data[1] == 150)
+               set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
      kfree_skb(skb);
 
      /* Read Controller Features */
include/net/bluetooth/hci.h +11 -0
index b80415011dcd..6da9bd6b7259 100644
@@ -246,6 +246,17 @@ enum {
       * HCI after resume.
       */
      HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+       /* When this quirk is set, LE Read Transmit Power is disabled.
+        * This is mainly due to the fact that the HCI LE Read Transmit
+        * Power command is advertised, but not supported; these
+        * controllers often reply with unknown command and need a hard
+        * reset.
+        *
+        * This quirk can be set before hci_register_dev is called or
+        * during the hdev->setup vendor callback.
+        */
+       HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -2
index 8a47a3017d61..9a23fe7c8d67 100644
@@ -742,7 +742,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
                      hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
              }
 
-               if (hdev->commands[38] & 0x80) {
+               if (hdev->commands[38] & 0x80 &&
+                       !test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
                      /* Read LE Min/Max Tx Power*/
                      hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
                                  0, NULL);
--
Quoted 1 line

2.33.0

Nowadays it is possible to treat errors such like this on a per command basis (assuming it is not essential for the init sequence):

include/net/bluetooth/hci.h +1 -0
index 979da5179ff4..f244f42cc609 100644
@@ -551,6 +551,7 @@ enum {
 #define HCI_LK_AUTH_COMBINATION_P256   0x08
 
 /* ---- HCI Error Codes ---- */
+#define HCI_ERROR_UNKNOWN_CMD          0x01
 #define HCI_ERROR_UNKNOWN_CONN_ID      0x02
 #define HCI_ERROR_AUTH_FAILURE         0x05
 #define HCI_ERROR_PIN_OR_KEY_MISSING   0x06
net/bluetooth/hci_sync.c +0 -0

This diff cannot be applied to stable 5.15. Could you provide a patch capable of being applied to stable.

Quoted 4 lines
Quoted 3 lines

That is not needed until a patch is in Linus's tree. Why do you need it earlier?

Well not an emergency, but the issue of Bluetooth not working on some Apple Macs has been there for a long time. BTW, will this patch be there in Linus’s tree in the coming days?

That is up to the bluetooth maintainers, they have to accept it first.

thanks,

greg k-h

#19 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Quoted 5 lines

Bluetooth maintainers, what's the status here? The proposed patch is fixing a regression. It's not a recent one (it afaics was introduced in v5.11-rc1). Nevertheless it would be good to get this finally resolved. But this thread seems inactive for more than a week now. Or was progress made, but is only visible somewhere else?

I think the best solution is getting broadcom to update their firmware, I've just sent them a message through a form on their website, I couldn't seem to get it to tell me "Your message has been sent", so it's possible that it didn't submit (more likely I've sent the same message several times).

If I hear back from them I'll send something here.

#20 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Quoted 6 lines · Orlando Chamberlain
Quoted 5 lines

Bluetooth maintainers, what's the status here? The proposed patch is fixing a regression. It's not a recent one (it afaics was introduced in v5.11-rc1). Nevertheless it would be good to get this finally resolved. But this thread seems inactive for more than a week now. Or was progress made, but is only visible somewhere else?

Quoted 6 lines

I think the best solution is getting broadcom to update their firmware, I've just sent them a message through a form on their website, I couldn't seem to get it to tell me "Your message has been sent", so it's possible that it didn't submit (more likely I've sent the same message several times).

If I hear back from them I'll send something here.

Thx for that. But FWIW: from the point of the regression tracker that's not the best solution, as according to your report this is a regression.
IOW: we deal with something that used to up to a certain kernel version and was broken by a change to the kernel. That is something frown upon in Linux kernel development, hence changes introducing regression are often quickly reverted, if they can't get fixed by follow up change quickly.

That sentence has two "quickly", as we want to prevent more people running into the issue, resulting in a loss of trust. But that's what will happen if we wait for a firmware update to get developed, tested, published, and rolled out. And even then we can't expect users to have the latest firmware installed when they switch to a new kernel.

Hence the best solution *afaics* might be: fix this in the kernel somehow now with a workaround; once the firmware update is out, change the kernel again to only apply the workaround if the old firmware is in use.

At least that's how it looks to me from the outside. But as mentioned earlier already: as a Linux kernel regression tracker I'm getting a lot of reports on my table. I can only look briefly into most of them. Therefore I unfortunately will get things wrong or miss something important. I hope that's not the case here; if you think it is, don't hesitate to tell me about it in a public reply. That's in everyone's interest, as what I wrote above might be misleading to everyone reading this, which is something I'd like to avoid.

Ciao, Thorsten (carrying his Linux kernel regression tracker hat)

#21 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Quoted 31 lines · Thorsten Leemhuis
Quoted 6 lines · Orlando Chamberlain
Quoted 5 lines

Bluetooth maintainers, what's the status here? The proposed patch is fixing a regression. It's not a recent one (it afaics was introduced in v5.11-rc1). Nevertheless it would be good to get this finally resolved. But this thread seems inactive for more than a week now. Or was progress made, but is only visible somewhere else?

Quoted 6 lines

I think the best solution is getting broadcom to update their firmware, I've just sent them a message through a form on their website, I couldn't seem to get it to tell me "Your message has been sent", so it's possible that it didn't submit (more likely I've sent the same message several times).

If I hear back from them I'll send something here.

Thx for that. But FWIW: from the point of the regression tracker that's not the best solution, as according to your report this is a regression.
IOW: we deal with something that used to up to a certain kernel version and was broken by a change to the kernel. That is something frown upon in Linux kernel development, hence changes introducing regression are often quickly reverted, if they can't get fixed by follow up change quickly.

That sentence has two "quickly", as we want to prevent more people running into the issue, resulting in a loss of trust. But that's what will happen if we wait for a firmware update to get developed, tested, published, and rolled out. And even then we can't expect users to have the latest firmware installed when they switch to a new kernel.

Quoted 3 lines

Hence the best solution *afaics* might be: fix this in the kernel somehow now with a workaround; once the firmware update is out, change the kernel again to only apply the workaround if the old firmware is in use.

I have an idea. Can we make LE Read Transmit Power as a module parameter and users can turn it off if it is causing trouble. I have a patch for the same but haven't tested it yet.

Quoted 11 lines

At least that's how it looks to me from the outside. But as mentioned earlier already: as a Linux kernel regression tracker I'm getting a lot of reports on my table. I can only look briefly into most of them. Therefore I unfortunately will get things wrong or miss something important. I hope that's not the case here; if you think it is, don't hesitate to tell me about it in a public reply. That's in everyone's interest, as what I wrote above might be misleading to everyone reading this, which is something I'd like to avoid.

Ciao, Thorsten (carrying his Linux kernel regression tracker hat)

maintainer
#22 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Quoted 31 lines · Aditya Garg
Quoted 31 lines · Thorsten Leemhuis
Quoted 6 lines · Orlando Chamberlain
Quoted 5 lines

Bluetooth maintainers, what's the status here? The proposed patch is fixing a regression. It's not a recent one (it afaics was introduced in v5.11-rc1). Nevertheless it would be good to get this finally resolved. But this thread seems inactive for more than a week now. Or was progress made, but is only visible somewhere else?

Quoted 6 lines

I think the best solution is getting broadcom to update their firmware, I've just sent them a message through a form on their website, I couldn't seem to get it to tell me "Your message has been sent", so it's possible that it didn't submit (more likely I've sent the same message several times).

If I hear back from them I'll send something here.

Thx for that. But FWIW: from the point of the regression tracker that's not the best solution, as according to your report this is a regression.
IOW: we deal with something that used to up to a certain kernel version and was broken by a change to the kernel. That is something frown upon in Linux kernel development, hence changes introducing regression are often quickly reverted, if they can't get fixed by follow up change quickly.

That sentence has two "quickly", as we want to prevent more people running into the issue, resulting in a loss of trust. But that's what will happen if we wait for a firmware update to get developed, tested, published, and rolled out. And even then we can't expect users to have the latest firmware installed when they switch to a new kernel.

Quoted 4 lines
Quoted 3 lines

Hence the best solution *afaics* might be: fix this in the kernel somehow now with a workaround; once the firmware update is out, change the kernel again to only apply the workaround if the old firmware is in use.

I have an idea. Can we make LE Read Transmit Power as a module parameter and users can turn it off if it is causing trouble. I have a patch for the same but haven't tested it yet.

Module parameters are for the 1990's, please never add new ones as they modify code, not data, and you want to do something like this on a per-device basis, not on "all devices in the system", right?

thanks,

greg k-h

#23 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Quoted 36 lines · Greg KH
Quoted 31 lines · Aditya Garg
Quoted 31 lines · Thorsten Leemhuis
Quoted 6 lines · Orlando Chamberlain
Quoted 5 lines

Bluetooth maintainers, what's the status here? The proposed patch is fixing a regression. It's not a recent one (it afaics was introduced in v5.11-rc1). Nevertheless it would be good to get this finally resolved. But this thread seems inactive for more than a week now. Or was progress made, but is only visible somewhere else?

Quoted 6 lines

I think the best solution is getting broadcom to update their firmware, I've just sent them a message through a form on their website, I couldn't seem to get it to tell me "Your message has been sent", so it's possible that it didn't submit (more likely I've sent the same message several times).

If I hear back from them I'll send something here.

Thx for that. But FWIW: from the point of the regression tracker that's not the best solution, as according to your report this is a regression.
IOW: we deal with something that used to up to a certain kernel version and was broken by a change to the kernel. That is something frown upon in Linux kernel development, hence changes introducing regression are often quickly reverted, if they can't get fixed by follow up change quickly.

That sentence has two "quickly", as we want to prevent more people running into the issue, resulting in a loss of trust. But that's what will happen if we wait for a firmware update to get developed, tested, published, and rolled out. And even then we can't expect users to have the latest firmware installed when they switch to a new kernel.

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

Hence the best solution *afaics* might be: fix this in the kernel somehow now with a workaround; once the firmware update is out, change the kernel again to only apply the workaround if the old firmware is in use.

I have an idea. Can we make LE Read Transmit Power as a module parameter and users can turn it off if it is causing trouble. I have a patch for the same but haven't tested it yet.

Module parameters are for the 1990's, please never add new ones as they modify code, not data, and you want to do something like this on a per-device basis, not on "all devices in the system", right?

Exactly. Since the issue affects only a few Macs and not all devices. In fact I have spotted just 2 Macs yet affected with this issue.

Quoted 4 lines

thanks,

greg k-h

#24 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Quoted 33 lines · Aditya Garg
Quoted 33 lines · Greg KH
Quoted 31 lines · Aditya Garg
Quoted 31 lines · Thorsten Leemhuis
Quoted 6 lines · Orlando Chamberlain
Quoted 5 lines

Bluetooth maintainers, what's the status here? The proposed patch is fixing a regression. It's not a recent one (it afaics was introduced in v5.11-rc1). Nevertheless it would be good to get this finally resolved. But this thread seems inactive for more than a week now. Or was progress made, but is only visible somewhere else?

Quoted 6 lines

I think the best solution is getting broadcom to update their firmware, I've just sent them a message through a form on their website, I couldn't seem to get it to tell me "Your message has been sent", so it's possible that it didn't submit (more likely I've sent the same message several times).

If I hear back from them I'll send something here.

Thx for that. But FWIW: from the point of the regression tracker that's not the best solution, as according to your report this is a regression.
IOW: we deal with something that used to up to a certain kernel version and was broken by a change to the kernel. That is something frown upon in Linux kernel development, hence changes introducing regression are often quickly reverted, if they can't get fixed by follow up change quickly.

That sentence has two "quickly", as we want to prevent more people running into the issue, resulting in a loss of trust. But that's what will happen if we wait for a firmware update to get developed, tested, published, and rolled out. And even then we can't expect users to have the latest firmware installed when they switch to a new kernel.

Hence the best solution *afaics* might be: fix this in the kernel somehow now with a workaround; once the firmware update is out, change the kernel again to only apply the workaround if the old firmware is in use.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

I have an idea. Can we make LE Read Transmit Power as a module parameter and users can turn it off if it is causing trouble. I have a patch for the same but haven't tested it yet.

Module parameters are for the 1990's, please never add new ones as they modify code, not data, and you want to do something like this on a per-device basis, not on "all devices in the system", right?

Exactly. Since the issue affects only a few Macs and not all devices. In fact I have spotted just 2 Macs yet affected with this issue.

When Greg said "per-device basis", he afaics meant: per-device in a system, as a module parameter would also affect a second bluetooth controller if there was one (say one connected via USB) -- and that shouldn't happen.

And FWIW: it's still a regression if something that used to work suddenly requires a module parameter to get working.

So if this just affects two macs, why can't the fix be realized as a quirk that is only enabled on those two systems? Or are they impossible to detect clearly via DMI data or something like that?

Ciao, Thorsten

#25 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Quoted 51 lines · Thorsten Leemhuis
Quoted 33 lines · Aditya Garg
Quoted 33 lines · Greg KH
Quoted 31 lines · Aditya Garg
Quoted 31 lines · Thorsten Leemhuis
Quoted 6 lines · Orlando Chamberlain
Quoted 5 lines

Bluetooth maintainers, what's the status here? The proposed patch is fixing a regression. It's not a recent one (it afaics was introduced in v5.11-rc1). Nevertheless it would be good to get this finally resolved. But this thread seems inactive for more than a week now. Or was progress made, but is only visible somewhere else?

Quoted 6 lines

I think the best solution is getting broadcom to update their firmware, I've just sent them a message through a form on their website, I couldn't seem to get it to tell me "Your message has been sent", so it's possible that it didn't submit (more likely I've sent the same message several times).

If I hear back from them I'll send something here.

Thx for that. But FWIW: from the point of the regression tracker that's not the best solution, as according to your report this is a regression.
IOW: we deal with something that used to up to a certain kernel version and was broken by a change to the kernel. That is something frown upon in Linux kernel development, hence changes introducing regression are often quickly reverted, if they can't get fixed by follow up change quickly.

That sentence has two "quickly", as we want to prevent more people running into the issue, resulting in a loss of trust. But that's what will happen if we wait for a firmware update to get developed, tested, published, and rolled out. And even then we can't expect users to have the latest firmware installed when they switch to a new kernel.

Hence the best solution *afaics* might be: fix this in the kernel somehow now with a workaround; once the firmware update is out, change the kernel again to only apply the workaround if the old firmware is in use.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

I have an idea. Can we make LE Read Transmit Power as a module parameter and users can turn it off if it is causing trouble. I have a patch for the same but haven't tested it yet.

Module parameters are for the 1990's, please never add new ones as they modify code, not data, and you want to do something like this on a per-device basis, not on "all devices in the system", right?

Exactly. Since the issue affects only a few Macs and not all devices. In fact I have spotted just 2 Macs yet affected with this issue.

When Greg said "per-device basis", he afaics meant: per-device in a system, as a module parameter would also affect a second bluetooth controller if there was one (say one connected via USB) -- and that shouldn't happen.

Quoted 6 lines

And FWIW: it's still a regression if something that used to work suddenly requires a module parameter to get working.

So if this just affects two macs, why can't the fix be realized as a quirk that is only enabled on those two systems? Or are they impossible to detect clearly via DMI data or something like that?

<RESENDING AS PLAIN TEXT>

A part of the output of dmidecode is below :-

Handle 0x0005, DMI type 1, 27 bytes
System Information
Manufacturer: Apple Inc.
Product Name: MacBookPro16,1
Version: 1.0
Serial Number: <Removed for Privacy>
UUID: <Removed for Privacy>
Wake-up Type: Power Switch
SKU Number:
Family: MacBook Pro

Handle 0x0006, DMI type 2, 17 bytes
Base Board Information
Manufacturer: Apple Inc.
Product Name: Mac-E1008331FDC96864
Version: MacBookPro16,1
Serial Number: <Removed for Privacy>
Asset Tag:
Features:
Board is a hosting board
Location In Chassis:
Chassis Handle: 0x0007
Type: Motherboard
Contained Object Handles: 0

The product name, MacBookPro16,1 in my case, is unique for each model. If possible a quirk to disable LE Read Transmit Power can be made on this basis.

Quoted 2 lines

Ciao, Thorsten

#26 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

In reply to Thorsten Leemhuis
Quoted 3 lines

So if this just affects two macs, why can't the fix be realized as a quirk that is only enabled on those two systems? Or are they impossible to detect clearly via DMI data or something like that?

I think we should be able to quirk based off the acpi _CID "apple-uart-blth" or _HID "BCM2E7C". Marcel suggested quirking based of the acpi table here
https://lore.kernel.org/linux-bluetooth/[email protected]/

This would catch some unaffected Macs, but they don't support the LE Read Transmit Power command anyway (the affected macs were released after it was added to the Bluetooth spec, while the unaffected Macs were released before it was added to the spec, and thus don't support it).

I'm not sure how to go about applying a quirk based off this, there are quirks in drivers/bluetooth/hci_bcm.c (no_early_set_baudrate and drive_rts_on_open), but they don't seem to be based off acpi ids.

It might be simpler to make it ignore the Unknown Command error, like
in this patch https://lore.kernel.org/linux-bluetooth/CABBYNZLjSfcG_KqTEbL6NOSvHhA5-b1t_S=3FQP4=GwW21kuzg@mail.gmail.com/
however that only applies on bluetooth-next and needed the status it
checks for to be -56, not 0x01.

--
Thanks,
Orlando

maintainer
#27 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Hi Orlando,

Quoted 13 lines
Quoted 3 lines

So if this just affects two macs, why can't the fix be realized as a quirk that is only enabled on those two systems? Or are they impossible to detect clearly via DMI data or something like that?

I think we should be able to quirk based off the acpi _CID "apple-uart-blth" or _HID "BCM2E7C". Marcel suggested quirking based of the acpi table here
https://lore.kernel.org/linux-bluetooth/[email protected]/

This would catch some unaffected Macs, but they don't support the LE Read Transmit Power command anyway (the affected macs were released after it was added to the Bluetooth spec, while the unaffected Macs were released before it was added to the spec, and thus don't support it).

Quoted 8 lines

I'm not sure how to go about applying a quirk based off this, there are quirks in drivers/bluetooth/hci_bcm.c (no_early_set_baudrate and drive_rts_on_open), but they don't seem to be based off acpi ids.

It might be simpler to make it ignore the Unknown Command error, like
in this patch https://lore.kernel.org/linux-bluetooth/CABBYNZLjSfcG_KqTEbL6NOSvHhA5-b1t_S=3FQP4=GwW21kuzg@mail.gmail.com/
however that only applies on bluetooth-next and needed the status it
checks for to be -56, not 0x01.

so we abstain from try-and-error sending of commands. The Bluetooth spec has a list of supported commands that a host can query for a reason. This is really broken behavior of the controller and needs to be pointed out as such.

The question is just how we quirk it.

Regards

Marcel

#28 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Quoted 28 lines · Marcel Holtmann

Hi Orlando,

Quoted 13 lines
Quoted 3 lines

So if this just affects two macs, why can't the fix be realized as a quirk that is only enabled on those two systems? Or are they impossible to detect clearly via DMI data or something like that?

I think we should be able to quirk based off the acpi _CID "apple-uart-blth" or _HID "BCM2E7C". Marcel suggested quirking based of the acpi table here
https://lore.kernel.org/linux-bluetooth/[email protected]/

This would catch some unaffected Macs, but they don't support the LE Read Transmit Power command anyway (the affected macs were released after it was added to the Bluetooth spec, while the unaffected Macs were released before it was added to the spec, and thus don't support it).

Quoted 8 lines

I'm not sure how to go about applying a quirk based off this, there are quirks in drivers/bluetooth/hci_bcm.c (no_early_set_baudrate and drive_rts_on_open), but they don't seem to be based off acpi ids.

It might be simpler to make it ignore the Unknown Command error, like
in this patch https://lore.kernel.org/linux-bluetooth/CABBYNZLjSfcG_KqTEbL6NOSvHhA5-b1t_S=3FQP4=GwW21kuzg@mail.gmail.com/
however that only applies on bluetooth-next and needed the status it
checks for to be -56, not 0x01.

Quoted 4 lines

so we abstain from try-and-error sending of commands. The Bluetooth spec has a list of supported commands that a host can query for a reason. This is really broken behavior of the controller and needs to be pointed out as such.

Well all I can do is provide you any logs or information I can. But we do really wish to get this regression fixed soon.

Quoted 7 lines

The question is just how we quirk it.

Regards

Marcel

#29 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Hi, this is your Linux kernel regression tracker speaking again.

Quoted 23 lines · Aditya Garg
Quoted 23 lines · Marcel Holtmann
Quoted 21 lines
Quoted 3 lines

So if this just affects two macs, why can't the fix be realized as a quirk that is only enabled on those two systems? Or are they impossible to detect clearly via DMI data or something like that?

I think we should be able to quirk based off the acpi _CID "apple-uart-blth" or _HID "BCM2E7C". Marcel suggested quirking based of the acpi table here
https://lore.kernel.org/linux-bluetooth/[email protected]/

This would catch some unaffected Macs, but they don't support the LE Read Transmit Power command anyway (the affected macs were released after it was added to the Bluetooth spec, while the unaffected Macs were released before it was added to the spec, and thus don't support it).

I'm not sure how to go about applying a quirk based off this, there are quirks in drivers/bluetooth/hci_bcm.c (no_early_set_baudrate and drive_rts_on_open), but they don't seem to be based off acpi ids.

It might be simpler to make it ignore the Unknown Command error, like
in this patch https://lore.kernel.org/linux-bluetooth/CABBYNZLjSfcG_KqTEbL6NOSvHhA5-b1t_S=3FQP4=GwW21kuzg@mail.gmail.com/
however that only applies on bluetooth-next and needed the status it
checks for to be -56, not 0x01.

Quoted 7 lines
Quoted 4 lines

so we abstain from try-and-error sending of commands. The Bluetooth spec has a list of supported commands that a host can query for a reason. This is really broken behavior of the controller and needs to be pointed out as such.

Well all I can do is provide you any logs or information I can. But we do really wish to get this regression fixed soon.

Quoted 2 lines

The question is just how we quirk it.

This thread once again looks stalled and smells a lot like "everyone agrees that his should be fixed, but afaics nobody submitted a fix or committed to work on one". Please speak up if my impression is wrong, as this is a regression and thus needs to be fixed, ideally quickly. Part of my job is to make that happen and thus remind developers and maintainers about this until we have a fix.

Ciao, Thorsten

#regzbot title bluetooth: "Query LE tx power on startup" broke Bluetooth on MacBookPro16,1
#regzbot poke

#30 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

Quoted 36 lines · Thorsten Leemhuis

Hi, this is your Linux kernel regression tracker speaking again.

Quoted 29 lines · Aditya Garg
Quoted 23 lines · Marcel Holtmann
Quoted 13 lines
Quoted 3 lines

So if this just affects two macs, why can't the fix be realized as a quirk that is only enabled on those two systems? Or are they impossible to detect clearly via DMI data or something like that?

I think we should be able to quirk based off the acpi _CID "apple-uart-blth" or _HID "BCM2E7C". Marcel suggested quirking based of the acpi table here
https://lore.kernel.org/linux-bluetooth/[email protected]/

This would catch some unaffected Macs, but they don't support the LE Read Transmit Power command anyway (the affected macs were released after it was added to the Bluetooth spec, while the unaffected Macs were released before it was added to the spec, and thus don't support it).

Quoted 8 lines

I'm not sure how to go about applying a quirk based off this, there are quirks in drivers/bluetooth/hci_bcm.c (no_early_set_baudrate and drive_rts_on_open), but they don't seem to be based off acpi ids.

It might be simpler to make it ignore the Unknown Command error, like
in this patch https://lore.kernel.org/linux-bluetooth/CABBYNZLjSfcG_KqTEbL6NOSvHhA5-b1t_S=3FQP4=GwW21kuzg@mail.gmail.com/
however that only applies on bluetooth-next and needed the status it
checks for to be -56, not 0x01.

Quoted 4 lines

so we abstain from try-and-error sending of commands. The Bluetooth spec has a list of supported commands that a host can query for a reason. This is really broken behavior of the controller and needs to be pointed out as such.

Well all I can do is provide you any logs or information I can. But we do really wish to get this regression fixed soon.

Quoted 1 line
Quoted 8 lines
Quoted 1 line
Quoted 1 line

The question is just how we quirk it.

This thread once again looks stalled and smells a lot like "everyone agrees that his should be fixed, but afaics nobody submitted a fix or committed to work on one". Please speak up if my impression is wrong, as this is a regression and thus needs to be fixed, ideally quickly. Part of my job is to make that happen and thus remind developers and maintainers about this until we have a fix.

On the basis of DMI data, I have made this patch to disable read transmit power on 16,1. I have tested this on my 16,1 successfully. Still consider this as a draft as more models have to be added. I am sending this to get the approval of the maintainers whether this quirk is acceptable or not. If yes, I shall send the final patch.

From 3dab2e1e9e0b266574f5f010efc6680417fb0c61 Mon Sep 17 00:00:00 2001
From: Aditya Garg <[email protected]>
Date: Fri, 26 Nov 2021 18:28:46 +0530
Subject: [PATCH] Add quirk to disable read transmit power on MacBook Pro 16
inch, 2019

---
 net/bluetooth/hci_core.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
net/bluetooth/hci_core.c +17 -1
index 8d33aa64846b1c..d11064cb3666ef 100644
@@ -32,6 +32,7 @@
 #include <linux/property.h>
 #include <linux/suspend.h>
 #include <linux/wait.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -461,9 +462,23 @@ static void hci_set_event_mask_page_2(struct hci_request *req)
 			    sizeof(events), events);
 }
 
+static const struct dmi_system_id fix_up_apple_bluetooth[] = {
+	{
+		/* Match for Apple MacBook Pro 16 inch, 2019 which needs
+		 * read transmit power to be disabled
+		 */
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{ }
+};
+
 static int hci_init3_req(struct hci_request *req, unsigned long opt)
 {
 	struct hci_dev *hdev = req->hdev;
+	const struct dmi_system_id *dmi_id;
 	u8 p;
 
 	hci_setup_event_mask(req);
@@ -619,7 +634,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		dmi_id = dmi_first_match(fix_up_apple_bluetooth);
+		if (hdev->commands[38] & 0x80 && (!dmi_id)) {
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);
Quoted 6 lines

Ciao, Thorsten

#regzbot title bluetooth: "Query LE tx power on startup" broke Bluetooth on MacBookPro16,1
#regzbot poke

#31 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

So I have finally managed to add quirks in btbcm on the basis on DMI data. This shall be advantageous in the situation when the user shall be using a USB adapter so that the quirk gets ineffective for the adapter.

Quoted 110 lines · Aditya Garg
Quoted 37 lines · Thorsten Leemhuis

Hi, this is your Linux kernel regression tracker speaking again.

Quoted 29 lines · Aditya Garg
Quoted 23 lines · Marcel Holtmann
Quoted 13 lines
Quoted 3 lines

So if this just affects two macs, why can't the fix be realized as a quirk that is only enabled on those two systems? Or are they impossible to detect clearly via DMI data or something like that?

I think we should be able to quirk based off the acpi _CID "apple-uart-blth" or _HID "BCM2E7C". Marcel suggested quirking based of the acpi table here
https://lore.kernel.org/linux-bluetooth/[email protected]/

This would catch some unaffected Macs, but they don't support the LE Read Transmit Power command anyway (the affected macs were released after it was added to the Bluetooth spec, while the unaffected Macs were released before it was added to the spec, and thus don't support it).

Quoted 8 lines

I'm not sure how to go about applying a quirk based off this, there are quirks in drivers/bluetooth/hci_bcm.c (no_early_set_baudrate and drive_rts_on_open), but they don't seem to be based off acpi ids.

It might be simpler to make it ignore the Unknown Command error, like
in this patch https://lore.kernel.org/linux-bluetooth/CABBYNZLjSfcG_KqTEbL6NOSvHhA5-b1t_S=3FQP4=GwW21kuzg@mail.gmail.com/
however that only applies on bluetooth-next and needed the status it
checks for to be -56, not 0x01.

Quoted 4 lines

so we abstain from try-and-error sending of commands. The Bluetooth spec has a list of supported commands that a host can query for a reason. This is really broken behavior of the controller and needs to be pointed out as such.

Well all I can do is provide you any logs or information I can. But we do really wish to get this regression fixed soon.

Quoted 1 line
Quoted 8 lines
Quoted 1 line
Quoted 1 line

The question is just how we quirk it.

This thread once again looks stalled and smells a lot like "everyone agrees that his should be fixed, but afaics nobody submitted a fix or committed to work on one". Please speak up if my impression is wrong, as this is a regression and thus needs to be fixed, ideally quickly. Part of my job is to make that happen and thus remind developers and maintainers about this until we have a fix.

On the basis of DMI data, I have made this patch to disable read transmit power on 16,1. I have tested this on my 16,1 successfully. Still consider this as a draft as more models have to be added. I am sending this to get the approval of the maintainers whether this quirk is acceptable or not. If yes, I shall send the final patch.

From 3dab2e1e9e0b266574f5f010efc6680417fb0c61 Mon Sep 17 00:00:00 2001
From: Aditya Garg <[email protected]>
Date: Fri, 26 Nov 2021 18:28:46 +0530
Subject: [PATCH] Add quirk to disable read transmit power on MacBook Pro 16 inch, 2019

---
net/bluetooth/hci_core.c | 18 +++++++++++++++++-

1 file changed, 17 insertions(+), 1 deletion(-)
net/bluetooth/hci_core.c +17 -1
index 8d33aa64846b1c..d11064cb3666ef 100644
@@ -32,6 +32,7 @@
 #include <linux/property.h>
 #include <linux/suspend.h>
 #include <linux/wait.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -461,9 +462,23 @@ static void hci_set_event_mask_page_2(struct hci_request *req)
 			    sizeof(events), events);
 }
 
+static const struct dmi_system_id fix_up_apple_bluetooth[] = {
+	{
+		/* Match for Apple MacBook Pro 16 inch, 2019 which needs
+		 * read transmit power to be disabled
+		 */
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{ }
+};
+
 static int hci_init3_req(struct hci_request *req, unsigned long opt)
 {
 	struct hci_dev *hdev = req->hdev;
+	const struct dmi_system_id *dmi_id;
 	u8 p;
 
 	hci_setup_event_mask(req);
@@ -619,7 +634,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		dmi_id = dmi_first_match(fix_up_apple_bluetooth);
+		if (hdev->commands[38] & 0x80 && (!dmi_id)) {
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);
Quoted 6 lines

Ciao, Thorsten

#regzbot title bluetooth: "Query LE tx power on startup" broke Bluetooth on MacBookPro16,1
#regzbot poke

#32 lore raw

PATCH 1/6 Bluetooth: add quirk disabling LE Read Transmit Power

In reply to Aditya Garg

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

---
 include/net/bluetooth/hci.h | 9 +++++++++
 net/bluetooth/hci_core.c    | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -1
index 8d33aa64846b1c..434c6878fe9640 100644
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if (hdev->commands[38] & 0x80 &&
+		!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);
#33 lore raw

PATCH 2/6 btbcm: disable read tx power for MacBook Pro 16,1 (16 inch, 2019)

From: Aditya Garg <[email protected]>

Bluetooth on Apple MacBook Pro 16,1 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.

---
 drivers/bluetooth/btbcm.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/bluetooth/btbcm.c +20 -0
index e4182acee488c5..c1b0ca63880a68 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -343,9 +344,23 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		/* Match for Apple MacBook Pro 16,1 which needs
+		 * Read LE Min/Max Tx Power to be disabled.
+		 */
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{ }
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
+	const struct dmi_system_id *dmi_id;
 
 	/* Read Verbose Config Version Info */
 	skb = btbcm_read_verbose_config(hdev);
@@ -362,6 +377,11 @@ static int btbcm_read_info(struct hci_dev *hdev)
 
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);
+
+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	dmi_id = dmi_first_match(disable_broken_read_transmit_power);
+	if (dmi_id)
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
 
 	return 0;
 }
#34 lore raw

PATCH 3/6 btbcm: disable read tx power for MacBook Pro 16,2 (13 inch - 4 Thunderbolt Ports, 2020)

From: Aditya Garg <[email protected]>

Bluetooth on Apple MacBook Pro 16,2 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.

---
 drivers/bluetooth/btbcm.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/bluetooth/btbcm.c +9 -0
index c1b0ca63880a6..ab7b754855d8a 100644
@@ -354,6 +354,15 @@ static const struct dmi_system_id disable_broken_read_transmit_power[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
 		},
 	},
+	{
+		/* Match for Apple MacBook Pro 16,2 which needs
+		 * Read LE Min/Max Tx Power to be disabled.
+		 */
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
+		},
+	},
 	{ }
 };
 
#35 lore raw

PATCH 4/6 btbcm: disable read tx power for MacBook Pro 16,4 (16 inch, 2019)

From: Aditya Garg <[email protected]>

Bluetooth on Apple MacBook Pro 16,4 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.

---
 drivers/bluetooth/btbcm.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/bluetooth/btbcm.c +9 -0
index 348a4afa0774e..88214b453b0ce 100644
@@ -363,6 +363,15 @@ static const struct dmi_system_id disable_broken_read_transmit_power[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
 		},
 	},
+	{
+		/* Match for Apple MacBook Pro 16,4 which needs
+		 * Read LE Min/Max Tx Power to be disabled.
+		 */
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
+		},
+	},
 	{ }
 };
 
#36 lore raw

PATCH 5/6 btbcm: disable read tx power for iMac 20,1 (Retina 5K, 27-inch, 2020)

From: Aditya Garg <[email protected]>

Bluetooth on Apple iMac 20,1 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.

---
 drivers/bluetooth/btbcm.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/bluetooth/btbcm.c +9 -0
index 88214b453b0ce..15c5be927c659 100644
@@ -372,6 +372,15 @@ static const struct dmi_system_id disable_broken_read_transmit_power[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
 		},
 	},
+	{
+		/* Match for Apple iMac 20,1 which needs
+		 * Read LE Min/Max Tx Power to be disabled.
+		 */
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+		},
+	},
 	{ }
 };
 
#37 lore raw

PATCH 6/6 btbcm: disable read tx power for iMac 20,2 (Retina 5K, 27-inch, 2020)

From: Aditya Garg <[email protected]>

Bluetooth on Apple iMac 20,2 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.

---
 drivers/bluetooth/btbcm.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/bluetooth/btbcm.c +9 -0
index 15c5be927c659..601337b5a5130 100644
@@ -381,6 +381,15 @@ static const struct dmi_system_id disable_broken_read_transmit_power[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
 		},
 	},
+	{
+		/* Match for Apple iMac 20,2 which needs
+		 * Read LE Min/Max Tx Power to be disabled.
+		 */
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+		},
+	},
 	{ }
 };
 
#38 lore raw

PATCH v2 4/6 btbcm: disable read tx power for MacBook Pro 16,4 (16 inch, 2019)

In reply to Aditya Garg

From: Aditya Garg <[email protected]>

Bluetooth on Apple MacBook Pro 16,4 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.

v2: Wrap changelog in 72 columns.

---
 drivers/bluetooth/btbcm.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/bluetooth/btbcm.c +9 -0
index 348a4afa0774e..88214b453b0ce 100644
@@ -363,6 +363,15 @@ static const struct dmi_system_id disable_broken_read_transmit_power[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
 		},
 	},
+	{
+		/* Match for Apple MacBook Pro 16,4 which needs
+		 * Read LE Min/Max Tx Power to be disabled.
+		 */
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
+		},
+	},
 	{ }
 };
 
#39 lore raw

PATCH v2 3/6 btbcm: disable read tx power for MacBook Pro 16,2 (13 inch - 4 Thunderbolt Ports, 2020)

In reply to Aditya Garg

From: Aditya Garg <[email protected]>

Bluetooth on Apple MacBook Pro 16,2 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.

v2: Wrap changelog in 72 columns

---
 drivers/bluetooth/btbcm.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/bluetooth/btbcm.c +9 -0
index c1b0ca63880a6..ab7b754855d8a 100644
@@ -354,6 +354,15 @@ static const struct dmi_system_id disable_broken_read_transmit_power[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
 		},
 	},
+	{
+		/* Match for Apple MacBook Pro 16,2 which needs
+		 * Read LE Min/Max Tx Power to be disabled.
+		 */
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
+		},
+	},
 	{ }
 };
 
#40 lore raw

PATCH v2 2/6 btbcm: disable read tx power for MacBook Pro 16,1 (16 inch, 2019)

In reply to Aditya Garg

From: Aditya Garg <[email protected]>

Bluetooth on Apple MacBook Pro 16,1 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.

v2: Wrap the changeling at 72 columns and remove tested by.

---
 drivers/bluetooth/btbcm.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/bluetooth/btbcm.c +20 -0
index e4182acee488c5..c1b0ca63880a68 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -343,9 +344,23 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		/* Match for Apple MacBook Pro 16,1 which needs
+		 * Read LE Min/Max Tx Power to be disabled.
+		 */
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{ }
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
+	const struct dmi_system_id *dmi_id;
 
 	/* Read Verbose Config Version Info */
 	skb = btbcm_read_verbose_config(hdev);
@@ -362,6 +377,11 @@ static int btbcm_read_info(struct hci_dev *hdev)
 
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);
+
+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	dmi_id = dmi_first_match(disable_broken_read_transmit_power);
+	if (dmi_id)
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
 
 	return 0;
 }
maintainer
#41 lore raw

Re: [PATCH 2/6] btbcm: disable read tx power for MacBook Pro 16,1 (16 inch, 2019)

In reply to Aditya Garg

Hi Aditya,

Quoted 1 line

Bluetooth on Apple MacBook Pro 16,1 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.

list all the MacBooks that you found problematic right now. We add the initial as a large batch instead of all individual.

Quoted 20 lines

---
drivers/bluetooth/btbcm.c | 20 ++++++++++++++++++++

1 file changed, 20 insertions(+)
drivers/bluetooth/btbcm.c +1 -0
index e4182acee488c5..c1b0ca63880a68 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>

drivers/bluetooth/btbcm.c static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev) · line 351

Quoted 8 lines
drivers/bluetooth/btbcm.c +5 -0
@@ -343,9 +344,23 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		/* Match for Apple MacBook Pro 16,1 which needs
+		 * Read LE Min/Max Tx Power to be disabled.
+		 */

Actually leave the comment out. You are not adding any value that isn’t already in the variable name or the DMI. It is just repeating the obvious.

Quoted 16 lines
drivers/bluetooth/btbcm.c +9 -0
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{ }
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
+	const struct dmi_system_id *dmi_id;
 
 	/* Read Verbose Config Version Info */
 	skb = btbcm_read_verbose_config(hdev);

drivers/bluetooth/btbcm.c static int btbcm_read_info(struct hci_dev *hdev) · line 384

Quoted 8 lines
drivers/bluetooth/btbcm.c +5 -0
@@ -362,6 +377,11 @@ static int btbcm_read_info(struct hci_dev *hdev)
 
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);
+
+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	dmi_id = dmi_first_match(disable_broken_read_transmit_power);
+	if (dmi_id)
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
	if (dmi_first_match(..))
		set_bit(.., &hdev->quirks);

There is really no need to have a variable for this.

Regards

Marcel

#42 lore raw

Re: [PATCH 2/6] btbcm: disable read tx power for MacBook Pro 16,1 (16 inch, 2019)

Quoted 34 lines · Marcel Holtmann

Hi Aditya,

Quoted 1 line

Bluetooth on Apple MacBook Pro 16,1 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.

list all the MacBooks that you found problematic right now. We add the initial as a large batch instead of all individual.

Quoted 23 lines

---
drivers/bluetooth/btbcm.c | 20 ++++++++++++++++++++

1 file changed, 20 insertions(+)
drivers/bluetooth/btbcm.c +1 -0
index e4182acee488c5..c1b0ca63880a68 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -343,9 +344,23 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
Quoted 8 lines

drivers/bluetooth/btbcm.c static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev) · line 351

Quoted 5 lines
drivers/bluetooth/btbcm.c +5 -0
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		/* Match for Apple MacBook Pro 16,1 which needs
+		 * Read LE Min/Max Tx Power to be disabled.
+		 */

Actually leave the comment out. You are not adding any value that isn’t already in the variable name or the DMI. It is just repeating the obvious.

Alright, I prepare the patches into a single one

Quoted 29 lines
Quoted 17 lines
drivers/bluetooth/btbcm.c +9 -0
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{ }
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
+	const struct dmi_system_id *dmi_id;
 
 	/* Read Verbose Config Version Info */
 	skb = btbcm_read_verbose_config(hdev);

drivers/bluetooth/btbcm.c static int btbcm_read_info(struct hci_dev *hdev) · line 384

Quoted 8 lines
drivers/bluetooth/btbcm.c +5 -0
@@ -362,6 +377,11 @@ static int btbcm_read_info(struct hci_dev *hdev)
 
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);
+
+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	dmi_id = dmi_first_match(disable_broken_read_transmit_power);
+	if (dmi_id)
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
	if (dmi_first_match(..))
		set_bit(.., &hdev->quirks);
Quoted 1 line

There is really no need to have a variable for this.

Fine, Ill correct this

Quoted 5 lines

Regards

Marcel

maintainer
#43 lore raw

Re: [PATCH 2/6] btbcm: disable read tx power for MacBook Pro 16,1 (16 inch, 2019)

Hi Aditya,

Quoted 36 lines
Quoted 28 lines
Quoted 1 line

Bluetooth on Apple MacBook Pro 16,1 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.

list all the MacBooks that you found problematic right now. We add the initial as a large batch instead of all individual.

Quoted 23 lines

---
drivers/bluetooth/btbcm.c | 20 ++++++++++++++++++++

1 file changed, 20 insertions(+)
drivers/bluetooth/btbcm.c +1 -0
index e4182acee488c5..c1b0ca63880a68 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -343,9 +344,23 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
Quoted 8 lines

drivers/bluetooth/btbcm.c static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev) · line 351

Quoted 5 lines
drivers/bluetooth/btbcm.c +5 -0
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		/* Match for Apple MacBook Pro 16,1 which needs
+		 * Read LE Min/Max Tx Power to be disabled.
+		 */

Actually leave the comment out. You are not adding any value that isn’t already in the variable name or the DMI. It is just repeating the obvious.

Quoted 1 line

Alright, I prepare the patches into a single one

two patches, one for adding the quirk to the core and one for adjusting the driver.

Regards

Marcel

#44 lore raw

Re: [PATCH 2/6] btbcm: disable read tx power for MacBook Pro 16,1 (16 inch, 2019)

Quoted 42 lines · Marcel Holtmann

Hi Aditya,

Quoted 36 lines
Quoted 36 lines
Quoted 1 line

Bluetooth on Apple MacBook Pro 16,1 is unable to start due to LE Min/Max Tx Power being queried on startup. Add a DMI based quirk so that it is disabled.

list all the MacBooks that you found problematic right now. We add the initial as a large batch instead of all individual.

Quoted 20 lines

---
drivers/bluetooth/btbcm.c | 20 ++++++++++++++++++++

1 file changed, 20 insertions(+)
drivers/bluetooth/btbcm.c +1 -0
index e4182acee488c5..c1b0ca63880a68 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>

drivers/bluetooth/btbcm.c static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev) · line 351

Quoted 8 lines
drivers/bluetooth/btbcm.c +5 -0
@@ -343,9 +344,23 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		/* Match for Apple MacBook Pro 16,1 which needs
+		 * Read LE Min/Max Tx Power to be disabled.
+		 */

Actually leave the comment out. You are not adding any value that isn’t already in the variable name or the DMI. It is just repeating the obvious.

Quoted 3 lines
Quoted 1 line

Alright, I prepare the patches into a single one

two patches, one for adding the quirk to the core and one for adjusting the driver.

Sent

Quoted 5 lines

Regards

Marcel

maintainer
#45 lore raw

Re: [PATCH 1/6] Bluetooth: add quirk disabling LE Read Transmit Power

In reply to Aditya Garg
Quoted 3 lines · Aditya Garg

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

Please wrap your changelog text at 72 columns, like your editor asked you to :)

Quoted 3 lines

Tested-by: is implicit for patches you create yourself, so no need to add it again :)

Quoted 30 lines
---
 include/net/bluetooth/hci.h | 9 +++++++++
 net/bluetooth/hci_core.c    | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +0 -0
index 8d33aa64846b1c..434c6878fe9640 100644

net/bluetooth/hci_core.c static int hci_init3_req(struct hci_request *req, unsigned long opt) · line 623

Quoted 6 lines
net/bluetooth/hci_core.c +2 -1
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if (hdev->commands[38] & 0x80 &&
+		!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {

Did you run checkpatch on this patch? Please indent properly.

thanks,

greg k-h

#46 lore raw

PATCH v2 1/6 Bluetooth: add quirk disabling LE Read Transmit Power

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

v2: Wrap the changeling at 72 columns, correct email and remove tested by.

---
 include/net/bluetooth/hci.h | 9 +++++++++
 net/bluetooth/hci_core.c    | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -1
index 8d33aa64846b1c..434c6878fe9640 100644
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if (hdev->commands[38] & 0x80 &&
+		!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);
maintainer
#47 lore raw

Re: [PATCH v2 1/6] Bluetooth: add quirk disabling LE Read Transmit Power

Quoted 6 lines · Aditya Garg

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

v2: Wrap the changeling at 72 columns, correct email and remove tested by.

These lines are not wrapped at 72 columns :(

Also the changes line goes below the --- line, as documented in the kernel documentation on how to submit a patch.

thanks,

greg k-h

#48 lore raw

Re: [PATCH v2 1/6] Bluetooth: add quirk disabling LE Read Transmit Power

Quoted 13 lines · Greg KH
Quoted 6 lines · Aditya Garg

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

v2: Wrap the changeling at 72 columns, correct email and remove tested by.

These lines are not wrapped at 72 columns :(

If I am not wrong, you mean that there should be 72 characters in one line right?

Quoted 7 lines

Also the changes line goes below the --- line, as documented in the kernel documentation on how to submit a patch.

thanks,

greg k-h

maintainer
#49 lore raw

Re: [PATCH v2 1/6] Bluetooth: add quirk disabling LE Read Transmit Power

In reply to Aditya Garg
Quoted 38 lines · Aditya Garg

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

v2: Wrap the changeling at 72 columns, correct email and remove tested by.

---
 include/net/bluetooth/hci.h | 9 +++++++++
 net/bluetooth/hci_core.c    | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +0 -0
index 8d33aa64846b1c..434c6878fe9640 100644

net/bluetooth/hci_core.c static int hci_init3_req(struct hci_request *req, unsigned long opt) · line 623

Quoted 6 lines
net/bluetooth/hci_core.c +2 -1
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if (hdev->commands[38] & 0x80 &&
+		!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {

You did not fix this formatting? Why not?

thanks,

greg k-h

maintainer
#50 lore raw

Re: [PATCH v2 1/6] Bluetooth: add quirk disabling LE Read Transmit Power

In reply to Aditya Garg

Hi Aditya,

Quoted 4 lines

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

v2: Wrap the changeling at 72 columns, correct email and remove tested by.

that part is for the reviewer and needs to go after ---. Otherwise please break at 72 characters.

Quoted 32 lines

---
include/net/bluetooth/hci.h | 9 +++++++++
net/bluetooth/hci_core.c | 3 ++-

2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +0 -0
index 8d33aa64846b1c..434c6878fe9640 100644

net/bluetooth/hci_core.c static int hci_init3_req(struct hci_request *req, unsigned long opt) · line 623

Quoted 6 lines
net/bluetooth/hci_core.c +2 -1
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if (hdev->commands[38] & 0x80 &&
+		!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
	if ((hdev->commands[38] & 0x80) &&
	    !test_bit(HCI_QUIRK_.., &hdev->quirks)) {

net/bluetooth/hci_core.c static int hci_init3_req(struct hci_request *req, unsigned long opt) · line 626

Quoted 4 lines
net/bluetooth/hci_core.c +0 -0
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);

Regards

Marcel

#51 lore raw

Re: [PATCH v3 1/2] Bluetooth: add quirk disabling LE Read Transmit Power

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

---
 include/net/bluetooth/hci.h | 9 +++++++++
 net/bluetooth/hci_core.c    | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -1
index 8d33aa64846b1c..434c6878fe9640 100644
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if (hdev->commands[38] & 0x80 &&
+		!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);
#52 lore raw

PATCH v3 2/2 btbcm: disable read tx power for affected Macs with the T2 Security chip

From: Aditya Garg <[email protected]>

Some Macs with the T2 security chip had Bluetooth not working. To fix it we add DMI based quirks to disable querying of LE Tx power.

---
 drivers/bluetooth/btbcm.c | 40 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
drivers/bluetooth/btbcm.c +40 -0
index e4182acee488c5..40f7c9c5cf0a5a 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -343,9 +344,44 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+		},
+	},
+	{ }
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
+	const struct dmi_system_id *dmi_id;
 
 	/* Read Verbose Config Version Info */
 	skb = btbcm_read_verbose_config(hdev);
@@ -363,6 +399,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);
 
+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	if (dmi_first_match(disable_broken_read_transmit_power))
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	return 0;
 }
 
#53 lore raw

PATCH RESEND v3 2/2 btbcm: disable read tx power for affected Macs with the T2 Security chip

From: Aditya Garg <[email protected]>

Some Macs with the T2 security chip had Bluetooth not working. To fix it we add DMI based quirks to disable querying of LE Tx power.

---
drivers/bluetooth/btbcm.c | 40 +++++++++++++++++++++++++++++++++++++++

1 file changed, 40 insertions(+)
drivers/bluetooth/btbcm.c +0 -0
index e4182acee488c5..40f7c9c5cf0a5a 100644
@@ -8,6 +8,7 @@
 

#include <linux/module.h>
#include <linux/firmware.h>
+#include <linux/dmi.h>
#include <asm/unaligned.h>

#include <net/bluetooth/bluetooth.h>
@@ -343,9 +344,44 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)

	return skb;
}

+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+ },
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
+ },
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
+ },
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+ },
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+ },
+ },
+ { }
+};
+
static int btbcm_read_info(struct hci_dev *hdev)

{
	struct sk_buff *skb;

+ const struct dmi_system_id *dmi_id;

	/* Read Verbose Config Version Info */
	skb = btbcm_read_verbose_config(hdev);
@@ -363,6 +399,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
	kfree_skb(skb);

+ /* Read DMI and disable broken Read LE Min/Max Tx Power */
+ if (dmi_first_match(disable_broken_read_transmit_power))
+ set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+

	return 0;
}
#54 lore raw

PATCH v4 2/2 btbcm: disable read tx power for affected Macs with the T2 Security chip

From: Aditya Garg <[email protected]>

Some Macs with the T2 security chip had Bluetooth not working. To fix it we add DMI based quirks to disable querying of LE Tx power.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
drivers/bluetooth/btbcm.c | 40 +++++++++++++++++++++++++++++++++++++++

1 file changed, 40 insertions(+)
drivers/bluetooth/btbcm.c +0 -0
index e4182acee488c5..40f7c9c5cf0a5a 100644
@@ -8,6 +8,7 @@
 

#include <linux/module.h>
#include <linux/firmware.h>
+#include <linux/dmi.h>
#include <asm/unaligned.h>

#include <net/bluetooth/bluetooth.h>
@@ -343,9 +344,44 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)

	return skb;
}

+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+ },
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
+ },
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
+ },
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+ },
+ },
+ {
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+ },
+ },
+ { }
+};
+
static int btbcm_read_info(struct hci_dev *hdev)

{
	struct sk_buff *skb;

+ const struct dmi_system_id *dmi_id;

	/* Read Verbose Config Version Info */
	skb = btbcm_read_verbose_config(hdev);
@@ -363,6 +399,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
	kfree_skb(skb);

+ /* Read DMI and disable broken Read LE Min/Max Tx Power */
+ if (dmi_first_match(disable_broken_read_transmit_power))
+ set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+

	return 0;
}
#55 lore raw

PATCH v5 2/2 btbcm: disable read tx power for affected Macs with the T2 Security chip

From: Aditya Garg <[email protected]>

Some Macs with the T2 security chip had Bluetooth not working. To fix it we add DMI based quirks to disable querying of LE Tx power.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")
---
 drivers/bluetooth/btbcm.c | 40 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
drivers/bluetooth/btbcm.c +40 -0
index e4182acee488c5..40f7c9c5cf0a5a 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -343,9 +344,44 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+		},
+	},
+	{ }
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
+	const struct dmi_system_id *dmi_id;
 
 	/* Read Verbose Config Version Info */
 	skb = btbcm_read_verbose_config(hdev);
@@ -363,6 +399,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);
 
+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	if (dmi_first_match(disable_broken_read_transmit_power))
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	return 0;
 }
 
maintainer
#56 lore raw

Re: [PATCH v3 resend 2/2] btbcm: disable read tx power for affected Macs with the T2 Security chip

In reply to Aditya Garg

Hi Aditya,

Quoted 52 lines

Some Macs with the T2 security chip had Bluetooth not working. To fix it we add DMI based quirks to disable querying of LE Tx power.

---
drivers/bluetooth/btbcm.c | 40 +++++++++++++++++++++++++++++++++++++++

1 file changed, 40 insertions(+)
drivers/bluetooth/btbcm.c +29 -0
index e4182acee488c5..40f7c9c5cf0a5a 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -343,9 +344,44 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),

drivers/bluetooth/btbcm.c static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev) · line 384

Quoted 10 lines
drivers/bluetooth/btbcm.c +7 -0
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+		},
+	},
+	{ }
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
+	const struct dmi_system_id *dmi_id;

this variable is not needed.

drivers/bluetooth/btbcm.c static int btbcm_read_info(struct hci_dev *hdev) · line 407

Quoted 13 lines
drivers/bluetooth/btbcm.c +4 -0
 	/* Read Verbose Config Version Info */
 	skb = btbcm_read_verbose_config(hdev);
@@ -363,6 +399,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);
 
+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	if (dmi_first_match(disable_broken_read_transmit_power))
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	return 0;
 }

Regards

Marcel

#57 lore raw

Re: [PATCH v3 resend 2/2] btbcm: disable read tx power for affected Macs with the T2 Security chip

Quoted 62 lines · Marcel Holtmann

Hi Aditya,

Quoted 56 lines

Some Macs with the T2 security chip had Bluetooth not working. To fix it we add DMI based quirks to disable querying of LE Tx power.

---
drivers/bluetooth/btbcm.c | 40 +++++++++++++++++++++++++++++++++++++++

1 file changed, 40 insertions(+)
drivers/bluetooth/btbcm.c +33 -0
index e4182acee488c5..40f7c9c5cf0a5a 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -343,9 +344,44 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+		},
+	},
+	{ }
Quoted 8 lines

drivers/bluetooth/btbcm.c static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev) · line 384

Quoted 6 lines
drivers/bluetooth/btbcm.c +3 -0
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
+	const struct dmi_system_id *dmi_id;

this variable is not needed.

You want me to replace const struct dmi_system_id *dmi_id; with const struct dmi_system_id or remove it altogether.

Quoted 18 lines

drivers/bluetooth/btbcm.c static int btbcm_read_info(struct hci_dev *hdev) · line 407

Quoted 13 lines
drivers/bluetooth/btbcm.c +4 -0
 	/* Read Verbose Config Version Info */
 	skb = btbcm_read_verbose_config(hdev);
@@ -363,6 +399,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);
 
+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	if (dmi_first_match(disable_broken_read_transmit_power))
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	return 0;
 }

Regards

Marcel

#58 lore raw

PATCH RESEND v3 1/2 Bluetooth: add quirk disabling LE Read Transmit Power

In reply to Aditya Garg

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

---
include/net/bluetooth/hci.h | 9 +++++++++
net/bluetooth/hci_core.c | 3 ++-

2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +0 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
	 * HCI after resume.
	 */
	HCI_QUIRK_NO_SUSPEND_NOTIFIER,

+
+ /*
+ * When this quirk is set, LE tx power is not queried on startup
+ * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+ *
+ * This quirk can be set before hci_register_dev is called or
+ * during the hdev->setup vendor callback.
+ */
+ HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
};

/* HCI device flags */

net/bluetooth/hci_core.c +0 -0
index 8d33aa64846b1c..434c6878fe9640 100644
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
		}

- if (hdev->commands[38] & 0x80) {
+ if (hdev->commands[38] & 0x80 &&

+		!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
			/* Read LE Min/Max Tx Power*/
			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
				    0, NULL);
#59 lore raw

PATCH v4 1/2 Bluetooth: add quirk disabling LE Read Transmit Power

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
include/net/bluetooth/hci.h | 9 +++++++++
net/bluetooth/hci_core.c | 3 ++-

2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +0 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
	 * HCI after resume.
	 */
	HCI_QUIRK_NO_SUSPEND_NOTIFIER,

+
+ /*
+ * When this quirk is set, LE tx power is not queried on startup
+ * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+ *
+ * This quirk can be set before hci_register_dev is called or
+ * during the hdev->setup vendor callback.
+ */
+ HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
};

/* HCI device flags */

net/bluetooth/hci_core.c +0 -0
index 8d33aa64846b1c..434c6878fe9640 100644
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
		}

- if (hdev->commands[38] & 0x80) {
+ if (hdev->commands[38] & 0x80 &&

+		!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
			/* Read LE Min/Max Tx Power*/
			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
				    0, NULL);
#60 lore raw

PATCH v5 1/2 Bluetooth: add quirk disabling LE Read Transmit Power

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")
---
 include/net/bluetooth/hci.h | 9 +++++++++
 net/bluetooth/hci_core.c    | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -1
index 8d33aa64846b1c..434c6878fe9640 100644
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if (hdev->commands[38] & 0x80 &&
+		!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);
#61 lore raw

PATCH v6 1/2 Bluetooth: add quirk disabling LE Read Transmit Power

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")
---
 include/net/bluetooth/hci.h | 9 +++++++++
 net/bluetooth/hci_core.c    | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -1
index 8d33aa64846b1c..434c6878fe9640 100644
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if ((hdev->commands[38] & 0x80) &&
+		!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);
#62 lore raw

PATCH v6 2/2 btbcm: disable read tx power for affected Macs with the T2 Security chip

From: Aditya Garg <[email protected]>

Some Macs with the T2 security chip had Bluetooth not working. To fix it we add DMI based quirks to disable querying of LE Tx power.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")
---
 drivers/bluetooth/btbcm.c | 40 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
drivers/bluetooth/btbcm.c +40 -0
index e4182acee488c5..40f7c9c5cf0a5a 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -343,9 +344,44 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+		},
+	},
+	{ }
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
+	const struct dmi_system_id;
 
 	/* Read Verbose Config Version Info */
 	skb = btbcm_read_verbose_config(hdev);
@@ -363,6 +399,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);
 
+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	if (dmi_first_match(disable_broken_read_transmit_power))
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	return 0;
 }
 
#63 lore raw

Re: [PATCH v6 2/2] btbcm: disable read tx power for affected Macs with the T2 Security chip

Quoted 76 lines · Aditya Garg

From: Aditya Garg <[email protected]>

Some Macs with the T2 security chip had Bluetooth not working. To fix it we add DMI based quirks to disable querying of LE Tx power.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
drivers/bluetooth/btbcm.c | 40 +++++++++++++++++++++++++++++++++++++++

1 file changed, 40 insertions(+)
drivers/bluetooth/btbcm.c +36 -0
index e4182acee488c5..40f7c9c5cf0a5a 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -343,9 +344,44 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+		},
+	},
+	{ }
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
+	const struct dmi_system_id;
 
 	/* Read Verbose Config Version Info */
 	skb = btbcm_read_verbose_config(hdev);

drivers/bluetooth/btbcm.c static int btbcm_read_info(struct hci_dev *hdev) · line 408

Quoted 10 lines
drivers/bluetooth/btbcm.c +4 -0
@@ -363,6 +399,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);
 
+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	if (dmi_first_match(disable_broken_read_transmit_power))
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	return 0;
 }
 

May I know whether this is fine or not.

Quoted 1 line
maintainer
#64 lore raw

Re: [PATCH v6 2/2] btbcm: disable read tx power for affected Macs with the T2 Security chip

Quoted 79 lines · Aditya Garg
Quoted 79 lines · Aditya Garg

From: Aditya Garg <[email protected]>

Some Macs with the T2 security chip had Bluetooth not working. To fix it we add DMI based quirks to disable querying of LE Tx power.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
drivers/bluetooth/btbcm.c | 40 +++++++++++++++++++++++++++++++++++++++

1 file changed, 40 insertions(+)
drivers/bluetooth/btbcm.c +36 -0
index e4182acee488c5..40f7c9c5cf0a5a 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -343,9 +344,44 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+		},
+	},
+	{ }
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
+	const struct dmi_system_id;
 
 	/* Read Verbose Config Version Info */
 	skb = btbcm_read_verbose_config(hdev);
@@ -363,6 +399,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);
 
Quoted 8 lines

drivers/bluetooth/btbcm.c static int btbcm_read_info(struct hci_dev *hdev) · line 408

Quoted 7 lines
drivers/bluetooth/btbcm.c +4 -0
+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	if (dmi_first_match(disable_broken_read_transmit_power))
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	return 0;
 }
 

May I know whether this is fine or not.

Please realize that maintainers have lots and lots of patches to review. If after 2 weeks of no response, it is fine to resend the patch again.

If you wish to help out with the maintainer's review load, please feel free to review patches on the relevant mailing list to help lighten that load such that your patch can be reviewed quicker.

thanks,

greg k-h

author Tested-by on v6 2/2
#65 lore raw

Re: [PATCH v6 2/2] btbcm: disable read tx power for affected Macs with the T2 Security chip

In reply to Aditya Garg
Quoted 11 lines · On Tue, 30 Nov 2021 01:00:43 +1100 "Aditya Garg" <[email protected]> wrote:

From: Aditya Garg <[email protected]>

Some Macs with the T2 security chip had Bluetooth not working. To fix it we add DMI based quirks to disable querying of LE Tx power.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---

It's hard to tell what the differences between versions of this patch are. This spot here after the "---" is often used for a change log (e.g. "v5->v6: Made change X and change Y"), so it would be useful to have that if you can add one in future patches. I think someone may have mentioned this earlier.

Quoted 52 lines
 drivers/bluetooth/btbcm.c | 40

+++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)

drivers/bluetooth/btbcm.c +29 -0
index e4182acee488c5..40f7c9c5cf0a5a 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -343,9 +344,44 @@ static struct sk_buff
 *btbcm_read_usb_product(struct hci_dev *hdev) return skb;
 }
 
+static const struct dmi_system_id
 disable_broken_read_transmit_power[] = {
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME,
 "MacBookPro16,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME,
 "MacBookPro16,2"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME,
 "MacBookPro16,4"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),

drivers/bluetooth/btbcm.c static struct sk_buff · line 384

Quoted 10 lines
drivers/bluetooth/btbcm.c +7 -0
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+		},
+	},
+	{ }
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
+	const struct dmi_system_id;

This line seems to produce a compiler warning:

drivers/bluetooth/btbcm.c: In function ‘btbcm_read_info’:
drivers/bluetooth/btbcm.c:384:22: warning: empty declaration with type qualifier does not redeclare tag

  384 |         const struct dmi_system_id;
      |                      ^~~~~~~~~~~~~

I think Marcel mentioned this line could be removed.

The two patches make Bluetooth work on my MacBookPro16,1, with and without that line.

Quoted 15 lines
drivers/bluetooth/btbcm.c +3 -0
 	/* Read Verbose Config Version Info */
 	skb = btbcm_read_verbose_config(hdev);
@@ -363,6 +399,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);
 
+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	if (dmi_first_match(disable_broken_read_transmit_power))
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,

&hdev->quirks); +
return 0;
}

Signature · 3 lines
Thanks,

Orlando
#66 lore raw

PATCH v7 1/2 Bluetooth: add quirk disabling LE Read Transmit Power

In reply to Aditya Garg

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
v7 :- Added Tested-by.

 include/net/bluetooth/hci.h | 9 +++++++++
 net/bluetooth/hci_core.c    | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -1
index 8d33aa64846b1c..434c6878fe9640 100644
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if ((hdev->commands[38] & 0x80) &&
+		!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);
#67 lore raw

PATCH v7 2/2 btbcm: disable read tx power for affected Macs with the T2 Security chip

From: Aditya Garg <[email protected]>

Some Macs with the T2 security chip had Bluetooth not working. To fix it we add DMI based quirks to disable querying of LE Tx power.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
v7 :- Removed unused variable and added Tested-by.

 drivers/bluetooth/btbcm.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
drivers/bluetooth/btbcm.c +39 -0
index e4182acee488c5..07fabaa5aa2979 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -343,6 +344,40 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+		},
+	},
+	{ }
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
@@ -363,6 +398,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);
 
+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	if (dmi_first_match(disable_broken_read_transmit_power))
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	return 0;
 }
 
maintainer
#68 lore raw

Re: [PATCH v7 1/2] Bluetooth: add quirk disabling LE Read Transmit Power

In reply to Aditya Garg
Quoted 43 lines · Aditya Garg

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
v7 :- Added Tested-by.

 include/net/bluetooth/hci.h | 9 +++++++++
 net/bluetooth/hci_core.c    | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +0 -0
index 8d33aa64846b1c..434c6878fe9640 100644

net/bluetooth/hci_core.c static int hci_init3_req(struct hci_request *req, unsigned long opt) · line 623

Quoted 6 lines
net/bluetooth/hci_core.c +2 -1
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if ((hdev->commands[38] & 0x80) &&
+		!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {

This line is still not properly formatted.

Please always use scripts/checkpatch.pl to find issues like this.

thanks,

greg k-h

#69 lore raw

Re: [PATCH v7 1/2] Bluetooth: add quirk disabling LE Read Transmit Power

Quoted 51 lines · Greg KH
Quoted 46 lines · Aditya Garg

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
v7 :- Added Tested-by.
include/net/bluetooth/hci.h | 9 +++++++++
net/bluetooth/hci_core.c | 3 ++-

2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +0 -0
index 8d33aa64846b1c..434c6878fe9640 100644
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
Quoted 5 lines

net/bluetooth/hci_core.c static int hci_init3_req(struct hci_request *req, unsigned long opt) · line 623

Quoted 3 lines
net/bluetooth/hci_core.c +2 -1
-		if (hdev->commands[38] & 0x80) {
+		if ((hdev->commands[38] & 0x80) &&
+		!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {

This line is still not properly formatted.

I hope its fine in the resent patch. I sent the patch as HTML by mistake.

Quoted 6 lines

Please always use scripts/checkpatch.pl to find issues like this.

thanks,

greg k-h

#70 lore raw

PATCH RESEND v7 1/2 Bluetooth: add quirk disabling LE Read Transmit Power

In reply to Aditya Garg

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
v7 :- Added Tested-by.

 include/net/bluetooth/hci.h | 9 +++++++++
 net/bluetooth/hci_core.c    | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -1
index 8d33aa64846b1c..434c6878fe9640 100644
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if ((hdev->commands[38] & 0x80) &&
+		!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);
#71 lore raw

PATCH RESEND v7 2/2 btbcm: disable read tx power for affected Macs with the T2 Security chip

From: Aditya Garg <[email protected]>

Some Macs with the T2 security chip had Bluetooth not working. To fix it we add DMI based quirks to disable querying of LE Tx power.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
v7 :- Removed unused variable and added Tested-by.

 drivers/bluetooth/btbcm.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
drivers/bluetooth/btbcm.c +39 -0
index e4182acee488c5..07fabaa5aa2979 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -343,6 +344,40 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+		},
+	},
+	{ }
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
@@ -363,6 +398,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);
 
+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	if (dmi_first_match(disable_broken_read_transmit_power))
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	return 0;
 }
 
maintainer
#72 lore raw

Re: [PATCH v7 resend 1/2] Bluetooth: add quirk disabling LE Read Transmit Power

In reply to Aditya Garg
Quoted 43 lines · Aditya Garg

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
v7 :- Added Tested-by.

 include/net/bluetooth/hci.h | 9 +++++++++
 net/bluetooth/hci_core.c    | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +0 -0
index 8d33aa64846b1c..434c6878fe9640 100644

net/bluetooth/hci_core.c static int hci_init3_req(struct hci_request *req, unsigned long opt) · line 623

Quoted 6 lines
net/bluetooth/hci_core.c +2 -1
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if ((hdev->commands[38] & 0x80) &&
+		!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {

I am getting tired of saying this, but PLEASE use scripts/checkpatch.pl before you send out your patches.

If you had done so, you would see the following output in it:

CHECK: Alignment should match open parenthesis
#49: FILE: net/bluetooth/hci_core.c:623:
+ if ((hdev->commands[38] & 0x80) &&
+ !test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {

Please fix.

#73 lore raw

Re: [PATCH v7 resend 1/2] Bluetooth: add quirk disabling LE Read Transmit Power

Quoted 51 lines · Greg KH
Quoted 46 lines · Aditya Garg

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
v7 :- Added Tested-by.
include/net/bluetooth/hci.h | 9 +++++++++
net/bluetooth/hci_core.c | 3 ++-

2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +0 -0
index 8d33aa64846b1c..434c6878fe9640 100644
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
Quoted 6 lines

net/bluetooth/hci_core.c static int hci_init3_req(struct hci_request *req, unsigned long opt) · line 623

Quoted 3 lines
net/bluetooth/hci_core.c +2 -1
-		if (hdev->commands[38] & 0x80) {
+		if ((hdev->commands[38] & 0x80) &&
+		!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {

I am getting tired of saying this, but PLEASE use scripts/checkpatch.pl before you send out your patches.

Sorry for offending you. The thing is that I am inexperienced in the field of submitting patches upstream. v8 shouldn't disappoint you.

Quoted 10 lines

If you had done so, you would see the following output in it:

CHECK: Alignment should match open parenthesis
#49: FILE: net/bluetooth/hci_core.c:623:

net/bluetooth/hci_core.c +2 -0
+	        if ((hdev->commands[38] & 0x80) &&
+	        !test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {

Please fix.

#74 lore raw

PATCH v8 1/2 Bluetooth: add quirk disabling LE Read Transmit Power

In reply to Aditya Garg

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
v7 :- Added Tested-by.
v8 :- Fix checkpatch error.

 include/net/bluetooth/hci.h | 9 +++++++++
 net/bluetooth/hci_core.c    | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +2 -1
index 8d33aa64846b1c..434c6878fe9640 100644
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if ((hdev->commands[38] & 0x80) &&
+		    !test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);
#75 lore raw

PATCH v8 2/2 btbcm: disable read tx power for affected Macs with the T2 Security chip

From: Aditya Garg <[email protected]>

Some Macs with the T2 security chip had Bluetooth not working. To fix it we add DMI based quirks to disable querying of LE Tx power.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
v7 :- Removed unused variable and added Tested-by. v8 :- No change.

 drivers/bluetooth/btbcm.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
drivers/bluetooth/btbcm.c +39 -0
index e4182acee488c5..07fabaa5aa2979 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -343,6 +344,40 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+		},
+	},
+	{ }
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
@@ -363,6 +398,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);
 
+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	if (dmi_first_match(disable_broken_read_transmit_power))
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	return 0;
 }
 
maintainer
#76 lore raw

Re: [PATCH v8 1/2] Bluetooth: add quirk disabling LE Read Transmit Power

In reply to Aditya Garg

Hi Aditya,

Quoted 43 lines

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
v7 :- Added Tested-by.
v8 :- Fix checkpatch error.
include/net/bluetooth/hci.h | 9 +++++++++
net/bluetooth/hci_core.c | 3 ++-

2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +0 -0
index 8d33aa64846b1c..434c6878fe9640 100644

net/bluetooth/hci_core.c static int hci_init3_req(struct hci_request *req, unsigned long opt) · line 626

Quoted 9 lines
net/bluetooth/hci_core.c +2 -1
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if ((hdev->commands[38] & 0x80) &&
+		    !test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);

while patch and indentation look good now, it doesn’t actually apply cleanly against bluetooth-next tree. So you need to re-spin it.

Regards

Marcel

#77 lore raw

PATCH v9 1/2 Bluetooth: add quirk disabling LE Read Transmit Power

In reply to Aditya Garg

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
v7 :- Added Tested-by.
v8 :- Fix checkpatch error.
v9 :- Remake patch for Bluetooth-next tree and add Cc: [email protected]

 include/net/bluetooth/hci.h | 9 +++++++++
 net/bluetooth/hci_sync.c    | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 0d2a92168..c4959cf9a 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_sync.c +2 -1
index ad86caf41..52e6b5dae 100644
@@ -3283,7 +3283,8 @@ static int hci_le_read_adv_tx_power_sync(struct hci_dev *hdev)
 /* Read LE Min/Max Tx Power*/
 static int hci_le_read_tx_power_sync(struct hci_dev *hdev)
 {
-	if (!(hdev->commands[38] & 0x80))
+	if (!(hdev->commands[38] & 0x80) ||
+	    test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks))
 		return 0;
 
 	return __hci_cmd_sync_status(hdev, HCI_OP_LE_READ_TRANSMIT_POWER,
Signature · 1 line
2.25.1
#78 lore raw

PATCH v9 2/2 btbcm: disable read tx power for affected Macs with the T2 Security chip

From: Aditya Garg <[email protected]>

Some Macs with the T2 security chip had Bluetooth not working. To fix it we add DMI based quirks to disable querying of LE Tx power.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
v7 :- Removed unused variable and added Tested-by. v8 :- No change.
v9 :- Add Cc: [email protected]

 drivers/bluetooth/btbcm.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
drivers/bluetooth/btbcm.c +39 -0
index e4182acee488c5..07fabaa5aa2979 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -343,6 +344,40 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+		},
+	},
+	{ }
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
@@ -363,6 +398,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);
 
+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	if (dmi_first_match(disable_broken_read_transmit_power))
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	return 0;
 }
 
#79 lore raw

PATCH v10 1/2 Bluetooth: add quirk disabling LE Read Transmit Power

In reply to Aditya Garg

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
v7 :- Added Tested-by.
v8 :- Fix checkpatch error.
v9 :- Remake patch for Bluetooth-next tree and add Cc: [email protected] v10 :- Fix gitlint

 include/net/bluetooth/hci.h | 9 +++++++++
 net/bluetooth/hci_sync.c    | 3 ++-
 2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 0d2a92168..c4959cf9a 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_sync.c +2 -1
index ad86caf41..52e6b5dae 100644
@@ -3283,7 +3283,8 @@ static int hci_le_read_adv_tx_power_sync(struct hci_dev *hdev)
 /* Read LE Min/Max Tx Power*/
 static int hci_le_read_tx_power_sync(struct hci_dev *hdev)
 {
-	if (!(hdev->commands[38] & 0x80))
+	if (!(hdev->commands[38] & 0x80) ||
+	    test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks))
 		return 0;
 
 	return __hci_cmd_sync_status(hdev, HCI_OP_LE_READ_TRANSMIT_POWER,
Signature · 1 line
2.25.1
#80 lore raw

PATCH v10 2/2 btbcm: disable read tx power for some Macs with the T2 Security chip

From: Aditya Garg <[email protected]>

Some Macs with the T2 security chip had Bluetooth not working. To fix it we add DMI based quirks to disable querying of LE Tx power.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

---
v7 :- Removed unused variable and added Tested-by. v8 :- No change.
v9 :- Add Cc: [email protected]
v10 :- Fix gitlint

 drivers/bluetooth/btbcm.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
drivers/bluetooth/btbcm.c +39 -0
index e4182acee488c5..07fabaa5aa2979 100644
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/firmware.h>
+#include <linux/dmi.h>
 #include <asm/unaligned.h>
 
 #include <net/bluetooth/bluetooth.h>
@@ -343,6 +344,40 @@ static struct sk_buff *btbcm_read_usb_product(struct hci_dev *hdev)
 	return skb;
 }
 
+static const struct dmi_system_id disable_broken_read_transmit_power[] = {
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,2"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro16,4"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,1"),
+		},
+	},
+	{
+		 .matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "iMac20,2"),
+		},
+	},
+	{ }
+};
+
 static int btbcm_read_info(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
@@ -363,6 +398,10 @@ static int btbcm_read_info(struct hci_dev *hdev)
 	bt_dev_info(hdev, "BCM: features 0x%2.2x", skb->data[1]);
 	kfree_skb(skb);
 
+	/* Read DMI and disable broken Read LE Min/Max Tx Power */
+	if (dmi_first_match(disable_broken_read_transmit_power))
+		set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks);
+
 	return 0;
 }
 
maintainer
#81 lore raw

Re: [PATCH v10 2/2] btbcm: disable read tx power for some Macs with the T2 Security chip

Hi Aditya,

Quoted 10 lines

Some Macs with the T2 security chip had Bluetooth not working. To fix it we add DMI based quirks to disable querying of LE Tx power.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")
Quoted 7 lines

---
v7 :- Removed unused variable and added Tested-by.
v8 :- No change.
v9 :- Add Cc: [email protected]
v10 :- Fix gitlint
drivers/bluetooth/btbcm.c | 39 +++++++++++++++++++++++++++++++++++++++

1 file changed, 39 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel

#82 lore raw

Re: [PATCH v10 2/2] btbcm: disable read tx power for some Macs with the T2 Security chip

Hi, this once again is your Linux kernel regression tracker speaking.

Quoted 9 lines · Marcel Holtmann
Quoted 9 lines

Some Macs with the T2 security chip had Bluetooth not working. To fix it we add DMI based quirks to disable querying of LE Tx power.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

If anyone wonders: this was for v5.11-rc1.

Quoted 10 lines
Quoted 8 lines

---
v7 :- Removed unused variable and added Tested-by.
v8 :- No change.
v9 :- Add Cc: [email protected]
v10 :- Fix gitlint
drivers/bluetooth/btbcm.c | 39 +++++++++++++++++++++++++++++++++++++++

1 file changed, 39 insertions(+)

patch has been applied to bluetooth-next tree.

And there are these two pages now for 19 days. What's the hold-up? Or do you consider the changes to dangerous to merge now?

Sure, it's not a recent regression, so it might not look that urgent. But it OTOH affects everyone that can't go back to v5.10 (the newest Longterm kernel without the regression) -- for example if a user needs a post-v5.10 feature or upgrades to a distro with a newer kernel.

That's why this fix (unless you considerer it to dangerous) IMHO should be merged rather sooner than later and and not wait for the merge window of v5.17. Another aspect against waiting for the next merge window: it contributes to piling up a large number of changes that need to be backported to stable and longterm kernels once v5.17-rc1 is out, resulting in stable and longterm releases with a huge pile of changes:
https://lwn.net/Articles/863505/

Ciao, Thorsten

#regzbot poke

maintainer
#83 lore raw

Re: [PATCH v10 1/2] Bluetooth: add quirk disabling LE Read Transmit Power

In reply to Aditya Garg

Hi Aditya,

Quoted 11 lines

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")
Quoted 8 lines

---
v7 :- Added Tested-by.
v8 :- Fix checkpatch error.
v9 :- Remake patch for Bluetooth-next tree and add Cc: [email protected] v10 :- Fix gitlint
include/net/bluetooth/hci.h | 9 +++++++++
net/bluetooth/hci_sync.c | 3 ++-

2 files changed, 11 insertions(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel

#84 lore raw

Re: [PATCH v3 1/2] Bluetooth: add quirk disabling LE Read Transmit Power

In reply to Aditya Garg

Hi! Great to see progress for this regression.

Quoted 8 lines · Aditya Garg

From: Aditya Garg <[email protected]>

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

---

FWIW: In case you need to send an improved patch, could you please add this after your 'Signed-off-by:' (see at (¹) below for the reasoning):

Link:
https://lore.kernel.org/r/[email protected]

Fixes 7c395ea521e6 ("Bluetooth: Query LE tx power on startup")

And if the patch is already good to go: could the subsystem maintainer please add it when applying? See (¹) for the reasoning.

Ciao, Thorsten, your Linux kernel regression tracker.

(¹) Long story: The commit message would benefit from a link to the regression report, for reasons explained in Documentation/process/submitting-patches.rst. To quote:

```
If related discussions or any other background information behind the
change can be found on the web, add 'Link:' tags pointing to it. In case
your patch fixes a bug, for example, add a tag with a URL referencing
the report in the mailing list archives or a bug tracker;
```

This concept is old, but the text was reworked recently to make this use case for the Link: tag clearer. For details see:
https://git.kernel.org/linus/1f57bd42b77c

Yes, that "Link:" is not really crucial; but it's good to have if someone needs to look into the backstory of this change sometime in the future. But I care for a different reason. I'm tracking this regression (and others) with regzbot, my Linux kernel regression tracking bot. This bot will notice if a patch with a Link: tag to a tracked regression gets posted and record that, which allowed anyone looking into the regression to quickly gasp the current status from regzbot's webui
(https://linux-regtracking.leemhuis.info/regzbot ) or its reports. The bot will also notice if a commit with a Link: tag to a regression report is applied by Linus and then automatically mark the regression as resolved then.

IOW: this tag makes my life a regression tracker a lot easier, as I otherwise have to tell regzbot manually when the fix lands. :-/

P.S.: As a Linux kernel regression tracker I'm getting a lot of reports on my table. I can only look briefly into most of them. Unfortunately therefore I sometimes will get things wrong or miss something important. I hope that's not the case here; if you think it is, don't hesitate to tell me about it in a public reply. That's in everyone's interest, as what I wrote above might be misleading to everyone reading this; any suggestion I gave they thus might sent someone reading this down the wrong rabbit hole, which none of us wants.

BTW, I have no personal interest in this issue, which is tracked using regzbot, my Linux kernel regression tracking bot
(https://linux-regtracking.leemhuis.info/regzbot/). I'm only posting this mail to get things rolling again and hence don't need to be CC on all further activities wrt to this regression.

maintainer
#85 lore raw

Re: [PATCH v3 1/2] Bluetooth: add quirk disabling LE Read Transmit Power

In reply to Aditya Garg

Hi Aditya,

Quoted 35 lines

Some devices have a bug causing them to not work if they query LE tx power on startup. Thus we add a quirk in order to not query it and default min/max tx power values to HCI_TX_POWER_INVALID.

---
include/net/bluetooth/hci.h | 9 +++++++++
net/bluetooth/hci_core.c | 3 ++-

2 files changed, 11 insertions(+), 1 deletion(-)
include/net/bluetooth/hci.h +9 -0
index 63065bc01b766c..383342efcdc464 100644
@@ -246,6 +246,15 @@ enum {
 	 * HCI after resume.
 	 */
 	HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+	/*
+	 * When this quirk is set, LE tx power is not queried on startup
+	 * and the min/max tx power values default to HCI_TX_POWER_INVALID.
+	 *
+	 * This quirk can be set before hci_register_dev is called or
+	 * during the hdev->setup vendor callback.
+	 */
+	HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER,
 };
 
 /* HCI device flags */
net/bluetooth/hci_core.c +0 -0
index 8d33aa64846b1c..434c6878fe9640 100644

net/bluetooth/hci_core.c static int hci_init3_req(struct hci_request *req, unsigned long opt) · line 623

Quoted 6 lines
net/bluetooth/hci_core.c +2 -1
@@ -619,7 +619,8 @@ static int hci_init3_req(struct hci_request *req, unsigned long opt)
 			hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
 		}
 
-		if (hdev->commands[38] & 0x80) {
+		if (hdev->commands[38] & 0x80 &&
+		!test_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks)) {
		if ((hdev->commands[38] && 0x80) &&
		    !test_bit(HCI_QUIRK_.., &hdev->quirks)) {

net/bluetooth/hci_core.c static int hci_init3_req(struct hci_request *req, unsigned long opt) · line 626

Quoted 4 lines
net/bluetooth/hci_core.c +0 -0
 			/* Read LE Min/Max Tx Power*/
 			hci_req_add(req, HCI_OP_LE_READ_TRANSMIT_POWER,
 				    0, NULL);

Regards

Marcel

#86 lore raw

Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

In reply to Luiz Augusto von Dentz
Quoted 42 lines · On Sat, 06 Nov 2021 08:47:39 +1100 "Luiz Augusto von Dentz"…

Nowadays it is possible to treat errors such like this on a per command basis (assuming it is not essential for the init sequence):

include/net/bluetooth/hci.h +1 -0
index 979da5179ff4..f244f42cc609 100644
@@ -551,6 +551,7 @@ enum {
 #define HCI_LK_AUTH_COMBINATION_P256   0x08
 
 /* ---- HCI Error Codes ---- */
+#define HCI_ERROR_UNKNOWN_CMD          0x01
 #define HCI_ERROR_UNKNOWN_CONN_ID      0x02
 #define HCI_ERROR_AUTH_FAILURE         0x05
 #define HCI_ERROR_PIN_OR_KEY_MISSING   0x06
net/bluetooth/hci_sync.c +9 -2
index bb88d31d2212..9c697e058974 100644
@@ -3325,11 +3325,18 @@ static int
 hci_le_read_adv_tx_power_sync(struct hci_dev *hdev)
 /* Read LE Min/Max Tx Power*/
 static int hci_le_read_tx_power_sync(struct hci_dev *hdev)
 {
+       int status;
+
        if (!(hdev->commands[38] & 0x80))
                return 0;
 
-       return __hci_cmd_sync_status(hdev,
 HCI_OP_LE_READ_TRANSMIT_POWER,
-                                    0, NULL, HCI_CMD_TIMEOUT);
+       status = __hci_cmd_sync_status(hdev,
 HCI_OP_LE_READ_TRANSMIT_POWER,
+                                      0, NULL, HCI_CMD_TIMEOUT);
+       /* Ignore if command is not really supported */
+       if (status == HCI_ERROR_UNKNOWN_CMD)
+               return 0;
+
+       return status;

}

Quoted 1 line

/* Read LE Accept List Size */

I've tried this patch, and status seems to be -56, not 0x01, but if I change
+ if (status == HCI_ERROR_UNKNOWN_CMD)
to
+ if (status == -56)
It ignores the error and continues.

I seem to have an unrelated problem where although I can connect to my Logitech MX Anywhere 2S mouse (I haven't tried any other devices yet), it doesn't move the cursor or register clicks. I've also noticed that bluetoothctl pair isn't asking for a "yes" when I pair a device, which it was doing on 5.15 (with the patch I sent to get bluetooth working at all). I've put dmesg and btsnoop for both 5.15 and bluetooth-next into a gist here:
https://gist.github.com/Redecorating/5620b758d8191418cf19879d09672cf4
but I think this is a separate issue.

Quoted 4 lines

Anyway, it would probably be worth pointing out to the vendor they have a broken firmware if they do mark the command as supported but return such error.

Do you know if it'd be better to contact Broadcom or Apple for this?

Quoted 2 lines

--
Luiz Augusto von Dentz