Re: [RFC PATCH 2/4] firmware: dmi: Add function to look up a handle and return DIMM size

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

 



On Mon, Dec 04, 2017 at 10:38:14PM +0100, Borislav Petkov wrote:
> On Thu, Nov 30, 2017 at 12:40:40PM -0800, Tony Luck wrote:
> >  	dmi_memdev[nr].bank = dmi_string(dm, d[0x11]);
> 
> <---- newline here.
> 
> > +	size = get_unaligned((u16 *)&d[0xC]);
> > +	if (size == 0)
> > +		bytes = 0;
> > +	else if (size == 0xffff)
> > +		bytes = ~0ul;
> > +	else if (size & 0x8000)
> > +		bytes = (u64)(size & 0x7fff) << 10;
> > +	else if (size != 0x7fff)
> > +		bytes = (u64)size << 20;
> > +	else
> > +		bytes = (u64)get_unaligned((u32 *)&d[0x1C]) << 20;
> 
> <---- newline here.

Ok ... it does read better with those breaks. Will add.

> So dmi_memdev_name() also loops over dmi_memdev and returns bank and
> device. This new function returns size.
> 
> If code is going to be calling those one after the other, you could do a
> 
> 	dmi_memdev_desc(u16 handle, struct memdev_desc *desc)

Current callers are from different code paths (dmi_memdev_name() from
ghes and EFI, dmi_memdev_size() just from the Skylake EDAC driver).
If we later find a place that calls both this would be a good cleanup.

> which fills up a descriptor with all fields a caller would need in one
> go so that you don't have to iterate multiple times. Looking at struct
> dmi_memdev_info, there are no more fields so maybe this is probably
> silly though or you can simply return struct dmi_memdev_info directly...
> 
> Meh.

I take it that you talked yourself out of asking for the cleanup now?

-Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux