Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#1827 closed enhancement (invalid)

Write a USB -> BIOS handover kernel debugger enter/exit add-on

Reported by: stippi Owned by: mmlr
Priority: high Milestone: R1/alpha1
Component: System/Kernel Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

A lot of people will probably run Haiku with USB keyboards. Those people can't do much in the kernel debugger. Michael mentioned being able to return USB legacy support back on. IIRC the infrastructure for this is now in place.

Change History (2)

comment:1 by mmlr, 16 years ago

Resolution: invalid
Status: newclosed

I'm sorry to report that it is highly unlikely that I will be able to implement this. I did a few attempts and thought through a few possible ways to go about this, but the problems are many fold and not really solvable.

First of all, while EHCI provides theoretical means (by the spec) to hand over the controller back to BIOS/firmware, there is no such provision in UHCI where the keyboards will usually be attached to. Also even the EHCI possibility seems not really supported anywhere and all the code in other OSes I checked do not handle this case at all or the corresponding code is simply disabled. It seems to me that there is no actual BIOS/firmware implementation that would reinitialize the legacy support by other means than rebooting. I have tried to simply reenable the legacy support bits for UHCI, but that cannot realistically work, as the BIOS couldn't really do anything as the schedules, controller setup and even device state is completely different from what the BIOS initializes it to when booting.

Then there is the more general problem of how to handle enter/leave conditions. Even if it was possible to hand over the controller back to the BIOS it would require the BIOS to reset the controller, do a redetection of the devices and then reenable legacy emulation through the PS/2 ports. That's a pretty big thing to handle which is unlikely to be present in most BIOSes and judging from how badly implemented legacy support itself in general is, I wouldn't put any hopes in such a process even if it existed.

Leaving KDL again after such a thing would also be pretty straight impossible. The controller would suddenly be in a completely different state than what the driver expects. It would require detecting this and doing clean resets. Again from judging how badly legacy handoff is generally implemented this would probably turn out to be very fragile if possible at all.

The more probable thing to happen would be if we wrote a KDL USB stack with modified controller drivers that work purely in polling mode. This is a huge task however, as you would essentially have to write a complete USB stack, host controller drivers and a hid driver inside the kernel debugger (not even thinking about the dependency on PCI and how to enumerate and reset the controllers). You would even need to partially support the unused EHCI as you have to kick it off so the companion host controllers get the lowspeed devices at all.

I don't really see myself doing this as the required effort would be huge for a relatively small gain. The better alternative in those cases would be to simply disable USB completely by removing the host controller drivers and then just use legacy emulation all the time, including KDL. So I will close this enhancement now as it is a bit unrealistic having thought it through. Have to close this as invalid however as there is no "wontfix".

comment:2 by axeld, 16 years ago

Bummer, but very reasonable.

Note: See TracTickets for help on using tickets.