Page MenuHomeFreeBSD

Expose USB port physical information in ACPI by sysctl.
ClosedPublic

Authored by takawata on Jul 6 2019, 3:07 PM.

Details

Summary

This expose USB port physical information (_UPC, _PLD) by sysctl.
This adds per port sysctl node tree with 3 children: upc, pldraw, info
upc is integer value that expose _UPC.
pldraw is buffer that raw PLD value.
info is interpreted version of above two.
example output follows.

sysctl -x dev.uhub.0.port1

dev.uhub.0.port1.info: Handle \_SB_.PCI0.XHC_.RHUB.HS01

Connectable TypeA port                                                  
Width 0 mm Height 0 mm                                                  
Visible                                                                 
PanelPosition: Right                                                    
VertPosition: Center                                                    
HorizPosition: Lower                                                    
Shape: HRect                                                            
Group Orientation Horizontal                                            
GroupToken 0                                                            
GroupPosition 1                                                         
 Eject OSPM

dev.uhub.0.port1.pldraw: Format:A Length:16 Dump:0x81000000000000005912800003000
000
dev.uhub.0.port1.upc: 0x80000000

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

takawata created this revision.Jul 6 2019, 3:07 PM
hselasky accepted this revision.Jul 6 2019, 6:39 PM

Looks good. Some minor nits. Please fix before commit.

sys/dev/usb/usb_hub_acpi.c
238 ↗(On Diff #59468)

Please indent this line properly.

243 ↗(On Diff #59468)

same here.

423 ↗(On Diff #59468)

spelling: Skipping

431 ↗(On Diff #59468)

{ -> should go to next line

This revision is now accepted and ready to land.Jul 6 2019, 6:39 PM

Please re-base this patch on top of the latest 13-current.

Thank you!

--HPS

takawata updated this revision to Diff 59573.Jul 9 2019, 3:47 PM

Merge the head version.

This revision now requires review to proceed.Jul 9 2019, 3:47 PM
hselasky added inline comments.Jul 9 2019, 4:40 PM
sys/dev/usb/usb_hub_acpi.c
453 ↗(On Diff #59573)

This function is not allowed to fail! Once uhub_attach() returns success, the wrapper attach needs to return success aswell, else we start leaking uhub_softc's because nobody is calling uhub_detach() !

Was patch updated?

takawata updated this revision to Diff 60321.Jul 31 2019, 2:44 PM

Run detach routine on fail.

hselasky added inline comments.Jul 31 2019, 2:53 PM
sys/dev/usb/usb_hub_acpi.c
500 ↗(On Diff #60321)

style: return (ret);

522 ↗(On Diff #60321)

style: return (ret);

takawata updated this revision to Diff 60381.Aug 2 2019, 7:33 AM

fix style .

hselasky accepted this revision.Aug 2 2019, 7:43 AM
This revision is now accepted and ready to land.Aug 2 2019, 7:43 AM