Discussion:
Why eeprom driver is read-only ?
Ranran
2018-11-19 12:08:26 UTC
Permalink
Hello,

What is the reason that kernel driver of eeprom is configured only as
read-only ?

Is it because the BIOS is stored there ?

Is there a way to make it writable ?

Thank you,
Ran
Ruben Safir
2018-11-19 13:12:11 UTC
Permalink
Post by Ranran
Hello,
What is the reason that kernel driver of eeprom is configured only as
read-only ?
Is it because the BIOS is stored there ?
Is there a way to make it writable ?
Thank you,
Ran
_______________________________________________
Kernelnewbies mailing list
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
because the ROM is read only?
--
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002

http://www.nylxs.com - Leadership Development in Free Software
http://www.brooklyn-living.com

Being so tracked is for FARM ANIMALS and and extermination camps,
but incompatible with living as a free human being. -RI Safir 2013
Chriz Chow
2018-11-19 13:48:13 UTC
Permalink
Hello,

It seems that some drivers in drivers/misc/eeprom does support write access. For example at24.c seems to have a function at24_write().

https://github.com/torvalds/linux/blob/master/drivers/misc/eeprom/at24.c

However some drivers doesn’t have write support, I believe it is because of simplicity - some eeprom are used for read only, such as ddr4 spd eeprom.

Point me out if I am wrong.

Chriz

Enviado desde mi iPhone
Post by Ruben Safir
Post by Ranran
Hello,
What is the reason that kernel driver of eeprom is configured only as
read-only ?
Is it because the BIOS is stored there ?
Is there a way to make it writable ?
Thank you,
Ran
_______________________________________________
Kernelnewbies mailing list
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
because the ROM is read only?
--
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www.brooklyn-living.com
Being so tracked is for FARM ANIMALS and and extermination camps,
but incompatible with living as a free human being. -RI Safir 2013
_______________________________________________
Kernelnewbies mailing list
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Ranran
2018-11-19 22:04:03 UTC
Permalink
Post by Ruben Safir
Post by Ranran
Hello,
What is the reason that kernel driver of eeprom is configured only as
read-only ?
Is it because the BIOS is stored there ?
Is there a way to make it writable ?
Thank you,
Ran
_______________________________________________
Kernelnewbies mailing list
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
because the ROM is read only?
That's interesting...
I think the name is confusing, because this chips are also writable.

Not only this, but in arm the eeprom (at24) is writable!
But in the x86 I am using, it is readonly in kernel code:
https://android.googlesource.com/kernel/omap/+/glass-omap-xrr02/drivers/misc/eeprom/eeprom.c
static struct bin_attribute eeprom_attr = {
.attr = {
.name = "eeprom",
.mode = S_IRUGO,
},
.size = EEPROM_SIZE,
.read = eeprom_read,
};

Regards,
ran
Post by Ruben Safir
--
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com
DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www.brooklyn-living.com
Being so tracked is for FARM ANIMALS and and extermination camps,
but incompatible with living as a free human being. -RI Safir 2013
_______________________________________________
Kernelnewbies mailing list
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
v***@vt.edu
2018-11-19 22:32:03 UTC
Permalink
Post by Ranran
That's interesting...
I think the name is confusing, because this chips are also writable.
Not only this, but in arm the eeprom (at24) is writable!
https://android.googlesource.com/kernel/omap/+/glass-omap-xrr02/drivers/misc/eeprom/eeprom.c
static struct bin_attribute eeprom_attr = {
.attr = {
.name = "eeprom",
.mode = S_IRUGO,
},
.size = EEPROM_SIZE,
.read = eeprom_read,
};
Well, at least in the mainline kernel, we have this at the top of the eeprom.c file:

/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54,
0x55, 0x56, 0x57, I2C_CLIENT_END };


/* Size of EEPROM in bytes */
#define EEPROM_SIZE 256

which is pretty obviously intended for "very small eeprom hanging off an I2C adapter",
and thus probably *NOT* the boot ROM that the BIOS lives in.
Ranran
2018-11-20 06:44:50 UTC
Permalink
Post by v***@vt.edu
Post by Ranran
That's interesting...
I think the name is confusing, because this chips are also writable.
Not only this, but in arm the eeprom (at24) is writable!
https://android.googlesource.com/kernel/omap/+/glass-omap-xrr02/drivers/misc/eeprom/eeprom.c
static struct bin_attribute eeprom_attr = {
.attr = {
.name = "eeprom",
.mode = S_IRUGO,
},
.size = EEPROM_SIZE,
.read = eeprom_read,
};
/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54,
0x55, 0x56, 0x57, I2C_CLIENT_END };
/* Size of EEPROM in bytes */
#define EEPROM_SIZE 256
which is pretty obviously intended for "very small eeprom hanging off an I2C adapter",
and thus probably *NOT* the boot ROM that the BIOS lives in.
although I think that in my system it is a flash rom which stores the
BIOS, so I really don't know what's the use of the eeprom....

I need a very small amout of data (several bytes) to save some non
volatile information in x86 system.
I can't use disk for this, but can use any other peripheral or even
x86 chip on board.
Now it also seems that I can't use the eeprom becuase of the kernel
limitation (can I open it for writing if the BIOS is not stored
there??)

I don't have any idea where I can find such storage.
Does x86 include some programmable registers ?
Do you have any idea where I can store the data ?

Thanks

v***@vt.edu
2018-11-19 14:07:17 UTC
Permalink
Post by Ranran
What is the reason that kernel driver of eeprom is configured only as
read-only ?
Probably depends on the hardware. I'm pretty sure that *some* eeproms
are writable.
Post by Ranran
Is it because the BIOS is stored there ?
Remember that the BIOS is stored in one of what may be several eeproms in the
system - graphics cards and other controllers probably have their own eeproms.

You might want to think about why most systems do a restart after updating the BIOS,
and then ask yourself if you really want to write to it while the system is up....
Post by Ranran
Is there a way to make it writable ?
Depends on which eeprom you're talking about.
Continue reading on narkive:
Loading...