Skip to contentSkip to conversation

platform/x86: thinkpad_acpi: sysfs interface to auxmac

PATCH Superseded Fernando Eckhardt Valle 2 participants 4 messages Sep 25, 2023 – Sep 27, 2023

Subsystems (2)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 platform/x86: thinkpad_acpi: sysfs interface to auxmac

Newer Thinkpads have a feature called MAC Address Pass-through. This patch provides a sysfs interface that userspace can use to get this auxiliary mac address.

---
Changes in v5:
- Repeated code deleted.
- Adjusted offset of a strscpy().
Changes in v4:
- strscpy() in all string copies.
Changes in v3:
- Added null terminator to auxmac string when copying auxiliary mac address value.
Changes in v2:
- Added documentation.
- All handling of the auxmac value is done in the _init function.

---
 .../admin-guide/laptops/thinkpad-acpi.rst     | 20 +++++
 drivers/platform/x86/thinkpad_acpi.c          | 81 +++++++++++++++++++
 2 files changed, 101 insertions(+)
Documentation/admin-guide/laptops/thinkpad-acpi.rst +20 -0
index e27a1c3f6..98d304010 100644
@@ -53,6 +53,7 @@ detailed description):
 	- Lap mode sensor
 	- Setting keyboard language
 	- WWAN Antenna type
+	- Auxmac
 
 A compatibility table by model and feature is maintained on the web
 site, http://ibm-acpi.sf.net/. I appreciate any success or failure
@@ -1511,6 +1512,25 @@ Currently 2 antenna types are supported as mentioned below:
 The property is read-only. If the platform doesn't have support the sysfs
 class is not created.
 
+Auxmac
+------
+
+sysfs: auxmac
+
+Some newer Thinkpads have a feature called MAC Address Pass-through. This
+feature is implemented by the system firmware to provide a system unique MAC,
+that can override a dock or USB ethernet dongle MAC, when connected to a
+network. This property enables user-space to easily determine the MAC address
+if the feature is enabled.
+
+The values of this auxiliary MAC are:
+
+        cat /sys/devices/platform/thinkpad_acpi/auxmac
+
+If the feature is disabled, the value will be 'disabled'.
+
+This property is read-only.
+
 Adaptive keyboard
 -----------------
 
drivers/platform/x86/thinkpad_acpi.c +81 -0

99 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw

Hi,

It looks like I just reviewed an old version, reviewing this version now ...

Quoted 85 lines · Fernando Eckhardt Valle

Newer Thinkpads have a feature called MAC Address Pass-through. This patch provides a sysfs interface that userspace can use to get this auxiliary mac address.

---
Changes in v5:
- Repeated code deleted.
- Adjusted offset of a strscpy().
Changes in v4:
- strscpy() in all string copies.
Changes in v3:
- Added null terminator to auxmac string when copying auxiliary mac address value.
Changes in v2:
- Added documentation.
- All handling of the auxmac value is done in the _init function.

---
 .../admin-guide/laptops/thinkpad-acpi.rst     | 20 +++++
 drivers/platform/x86/thinkpad_acpi.c          | 81 +++++++++++++++++++
 2 files changed, 101 insertions(+)
Documentation/admin-guide/laptops/thinkpad-acpi.rst +20 -0
index e27a1c3f6..98d304010 100644
@@ -53,6 +53,7 @@ detailed description):
 	- Lap mode sensor
 	- Setting keyboard language
 	- WWAN Antenna type
+	- Auxmac
 
 A compatibility table by model and feature is maintained on the web
 site, http://ibm-acpi.sf.net/. I appreciate any success or failure
@@ -1511,6 +1512,25 @@ Currently 2 antenna types are supported as mentioned below:
 The property is read-only. If the platform doesn't have support the sysfs
 class is not created.
 
+Auxmac
+------
+
+sysfs: auxmac
+
+Some newer Thinkpads have a feature called MAC Address Pass-through. This
+feature is implemented by the system firmware to provide a system unique MAC,
+that can override a dock or USB ethernet dongle MAC, when connected to a
+network. This property enables user-space to easily determine the MAC address
+if the feature is enabled.
+
+The values of this auxiliary MAC are:
+
+        cat /sys/devices/platform/thinkpad_acpi/auxmac
+
+If the feature is disabled, the value will be 'disabled'.
+
+This property is read-only.
+
 Adaptive keyboard
 -----------------
 
drivers/platform/x86/thinkpad_acpi.c +17 -0
index d70c89d32..2324ebb46 100644
@@ -10785,6 +10785,82 @@ static struct ibm_struct dprc_driver_data = {
 	.name = "dprc",
 };
 
+/*
+ * Auxmac
+ *
+ * This auxiliary mac address is enabled in the bios through the
+ * MAC Address Pass-through feature. In most cases, there are three
+ * possibilities: Internal Mac, Second Mac, and disabled.
+ *
+ */
+
+#define AUXMAC_LEN 12
+#define AUXMAC_START 9
+#define AUXMAC_STRLEN 22
+#define AUXMAC_BEGIN_MARKER 8
+#define AUXMAC_END_MARKER 21
+
+static char auxmac[AUXMAC_LEN + 1];
+

drivers/platform/x86/thinkpad_acpi.c static struct ibm_struct dprc_driver_data = { · line 10814

Quoted 10 lines
drivers/platform/x86/thinkpad_acpi.c +10 -0
+static int auxmac_init(struct ibm_init_struct *iibm)
+{
+	acpi_status status;
+	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+	union acpi_object *obj;
+
+	status = acpi_evaluate_object(NULL, "\\MACA", NULL, &buffer);
+
+	if (ACPI_FAILURE(status))
+		return -ENODEV;

In this code path you don't initialize the "auxmac" buffer at all, but your auxmac_attr_group does not have an is_visible callback, so the auxmax sysfs attr will still show up.

Please add an is_visible callback and retuern 0 (not visible) when auxmac[0] == 0; See existing is_visible code for some examples.

Quoted 6 lines
drivers/platform/x86/thinkpad_acpi.c +6 -0
+
+	obj = buffer.pointer;
+
+	if (obj->type != ACPI_TYPE_STRING || obj->string.length != AUXMAC_STRLEN) {
+		pr_info("Invalid buffer for MAC address pass-through.\n");
+		goto auxmacinvalid;

drivers/platform/x86/thinkpad_acpi.c static struct ibm_struct dprc_driver_data = { · line 10830

Quoted 10 lines
drivers/platform/x86/thinkpad_acpi.c +10 -0
+	}
+
+	if (obj->string.pointer[AUXMAC_BEGIN_MARKER] != '#' ||
+	    obj->string.pointer[AUXMAC_END_MARKER] != '#') {
+		pr_info("Invalid header for MAC address pass-through.\n");
+		goto auxmacinvalid;
+	}
+
+	if (strncmp(obj->string.pointer + AUXMAC_START, "XXXXXXXXXXXX", AUXMAC_LEN) != 0)
+		strscpy(auxmac, obj->string.pointer + AUXMAC_START, AUXMAC_LEN + 1);

Please use sizeof(auxmac) as last parameter to strscpy() here.

drivers/platform/x86/thinkpad_acpi.c static struct ibm_struct dprc_driver_data = { · line 10832

Quoted 2 lines
drivers/platform/x86/thinkpad_acpi.c +2 -0
+	else
+		strscpy(auxmac, "disabled", AUXMAC_LEN);

Please use sizeof(auxmac) as last parameter to strscpy() here.

Also note how you pass 2 different dest-sizes for the same dest buffer before, which looks weird ...

drivers/platform/x86/thinkpad_acpi.c static struct ibm_struct dprc_driver_data = { · line 10841

Quoted 9 lines
drivers/platform/x86/thinkpad_acpi.c +9 -0
+
+free:
+	kfree(obj);
+	return 0;
+
+auxmacinvalid:
+	strscpy(auxmac, "unavailable", AUXMAC_LEN);
+	goto free;
+}

I'm not liking the goto dance here, I would prefer:

	kfree(obj);
	return 0;

auxmacinvalid:

	strscpy(auxmac, "unavailable", AUXMAC_LEN);
	kfree(obj);
	return 0;

It is quite normal for an error-exit path to repeat a kfree().

Note this is just a preference you keen keep this as is if you want, but to me the goto free which jumps up looks pretty weird.

Regards,

Hans

Quoted 44 lines
drivers/platform/x86/thinkpad_acpi.c +27 -0
+
+static struct ibm_struct auxmac_data = {
+	.name = "auxmac",
+};
+
+static ssize_t auxmac_show(struct device *dev,
+			   struct device_attribute *attr,
+			   char *buf)
+{
+	return sysfs_emit(buf, "%s\n", auxmac);
+}
+static DEVICE_ATTR_RO(auxmac);
+
+static struct attribute *auxmac_attributes[] = {
+	&dev_attr_auxmac.attr,
+	NULL
+};
+
+static const struct attribute_group auxmac_attr_group = {
+	.attrs = auxmac_attributes,
+};
+
 /* --------------------------------------------------------------------- */
 
 static struct attribute *tpacpi_driver_attributes[] = {
@@ -10843,6 +10919,7 @@ static const struct attribute_group *tpacpi_groups[] = {
 	&proxsensor_attr_group,
 	&kbdlang_attr_group,
 	&dprc_attr_group,
+	&auxmac_attr_group,
 	NULL,
 };
 
@@ -11414,6 +11491,10 @@ static struct ibm_init_struct ibms_init[] __initdata = {
 		.init = tpacpi_dprc_init,
 		.data = &dprc_driver_data,
 	},
+	{
+		.init = auxmac_init,
+		.data = &auxmac_data,
+	},
 };
 
 static int __init set_ibm_param(const char *val, const struct kernel_param *kp)
#2 lore raw

Thanks for the review Hans, I'll send a new version with some adjustments.

Quoted 2 lines

Note this is just a preference you keen keep this as is if you want,

I liked the Ilpo suggestion, with two 'gotos' is eliminated repeated code. If everything is ok, I prefer it this way.

Regards,
Fernando Valle

________________________________________
From: Hans de Goede <[email protected]>
Sent: Tuesday, September 26, 2023 7:23 AM
To: Fernando Eckhardt Valle (FIPT); [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v5] platform/x86: thinkpad_acpi: sysfs interface to auxmac

Hi,

It looks like I just reviewed an old version, reviewing this version now ...

Quoted 85 lines · Fernando Eckhardt Valle

Newer Thinkpads have a feature called MAC Address Pass-through. This patch provides a sysfs interface that userspace can use to get this auxiliary mac address.

---
Changes in v5:
- Repeated code deleted.
- Adjusted offset of a strscpy().
Changes in v4:
- strscpy() in all string copies.
Changes in v3:
- Added null terminator to auxmac string when copying auxiliary mac address value.
Changes in v2:
- Added documentation.
- All handling of the auxmac value is done in the _init function.

---
 .../admin-guide/laptops/thinkpad-acpi.rst     | 20 +++++
 drivers/platform/x86/thinkpad_acpi.c          | 81 +++++++++++++++++++
 2 files changed, 101 insertions(+)
Documentation/admin-guide/laptops/thinkpad-acpi.rst +20 -0
index e27a1c3f6..98d304010 100644
@@ -53,6 +53,7 @@ detailed description):
      - Lap mode sensor
      - Setting keyboard language
      - WWAN Antenna type
+     - Auxmac
 
 A compatibility table by model and feature is maintained on the web
 site, http://ibm-acpi.sf.net/. I appreciate any success or failure
@@ -1511,6 +1512,25 @@ Currently 2 antenna types are supported as mentioned below:
 The property is read-only. If the platform doesn't have support the sysfs
 class is not created.
 
+Auxmac
+------
+
+sysfs: auxmac
+
+Some newer Thinkpads have a feature called MAC Address Pass-through. This
+feature is implemented by the system firmware to provide a system unique MAC,
+that can override a dock or USB ethernet dongle MAC, when connected to a
+network. This property enables user-space to easily determine the MAC address
+if the feature is enabled.
+
+The values of this auxiliary MAC are:
+
+        cat /sys/devices/platform/thinkpad_acpi/auxmac
+
+If the feature is disabled, the value will be 'disabled'.
+
+This property is read-only.
+
 Adaptive keyboard
 -----------------
 
drivers/platform/x86/thinkpad_acpi.c +17 -0
index d70c89d32..2324ebb46 100644
@@ -10785,6 +10785,82 @@ static struct ibm_struct dprc_driver_data = {
      .name = "dprc",
 };
 
+/*
+ * Auxmac
+ *
+ * This auxiliary mac address is enabled in the bios through the
+ * MAC Address Pass-through feature. In most cases, there are three
+ * possibilities: Internal Mac, Second Mac, and disabled.
+ *
+ */
+
+#define AUXMAC_LEN 12
+#define AUXMAC_START 9
+#define AUXMAC_STRLEN 22
+#define AUXMAC_BEGIN_MARKER 8
+#define AUXMAC_END_MARKER 21
+
+static char auxmac[AUXMAC_LEN + 1];
+

drivers/platform/x86/thinkpad_acpi.c static struct ibm_struct dprc_driver_data = { · line 10814

Quoted 10 lines
drivers/platform/x86/thinkpad_acpi.c +10 -0
+static int auxmac_init(struct ibm_init_struct *iibm)
+{
+     acpi_status status;
+     struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+     union acpi_object *obj;
+
+     status = acpi_evaluate_object(NULL, "\\MACA", NULL, &buffer);
+
+     if (ACPI_FAILURE(status))
+             return -ENODEV;

In this code path you don't initialize the "auxmac" buffer at all, but your auxmac_attr_group does not have an is_visible callback, so the auxmax sysfs attr will still show up.

Please add an is_visible callback and retuern 0 (not visible) when auxmac[0] == 0; See existing is_visible code for some examples.

Quoted 6 lines
drivers/platform/x86/thinkpad_acpi.c +6 -0
+
+     obj = buffer.pointer;
+
+     if (obj->type != ACPI_TYPE_STRING || obj->string.length != AUXMAC_STRLEN) {
+             pr_info("Invalid buffer for MAC address pass-through.\n");
+             goto auxmacinvalid;

drivers/platform/x86/thinkpad_acpi.c static struct ibm_struct dprc_driver_data = { · line 10830

Quoted 10 lines
drivers/platform/x86/thinkpad_acpi.c +10 -0
+     }
+
+     if (obj->string.pointer[AUXMAC_BEGIN_MARKER] != '#' ||
+         obj->string.pointer[AUXMAC_END_MARKER] != '#') {
+             pr_info("Invalid header for MAC address pass-through.\n");
+             goto auxmacinvalid;
+     }
+
+     if (strncmp(obj->string.pointer + AUXMAC_START, "XXXXXXXXXXXX", AUXMAC_LEN) != 0)
+             strscpy(auxmac, obj->string.pointer + AUXMAC_START, AUXMAC_LEN + 1);

Please use sizeof(auxmac) as last parameter to strscpy() here.

drivers/platform/x86/thinkpad_acpi.c static struct ibm_struct dprc_driver_data = { · line 10832

Quoted 2 lines
drivers/platform/x86/thinkpad_acpi.c +2 -0
+     else
+             strscpy(auxmac, "disabled", AUXMAC_LEN);

Please use sizeof(auxmac) as last parameter to strscpy() here.

Also note how you pass 2 different dest-sizes for the same dest buffer before, which looks weird ...

drivers/platform/x86/thinkpad_acpi.c static struct ibm_struct dprc_driver_data = { · line 10841

Quoted 9 lines
drivers/platform/x86/thinkpad_acpi.c +9 -0
+
+free:
+     kfree(obj);
+     return 0;
+
+auxmacinvalid:
+     strscpy(auxmac, "unavailable", AUXMAC_LEN);
+     goto free;
+}

I'm not liking the goto dance here, I would prefer:

        kfree(obj);
        return 0;

auxmacinvalid:

        strscpy(auxmac, "unavailable", AUXMAC_LEN);
        kfree(obj);
        return 0;

It is quite normal for an error-exit path to repeat a kfree().

Note this is just a preference you keen keep this as is if you want, but to me the goto free which jumps up looks pretty weird.

Regards,

Hans

Quoted 44 lines
drivers/platform/x86/thinkpad_acpi.c +27 -0
+
+static struct ibm_struct auxmac_data = {
+     .name = "auxmac",
+};
+
+static ssize_t auxmac_show(struct device *dev,
+                        struct device_attribute *attr,
+                        char *buf)
+{
+     return sysfs_emit(buf, "%s\n", auxmac);
+}
+static DEVICE_ATTR_RO(auxmac);
+
+static struct attribute *auxmac_attributes[] = {
+     &dev_attr_auxmac.attr,
+     NULL
+};
+
+static const struct attribute_group auxmac_attr_group = {
+     .attrs = auxmac_attributes,
+};
+
 /* --------------------------------------------------------------------- */
 
 static struct attribute *tpacpi_driver_attributes[] = {
@@ -10843,6 +10919,7 @@ static const struct attribute_group *tpacpi_groups[] = {
      &proxsensor_attr_group,
      &kbdlang_attr_group,
      &dprc_attr_group,
+     &auxmac_attr_group,
      NULL,
 };
 
@@ -11414,6 +11491,10 @@ static struct ibm_init_struct ibms_init[] __initdata = {
              .init = tpacpi_dprc_init,
              .data = &dprc_driver_data,
      },
+     {
+             .init = auxmac_init,
+             .data = &auxmac_data,
+     },
 };
 
 static int __init set_ibm_param(const char *val, const struct kernel_param *kp)
#3 lore raw

Hi,

Quoted 5 lines · Fernando Eckhardt Valle (FIPT)

Thanks for the review Hans, I'll send a new version with some adjustments.

Quoted 2 lines

Note this is just a preference you keen keep this as is if you want,

I liked the Ilpo suggestion, with two 'gotos' is eliminated repeated code. If everything is ok, I prefer it this way.

If you prefer the 2 goto solution from v5 then keeping it as is is fine.

Regards,

Hans

Quoted 221 lines

________________________________________
From: Hans de Goede <[email protected]>
Sent: Tuesday, September 26, 2023 7:23 AM
To: Fernando Eckhardt Valle (FIPT); [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v5] platform/x86: thinkpad_acpi: sysfs interface to auxmac

Hi,

It looks like I just reviewed an old version, reviewing this version now ...

Quoted 85 lines · Fernando Eckhardt Valle

Newer Thinkpads have a feature called MAC Address Pass-through. This patch provides a sysfs interface that userspace can use to get this auxiliary mac address.

---
Changes in v5:
- Repeated code deleted.
- Adjusted offset of a strscpy().
Changes in v4:
- strscpy() in all string copies.
Changes in v3:
- Added null terminator to auxmac string when copying auxiliary mac address value.
Changes in v2:
- Added documentation.
- All handling of the auxmac value is done in the _init function.

---
 .../admin-guide/laptops/thinkpad-acpi.rst     | 20 +++++
 drivers/platform/x86/thinkpad_acpi.c          | 81 +++++++++++++++++++
 2 files changed, 101 insertions(+)
Documentation/admin-guide/laptops/thinkpad-acpi.rst +20 -0
index e27a1c3f6..98d304010 100644
@@ -53,6 +53,7 @@ detailed description):
      - Lap mode sensor
      - Setting keyboard language
      - WWAN Antenna type
+     - Auxmac
 
 A compatibility table by model and feature is maintained on the web
 site, http://ibm-acpi.sf.net/. I appreciate any success or failure
@@ -1511,6 +1512,25 @@ Currently 2 antenna types are supported as mentioned below:
 The property is read-only. If the platform doesn't have support the sysfs
 class is not created.
 
+Auxmac
+------
+
+sysfs: auxmac
+
+Some newer Thinkpads have a feature called MAC Address Pass-through. This
+feature is implemented by the system firmware to provide a system unique MAC,
+that can override a dock or USB ethernet dongle MAC, when connected to a
+network. This property enables user-space to easily determine the MAC address
+if the feature is enabled.
+
+The values of this auxiliary MAC are:
+
+        cat /sys/devices/platform/thinkpad_acpi/auxmac
+
+If the feature is disabled, the value will be 'disabled'.
+
+This property is read-only.
+
 Adaptive keyboard
 -----------------
 
drivers/platform/x86/thinkpad_acpi.c +17 -0
index d70c89d32..2324ebb46 100644
@@ -10785,6 +10785,82 @@ static struct ibm_struct dprc_driver_data = {
      .name = "dprc",
 };
 
+/*
+ * Auxmac
+ *
+ * This auxiliary mac address is enabled in the bios through the
+ * MAC Address Pass-through feature. In most cases, there are three
+ * possibilities: Internal Mac, Second Mac, and disabled.
+ *
+ */
+
+#define AUXMAC_LEN 12
+#define AUXMAC_START 9
+#define AUXMAC_STRLEN 22
+#define AUXMAC_BEGIN_MARKER 8
+#define AUXMAC_END_MARKER 21
+
+static char auxmac[AUXMAC_LEN + 1];
+

drivers/platform/x86/thinkpad_acpi.c static struct ibm_struct dprc_driver_data = { · line 10814

Quoted 10 lines
drivers/platform/x86/thinkpad_acpi.c +10 -0
+static int auxmac_init(struct ibm_init_struct *iibm)
+{
+     acpi_status status;
+     struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+     union acpi_object *obj;
+
+     status = acpi_evaluate_object(NULL, "\\MACA", NULL, &buffer);
+
+     if (ACPI_FAILURE(status))
+             return -ENODEV;

In this code path you don't initialize the "auxmac" buffer at all, but your auxmac_attr_group does not have an is_visible callback, so the auxmax sysfs attr will still show up.

Please add an is_visible callback and retuern 0 (not visible) when auxmac[0] == 0; See existing is_visible code for some examples.

Quoted 6 lines
drivers/platform/x86/thinkpad_acpi.c +6 -0
+
+     obj = buffer.pointer;
+
+     if (obj->type != ACPI_TYPE_STRING || obj->string.length != AUXMAC_STRLEN) {
+             pr_info("Invalid buffer for MAC address pass-through.\n");
+             goto auxmacinvalid;

drivers/platform/x86/thinkpad_acpi.c static struct ibm_struct dprc_driver_data = { · line 10830

Quoted 10 lines
drivers/platform/x86/thinkpad_acpi.c +10 -0
+     }
+
+     if (obj->string.pointer[AUXMAC_BEGIN_MARKER] != '#' ||
+         obj->string.pointer[AUXMAC_END_MARKER] != '#') {
+             pr_info("Invalid header for MAC address pass-through.\n");
+             goto auxmacinvalid;
+     }
+
+     if (strncmp(obj->string.pointer + AUXMAC_START, "XXXXXXXXXXXX", AUXMAC_LEN) != 0)
+             strscpy(auxmac, obj->string.pointer + AUXMAC_START, AUXMAC_LEN + 1);

Please use sizeof(auxmac) as last parameter to strscpy() here.

drivers/platform/x86/thinkpad_acpi.c static struct ibm_struct dprc_driver_data = { · line 10832

Quoted 2 lines
drivers/platform/x86/thinkpad_acpi.c +2 -0
+     else
+             strscpy(auxmac, "disabled", AUXMAC_LEN);

Please use sizeof(auxmac) as last parameter to strscpy() here.

Also note how you pass 2 different dest-sizes for the same dest buffer before, which looks weird ...

drivers/platform/x86/thinkpad_acpi.c static struct ibm_struct dprc_driver_data = { · line 10841

Quoted 9 lines
drivers/platform/x86/thinkpad_acpi.c +9 -0
+
+free:
+     kfree(obj);
+     return 0;
+
+auxmacinvalid:
+     strscpy(auxmac, "unavailable", AUXMAC_LEN);
+     goto free;
+}

I'm not liking the goto dance here, I would prefer:

        kfree(obj);
        return 0;

auxmacinvalid:

        strscpy(auxmac, "unavailable", AUXMAC_LEN);
        kfree(obj);
        return 0;

It is quite normal for an error-exit path to repeat a kfree().

Note this is just a preference you keen keep this as is if you want, but to me the goto free which jumps up looks pretty weird.

Regards,

Hans

Quoted 44 lines
drivers/platform/x86/thinkpad_acpi.c +27 -0
+
+static struct ibm_struct auxmac_data = {
+     .name = "auxmac",
+};
+
+static ssize_t auxmac_show(struct device *dev,
+                        struct device_attribute *attr,
+                        char *buf)
+{
+     return sysfs_emit(buf, "%s\n", auxmac);
+}
+static DEVICE_ATTR_RO(auxmac);
+
+static struct attribute *auxmac_attributes[] = {
+     &dev_attr_auxmac.attr,
+     NULL
+};
+
+static const struct attribute_group auxmac_attr_group = {
+     .attrs = auxmac_attributes,
+};
+
 /* --------------------------------------------------------------------- */
 
 static struct attribute *tpacpi_driver_attributes[] = {
@@ -10843,6 +10919,7 @@ static const struct attribute_group *tpacpi_groups[] = {
      &proxsensor_attr_group,
      &kbdlang_attr_group,
      &dprc_attr_group,
+     &auxmac_attr_group,
      NULL,
 };
 
@@ -11414,6 +11491,10 @@ static struct ibm_init_struct ibms_init[] __initdata = {
              .init = tpacpi_dprc_init,
              .data = &dprc_driver_data,
      },
+     {
+             .init = auxmac_init,
+             .data = &auxmac_data,
+     },
 };
 
 static int __init set_ibm_param(const char *val, const struct kernel_param *kp)