Message ID | 20170224053357.18391-1-joel@jms.id.au |
---|---|
State | Accepted, archived |
Headers | show |
On Fri, 2017-02-24 at 16:03 +1030, Joel Stanley wrote: > This flash_memory region reserved memory region is used by the host<- > >bmc > mailbox daemon. > > This patch initially had a vga_memory region for the host processor's > framebuffer when using the Aspeed as a PCI graphics device. However > this > is not required as u-boot modifies the /memory node of the device > tree > to report the total RAM size minus the strapped VGA framebuffer. This > is > 16MB of the current system. > > These numbers were generated as follows: > > $ genmem.py --ram-base 0x80000000 --ram 1G --flash 64M > > And for Romulus and Witherspoon: > > $ genmem.py --ram-base 0x80000000 --ram 512M --flash 64M > > With this script: > > def convert_one(s): > suffixes = [ > ('K', 1024), > ('M', (1024*1024)), > ('G', (1024*1024*1024)), > ('T', (1024*1024*1024*1024)), > ('th', 1000), > ('mi', (1000*1000)), > ('bi', (1000*1000*1000)), > ('tri', (1000*1000*1000*1000)) > ] > > s = s.strip() > > factor = 1 > for suffix, mul in suffixes: > if s.endswith(suffix) or s.endswith(suffix.lower()): > factor = mul > s = s[:-len(suffix)] > break > > val = None > > if s.startswith('0b'): > val = convert_binary(s) > elif s.startswith('0x'): > val = int(s, 16) > else: > for c in 'abcdefABCDEF': > if c in s: > val = int(s, 16) > break > > if val is None: > val = int(s) > > val *= factor > > return val > > import argparse > parser = argparse.ArgumentParser() > parser.add_argument('--ram-base') > parser.add_argument('--ram') > parser.add_argument('--flash') > parser.add_argument('--vga') > > args = parser.parse_args() > base = convert_one(args.ram_base) > size = convert_one(args.ram) > flash_size = convert_one(args.flash) > vga_size = 0 > if args.vga: > vga_size = convert_one(args.vga) > > vga_base = base + size - vga_size > flash_base = base + size - vga_size - flash_size > > if flash_base % flash_size != 0: > print("Error: flash base address not a multiple of window. > Rounding down") > flash_base -= flash_base % flash_size > > print("memory {\r\n\treg = <0x%08x 0x%08x>;\r\n}" % (base, size)) > if vga_size > 0: > print("vga_memory {\r\n\tno-map;\r\n\treg = <0x%08x > 0x%08x>;\r\n}" % (vga_base, vga_base)) > print("flash_memory {\r\n\tno-map;\r\n\treg = <0x%08x 0x%08x>;\r\n}" > % (flash_base, flash_size)) > > Signed-off-by: Joel Stanley <joel@jms.id.au> Acked-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> > --- > v2 drops the the reserved region for VGA as we don't need it > > arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts | 11 +++++++++++ > arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 4 ++-- > arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts | 4 ++-- > 3 files changed, 15 insertions(+), 4 deletions(-) > > diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts > b/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts > index 5ba7b62aee83..93fbd7b8c490 100644 > --- a/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts > +++ b/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts > @@ -20,6 +20,17 @@ > reg = <0x80000000 0x20000000>; > }; > > + reserved-memory { > + #address-cells = <1>; > + #size-cells = <1>; > + ranges; > + > + flash_memory: region@98000000 { > + no-map; > + reg = <0x98000000 0x04000000>; /* 64M */ > + }; > + }; > + > fsi-master { > compatible = "ibm,fsi-master", "ibm,fsi-master- > gpio"; > > diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts > b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts > index e15bd256c0fd..0769507f1126 100644 > --- a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts > +++ b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts > @@ -25,9 +25,9 @@ > #size-cells = <1>; > ranges; > > - flash_memory: region@94000000 { > + flash_memory: region@98000000 { > no-map; > - reg = <0x94000000 0x04000000>; /* 64M */ > + reg = <0x98000000 0x04000000>; /* 64M */ > }; > }; > > diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts > b/arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts > index d9f63d7752dd..c2af9ffa89bf 100644 > --- a/arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts > +++ b/arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts > @@ -25,9 +25,9 @@ > #size-cells = <1>; > ranges; > > - flash_memory: region@94000000 { > + flash_memory: region@bc000000 { > no-map; > - reg = <0x94000000 0x04000000>; /* 64M */ > + reg = <0xbc000000 0x04000000>; /* 64M */ > }; > }; >
On Thu, Feb 23, 2017 at 9:49 PM, Suraj Jitindar Singh <sjitindarsingh@gmail.com> wrote: > > On Fri, 2017-02-24 at 16:03 +1030, Joel Stanley wrote: > > This flash_memory region reserved memory region is used by the host<- > > >bmc > > mailbox daemon. > > > > This patch initially had a vga_memory region for the host processor's > > framebuffer when using the Aspeed as a PCI graphics device. However > > this > > is not required as u-boot modifies the /memory node of the device > > tree > > to report the total RAM size minus the strapped VGA framebuffer. This > > is > > 16MB of the current system. > > > > These numbers were generated as follows: > > > > $ genmem.py --ram-base 0x80000000 --ram 1G --flash 64M > > > > And for Romulus and Witherspoon: > > > > $ genmem.py --ram-base 0x80000000 --ram 512M --flash 64M > > > > With this script: > > > > def convert_one(s): > > suffixes = [ > > ('K', 1024), > > ('M', (1024*1024)), > > ('G', (1024*1024*1024)), > > ('T', (1024*1024*1024*1024)), > > ('th', 1000), > > ('mi', (1000*1000)), > > ('bi', (1000*1000*1000)), > > ('tri', (1000*1000*1000*1000)) > > ] > > > > s = s.strip() > > > > factor = 1 > > for suffix, mul in suffixes: > > if s.endswith(suffix) or s.endswith(suffix.lower()): > > factor = mul > > s = s[:-len(suffix)] > > break > > > > val = None > > > > if s.startswith('0b'): > > val = convert_binary(s) > > elif s.startswith('0x'): > > val = int(s, 16) > > else: > > for c in 'abcdefABCDEF': > > if c in s: > > val = int(s, 16) > > break > > > > if val is None: > > val = int(s) > > > > val *= factor > > > > return val > > > > import argparse > > parser = argparse.ArgumentParser() > > parser.add_argument('--ram-base') > > parser.add_argument('--ram') > > parser.add_argument('--flash') > > parser.add_argument('--vga') > > > > args = parser.parse_args() > > base = convert_one(args.ram_base) > > size = convert_one(args.ram) > > flash_size = convert_one(args.flash) > > vga_size = 0 > > if args.vga: > > vga_size = convert_one(args.vga) > > > > vga_base = base + size - vga_size > > flash_base = base + size - vga_size - flash_size > > > > if flash_base % flash_size != 0: > > print("Error: flash base address not a multiple of window. > > Rounding down") > > flash_base -= flash_base % flash_size > > > > print("memory {\r\n\treg = <0x%08x 0x%08x>;\r\n}" % (base, size)) > > if vga_size > 0: > > print("vga_memory {\r\n\tno-map;\r\n\treg = <0x%08x > > 0x%08x>;\r\n}" % (vga_base, vga_base)) > > print("flash_memory {\r\n\tno-map;\r\n\treg = <0x%08x 0x%08x>;\r\n}" > > % (flash_base, flash_size)) > > > > Signed-off-by: Joel Stanley <joel@jms.id.au> > Acked-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> > > --- > > v2 drops the the reserved region for VGA as we don't need it > > > > arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts | 11 +++++++++++ > > arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 4 ++-- > > arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts | 4 ++-- > > 3 files changed, 15 insertions(+), 4 deletions(-) > > > > diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts > > b/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts > > index 5ba7b62aee83..93fbd7b8c490 100644 > > --- a/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts > > +++ b/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts > > @@ -20,6 +20,17 @@ > > reg = <0x80000000 0x20000000>; > > }; > > > > + reserved-memory { > > + #address-cells = <1>; > > + #size-cells = <1>; > > + ranges; > > + > > + flash_memory: region@98000000 { > > + no-map; > > + reg = <0x98000000 0x04000000>; /* 64M */ > > + }; > > + }; > > + > > fsi-master { > > compatible = "ibm,fsi-master", "ibm,fsi-master- > > gpio"; > > > > diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts > > b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts > > index e15bd256c0fd..0769507f1126 100644 > > --- a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts > > +++ b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts > > @@ -25,9 +25,9 @@ > > #size-cells = <1>; > > ranges; > > > > - flash_memory: region@94000000 { > > + flash_memory: region@98000000 { > > no-map; > > - reg = <0x94000000 0x04000000>; /* 64M */ > > + reg = <0x98000000 0x04000000>; /* 64M */ > > }; > > }; > > > > diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts > > b/arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts > > index d9f63d7752dd..c2af9ffa89bf 100644 > > --- a/arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts > > +++ b/arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts > > @@ -25,9 +25,9 @@ > > #size-cells = <1>; > > ranges; > > > > - flash_memory: region@94000000 { > > + flash_memory: region@bc000000 { > > no-map; > > - reg = <0x94000000 0x04000000>; /* 64M */ > > + reg = <0xbc000000 0x04000000>; /* 64M */ > > }; > > }; > > Reviewed-by: Xo Wang <xow@google.com>
diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts b/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts index 5ba7b62aee83..93fbd7b8c490 100644 --- a/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts +++ b/arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts @@ -20,6 +20,17 @@ reg = <0x80000000 0x20000000>; }; + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + flash_memory: region@98000000 { + no-map; + reg = <0x98000000 0x04000000>; /* 64M */ + }; + }; + fsi-master { compatible = "ibm,fsi-master", "ibm,fsi-master-gpio"; diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts index e15bd256c0fd..0769507f1126 100644 --- a/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +++ b/arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts @@ -25,9 +25,9 @@ #size-cells = <1>; ranges; - flash_memory: region@94000000 { + flash_memory: region@98000000 { no-map; - reg = <0x94000000 0x04000000>; /* 64M */ + reg = <0x98000000 0x04000000>; /* 64M */ }; }; diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts b/arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts index d9f63d7752dd..c2af9ffa89bf 100644 --- a/arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts +++ b/arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts @@ -25,9 +25,9 @@ #size-cells = <1>; ranges; - flash_memory: region@94000000 { + flash_memory: region@bc000000 { no-map; - reg = <0x94000000 0x04000000>; /* 64M */ + reg = <0xbc000000 0x04000000>; /* 64M */ }; };
This flash_memory region reserved memory region is used by the host<->bmc mailbox daemon. This patch initially had a vga_memory region for the host processor's framebuffer when using the Aspeed as a PCI graphics device. However this is not required as u-boot modifies the /memory node of the device tree to report the total RAM size minus the strapped VGA framebuffer. This is 16MB of the current system. These numbers were generated as follows: $ genmem.py --ram-base 0x80000000 --ram 1G --flash 64M And for Romulus and Witherspoon: $ genmem.py --ram-base 0x80000000 --ram 512M --flash 64M With this script: def convert_one(s): suffixes = [ ('K', 1024), ('M', (1024*1024)), ('G', (1024*1024*1024)), ('T', (1024*1024*1024*1024)), ('th', 1000), ('mi', (1000*1000)), ('bi', (1000*1000*1000)), ('tri', (1000*1000*1000*1000)) ] s = s.strip() factor = 1 for suffix, mul in suffixes: if s.endswith(suffix) or s.endswith(suffix.lower()): factor = mul s = s[:-len(suffix)] break val = None if s.startswith('0b'): val = convert_binary(s) elif s.startswith('0x'): val = int(s, 16) else: for c in 'abcdefABCDEF': if c in s: val = int(s, 16) break if val is None: val = int(s) val *= factor return val import argparse parser = argparse.ArgumentParser() parser.add_argument('--ram-base') parser.add_argument('--ram') parser.add_argument('--flash') parser.add_argument('--vga') args = parser.parse_args() base = convert_one(args.ram_base) size = convert_one(args.ram) flash_size = convert_one(args.flash) vga_size = 0 if args.vga: vga_size = convert_one(args.vga) vga_base = base + size - vga_size flash_base = base + size - vga_size - flash_size if flash_base % flash_size != 0: print("Error: flash base address not a multiple of window. Rounding down") flash_base -= flash_base % flash_size print("memory {\r\n\treg = <0x%08x 0x%08x>;\r\n}" % (base, size)) if vga_size > 0: print("vga_memory {\r\n\tno-map;\r\n\treg = <0x%08x 0x%08x>;\r\n}" % (vga_base, vga_base)) print("flash_memory {\r\n\tno-map;\r\n\treg = <0x%08x 0x%08x>;\r\n}" % (flash_base, flash_size)) Signed-off-by: Joel Stanley <joel@jms.id.au> --- v2 drops the the reserved region for VGA as we don't need it arch/arm/boot/dts/aspeed-bmc-opp-romulus.dts | 11 +++++++++++ arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 4 ++-- arch/arm/boot/dts/aspeed-bmc-opp-zaius.dts | 4 ++-- 3 files changed, 15 insertions(+), 4 deletions(-)