Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Writing to the system page?: (7 Items)
   
Writing to the system page?  
Hi,

I need to pass some paramaters from my Bootloader to QNX. The reason is because we are using the same BSP/Image on two 
devices that are based on the same CPU, but have different PHYs. So I would like io-pkt to get the parameters for the 
network code (such as MAC, IP and phyaddr) from the system page.
So my idea is to write that info to the system page when the image is setup by UBoot, then start the image.

However, I haven't found any documentation on how to write to the system page?

Thanks & Greetings,
 Marc
Re: Writing to the system page?  
On Fri, Feb 13, 2009 at 06:26:30AM -0500, Marc Roessler wrote:
> So my idea is to write that info to the system page when the image is setup by UBoot, then start the image.
> 
> However, I haven't found any documentation on how to write to the system page?

You can't write to the system page from the IPL (UBoot) since it doesn't
exist at that time - it's dynamically allocated by the startup process.
What you need to do is put the information in some place that the startup
code can find and then in init_hwinfo routine of startup, extract the info 
and use the hwi_* functions (e.g. hwi_add_nicphyaddr()) to put the 
information into the hwinfo section of the system page for the driver 
to find.

-- 
Brian Stecher (bstecher@qnx.com)        QNX Software Systems
phone: +1 (613) 591-0931 (voice)        175 Terence Matthews Cr.
       +1 (613) 591-3579 (fax)          Kanata, Ontario, Canada K2M 1W8
RE: Writing to the system page?  
The 85x0 BSP has an example of how to do this in startup.

init_hwinfo.c contains this function


static void add_one_tsec(unsigned off, 
					unsigned intr_tx, 
					unsigned int intr_rx, 
					unsigned int intr_err,
					unsigned char *mac,
					unsigned char phy_addr)
{
	paddr_t		paddr = immr_paddr + off;

	hwi_add_device(HWI_ITEM_BUS_UNKNOWN, HWI_ITEM_DEVCLASS_NETWORK,
"tsec", 0);

	hwi_add_location(paddr, 8, 0, hwi_find_as(paddr, 0));

	hwi_add_irq(intr_tx);
	hwi_add_irq(intr_rx);
	hwi_add_irq(intr_err);

	if (mac != NULL) {
		hwi_add_nicaddr(mac, 6);
	}

	if (phy_addr != 0xFF) {
		hwi_add_nicphyaddr(phy_addr);
	}
}

You can then see the corresponding code in the mpc5xx network driver on
the foundry which uses the "syspage" option


http://community.qnx.com/integration/viewcvs/viewcvs.cgi/trunk/sys/dev_q
nx/mpc85xx/detect.c?root=core_networking&rev=552&system=exsy1001&view=ma
rkup


(in the ppc85xx_get_syspage function)

		Robert.
-----Original Message-----
From: Brian Stecher [mailto:community-noreply@qnx.com] 
Sent: Friday, February 13, 2009 9:19 AM
To: ostech-core_os
Subject: Re: Writing to the system page?

On Fri, Feb 13, 2009 at 06:26:30AM -0500, Marc Roessler wrote:
> So my idea is to write that info to the system page when the image is
setup by UBoot, then start the image.
> 
> However, I haven't found any documentation on how to write to the
system page?

You can't write to the system page from the IPL (UBoot) since it doesn't
exist at that time - it's dynamically allocated by the startup process.
What you need to do is put the information in some place that the
startup code can find and then in init_hwinfo routine of startup,
extract the info and use the hwi_* functions (e.g. hwi_add_nicphyaddr())
to put the information into the hwinfo section of the system page for
the driver to find.

-- 
Brian Stecher (bstecher@qnx.com)        QNX Software Systems
phone: +1 (613) 591-0931 (voice)        175 Terence Matthews Cr.
       +1 (613) 591-3579 (fax)          Kanata, Ontario, Canada K2M 1W8

_______________________________________________
OSTech
http://community.qnx.com/sf/go/post22201
Re: Writing to the system page?  
> On Fri, Feb 13, 2009 at 06:26:30AM -0500, Marc Roessler wrote:
> > So my idea is to write that info to the system page when the image is setup 
> by UBoot, then start the image.
> > 
> > However, I haven't found any documentation on how to write to the system 
> page?
> 
> You can't write to the system page from the IPL (UBoot) since it doesn't
> exist at that time - it's dynamically allocated by the startup process.
> What you need to do is put the information in some place that the 

The main problem here is "some place".
There is no senseful interface in the u-boot code to pass the needed info to startup. There is a boardinfo structure, 
which contains some infos, but not all. You only get this structure with the "bootm" command, not with "go" or "bootelf"
. Normally you need access to the u-boot env. It would be nice to get the ram copy of this env from u-boot, to fill in a
 hwinfo-entry during startup... Well, no interface for this in u-boot.
I am thinking about an u-boot-patch, which will pass the boardinfo-struct, the address and size of the u-boot env by CPU
 registers(Perhaps r31,r30,... in the PPC case, saving r3,r4,... for arc, argv)...

Well, here u-boot is like the Linux kernel, ...why having clean binary interfaces if you can patch the source. ;-)  

- Michael


startup
> code can find and then in init_hwinfo routine of startup, extract the info 
> and use the hwi_* functions (e.g. hwi_add_nicphyaddr()) to put the 
> information into the hwinfo section of the system page for the driver 
> to find.
> 
> -- 
> Brian Stecher (bstecher@qnx.com)        QNX Software Systems
> phone: +1 (613) 591-0931 (voice)        175 Terence Matthews Cr.
>        +1 (613) 591-3579 (fax)          Kanata, Ontario, Canada K2M 1W8


RE: Writing to the system page?  
The other thing that you can do with UBOOT is fish into the flash and
search for the string and values that are stored with "setenv /
printenv".  You have to know approximately where the configuration
information is being stored (and understand that there is a "default"
configuration as well as a "user stored" one), but things are stored as
string=value, so once you find the string, you can read the value from
there. Some of these are used by UBOOT, others would obviously be unique
to your environment.

	Robert.

-----Original Message-----
From: Michael Tasche [mailto:community-noreply@qnx.com] 
Sent: Monday, February 16, 2009 8:16 AM
To: ostech-core_os
Subject: Re: Writing to the system page?

> On Fri, Feb 13, 2009 at 06:26:30AM -0500, Marc Roessler wrote:
> > So my idea is to write that info to the system page when the image 
> > is setup
> by UBoot, then start the image.
> > 
> > However, I haven't found any documentation on how to write to the 
> > system
> page?
> 
> You can't write to the system page from the IPL (UBoot) since it 
> doesn't exist at that time - it's dynamically allocated by the startup
process.
> What you need to do is put the information in some place that the

The main problem here is "some place".
There is no senseful interface in the u-boot code to pass the needed
info to startup. There is a boardinfo structure, which contains some
infos, but not all. You only get this structure with the "bootm"
command, not with "go" or "bootelf". Normally you need access to the
u-boot env. It would be nice to get the ram copy of this env from
u-boot, to fill in a hwinfo-entry during startup... Well, no interface
for this in u-boot.
I am thinking about an u-boot-patch, which will pass the
boardinfo-struct, the address and size of the u-boot env by CPU
registers(Perhaps r31,r30,... in the PPC case, saving r3,r4,... for arc,
argv)...

Well, here u-boot is like the Linux kernel, ...why having clean binary
interfaces if you can patch the source. ;-)  

- Michael


startup
> code can find and then in init_hwinfo routine of startup, extract the 
> info and use the hwi_* functions (e.g. hwi_add_nicphyaddr()) to put 
> the information into the hwinfo section of the system page for the 
> driver to find.
> 
> -- 
> Brian Stecher (bstecher@qnx.com)        QNX Software Systems
> phone: +1 (613) 591-0931 (voice)        175 Terence Matthews Cr.
>        +1 (613) 591-3579 (fax)          Kanata, Ontario, Canada K2M
1W8




_______________________________________________
OSTech
http://community.qnx.com/sf/go/post22311
Re: RE: Writing to the system page?  
At the moment our BSP's are working in the way, you describe.  
But there are 2 problems:
1) u-boot can store uboot-env not only in flash. There are variants with env in eeprom or nvram, too.
2) Your approach implies, that you have saved your uboot env with "saveenv" before you boot. There are boot commands out
 there, which dynamically define new env values before they boot.
Others want to change a env-value for a quick test, but do not want to save it.

-Michael

> The other thing that you can do with UBOOT is fish into the flash and
> search for the string and values that are stored with "setenv /
> printenv".  You have to know approximately where the configuration
> information is being stored (and understand that there is a "default"
> configuration as well as a "user stored" one), but things are stored as
> string=value, so once you find the string, you can read the value from
> there. Some of these are used by UBOOT, others would obviously be unique
> to your environment.
> 
> 	Robert.
> 
> -----Original Message-----
> From: Michael Tasche [mailto:community-noreply@qnx.com] 
> Sent: Monday, February 16, 2009 8:16 AM
> To: ostech-core_os
> Subject: Re: Writing to the system page?
> 
> > On Fri, Feb 13, 2009 at 06:26:30AM -0500, Marc Roessler wrote:
> > > So my idea is to write that info to the system page when the image 
> > > is setup
> > by UBoot, then start the image.
> > > 
> > > However, I haven't found any documentation on how to write to the 
> > > system
> > page?
> > 
> > You can't write to the system page from the IPL (UBoot) since it 
> > doesn't exist at that time - it's dynamically allocated by the startup
> process.
> > What you need to do is put the information in some place that the
> 
> The main problem here is "some place".
> There is no senseful interface in the u-boot code to pass the needed
> info to startup. There is a boardinfo structure, which contains some
> infos, but not all. You only get this structure with the "bootm"
> command, not with "go" or "bootelf". Normally you need access to the
> u-boot env. It would be nice to get the ram copy of this env from
> u-boot, to fill in a hwinfo-entry during startup... Well, no interface
> for this in u-boot.
> I am thinking about an u-boot-patch, which will pass the
> boardinfo-struct, the address and size of the u-boot env by CPU
> registers(Perhaps r31,r30,... in the PPC case, saving r3,r4,... for arc,
> argv)...
> 
> Well, here u-boot is like the Linux kernel, ...why having clean binary
> interfaces if you can patch the source. ;-)  
> 
> - Michael
> 
> 
> startup
> > code can find and then in init_hwinfo routine of startup, extract the 
> > info and use the hwi_* functions (e.g. hwi_add_nicphyaddr()) to put 
> > the information into the hwinfo section of the system page for the 
> > driver to find.
> > 
> > -- 
> > Brian Stecher (bstecher@qnx.com)        QNX Software Systems
> > phone: +1 (613) 591-0931 (voice)        175 Terence Matthews Cr.
> >        +1 (613) 591-3579 (fax)          Kanata, Ontario, Canada K2M
> 1W8
> 
> 
> 
> 
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post22311


Re: RE: Writing to the system page?  
Thanks for all your replies so far.

I think I will modify UBoot to put the settings into some unused position in RAM somewhere.

Reading from the stored UBoot settings is possible of course. In principle. ;)
I wouldn't mind having to do a saveenv before being able to boot... the UBoot image is written to the flash memory 
during the firmware update anyway, so we can include the UBoot settings areas within the firmware image. The problem 
rather is that we are using NAND for storage, and this is a bit tricky to read (both with regard to controlling the 
access but also how the access needs to be managed).
So I'll probably go with the RAM approach.

Greetings,
 Marc