Page MenuHomeFreeBSD

ACPI support for USB , mainly hub.
ClosedPublic

Authored by takawata on Jun 13 2019, 3:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Feb 29, 2:40 AM
Unknown Object (File)
Feb 18 2024, 3:00 AM
Unknown Object (File)
Feb 11 2024, 8:26 AM
Unknown Object (File)
Dec 27 2023, 3:01 AM
Unknown Object (File)
Dec 23 2023, 6:21 PM
Unknown Object (File)
Dec 22 2023, 9:43 PM
Unknown Object (File)
Dec 12 2023, 1:09 AM
Unknown Object (File)
Nov 25 2023, 4:23 PM
Subscribers
None

Details

Summary

ACPI supports USB related features.
This patch will do

  1. detects USB root hub if host controller has ACPI handle.
  2. Enumulate ACPI handles of USB ports and attach to device driver structure.
  3. Evaluate _UPC and _PLD objects under the ACPI objects of USB ports and parse them.

I think this patch is premature for merge, but I want to hear your opinion.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 24871
Build 23612: arc lint + arc unit

Event Timeline

I've not looked deeply into this, but it seems to my limited understanding in the right direction, though I'll defer to hps@ should his opinion differ.
Just noted a couple of nits, plus there's some minor style issues with some of the code that we can get into once other comments are made to the source.

sys/dev/usb/usb_hub_acpi.c
9

The project template now omits "all rights reserved," and it's preferred that new code not have that unless the author really wants it. It is your choice, though.

#!/bin/sh

#
# This script should be run on every USB C- and H- file before
# commit to enforce correct style.
#

[ -z "$1" ] && (echo "Please specify a filename.") && exit

#
# The "-ta" option is an extension to indent.
# Contact hselasky@freebsd.org to receive a
# patch that adds support for this option to
# indent !
#

#
# sed -E 's/&\(([^, \)]*)\)/\&\1/' |
#

for F in $*
do

echo "Now styling $F"

(cat $F | indent -Toss_mixerinfo -TFILE -Tu_char -Tu_int -Tu_long \
 -TTAILQ_HEAD -TLIST_HEAD -TTAILQ_ENTRY -TLIST_ENTRY \
 -TSTAILQ_HEAD -TSTAILQ_ENTRY \
 -Tu_short -Tfd_set -ta -st -bad -bap -nbbb -nbc -br -nbs \
 -c41 -cd41 -cdb -ce -ci4 -cli0 -d0 -di8 -ndj -ei -nfc1 \
 -nfcb -i8 -ip8 -l79 -lc77 -ldi0 -nlp -npcs -psl -sc \
 -nsob -nv | 
 sed -e "s/_HEAD [(]/_HEAD(/g" |
 sed -e "s/_ENTRY [(]/_ENTRY(/g" |
 sed -e "s/     __packed/ __packed/g" | 
 sed -e "s/     __aligned/ __aligned/g" |
 sed -e "s/^#define /#define    /g") > temp

(diff temp $F > /dev/null) || (cp temp $F)

done

Can you pass the new files through the style script above?

sys/dev/usb/usb_hub_acpi.c
111

remove this commented line

125

/* Found */

154

Spelling error Propritary

sys/dev/usb/usb_hub_acpi.c
80

Remove one empty line.

85

Insert an empty line before static UINT32 ...

105

uint8_t nports;

132

Add empty line before static int

146

Indent this line properly.

205

Wrap long line.

253

Can you move the curly bracket at the end of the line to the next line.

262

Address is 64-bit? Use cast when comparing.

devinfo->Address <= (uint64_t)sc->nports)

263

Looks off-by-one:
sc->porthandle[devinfo->Address - 1] = ah;

294

/* success prior than non - acpi hub */

319

Use device_printf() ??

348

This print does not look needed.

415

Remove this empty line.

426

Remove this empty line.

447

Remove one empty line here.

sys/dev/usb/usb_hub_private.h
38

Insert empty line before UHUB_INTR_INTERVAL.

Also use TAB after #define, before UHUB_INTR_INTERVAL.

sys/modules/usb/usb/Makefile
42

Will this build for all platforms? ARM, RISC, MIPS, SPARC ...

Resolve comments.
Fix off-by-one error in acpi_usb_hub_port_probe_cb
Hide verbose outputs under debug flag.

sys/dev/usb/usb_hub_acpi.c
311

Use /**/ comments.

Fix the last few comments I've added and this is ready to go.

This revision is now accepted and ready to land.Jun 17 2019, 6:58 PM
This revision was automatically updated to reflect the committed changes.