From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Greg KH <greg@kroah.com>
Cc: Gil Fine <gil.fine@intel.com>,
andreas.noever@gmail.com, michael.jamet@intel.com,
YehezkelShB@gmail.com, linux-usb@vger.kernel.org,
lukas@wunner.de
Subject: Re: [PATCH] thunderbolt: Fix DROM handling for USB4 DROM
Date: Mon, 14 Jun 2021 17:59:35 +0300 [thread overview]
Message-ID: <YMdu1/1sRCItaKrj@lahna> (raw)
In-Reply-To: <YMdiZnPKqjyK6FQ5@kroah.com>
Hi Greg,
On Mon, Jun 14, 2021 at 04:06:30PM +0200, Greg KH wrote:
> On Mon, Jun 14, 2021 at 04:52:10PM +0300, Gil Fine wrote:
> > DROM for USB4 host/device has a shorter header than Thunderbolt DROM
> > header. This patch addresses host/device with USB4 DROM (According to spec:
> > Universal Serial Bus 4 (USB4) Device ROM Specification, Rev 1.0, Feb-2021).
> >
> > Signed-off-by: Gil Fine <gil.fine@intel.com>
> > ---
> > drivers/thunderbolt/eeprom.c | 19 +++++++++++--------
> > 1 file changed, 11 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/thunderbolt/eeprom.c b/drivers/thunderbolt/eeprom.c
> > index 46d0906a3070..f9d26bd4f486 100644
> > --- a/drivers/thunderbolt/eeprom.c
> > +++ b/drivers/thunderbolt/eeprom.c
> > @@ -214,7 +214,10 @@ static u32 tb_crc32(void *data, size_t len)
> > return ~__crc32c_le(~0, data, len);
> > }
> >
> > -#define TB_DROM_DATA_START 13
> > +#define TB_DROM_DATA_START 13
> > +#define TB_DROM_HEADER_LENGTH 22
> > +/* BYTES 16-21 - nonexistent in USB4 DROM */
> > +#define TB_DROM_USB4_HEADER_LENGTH 16
> > struct tb_drom_header {
> > /* BYTE 0 */
> > u8 uid_crc8; /* checksum for uid */
> > @@ -224,9 +227,9 @@ struct tb_drom_header {
> > u32 data_crc32; /* checksum for data_len bytes starting at byte 13 */
> > /* BYTE 13 */
> > u8 device_rom_revision; /* should be <= 1 */
> > - u16 data_len:10;
> > - u8 __unknown1:6;
> > - /* BYTES 16-21 */
> > + u16 data_len:12;
> > + u8 reserved:4;
> > + /* BYTES 16-21 - Only for TBT DROM, nonexistent in USB4 DROM */
>
> What is the odds the above does not work properly for big endian
> systems?
If you mean the bitfields, we have been trying to get rid of them. Any
new code is expected not to introduce new structures like this but it
has been OK for existing structures (for now).
> And why put the comment after the area and not before?
The gap is there after the "reserved" field.
Thanks!
next prev parent reply other threads:[~2021-06-14 14:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-14 13:52 [PATCH] thunderbolt: Fix DROM handling for USB4 DROM Gil Fine
2021-06-14 14:06 ` Greg KH
2021-06-14 14:59 ` Mika Westerberg [this message]
2021-06-14 15:21 ` Greg KH
2021-06-14 16:07 ` Mika Westerberg
2021-06-15 10:54 ` Mika Westerberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YMdu1/1sRCItaKrj@lahna \
--to=mika.westerberg@linux.intel.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=gil.fine@intel.com \
--cc=greg@kroah.com \
--cc=linux-usb@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=michael.jamet@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox