Skip to contentSkip to conversation

sparc: Set HostID in NVRAM

PATCH In review Olivier Danet 3 participants 5 messages Dec 29, 2013 – Feb 23, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc: Set HostID in NVRAM

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.

---
 include/hw/nvram/openbios_firmware_abi.h | 2 ++
 1 file changed, 2 insertions(+)
include/hw/nvram/openbios_firmware_abi.h +2 -0
index 5e6e5d4..492c8d5 100644
@@ -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;
Signature · 1 line
1.8.1.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Olivier Danet

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.

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

Quoted 21 lines
---
 include/hw/nvram/openbios_firmware_abi.h | 2 ++
 1 file changed, 2 insertions(+)
include/hw/nvram/openbios_firmware_abi.h +2 -0
index 5e6e5d4..492c8d5 100644
@@ -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

Signature · 5 lines
Regards,
Artyom Tarasenko

linux/sparc and solaris/sparc under qemu blog:
http://tyom.blogspot.com/search/label/qemu
#2 lore raw

PATCH 1/1 Sun4m: Set HostID in NVRAM

Ping.
Repost !

Quoted 35 lines · Artyom Tarasenko
Quoted 6 lines · Olivier Danet

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.

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

Quoted 21 lines
---
  include/hw/nvram/openbios_firmware_abi.h | 2 ++
  1 file changed, 2 insertions(+)
include/hw/nvram/openbios_firmware_abi.h +2 -0
index 5e6e5d4..492c8d5 100644
@@ -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

#4 lore raw
In reply to Olivier Danet
Quoted 16 lines · Olivier Danet

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.

---
include/hw/nvram/openbios_firmware_abi.h | 2 ++

1 file changed, 2 insertions(+)
include/hw/nvram/openbios_firmware_abi.h +0 -0
index 5e6e5d4..492c8d5 100644
@@ -62,6 +62,8 @@ Sun_init_header(struct Sun_nvram *header, const
Quoted 5 lines

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?

Quoted 4 lines

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

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

ATB,

Mark.

Tested-by on v1 1/1 Applied
#3 lore raw

Re: [Qemu-devel] [PATCH] Sun4m: Set HostID in NVRAM

In reply to Olivier Danet
Quoted 30 lines · Olivier Danet

Ping.
Repost !

Quoted 26 lines · Artyom Tarasenko
Quoted 6 lines · Olivier Danet

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.

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

Quoted 13 lines

---
include/hw/nvram/openbios_firmware_abi.h | 2 ++

1 file changed, 2 insertions(+)
include/hw/nvram/openbios_firmware_abi.h +0 -0
index 5e6e5d4..492c8d5 100644
@@ -62,6 +62,8 @@ Sun_init_header(struct Sun_nvram *header, const

uint8_t
*macaddr, int machine_id
header->type = 1;

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

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;
--

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

ATB,

Mark.