0018-grub-core-bus-usb-usbhub-Add-new-private-fields-for-.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. From 1ab23afbfa7ae436741947c0b9bdacc434ad6153 Mon Sep 17 00:00:00 2001
  2. From: Patrick Rudolph <patrick.rudolph@9elements.com>
  3. Date: Sun, 15 Nov 2020 19:54:40 +0100
  4. Subject: [PATCH 18/22] grub-core/bus/usb/usbhub: Add new private fields for
  5. xHCI controller
  6. Store the root port number, the route, consisting out of the port ID
  7. in each nibble, and a pointer to driver private data.
  8. Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
  9. ---
  10. grub-core/bus/usb/usbhub.c | 11 ++++++++---
  11. include/grub/usb.h | 5 +++++
  12. 2 files changed, 13 insertions(+), 3 deletions(-)
  13. diff --git a/grub-core/bus/usb/usbhub.c b/grub-core/bus/usb/usbhub.c
  14. index 8e963e84b..b4b3a1a61 100644
  15. --- a/grub-core/bus/usb/usbhub.c
  16. +++ b/grub-core/bus/usb/usbhub.c
  17. @@ -49,7 +49,9 @@ static grub_usb_controller_dev_t grub_usb_list;
  18. static grub_usb_device_t
  19. grub_usb_hub_add_dev (grub_usb_controller_t controller,
  20. grub_usb_speed_t speed,
  21. - int split_hubport, int split_hubaddr)
  22. + int split_hubport, int split_hubaddr,
  23. + int root_portno,
  24. + grub_uint32_t route)
  25. {
  26. grub_usb_device_t dev;
  27. int i;
  28. @@ -65,6 +67,8 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller,
  29. dev->speed = speed;
  30. dev->split_hubport = split_hubport;
  31. dev->split_hubaddr = split_hubaddr;
  32. + dev->root_port = root_portno;
  33. + dev->route = route;
  34. if (controller->dev->attach_dev) {
  35. err = controller->dev->attach_dev (controller, dev);
  36. @@ -245,7 +249,7 @@ attach_root_port (struct grub_usb_hub *hub, int portno,
  37. and full/low speed device connected to OHCI/UHCI needs not
  38. transaction translation - e.g. hubport and hubaddr should be
  39. always none (zero) for any device connected to any root hub. */
  40. - dev = grub_usb_hub_add_dev (hub->controller, speed, 0, 0);
  41. + dev = grub_usb_hub_add_dev (hub->controller, speed, 0, 0, portno, 0);
  42. hub->controller->dev->pending_reset = 0;
  43. npending--;
  44. if (! dev)
  45. @@ -676,7 +680,8 @@ poll_nonroot_hub (grub_usb_device_t dev)
  46. /* Add the device and assign a device address to it. */
  47. next_dev = grub_usb_hub_add_dev (&dev->controller, speed,
  48. - split_hubport, split_hubaddr);
  49. + split_hubport, split_hubaddr, dev->root_port,
  50. + dev->route << 4 | (i & 0xf));
  51. if (dev->controller.dev->pending_reset)
  52. {
  53. dev->controller.dev->pending_reset = 0;
  54. diff --git a/include/grub/usb.h b/include/grub/usb.h
  55. index 4dd179db2..609faf7d0 100644
  56. --- a/include/grub/usb.h
  57. +++ b/include/grub/usb.h
  58. @@ -237,6 +237,11 @@ struct grub_usb_device
  59. int split_hubport;
  60. int split_hubaddr;
  61. +
  62. + /* xHCI specific information */
  63. + int root_port;
  64. + grub_uint32_t route;
  65. + void *xhci_priv;
  66. };
  67. --
  68. 2.39.2