* Reach out "dirty" state value
@ 2017-04-24 8:20 Çağlar Kilimci
2017-04-25 5:51 ` Sascha Hauer
0 siblings, 1 reply; 7+ messages in thread
From: Çağlar Kilimci @ 2017-04-24 8:20 UTC (permalink / raw)
To: barebox
Hi all,
I would like to use state framework and now I can read variables from
both barebox and regular kernel space. In addition, if I can change
from barebox, I can successfully read the changes from kernel space
but if I change from kernel space, I could not reach out the new value
from barebox. The dirty variable is set and I can see the new value
from eeprom (where I store the values) but I guess there would be
better way to reach out the "dirty" values. So, how can I read last
value for that state variable?
Sincerely,
--
Çağlar Kilimci
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Reach out "dirty" state value
2017-04-24 8:20 Reach out "dirty" state value Çağlar Kilimci
@ 2017-04-25 5:51 ` Sascha Hauer
2017-04-25 6:08 ` Çağlar Kilimci
0 siblings, 1 reply; 7+ messages in thread
From: Sascha Hauer @ 2017-04-25 5:51 UTC (permalink / raw)
To: Çağlar Kilimci; +Cc: barebox
Hi Çağlar,
On Mon, Apr 24, 2017 at 11:20:47AM +0300, Çağlar Kilimci wrote:
> Hi all,
>
> I would like to use state framework and now I can read variables from
> both barebox and regular kernel space. In addition, if I can change
> from barebox, I can successfully read the changes from kernel space
> but if I change from kernel space, I could not reach out the new value
> from barebox. The dirty variable is set and I can see the new value
> from eeprom (where I store the values) but I guess there would be
> better way to reach out the "dirty" values. So, how can I read last
> value for that state variable?
If you get outdated variables in barebox that's a bug. You are on latest
master, right? Do you have stridesize specified in the devicetree?
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Reach out "dirty" state value
2017-04-25 5:51 ` Sascha Hauer
@ 2017-04-25 6:08 ` Çağlar Kilimci
2017-04-25 6:42 ` Sascha Hauer
0 siblings, 1 reply; 7+ messages in thread
From: Çağlar Kilimci @ 2017-04-25 6:08 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Hi Sascha,
2017-04-25 8:51 GMT+03:00 Sascha Hauer <s.hauer@pengutronix.de>:
> Hi Çağlar,
>
> On Mon, Apr 24, 2017 at 11:20:47AM +0300, Çağlar Kilimci wrote:
>> Hi all,
>>
>> I would like to use state framework and now I can read variables from
>> both barebox and regular kernel space. In addition, if I can change
>> from barebox, I can successfully read the changes from kernel space
>> but if I change from kernel space, I could not reach out the new value
>> from barebox. The dirty variable is set and I can see the new value
>> from eeprom (where I store the values) but I guess there would be
>> better way to reach out the "dirty" values. So, how can I read last
>> value for that state variable?
>
> If you get outdated variables in barebox that's a bug. You are on latest
> master, right? Do you have stridesize specified in the devicetree?
Yes, I am on the latest master. And yes, I have specified stridsize.
Here is my of_dump of my state device:
barebox@Phytec phyCORE AM335x:/ of_dump /state
state {
magic = <0x4aaef393>;
compatible = "barebox,state";
backend-type = "raw";
backend = <0x3f>;
backend-storage-type = "direct";
backend-stridesize = <0x10>;
partname {
reg = <0x0 0x10>;
type = "string";
default = "mmc0.1";
};
optional {
reg = <0x10 0x10>;
type = "string";
default = "none";
};
};
I do not know how to calculate stridsize.
Here is my state variable value and layout in the eeprom:
barebox@Phytec phyCORE AM335x:/ echo $state.partname
mmc0.1
barebox@Phytec phyCORE AM335x:/ md -s /dev/eeprom0
00000000: 2354fdf3 00000030 4aaef393 00200000 ..T#0......J.. .
00000010: c81ccb67 c3f780e7 30636d6d 0000322e g.......mmc0.2..
00000020: 00000000 00000000 656e6f6e 00000000 ........none....
00000030: 00000000 00000000 7b88e6a4 d0dfb994 ...........{....
00000040: 30636d6d 0000312e 00000000 00000000 mmc0.1..........
00000050: 656e6f6e 00000000 00000000 00000000 none............
00000060: 00000065 00000000 00000000 00000000 e...............
00000070: 00000000 00000000 00000000 6e6f6e00 .............non
00000080: 00000065 00000000 00000000 00000000 e...............
00000090: 00000000 ffff0000 ffffffff ffffffff ................
000000a0: ffffffff fdf3ffff 003b2354 f3630000 ........T#;...c.
000000b0: 0000456e d8a5002b 9732f9fc 0000873f nE..+.....2.?...
000000c0: 65646568 00000000 00000000 00000000 hede............
000000d0: 656e6f6e 00000000 00000000 00000000 none............
000000e0: 00000000 00000000 ffffff00 ffffffff ................
000000f0: ffffffff ffffffff ffffffff ffffffff ................
And here is the output from Linux side:
root@phyboard-wega-am335x-1:~# barebox-state -n /state -d
No backend-storage-type found, using default.
WARNING, no stridesize given although we use a direct file write.
Starting in degraded mode
Failed to initialize desired amount of direct buckets, only 1 of 3 succeeded
New state registered 'state'
partname=mmc0.2
optional=none
--
Çağlar Kilimci
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Reach out "dirty" state value
2017-04-25 6:08 ` Çağlar Kilimci
@ 2017-04-25 6:42 ` Sascha Hauer
2017-04-25 9:17 ` Çağlar Kilimci
0 siblings, 1 reply; 7+ messages in thread
From: Sascha Hauer @ 2017-04-25 6:42 UTC (permalink / raw)
To: Çağlar Kilimci; +Cc: barebox
On Tue, Apr 25, 2017 at 09:08:25AM +0300, Çağlar Kilimci wrote:
> Hi Sascha,
>
> 2017-04-25 8:51 GMT+03:00 Sascha Hauer <s.hauer@pengutronix.de>:
> > Hi Çağlar,
> >
> > On Mon, Apr 24, 2017 at 11:20:47AM +0300, Çağlar Kilimci wrote:
> >> Hi all,
> >>
> >> I would like to use state framework and now I can read variables from
> >> both barebox and regular kernel space. In addition, if I can change
> >> from barebox, I can successfully read the changes from kernel space
> >> but if I change from kernel space, I could not reach out the new value
> >> from barebox. The dirty variable is set and I can see the new value
> >> from eeprom (where I store the values) but I guess there would be
> >> better way to reach out the "dirty" values. So, how can I read last
> >> value for that state variable?
> >
> > If you get outdated variables in barebox that's a bug. You are on latest
> > master, right? Do you have stridesize specified in the devicetree?
>
> Yes, I am on the latest master. And yes, I have specified stridsize.
> Here is my of_dump of my state device:
>
> barebox@Phytec phyCORE AM335x:/ of_dump /state
> state {
> magic = <0x4aaef393>;
> compatible = "barebox,state";
> backend-type = "raw";
> backend = <0x3f>;
> backend-storage-type = "direct";
> backend-stridesize = <0x10>;
The stridesize is too small. It must be at least the size of one state
instance storage space which is the size of your data (0x20) and the
size of the header (0xc), so total 0x2c. However, I recommend a bigger
value, maybe 0x40 or 0x80.
There should be an error message when the stridesize is too small.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Reach out "dirty" state value
2017-04-25 6:42 ` Sascha Hauer
@ 2017-04-25 9:17 ` Çağlar Kilimci
2017-04-25 13:08 ` Çağlar Kilimci
0 siblings, 1 reply; 7+ messages in thread
From: Çağlar Kilimci @ 2017-04-25 9:17 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Hello,
>> barebox@Phytec phyCORE AM335x:/ of_dump /state
>> state {
>> magic = <0x4aaef393>;
>> compatible = "barebox,state";
>> backend-type = "raw";
>> backend = <0x3f>;
>> backend-storage-type = "direct";
>> backend-stridesize = <0x10>;
>
> The stridesize is too small. It must be at least the size of one state
> instance storage space which is the size of your data (0x20) and the
> size of the header (0xc), so total 0x2c. However, I recommend a bigger
> value, maybe 0x40 or 0x80.
> There should be an error message when the stridesize is too small.
Nothing changed even if the value of 0x80.
Here are some output, they may give you an idea:
barebox@Phytec phyCORE AM335x:/ devinfo state
Parameters:
dirty: 0
optional: none
partname: mmc0.1
barebox@Phytec phyCORE AM335x:/ md -s /dev/eeprom0
00000000: 4aaef393 00200000 7b88e6a4 d0dfb994 ...J.. ....{....
00000010: 30636d6d 0000312e 00000000 00000000 mmc0.1..........
00000020: 656e6f6e 00000000 00000000 00000000 none............
00000030: 4aaef393 00200000 7b88e6a4 d0dfb994 ...J.. ....{....
00000040: 30636d6d 0000312e 00000000 00000000 mmc0.1..........
00000050: 656e6f6e 00000000 00000000 00000000 none............
00000060: 00000065 00000000 00000000 00000000 e...............
00000070: 00000000 00000000 00000000 6e6f6e00 .............non
00000080: 00000065 00000000 00000000 00000000 e...............
00000090: 00000000 ffff0000 ffffffff ffffffff ................
000000a0: ffffffff fdf3ffff 003b2354 f3630000 ........T#;...c.
000000b0: 0000456e d8a5002b 9732f9fc 0000873f nE..+.....2.?...
000000c0: 65646568 00000000 00000000 00000000 hede............
000000d0: 656e6f6e 00000000 00000000 00000000 none............
000000e0: 00000000 00000000 ffffff00 ffffffff ................
000000f0: ffffffff ffffffff ffffffff ffffffff ................
Then boot:
root@phyboard-wega-am335x-1:~# barebox-state -n /state -d
No backend-storage-type found, using default.
WARNING, no stridesize given although we use a direct file write.
Starting in degraded mode
Failed to initialize desired amount of direct buckets, only 1 of 3 succeeded
New state registered 'state'
partname=mmc0.1
optional=none
root@phyboard-wega-am335x-1:~# barebox-state -n /state -s partname=mmc0.2
No backend-storage-type found, using default.
WARNING, no stridesize given although we use a direct file write.
Starting in degraded mode
Failed to initialize desired amount of direct buckets, only 1 of 3 succeeded
New state registered 'state'
root@phyboard-wega-am335x-1:~# barebox-state -n /state -d
No backend-storage-type found, using default.
WARNING, no stridesize given although we use a direct file write.
Starting in degraded mode
Failed to initialize desired amount of direct buckets, only 1 of 3 succeeded
New state registered 'state'
partname=mmc0.2
optional=none
And then, reboot:
barebox@Phytec phyCORE AM335x:/ devinfo state
Parameters:
dirty: 1
optional: none
partname: mmc0.1
barebox@Phytec phyCORE AM335x:/ md -s /dev/eeprom0
00000000: 2354fdf3 00000030 4aaef393 00200000 ..T#0......J.. .
00000010: c81ccb67 c3f780e7 30636d6d 0000322e g.......mmc0.2..
00000020: 00000000 00000000 656e6f6e 00000000 ........none....
00000030: 00000000 00000000 7b88e6a4 d0dfb994 ...........{....
00000040: 30636d6d 0000312e 00000000 00000000 mmc0.1..........
00000050: 656e6f6e 00000000 00000000 00000000 none............
00000060: 00000065 00000000 00000000 00000000 e...............
00000070: 00000000 00000000 00000000 6e6f6e00 .............non
00000080: 00000065 00000000 00000000 00000000 e...............
00000090: 00000000 ffff0000 ffffffff ffffffff ................
000000a0: ffffffff fdf3ffff 003b2354 f3630000 ........T#;...c.
000000b0: 0000456e d8a5002b 9732f9fc 0000873f nE..+.....2.?...
000000c0: 65646568 00000000 00000000 00000000 hede............
000000d0: 656e6f6e 00000000 00000000 00000000 none............
000000e0: 00000000 00000000 ffffff00 ffffffff ................
000000f0: ffffffff ffffffff ffffffff ffffffff ................
Here is of_dump of state
barebox@Phytec phyCORE AM335x:/ of_dump /state
state {
magic = <0x4aaef393>;
compatible = "barebox,state";
backend-type = "raw";
backend = <0x3f>;
backend-storage-type = "direct";
backend-stridesize = <0x80>;
partname {
reg = <0x0 0x10>;
type = "string";
default = "mmc0.1";
};
optional {
reg = <0x10 0x10>;
type = "string";
default = "none";
};
};
--
Çağlar Kilimci
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Reach out "dirty" state value
2017-04-25 9:17 ` Çağlar Kilimci
@ 2017-04-25 13:08 ` Çağlar Kilimci
2017-04-25 13:24 ` Çağlar Kilimci
0 siblings, 1 reply; 7+ messages in thread
From: Çağlar Kilimci @ 2017-04-25 13:08 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
Hi again,
Found the reason. It logs in the boot:
state: invalid header crc, calculated 0x3a25a1e3, found 0x00200000
state: invalid header crc, calculated 0x203e5ed8, found 0xd0dfb994
state: load failed - using defaults
state state.4: backend: raw, path: /dev/eeprom0, of_path:
/ocp/i2c@44e0b000/eeprom@52
So, do you know why?
--
Çağlar Kilimci
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Reach out "dirty" state value
2017-04-25 13:08 ` Çağlar Kilimci
@ 2017-04-25 13:24 ` Çağlar Kilimci
0 siblings, 0 replies; 7+ messages in thread
From: Çağlar Kilimci @ 2017-04-25 13:24 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
2017-04-25 16:08 GMT+03:00 Çağlar Kilimci <ckilimci@gmail.com>:
> Hi again,
>
> Found the reason. It logs in the boot:
> state: invalid header crc, calculated 0x3a25a1e3, found 0x00200000
> state: invalid header crc, calculated 0x203e5ed8, found 0xd0dfb994
> state: load failed - using defaults
> state state.4: backend: raw, path: /dev/eeprom0, of_path:
> /ocp/i2c@44e0b000/eeprom@52
>
> So, do you know why?
It is working without an issue now. I am using 2017.03 version both
dt-utils and barebox.
--
Çağlar Kilimci
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-04-25 13:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-24 8:20 Reach out "dirty" state value Çağlar Kilimci
2017-04-25 5:51 ` Sascha Hauer
2017-04-25 6:08 ` Çağlar Kilimci
2017-04-25 6:42 ` Sascha Hauer
2017-04-25 9:17 ` Çağlar Kilimci
2017-04-25 13:08 ` Çağlar Kilimci
2017-04-25 13:24 ` Çağlar Kilimci
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox