Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- /dev/null 2015-06-10 22:09:58.297974446 +0200
- +++ linux-4.0.5/include/misc/sunxi_sid.h 2015-06-17 13:27:01.572876169 +0200
- @@ -0,0 +1,19 @@
- +#ifndef _MISC_SUNXI_H
- +#define _MISC_SUNXI_H
- +
- +#include <linux/types.h>
- +
- +/* This enables drivers/misc/eeprom/sunxi_sid.c to provide a chip ID
- + * for supported sunxi platforms. It gets set to the 16-byte "root"
- + * SID present on most Allwinner SoCs.
- + * The c_show() function in arch/arm/kernel/setup.c may display this
- + * chip_id as part of the /proc/cpuinfo information.
- + */
- +
- +typedef u32 chip_id_t[4];
- +
- +#if defined(CONFIG_EEPROM_SUNXI_SID)
- + extern chip_id_t chip_id;
- +#endif
- +
- +#endif
- --- linux-4.0.5.orig/drivers/misc/eeprom/sunxi_sid.c 2015-06-06 17:21:22.000000000 +0200
- +++ linux-4.0.5/drivers/misc/eeprom/sunxi_sid.c 2015-06-17 12:25:15.369171717 +0200
- @@ -33,6 +33,8 @@
- #include <linux/sysfs.h>
- #include <linux/types.h>
- +#include <misc/sunxi_sid.h>
- +
- #define DRV_NAME "sunxi-sid"
- struct sunxi_sid_data {
- @@ -40,6 +42,9 @@
- unsigned int keysize;
- };
- +// variable to hold chip ID. gets initialized once in sunxi_sid_probe()
- +chip_id_t chip_id = {0};
- +
- /* We read the entire key, due to a 32 bit read alignment requirement. Since we
- * want to return the requested byte, this results in somewhat slower code and
- * uses 4 times more reads as needed but keeps code simpler. Since the SID is
- @@ -130,6 +135,12 @@
- if (device_create_bin_file(&pdev->dev, &sid_bin_attr))
- return -ENODEV;
- + // initialize chip_id from "root" key (first 16 SID bytes)
- + chip_id[0] = ioread32(sid_data->reg_base + 0);
- + chip_id[1] = ioread32(sid_data->reg_base + 4);
- + chip_id[2] = ioread32(sid_data->reg_base + 8);
- + chip_id[3] = ioread32(sid_data->reg_base + 12);
- +
- entropy = kzalloc(sizeof(u8) * sid_data->keysize, GFP_KERNEL);
- for (i = 0; i < sid_data->keysize; i++)
- entropy[i] = sunxi_sid_read_byte(sid_data, i);
- --- linux-4.0.5.orig/arch/arm/kernel/setup.c 2015-06-06 17:21:22.000000000 +0200
- +++ linux-4.0.5/arch/arm/kernel/setup.c 2015-06-17 11:55:49.842106578 +0200
- @@ -58,6 +58,7 @@
- #include <asm/memblock.h>
- #include <asm/virt.h>
- +#include <misc/sunxi_sid.h>
- #include "atags.h"
- @@ -1094,6 +1095,12 @@
- seq_printf(m, "Serial\t\t: %08x%08x\n",
- system_serial_high, system_serial_low);
- +#if defined(CONFIG_EEPROM_SUNXI_SID)
- + if (chip_id[0] != 0)
- + seq_printf(m, "Chipid\t\t: %08x-%08x-%08x-%08x\n",
- + chip_id[0], chip_id[1], chip_id[2], chip_id[3]);
- +#endif
- +
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement