diff mbox

sparc: Set HostID in NVRAM

Message ID 52C0B576.6060102@caramail.com
State New
Headers show

Commit Message

Olivier DANET Dec. 29, 2013, 11:51 p.m. UTC
On SparcStations, the HostID field in the NVRAM is equal to the
last three bytes of the MAC address (which is also stored in the NVRAM).

This constant is used as an identification/serial number on Solaris.

signed-off-by : Olivier Danet <odanet@caramail.com>
---
  include/hw/nvram/openbios_firmware_abi.h | 2 ++
  1 file changed, 2 insertions(+)

      tmpptr = (uint8_t *)header;

Comments

Artyom Tarasenko Dec. 30, 2013, 2:02 p.m. UTC | #1
On Mon, Dec 30, 2013 at 12:51 AM, Olivier Danet <odanet@caramail.com> wrote:
> On SparcStations, the HostID field in the NVRAM is equal to the
> last three bytes of the MAC address (which is also stored in the NVRAM).
>
> This constant is used as an identification/serial number on Solaris.
>
> signed-off-by : Olivier Danet <odanet@caramail.com>

Corresponds with http://www.squirrel.com/squirrel/sun-nvram-hostid.faq
and Solaris 9 detects the hostid after this patch fine, so

Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>

> ---
>  include/hw/nvram/openbios_firmware_abi.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/include/hw/nvram/openbios_firmware_abi.h
> b/include/hw/nvram/openbios_firmware_abi.h
> index 5e6e5d4..492c8d5 100644
> --- a/include/hw/nvram/openbios_firmware_abi.h
> +++ b/include/hw/nvram/openbios_firmware_abi.h
> @@ -62,6 +62,8 @@ Sun_init_header(struct Sun_nvram *header, const uint8_t
> *macaddr, int machine_id
>      header->type = 1;
>      header->machine_id = machine_id & 0xff;
>      memcpy(&header->macaddr, macaddr, 6);
> +    memcpy(&header->hostid , &macaddr[3],3);
> +
>      /* Calculate checksum */
>      tmp = 0;
>      tmpptr = (uint8_t *)header;
> --
> 1.8.1.5
Olivier DANET Feb. 16, 2014, 11:13 p.m. UTC | #2
Ping.
Repost !

On 30/12/2013 15:02, Artyom Tarasenko wrote:
> On Mon, Dec 30, 2013 at 12:51 AM, Olivier Danet <odanet@caramail.com> wrote:
>> On SparcStations, the HostID field in the NVRAM is equal to the
>> last three bytes of the MAC address (which is also stored in the NVRAM).
>>
>> This constant is used as an identification/serial number on Solaris.
>>
>> signed-off-by : Olivier Danet <odanet@caramail.com>
> Corresponds with http://www.squirrel.com/squirrel/sun-nvram-hostid.faq
> and Solaris 9 detects the hostid after this patch fine, so
>
> Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>
>
>> ---
>>   include/hw/nvram/openbios_firmware_abi.h | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/include/hw/nvram/openbios_firmware_abi.h
>> b/include/hw/nvram/openbios_firmware_abi.h
>> index 5e6e5d4..492c8d5 100644
>> --- a/include/hw/nvram/openbios_firmware_abi.h
>> +++ b/include/hw/nvram/openbios_firmware_abi.h
>> @@ -62,6 +62,8 @@ Sun_init_header(struct Sun_nvram *header, const uint8_t
>> *macaddr, int machine_id
>>       header->type = 1;
>>       header->machine_id = machine_id & 0xff;
>>       memcpy(&header->macaddr, macaddr, 6);
>> +    memcpy(&header->hostid , &macaddr[3],3);
>> +
>>       /* Calculate checksum */
>>       tmp = 0;
>>       tmpptr = (uint8_t *)header;
>> --
>> 1.8.1.5
>
>
Mark Cave-Ayland Feb. 20, 2014, 8:46 a.m. UTC | #3
On 29/12/13 23:51, Olivier Danet wrote:

> On SparcStations, the HostID field in the NVRAM is equal to the
> last three bytes of the MAC address (which is also stored in the NVRAM).
>
> This constant is used as an identification/serial number on Solaris.
>
> signed-off-by : Olivier Danet <odanet@caramail.com>
> ---
> include/hw/nvram/openbios_firmware_abi.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/hw/nvram/openbios_firmware_abi.h
> b/include/hw/nvram/openbios_firmware_abi.h
> index 5e6e5d4..492c8d5 100644
> --- a/include/hw/nvram/openbios_firmware_abi.h
> +++ b/include/hw/nvram/openbios_firmware_abi.h
> @@ -62,6 +62,8 @@ Sun_init_header(struct Sun_nvram *header, const
> uint8_t *macaddr, int machine_id
> header->type = 1;
> header->machine_id = machine_id & 0xff;
> memcpy(&header->macaddr, macaddr, 6);
> + memcpy(&header->hostid , &macaddr[3],3);

I think there is some whitespace damage on this patch? At least I 
couldn't apply it as is :/  Also the lack of a space after the final 
comma on the line above looks suspicious too... have you tried running 
scripts/checkpatch.pl on the resulting diffs?

> +
> /* Calculate checksum */
> tmp = 0;
> tmpptr = (uint8_t *)header;

Apart from the whitespace issues, the basic patch looks fine though.


ATB,

Mark.
Mark Cave-Ayland Feb. 23, 2014, 5:32 p.m. UTC | #4
On 16/02/14 23:13, Olivier Danet wrote:

> Ping.
> Repost !
>
> On 30/12/2013 15:02, Artyom Tarasenko wrote:
>> On Mon, Dec 30, 2013 at 12:51 AM, Olivier Danet <odanet@caramail.com>
>> wrote:
>>> On SparcStations, the HostID field in the NVRAM is equal to the
>>> last three bytes of the MAC address (which is also stored in the NVRAM).
>>>
>>> This constant is used as an identification/serial number on Solaris.
>>>
>>> signed-off-by : Olivier Danet <odanet@caramail.com>
>> Corresponds with http://www.squirrel.com/squirrel/sun-nvram-hostid.faq
>> and Solaris 9 detects the hostid after this patch fine, so
>>
>> Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com>
>>
>>> ---
>>> include/hw/nvram/openbios_firmware_abi.h | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/include/hw/nvram/openbios_firmware_abi.h
>>> b/include/hw/nvram/openbios_firmware_abi.h
>>> index 5e6e5d4..492c8d5 100644
>>> --- a/include/hw/nvram/openbios_firmware_abi.h
>>> +++ b/include/hw/nvram/openbios_firmware_abi.h
>>> @@ -62,6 +62,8 @@ Sun_init_header(struct Sun_nvram *header, const
>>> uint8_t
>>> *macaddr, int machine_id
>>> header->type = 1;
>>> header->machine_id = machine_id & 0xff;
>>> memcpy(&header->macaddr, macaddr, 6);
>>> + memcpy(&header->hostid , &macaddr[3],3);
>>> +
>>> /* Calculate checksum */
>>> tmp = 0;
>>> tmpptr = (uint8_t *)header;
>>> --

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

I've applied this to my qemu-sparc branch.


ATB,

Mark.
diff mbox

Patch

diff --git a/include/hw/nvram/openbios_firmware_abi.h 
b/include/hw/nvram/openbios_firmware_abi.h
index 5e6e5d4..492c8d5 100644
--- a/include/hw/nvram/openbios_firmware_abi.h
+++ b/include/hw/nvram/openbios_firmware_abi.h
@@ -62,6 +62,8 @@  Sun_init_header(struct Sun_nvram *header, const 
uint8_t *macaddr, int machine_id
      header->type = 1;
      header->machine_id = machine_id & 0xff;
      memcpy(&header->macaddr, macaddr, 6);
+    memcpy(&header->hostid , &macaddr[3],3);
+
      /* Calculate checksum */
      tmp = 0;