Re: [U-Boot] serial atag tag in devicetree ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Le mardi 24 mars 2015 à 09:01 +0100, Hans de Goede a écrit :
> Hi,
> 
> On 24-03-15 00:12, Rob Herring wrote:
> > On Mon, Mar 23, 2015 at 6:30 AM, Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
> >> Hi,
> >>
> >>
> >> On 22-03-15 22:01, Rob Herring wrote:
> 
> <snip>
> 
> >>> There is already "serial-number" (a string) which exists for
> >>> OpenFirmware. Also, "copyright" corresponds to vendor/manufacturer
> >>> string. Both of these are supported by lshw already.
> >>
> >>
> >> Ok, so if I understand you correctly then you're saying that we
> >> should set a "serial-number" string property at the dt root level
> >> and that this may contain pretty much anything, e.g. in the
> >> sunxi case the full 128 bit SID in hex.
> >
> > Right.
> >
> >> Is the use of the "serial-number" string property already documented
> >> somewhere? If not I'll submit a kernel patch to document it.
> >
> > Not that I'm aware of. It is something that predates our documentation
> > requirements. It could be in OpenFirmware specs. Documenting it in the
> > DT bindings does not hurt.
> 
> Ok.
> 
> >> And for older kernels we should not set any serial atag (u-boot
> >> always sets it, so this leaves it at 0) and old kernel users are
> >> out of luck wrt getting to the serial ?
> >
> > If there is sufficient reason to support this on old kernels you could.
> 
> One problem with supporting this for older kernels is that if a non 0
> serial gets shown in /proc/cpuinfo with older atag booted kernels, we
> should really show the same number in /proc/cpuinfo which means adding
> code to the kernel to get the devicetree "serial-number" string property
> and somehow put that into the 64 bits which we have in /proc/cpuinfo,
> but given that the "serial-number" string could be hex or decimal or
> what ever and > 64 bits that will likely require a platform specific
> solution. All doable, but the question then becomes is this worth the
> effort ?

After investigating a bit more, I found out that the USB serial number
is expected to be a string of 32 bytes, so a 128 bit numeric serial
doesn't fit (it takes 32 bytes for the hex representation of 128 bits,
so there is no room left for the terminating null byte), hence it makes
sense to keep a 64 bit limitation for the serial number, if users are
going to rely on it as USB serial string. Moreover, it seems that
Android devices are mostly used 64 bit numbers for serial numbers/

I was initially going to suggest that we set it in stone that serial
must be 64 numeric bits (as it was in the ATAGs days) and that
bootloaders would pass it that way to the kernel through device tree
(with two 32 bits numeric integers), but Hans talked me out of it.
I just want to expose the situation (especially the USB and Android
thing) here to double-check that everyone still is convinced that a
string approach in device tree is best (which is fine with me).

This way, users that still want to use the serial passed through device
tree as a USB serial number will have to use a string of 32 bits,
including the null terminating byte (which is what I'll suggest for
sunxi by using only 64 bits for the serial number).

Also, I suggest that we show that serial-number string as-is in cpuinfo
as well and instead make a string out of the serial ATAG in the kernel
prior to showing it in cpuinfo (as opposed to translating the string
coming from device tree to a numeric value that cpuinfo will end up
showing as a string at the end of the day). Thus, the serial number
coming from device tree will still be shown in cpuinfo as well and no
ABI gets broken.

If you're all okay with this, I'll be sending patches to both U-Boot and
Linux to start documenting/implementing this.

-- 
Paul Kocialkowski, Replicant developer

Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.

Website: http://www.replicant.us/
Blog: http://blog.replicant.us/
Wiki/tracker/forums: http://redmine.replicant.us/

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux