Start arch/powerpc/boot code reorganization
PATCH 1/1 Start arch/powerpc/boot code reorganization
From: Mark A. Greer <[email protected]>
This abstracts the operations used in the bootwrapper, and defines the operations needed for the bootwrapper to run on an OF platform.
The operations have been divided up into platform ops (platform_ops), firmware ops (fw_ops), device tree ops (dt_ops), and console ops (console_ops).
The proper operations will be hooked up at runtime to provide the functionality that you need.
---
arch/powerpc/boot/Makefile +2 -1
@@ -36,7 +36,8 @@ zliblinuxheader := zlib.h zconf.h zutil. $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) #$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h) -src-boot := crt0.S string.S prom.c stdio.c main.c div64.S +src-boot-$(CONFIG_PPC_MULTIPLATFORM) := of.c +src-boot := crt0.S string.S stdio.c main.c div64.S $(src-boot-y) src-boot += $(zlib) src-boot := $(addprefix $(obj)/, $(src-boot)) obj-boot := $(addsuffix .o, $(basename $(src-boot)))
arch/powerpc/boot/flatdevtree.h new file +46 -0
46 lines not on this page · raw message
arch/powerpc/boot/main.c +129 -121
345 lines not on this page · raw message
arch/powerpc/boot/of.c new file +283 -0
283 lines not on this page · raw message
arch/powerpc/boot/ops.h new file +100 -0
100 lines not on this page · raw message
arch/powerpc/boot/prom.c deleted +0 -165
165 lines not on this page · raw message
arch/powerpc/boot/prom.h deleted +0 -41
41 lines not on this page · raw message
arch/powerpc/boot/stdio.c +2 -2
@@ -10,7 +10,7 @@ #include <stdarg.h>#include <stddef.h> #include "string.h" #include "stdio.h" -#include "prom.h" +#include "ops.h" size_t strnlen (const char * s,size_t count) {
@@ -320,6 +320,6 @@ printf(const char *fmt, ...)va_start (args, fmt); n =vsprintf (sprint_buf, fmt, args);va_end (args); -write (stdout, sprint_buf, n); + console_ops.write (sprint_buf, n);return n; }
arch/powerpc/boot/stdio.h +8 -0
@@ -1,8 +1,16 @@#ifndef _PPC_BOOT_STDIO_H_#define _PPC_BOOT_STDIO_H_ +#include <stdarg.h> + +#define ENOMEM 12/* Out of Memory */ +#define EINVAL 22/* Invalid argument */ +#define ENOSPC 28/* No space left on device */ +extern int printf (const char *fmt, ...); +#define fprintf(fmt, args...) printf(args) +extern int sprintf (char *buf,const char *fmt, ...);extern int vsprintf (char *buf,const char *fmt,va_list args);
arch/powerpc/boot/types.h new file +23 -0
@@ -0,0 +1,23 @@ +#ifndef _TYPES_H_ +#define _TYPES_H_ + +#define ARRAY_SIZE (x) (sizeof(x) / sizeof((x)[0])) + +typedef unsigned char u8 ; +typedef unsigned short u16 ; +typedef unsigned int u32 ; +typedef unsigned long long u64 ; + +#define min (x,y) ({ \ + typeof(x) _x = (x); \ + typeof(y) _y = (y); \ + (void) (&_x == &_y); \ + _x < _y ? _x : _y; }) + +#define max (x,y) ({ \ + typeof(x) _x = (x); \ + typeof(y) _y = (y); \ + (void) (&_x == &_y); \ + _x > _y ? _x : _y; }) + +#endif /* _TYPES_H_ */
Paul,
Regarding our earlier conversation about ft_translate_addr and ft_parentize. I just realized that on IRC today Matt Porter pointed out that using the "reg" property in ns16550.c is wrong. We--several of us on #mklinux--decided that the "address" property is the correct thing to use because we should really be using a virtual address from the fw (bootwrapper has no ioremap). So, unless someone objects, we'll all add the "address" property to our uart device nodes in our fdt's (if they can be used as the console).
A couple consequences, if that happens:
- It removes the requirement for ft_translate_addr (and dt_ops.translate_addr) in the bootwrapper. That cleans up flatdevtree_misc.c a lot.
- Since ft_find_node/device will be the only caller of ft_parentize now, that may change your plans for ft_parentize.
Do you have any objections to using "address" property instead of "reg"?
Mark
Quoted 3 lines · Mark A. Greer
Paul,
Regarding our earlier conversation about
ft_translate_addrand
...
BTW, the only changes to your patch would be removing translate_addr from dt_ops in ops.h and removing the "dt_ops.translate_addr = NULL;" line in of.c.
I'll respin the other patches.
Mark
Quoted 9 lines · Mark A. Greer
Quoted 3 lines · Mark A. Greer
Paul,
Regarding our earlier conversation about
ft_translate_addrand...
BTW, the only changes to your patch would be removing
translate_addrfromdt_opsinops.hand removing the "dt_ops.translate_addr = NULL;" line inof.c.
FWIW, here is a patch to do this:
arch/powerpc/boot/of.c +0 -1
@@ -270,7 +270,6 @@ dt_ops.finddevice = of_finddevice; dt_ops.getprop = of_getprop; dt_ops.setprop = of_setprop; - dt_ops.translate_addr =NULL ; console_ops.open = of_console_open; console_ops.write = of_console_write;
arch/powerpc/boot/ops.h +0 -2
@@ -34,8 +34,6 @@ const int buflen);int (*setprop)(const void *node,const char *name,const void *buf,const int buflen); -u64 (*translate_addr)(const char *path,const u32 *in_addr, -const u32 addr_len);unsigned long (*ft_addr)(void ); };extern struct dt_ops dt_ops;
Quoted 10 lines · Mark A. Greer
Paul,
Regarding our earlier conversation about
ft_translate_addrandft_parentize. I just realized that on IRC today Matt Porter pointed out that using the "reg" property inns16550.cis wrong. We--several of us on #mklinux--decided that the "address" property is the correct thing to use because we should really be using a virtual address from the fw (bootwrapper has no ioremap). So, unless someone objects, we'll all add the "address" property to our uart device nodes in our fdt's (if they can be used as the console).
An example of where this is needed is 4xx. Lots of boards rely on the openbios mapping created for the UART in the zImage wrapper. However, the kernel doesn't rely on that, and the "reg" property of the .dts should contain the physical address.
It was pointed out on IRC that the "address" property is defined in the OF spec for specifying virtual address mappings. This is exactly what we need in that it allows the zImage wrapper to use the fw defined UART mapping, but the kernel still gets the real physical address later on. And other things that don't use zImage wrappers, like u-boot, can simply ignore the "address" property defined within the UART node.
The options that were discussed were this, hardcoding, or implementing ioremap in the bootwraper. This seemed to be the most elegant way of doing things.
josh
Quoted 6 lines
It was pointed out on IRC that the "address" property is defined in the OF spec for specifying virtual address mappings. This is exactly what we need in that it allows the zImage wrapper to use the fw defined UART mapping, but the kernel still gets the real physical address later on. And other things that don't use zImage wrappers, like u-boot, can simply ignore the "address" property defined within the UART node.
The "address" property has several problems. An obvious one is that the name is too generic. A nastier one is that once you start making new MMU mappings, you have to keep *all* old mappings, or blow away the mapping for this "address" as well (you don't know the size of the mapping). And a third problem is that it can only encode 32-bit virtual addresses.
Now, if it's only used for the very-early-debug UART console on machines that cannot accesses physical addresses directly, in things like a boot- wrapper that cannot be bothered to set up a MMU mapping themselves (and there might be good reasons not to), and only when there is no client interface (i.e., it uses the flat tree only); then it might be a reasonable approach. All alternatives I can think of have their own nasty problems.
So please comment the nastiness with a big "HACK HACK HACK" comment and make sure it only ever gets used on systems where nothing better is available, and all should be fine.
Segher
Quoted 10 lines · Segher Boessenkool
Quoted 9 lines
It was pointed out on IRC that the "address" property is defined in the
OF spec for specifying virtual address mappings. This is exactly what we need in that it allows the zImage wrapper to use the fw defined UART
mapping, but the kernel still gets the real physical address later on. And other things that don't use zImage wrappers, like u-boot, can simply
ignore the "address" property defined within the UART node.
Quoted 2 lines
The "address" property has several problems. An obvious one is that the name is too generic. A nastier one is that once you start making new
Well, I agree. But it's documented in the spec. Blame the spec writers ;).
Quoted 3 lines
MMU
mappings, you have to keep *all* old mappings, or blow away the mapping for this "address" as well (you don't know the size of the mapping).
Which we do on 4xx in the kernel (the blow away part).
Quoted 3 lines
And
a third problem is that it can only encode 32-bit virtual addresses.
Which isn't a _current_ problem, since the use case here is the bootwrapper and that limits itself to 32bit already anyway.
Quoted 9 lines
Now, if it's only used for the very-early-debug UART console on machines that cannot accesses physical addresses directly, in things like a boot- wrapper that cannot be bothered to set up a MMU mapping themselves (and there might be good reasons not to), and only when there is no client interface (i.e., it uses the flat tree only); then it might be a reasonable
approach. All alternatives I can think of have their own nasty problems.
Right, that's where we were at too.
Quoted 3 lines
So please comment the nastiness with a big "HACK HACK HACK" comment and make sure it only ever gets used on systems where nothing better is available, and all should be fine.
I'll leave that to Mark ;)
josh
Quoted 4 lines
So please comment the nastiness with a big "HACK HACK HACK" comment and make sure it only ever gets used on systems where nothing better is available, and all should be fine.
An option is to call it something like fw,address to avoid confusion and make it somewhat clearer that it's really a firmware address useable within the context of the firmware...
Ben.
Quoted 8 lines · Benjamin Herrenschmidt
Quoted 4 lines
So please comment the nastiness with a big "HACK HACK HACK" comment and make sure it only ever gets used on systems where nothing better is available, and all should be fine.
An option is to call it something like fw,address to avoid confusion and make it somewhat clearer that it's really a firmware address useable within the context of the firmware...
Okay. We did talk about that but then we realized that "address" was for vaddrs. We thought of other names like "bootwrapper-vaddr" etc. but "fw,address" or "fw,vaddr" are probably better--they show that the vaddr was setup by the fw.
Comments?
Mark
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
So please comment the nastiness with a big "HACK HACK HACK" comment and make sure it only ever gets used on systems where nothing better is available, and all should be fine.
Quoted 8 lines
Quoted 3 lines
An option is to call it something like fw,address to avoid confusion and make it somewhat clearer that it's really a firmware address useable within the context of the firmware...
Okay. We did talk about that but then we realized that "address" was for vaddrs. We thought of other names like "bootwrapper-vaddr" etc. but "fw,address" or "fw,vaddr" are probably better--they show that the vaddr was setup by the fw.
If you use a different name than "address", you're not bound to its semantics either. And as those semantics have some problems, please do change-em. How about:
The "reg-virtual-address" property contains the same regions as the "reg" property, in the same order; each entry is #address-cells from the root node 32-bit integers wide(*); the entry describes a contiguous area of virtual memory of the same size as the corresponding "reg" entry, mapping that area, or 0 if the area isn't mapped.
Any holes in this definition?
Segher
(*) This isn't strictly correct, but OF doesn't describe the size of virtual addresses anywhere. In practice, it's the same as the size of physical addresses always. Oh, and the name "virtual" isn't correct in PowerPC-speak anyway, heh.
Quoted 4 lines · Segher Boessenkool
If you use a different name than "address", you're not bound to its semantics either. And as those semantics have some problems, please do change-em. How about:
Quoted 8 lines
The "reg-virtual-address" property contains the same regions as the "reg" property, in the same order; each entry is #address-cells from the root node 32-bit integers
wide(*); the entry describes a contiguous area of virtual memory of the same size as the corresponding "reg" entry, mapping that area, or 0 if the area isn't mapped.Any holes in this definition?
On PPC44x (and other PowerPC processors) the number of address cells to represent a virtual address and a physical address differ due the 36-bits of physical address space. Regardless of the name of the new property, it should be defined to allow a different number of address cells to represent an address in virtual address space.
Quoted 5 lines
(*) This isn't strictly correct, but OF doesn't describe the size of virtual addresses anywhere. In practice, it's the same as the size of physical addresses always. Oh, and the name "virtual" isn't correct in PowerPC-speak anyway, heh.
Actually, in practice, it's not always the same size as a physical address. We have 36-bit physical addressing systems in the real world.
FWIW, I'd be happy with this property name or fw,address. When we discussed this on IRC the thought was to conform to what already existed for this purpose in the OF spec. Since the address prop sounds like it will confuse some people I think it makes sense to add a new property (might as well just throw out the spec :P).
-Matt
So, like, the other day Matt Porter mumbled:
Quoted 4 lines
Since the address prop sounds
like it will confuse some people I think it makes sense to add a new property (might as well just throw out the spec :P).
Ayyyy, mate. She be not so much a "code" as she be a "guideline".
Huh? That was the other day? Neeeveeer mind.
jdl
Quoted 7 lines · Jon Loeliger
So, like, the other day Matt Porter mumbled:
Quoted 4 lines
Since the address prop sounds
like it will confuse some people I think it makes sense to add a new property (might as well just throw out the spec :P).Ayyyy, mate. She be not so much a "code" as she be a "guideline".
Yeah, yeah, of course. We only use it when convenient.
Quoted 1 line
Huh? That was the other day? Neeeveeer mind.
:)
-Matt
Quoted 3 lines
On PPC44x (and other PowerPC processors) the number of address cells to represent a virtual address and a physical address differ due the 36-bits of physical address space.
The number of virtual address cells is always 1. A cell isn't always 32-bits though. Want more confusion? Lots of properties are called "<something>-cells" etc., but those names are historical; the proper name for the things encoded in properties is "32-bit integers".
Quoted 3 lines
Regardless of the name of the
new property, it should be defined to allow a different number of address cells to represent an address in virtual address space.
How about you check whether the "64-bit" property exists in the CPU nodes?
Quoted 7 lines
Quoted 4 lines
(*) This isn't strictly correct, but OF doesn't describe the size of virtual addresses anywhere. In practice, it's the same as the size of physical addresses always. Oh, and the name "virtual" isn't correct in PowerPC-speak anyway, heh.
Actually, in practice, it's not always the same size as a physical address. We have 36-bit physical addressing systems in the real world.
Darn, and you have #address-cells = 2 in the root node? It's allowed, sure.
Quoted 5 lines
FWIW, I'd be happy with this property name or fw,address. When we discussed this on IRC the thought was to conform to what already existed for this purpose in the OF spec. Since the address prop sounds like it will confuse some people I think it makes sense to add a new property (might as well just throw out the spec :P).
But if you do make something new, you'll have to make it better than what you're replacing, or what's the point :-)
Segher
Quoted 6 lines · Segher Boessenkool
Quoted 3 lines
Regardless of the name of the
new property, it should be defined to allow a different number of address cells to represent an address in virtual address space.How about you check whether the "64-bit" property exists in the CPU nodes?
That seemed like the right thing until I realized, its still specifying the physical size, not the virtual size.
I don't think we can avoid making a new xxx-cells property for the virt addr size. Ben suggested adding #virt-address-cells to the root node.
I like the name but prefer putting it directly under "/cpus" because the virt addr size is really determined by the cpu. It doesn't matter that much to me, though.
Comments?
Mark
Quoted 5 lines
Quoted 2 lines
How about you check whether the "64-bit" property exists in the CPU nodes?
That seemed like the right thing until I realized, its still specifying the physical size, not the virtual size.
No, it says that the CPU supports the full PowerPC arch, not just the 32-bit subset. Every 64-bit PowerPC has a 64-bit effective address, every 32-bit PowerPC has a 32-bit effective address. There's no way around that unless you change most of the instruction set ;-)
Segher
Quoted 11 lines · Segher Boessenkool
Quoted 6 lines
Quoted 2 lines
How about you check whether the "64-bit" property exists in the CPU nodes?
That seemed like the right thing until I realized, its still specifying
the physical size, not the virtual size.No, it says that the CPU supports the full PowerPC arch, not just the 32-bit subset. Every 64-bit PowerPC has a 64-bit effective address, every 32-bit PowerPC has a 32-bit effective address. There's no way around that unless you change most of the instruction set ;-)
Oh, okay. I didn't realize there was an actual "64-bit" property. I thought you just meant "/cpus/#address-cells = <2>". I should've googled first.
So, yes, that probably does give us the info we need. --
Here is where I think we are for getting the effective base addr of the regs for the console uart in the bootwrapper:
1) We add the "fw,address" property to the uart's dt node. That property provides the effective base address of the uart's registers left over by the firmware. The format is similar to that of the "reg" property in that it contains an "address size" tuple.
2) The effective address width (32 or 64 bits) (i.e., the # cells in the "address" portion of the tuple) is indicated by the presence of the "/cpus/64-bit" property. If it exists, the effective addr space is 64-bits wide (2 cells); if not, its 32-bits wide (1 cell).
3) The number of cells in the "size" portion of the tuple is indicated by the nearest #size-cells as you go up the tree. Just like the "reg" property.
Comments?
Mark
Hello.
Quoted 8 lines · Mark A. Greer
Here is where I think we are for getting the effective base addr of the regs for the console uart in the bootwrapper:
1) We add the "fw,address" property to the uart's dt node. That property provides the effective base address of the uart's registers left over by the firmware. The format is similar to that of the "reg" property in that it contains an "address size" tuple.
Quoted 8 lines
2) The effective address width (32 or 64 bits) (i.e., the # cells in the "address" portion of the tuple) is indicated by the presence of the "/cpus/64-bit" property. If it exists, the effective addr space is 64-bits wide (2 cells); if not, its 32-bits wide (1 cell).
3) The number of cells in the "size" portion of the tuple is indicated by the nearest #size-cells as you go up the tree. Just like the "reg" property.
Well, is there need for duplication of size if "reg" prop must be present
anyway?
WBR, Sergei
Quoted 6 lines · Sergei Shtylyov
Quoted 3 lines
3) The number of cells in the "size" portion of the tuple is indicated by the nearest #size-cells as you go up the tree. Just like the "reg" property.
Well, is there need for duplication of size if "reg" prop must be present anyway?
We're not adding another #size-cells, we're using the same one that "reg" uses. No duplication, just reuse.
Mark
Hello.
Quoted 9 lines · Mark A. Greer
Quoted 6 lines
Quoted 3 lines
3) The number of cells in the "size" portion of the tuple is indicated by the nearest #size-cells as you go up the tree. Just like the "reg" property.
Well, is there need for duplication of size if "reg" prop must be present anyway?
We're not adding another #size-cells, we're using the same one that "reg" uses. No duplication, just reuse.
I mean size could have been gotten from "reg" prop.
Quoted 1 line
Mark
WBR, Sergei
Quoted 8 lines · Sergei Shtylyov
Hello.
Quoted 3 lines · Mark A. Greer
Quoted 3 lines
Quoted 3 lines
3) The number of cells in the "size" portion of the tuple is indicated by the nearest #size-cells as you go up the tree. Just like the "reg" property.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Well, is there need for duplication of size if "reg" prop must be present anyway?
We're not adding another #size-cells, we're using the same one that "reg" uses. No duplication, just reuse.
I mean size could have been gotten from "reg" prop.
Oh. Nah, seems like a violation of how things usually work and it only adds work to look up yet another property.
Mark
Hello.
Quoted 4 lines · Mark A. Greer
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
3) The number of cells in the "size" portion of the tuple is indicated by the nearest #size-cells as you go up the tree. Just like the "reg" property.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Well, is there need for duplication of size if "reg" prop must be present anyway?
We're not adding another #size-cells, we're using the same one that "reg" uses. No duplication, just reuse.
I mean size could have been gotten from "reg" prop.
Oh. Nah, seems like a violation of how things usually work and it only
Since you're cloning the "address" prop which consisted only of the
address value, this doesn't seem so obvious.
Quoted 1 line
adds work to look up yet another property.
Oh, that's another story. :-)
Quoted 1 line
Mark
WBR, Sergei
Quoted 2 lines
Well, is there need for duplication of size if "reg" prop must
be present anyway?
No, not really. But this way, "reg" can be absent, actually.
Segher
Hello.
Quoted 4 lines · Segher Boessenkool
Quoted 2 lines
Well, is there need for duplication of size if "reg" prop must be
present anyway?No, not really. But this way, "reg" can be absent, actually.
Is this a joke? :-)
Or you're supposing that UART is only usable to the bootwrapper? Or you're
going to add support for this new prop to the main kernel as well?
Quoted 1 line
Segher
WBR, Sergei
Quoted 3 lines
Oh, okay. I didn't realize there was an actual "64-bit" property. I thought you just meant "/cpus/#address-cells = <2>". I should've googled first.
No, cpus/"#address-cells" is required to be 1, as that's the number of address cells required to identify a CPU itself.
Quoted 9 lines
So, yes, that probably does give us the info we need.
Here is where I think we are for getting the effective base addr of the regs for the console uart in the bootwrapper:
1) We add the "fw,address" property to the uart's dt node. That property provides the effective base address of the uart's registers left over by the firmware. The format is similar to that of the "reg" property in that it contains an "address size" tuple.
I completely lost you here, sorry. Maybe it's me. Care to repeat this in a (perhaps more verbose) way that I might understand?
Quoted 4 lines
2) The effective address width (32 or 64 bits) (i.e., the # cells in the "address" portion of the tuple) is indicated by the presence of the "/cpus/64-bit" property. If it exists, the effective addr space is 64-bits wide (2 cells); if not, its 32-bits wide (1 cell).
Yes. Except a "cell" is not what you think it is. A "cell" is the size of numbers OF deals with internally; just deal with it. Of course, there's things like "#address-cells", which really mean "#-32bit-things-per-address".
Quoted 3 lines
3) The number of cells in the "size" portion of the tuple is indicated by the nearest #size-cells as you go up the tree. Just like the "reg" property.
Yes, sounds fine.
Segher
Quoted 11 lines · Segher Boessenkool
Quoted 7 lines
Here is where I think we are for getting the effective base addr of the regs for the console uart in the bootwrapper:
1) We add the "fw,address" property to the uart's dt node. That property provides the effective base address of the uart's registers left over by the firmware. The format is similar to that of the "reg" property in that it contains an "address size" tuple.
I completely lost you here, sorry. Maybe it's me. Care to repeat this in a (perhaps more verbose) way that I might understand?
Well, I'm still new to the dt stuff and probably use the wrong terminology all the time. I tried to use the same type of description that is used in ./Documentation/powerpc/booting-without-of.txt.
For example:
'"reg" properties are always a tuple of the type "address size" where the number of cells of address and size is specified by the bus #address-cells and #size-cells.'
All I'm try to say is that "fw,address" is just like the "reg" property except that it holds the effective addr not the physical addr and the size of the address is determined by the existence of "/cpus/64-bit" not #address-cells. That's all.
Quoted 10 lines
Quoted 5 lines
2) The effective address width (32 or 64 bits) (i.e., the # cells in the "address" portion of the tuple) is indicated by the presence of the
"/cpus/64-bit" property. If it exists, the effective addr space is 64-bits wide (2 cells); if not, its 32-bits wide (1 cell).Yes. Except a "cell" is not what you think it is. A "cell" is the size of numbers OF deals with internally; just deal with it. Of course, there's things like "#address-cells", which really mean "#-32bit-things-per-address".
Okay, well, when I talked about cells I meant "#-32bit-things-per-address". Obviously it was silly of me to think that "#address-cells" meant the # of address cells...
Mark
Quoted 4 lines
All I'm try to say is that "fw,address" is just like the "reg" property except that it holds the effective addr not the physical addr and the size of the address is determined by the existence of "/cpus/64-bit" not #address-cells. That's all.
Sounds good.
Quoted 8 lines
Quoted 4 lines
Yes. Except a "cell" is not what you think it is. A "cell" is the size of numbers OF deals with internally; just deal with it. Of course, there's things like "#address-cells", which really mean "#-32bit-things-per-address".
Okay, well, when I talked about cells I meant "#-32bit-things-per-address". Obviously it was silly of me to think that "#address-cells" meant the # of address cells...
Some background might clear things up (or not)... A "cell" is the unit of data in a Forth system. When OF was young (and not yet called OF), all systems were 32-bit, and the 32-bit-thingies in the properties (which weren't yet called properties) in the device tree were called cells as well. When 64-bit came into the picture, everything fell apart. The "correct" name for the property thingies now is "integers as encoded with encode-int". Maybe we can compromise on calling it "property cells" or something.
The situation is even worse with "package", let's not go there :-)
Segher
Quoted 19 lines · Segher Boessenkool
Quoted 5 lines
All I'm try to say is that "fw,address" is just like the "reg" property
except that it holds the effective addr not the physical addr and the size of the address is determined by the existence of "/cpus/64-bit" not #address-cells. That's all.Sounds good.
Quoted 10 lines
Quoted 4 lines
Yes. Except a "cell" is not what you think it is. A "cell" is the size of numbers OF deals with internally; just deal with it. Of course, there's things like "#address-cells", which really mean "#-32bit-things-per-address".
Okay, well, when I talked about cells I meant "#-32bit-things-per- address".
Obviously it was silly of me to think that "#address-cells" meant the # of
address cells...
Quoted 8 lines
Some background might clear things up (or not)... A "cell" is the unit of data in a Forth system. When OF was young (and not yet called OF), all systems were 32-bit, and the 32-bit-thingies in the properties (which weren't yet called properties) in the device tree were called cells as well. When 64-bit came into the picture, everything fell apart. The "correct" name for the property thingies now is "integers as encoded with encode-int". Maybe we can compromise on calling it "property cells" or something.
Okay, fair enough. I think you understand what I was trying to say, right? If so, do you have any objections to it?
Quoted 1 line
The situation is even worse with "package", let's not go there :-)
Heh. :)
Mark
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
All I'm try to say is that "fw,address" is just like the "reg" property
except that it holds the effective addr not the physical addr and the size of the address is determined by the existence of "/cpus/64-bit" not #address-cells. That's all.Okay, fair enough. I think you understand what I was trying to say, right? If so, do you have any objections to it?
Yes: don't call it "<whatever>address", when you immediately say it is more like "reg". How about "virtual-reg"?
Quoted 3 lines
Quoted 1 line
The situation is even worse with "package", let's not go there :-)
Heh. :)
Ooh your tempting me :-)
Segher
Quoted 7 lines · Segher Boessenkool
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
All I'm try to say is that "fw,address" is just like the "reg" property
except that it holds the effective addr not the physical addr and the
size of the address is determined by the existence of "/cpus/64-bit" not #address-cells. That's all.
Quoted 5 lines
Quoted 2 lines
Okay, fair enough. I think you understand what I was trying to say, right? If so, do you have any objections to it?
Yes: don't call it "<whatever>address", when you immediately say it is more like "reg". How about "virtual-reg"?
Anyone have a problem with "virtual-reg"?
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
All I'm try to say is that "fw,address" is just like the "reg" property
except that it holds the effective addr not the physical addr and the
size of the address is determined by the existence of "/cpus/64-bit" not #address-cells. That's all.
Oh and use "/cpus/<some-cpu>/64-bit", not a property directly in the "/cpus" node.
Segher
Hello.
Quoted 9 lines · Segher Boessenkool
Quoted 8 lines
Quoted 4 lines
Yes. Except a "cell" is not what you think it is. A "cell" is the size of numbers OF deals with internally; just deal with it. Of course, there's things like "#address-cells", which really mean "#-32bit-things-per-address".
Okay, well, when I talked about cells I meant "#-32bit-things-per- address". Obviously it was silly of me to think that "#address-cells" meant the # of address cells...
Quoted 7 lines
Some background might clear things up (or not)... A "cell" is the unit of data in a Forth system. When OF was young (and not yet called OF), all systems were 32-bit, and the 32-bit-thingies in the properties (which weren't yet called properties) in the device tree were called cells as well. When 64-bit came into the picture, everything fell apart. The "correct" name for the property thingies now is "integers as encoded with encode-int".
I looked into the OF 64-bit extensions spec, and "cell" is 64-bit there.
So, "address" should look valid. I don't know whether PPC64 boxes support 64-bit OF, or only 32-bit, however, the kernel doesn't seem to deal with 64-bit ones correctly, so I'm assuming that 32-bit OF is at least available...
Anyway, I'm still missing the point of not using "address" which is
clearly intended for such case.
WBR, Sergei
Quoted 2 lines
I looked into the OF 64-bit extensions spec, and "cell" is 64-
bit there.
Like I said before, a "cell" in OF has nothing to do with the items in the device tree.
Quoted 1 line
So, "address" should look valid. I don't know whether PPC64 boxes support 64-bit OF, or only 32-bit, however, the kernel
Most OF's on 64-bit machines are 64 bit. The only defined client interface for PowerPC is 32 bit though. And, again, the format of the device tree is independent of machine word size or other environmental factors.
Quoted 3 lines
doesn't seem to deal with 64-bit ones correctly, so I'm assuming that 32-bit OF is at least available...
Anyway, I'm still missing the point of not using "address" which
is clearly intended for such case.
It also has many many problems and therefore should preferably not be used.
Segher