Plan 9 from Bell Labs’s /usr/web/sources/patch/applied/usbohci-page-boundary/readme

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


Two fixes:

1146,1149c1146
< 			if((td->cbp & ~0xFFF) == (td->cbp0 & ~0xFFF))
< 				bp->wp = pa2ptr(td->cbp);
< 			else
< 				bp->wp = bp->rp + 0x1000 + (td->cbp&0xFFF);
---
> 			bp->wp = bp->rp + (td->cbp - td->cbp0);

td->cbp and td->cbp0 are the real addresses corresponding
to virtual addresses bp->wp and bp->rp respectively.

The 'else' clause will make BLEN(bp) = (bp->wp - bp->rp) equal
to 0x1000 or greater, which can't be right because usb packets
are never that big!

If td->cbp and td->cbp0 are on different pages, the pages
must be adjacent (because no packet is greater than 4k),
and the corresponding virtual pages containing bp->wp and bp->rp
must also be adjacent (otherwise the mapping would be wrong).

So the replacement line works in all cases.

I've tested this and confirmed with Nemo that it's sensible.

1370a1368,1369
> 	if(ed == nil)
> 		return;

This "shouldn't happen" code prevents a panic which I've observed
but I'm too lazy to investigate.

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].