Skip to content

Commit b607bd8

Browse files
committed
Revert port_resume_mask re-enumeration and restore original wake command
- Revert BCE_MB_RESTORE_STATE_AND_WAKE from 0x1b back to 0x18 - Remove PORT_CONNECT/RESUME/SUSPEND event handling (back to log-only) - Remove port_resume_mask and hub_status_data changes
1 parent ab1e51e commit b607bd8

4 files changed

Lines changed: 4 additions & 57 deletions

File tree

mailbox.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ enum bce_message_type {
2121
BCE_MB_SLEEP_NO_STATE = 0x14, // to-device
2222
BCE_MB_RESTORE_NO_STATE = 0x15, // to-device
2323
BCE_MB_SAVE_STATE_AND_SLEEP = 0x17, // to-device
24-
BCE_MB_RESTORE_STATE_AND_WAKE = 0x1b, // to-device (macOS: 0x6c00000000000000)
24+
BCE_MB_RESTORE_STATE_AND_WAKE = 0x18, // to-device
2525
BCE_MB_SAVE_STATE_AND_SLEEP_FAILURE = 0x19, // from-device
2626
BCE_MB_SAVE_RESTORE_STATE_COMPLETE = 0x1A, // from-device
2727
};

vhci/command.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ enum bce_vhci_command {
2727
BCE_VHCI_CMD_PORT_RESET = 0x14,
2828
BCE_VHCI_CMD_PORT_DISABLE = 0x15,
2929
BCE_VHCI_CMD_PORT_STATUS = 0x16,
30-
BCE_VHCI_CMD_PORT_CONNECT = 0x18, /* Undocumented - port connection notification from T2 */
3130

3231
BCE_VHCI_CMD_DEVICE_CREATE = 0x30,
3332
BCE_VHCI_CMD_DEVICE_DESTROY = 0x31,

vhci/vhci.c

Lines changed: 3 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,7 @@ void bce_vhci_stop(struct usb_hcd *hcd)
112112

113113
static int bce_vhci_hub_status_data(struct usb_hcd *hcd, char *buf)
114114
{
115-
struct bce_vhci *vhci = bce_vhci_from_hcd(hcd);
116-
unsigned long mask = READ_ONCE(vhci->port_resume_mask);
117-
int i, ret_len;
118-
119-
if (!mask)
120-
return 0;
121-
122-
ret_len = (vhci->port_count + 8) / 8;
123-
memset(buf, 0, ret_len);
124-
for (i = 1; i <= vhci->port_count; i++) {
125-
if (test_bit(i, &vhci->port_resume_mask))
126-
buf[i / 8] |= BIT(i % 8);
127-
}
128-
return ret_len;
115+
return 0;
129116
}
130117

131118
static int bce_vhci_reset_device(struct bce_vhci *vhci, int index, u16 timeout);
@@ -182,8 +169,6 @@ static int bce_vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u1
182169

183170
if (port_status & 0x40000)
184171
ps->wPortChange |= USB_PORT_STAT_C_CONNECTION;
185-
if (test_bit(wIndex, &vhci->port_resume_mask))
186-
ps->wPortChange |= USB_PORT_STAT_C_CONNECTION;
187172

188173
pr_debug("bce-vhci: Translated status %x to %x:%x\n", port_status, ps->wPortStatus, ps->wPortChange);
189174
return 0;
@@ -212,10 +197,8 @@ static int bce_vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u1
212197
vhci->port_power_mask &= ~BIT(wIndex);
213198
return status;
214199
}
215-
if (wValue == USB_PORT_FEAT_C_CONNECTION) {
216-
clear_bit(wIndex, &vhci->port_resume_mask);
200+
if (wValue == USB_PORT_FEAT_C_CONNECTION)
217201
return bce_vhci_cmd_port_status(&vhci->cq, (u8) wIndex, 0x40000, &port_status);
218-
}
219202
if (wValue == USB_PORT_FEAT_C_RESET) { /* I don't think I can transfer it in any way */
220203
return 0;
221204
}
@@ -384,7 +367,6 @@ static int bce_vhci_bus_suspend(struct usb_hcd *hcd)
384367
pr_info("bce_vhci: suspend started\n");
385368

386369
bce_vhci_debug_port_status(vhci, "pre-suspend");
387-
WRITE_ONCE(vhci->port_resume_mask, 0);
388370

389371
for (i = 0; i < 16; i++) {
390372
if (!vhci->port_to_device[i])
@@ -735,44 +717,11 @@ static void bce_vhci_firmware_event_completion(struct bce_queue_sq *sq)
735717

736718
static void bce_vhci_handle_system_event(struct bce_vhci_event_queue *q, struct bce_vhci_message *msg)
737719
{
738-
struct usb_hcd *hcd = q->vhci->hcd;
739-
u8 port;
740-
741720
if (msg->cmd & 0x8000) {
742721
bce_vhci_command_queue_deliver_completion(&q->vhci->cq, msg);
743-
return;
744-
}
745-
746-
switch (msg->cmd) {
747-
case BCE_VHCI_CMD_PORT_CONNECT:
748-
/*
749-
* T2 notifies us that a port connection state changed.
750-
* This happens during boot and resume. Mark the port as changed
751-
* so hub_status_data reports it, then notify USB core to poll.
752-
*/
753-
port = (u8)(msg->param1 & 0xff);
754-
pr_info("bce-vhci: port %d connect notification (status=0x%llx)\n", port, msg->param2);
755-
set_bit(port, &q->vhci->port_resume_mask);
756-
if (hcd)
757-
usb_hcd_poll_rh_status(hcd);
758-
break;
759-
760-
case BCE_VHCI_CMD_PORT_RESUME:
761-
port = (u8)(msg->param1 & 0xff);
762-
pr_info("bce-vhci: T2 initiated port %d resume (status=0x%llx)\n", port, msg->param2);
763-
if (hcd)
764-
usb_hcd_poll_rh_status(hcd);
765-
break;
766-
767-
case BCE_VHCI_CMD_PORT_SUSPEND:
768-
port = (u8)(msg->param1 & 0xff);
769-
pr_info("bce-vhci: T2 initiated port %d suspend (status=0x%llx)\n", port, msg->param2);
770-
break;
771-
772-
default:
722+
} else {
773723
pr_warn("bce-vhci: Unhandled system event: %x s=%x p1=%x p2=%llx\n",
774724
msg->cmd, msg->status, msg->param1, msg->param2);
775-
break;
776725
}
777726
}
778727

vhci/vhci.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ struct bce_vhci {
3737
struct bce_vhci_device *devices[16];
3838
struct workqueue_struct *tq_state_wq;
3939
struct work_struct w_fw_events;
40-
unsigned long port_resume_mask; /* Ports needing re-enumeration after resume (accessed atomically) */
4140
};
4241

4342
int __init bce_vhci_module_init(void);

0 commit comments

Comments
 (0)