Re: [U-Boot] [PATCH] Add ability for arch code to make changes before we boot
Dear Kumar Gala, In message 1250276442-28463-1-git-send-email-ga...@kernel.crashing.org you wrote: Added a arch_preboot() function that cpu specific code can implement to allow for various modifications to the state of the machine right before we boot. This can be useful to setup register state to a specific configuration. Signed-off-by: Kumar Gala ga...@kernel.crashing.org --- common/cmd_bootm.c | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 86c8122..766889a 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -166,6 +166,13 @@ void __arch_lmb_reserve(struct lmb *lmb) } void arch_lmb_reserve(struct lmb *lmb) __attribute__((weak, alias(__arch_lmb_reserve))); +/* Allow for arch specific config before we boot */ +void __arch_preboot(void) As this is only used when booting an OS (and not for example when starting a standalone program) we should probably write: /* Allow for arch specific code before booting the OS */ void __arch_preboot_os() ... +{ + /* please define platform specific arch_preboot() */ +} +void arch_preboot(void) __attribute__((weak, alias(__arch_preboot))); + #if defined(__ARM__) #define IH_INITRD_ARCH IH_ARCH_ARM #elif defined(__avr32__) @@ -543,6 +550,7 @@ int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) break; case BOOTM_STATE_OS_GO: Hm... maybe this could / should be handled in BOOTM_STATE_OS_PREP state? disable_interrupts(); + arch_preboot(); And maybe we should mode disable_interrupts() into the default implementation of arch_preboot_os() ? boot_fn(BOOTM_STATE_OS_GO, argc, argv, images); break; } @@ -673,6 +681,8 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; } + arch_preboot(); + boot_fn(0, argc, argv, images); But this would change behaviour here. Eventually to the better? Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de Niklaus Wirth has lamented that, whereas Europeans pronounce his name correctly (Ni-klows Virt), Americans invariably mangle it into (Nick-les Worth). Which is to say that Europeans call him by name, but Americans call him by value. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Add ability for arch code to make changes before we boot
On Aug 26, 2009, at 10:27 PM, Kumar Gala wrote: On Aug 26, 2009, at 3:46 PM, Wolfgang Denk wrote: Dear Kumar Gala, In message 1250276442-28463-1-git-send-email-ga...@kernel.crashing.org you wrote: Added a arch_preboot() function that cpu specific code can implement to allow for various modifications to the state of the machine right before we boot. This can be useful to setup register state to a specific configuration. Signed-off-by: Kumar Gala ga...@kernel.crashing.org --- common/cmd_bootm.c | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 86c8122..766889a 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -166,6 +166,13 @@ void __arch_lmb_reserve(struct lmb *lmb) } void arch_lmb_reserve(struct lmb *lmb) __attribute__((weak, alias(__arch_lmb_reserve))); +/* Allow for arch specific config before we boot */ +void __arch_preboot(void) As this is only used when booting an OS (and not for example when starting a standalone program) we should probably write: /* Allow for arch specific code before booting the OS */ void __arch_preboot_os() ... no problem, will change the name. +{ + /* please define platform specific arch_preboot() */ +} +void arch_preboot(void) __attribute__((weak, alias(__arch_preboot))); + #if defined(__ARM__) #define IH_INITRD_ARCH IH_ARCH_ARM #elif defined(__avr32__) @@ -543,6 +550,7 @@ int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) break; case BOOTM_STATE_OS_GO: Hm... maybe this could / should be handled in BOOTM_STATE_OS_PREP state? I'd prefer to keep arch_preboot_os() as close to boot_fn() as possible disable_interrupts(); + arch_preboot(); And maybe we should mode disable_interrupts() into the default implementation of arch_preboot_os() ? Got no issue with moving disable_interrupts into the default implementation of arch_preboot_os() Now that I look at how do_bootm() calls and uses disable_interrupts() this is a bit more tricky. I'd prefer to leave disable_interrupts() alone. - k ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Add ability for arch code to make changes before we boot
On Aug 15, 2009, at 9:24 AM, Jean-Christophe PLAGNIOL-VILLARD wrote: On 15:45 Fri 14 Aug , Kumar Gala wrote: On Aug 14, 2009, at 3:13 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: On 14:00 Fri 14 Aug , Kumar Gala wrote: Added a arch_preboot() function that cpu specific code can implement to allow for various modifications to the state of the machine right before we boot. This can be useful to setup register state to a specific configuration. Signed-off-by: Kumar Gala ga...@kernel.crashing.org --- common/cmd_bootm.c | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 86c8122..766889a 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -166,6 +166,13 @@ void __arch_lmb_reserve(struct lmb *lmb) } void arch_lmb_reserve(struct lmb *lmb) __attribute__((weak, alias(__arch_lmb_reserve))); +/* Allow for arch specific config before we boot */ +void __arch_preboot(void) +{ + /* please define platform specific arch_preboot() */ +} +void arch_preboot(void) __attribute__((weak, alias(__arch_preboot))); + why not a section so you will be able to have multiple callback so it can be arch or soc or board too in any combination Because the use I have for it is a simple single case at this point. If and when we need more complexity we can add it. we have already it as example the usb drivers that need to be stop before start an os I forget some but I'm sure to have seen oher We already handle USB in the bootm code. I don't see any reason to go add a bunch of code for the one case we handle. - k ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Add ability for arch code to make changes before we boot
On Aug 14, 2009, at 2:00 PM, Kumar Gala wrote: Added a arch_preboot() function that cpu specific code can implement to allow for various modifications to the state of the machine right before we boot. This can be useful to setup register state to a specific configuration. Signed-off-by: Kumar Gala ga...@kernel.crashing.org --- common/cmd_bootm.c | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) Wolfgang, Can you look at either commenting on this or picking it up for 'next'. Its one patch the current '85xx next' tree depends on. - k ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Add ability for arch code to make changes before we boot
On 15:45 Fri 14 Aug , Kumar Gala wrote: On Aug 14, 2009, at 3:13 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: On 14:00 Fri 14 Aug , Kumar Gala wrote: Added a arch_preboot() function that cpu specific code can implement to allow for various modifications to the state of the machine right before we boot. This can be useful to setup register state to a specific configuration. Signed-off-by: Kumar Gala ga...@kernel.crashing.org --- common/cmd_bootm.c | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 86c8122..766889a 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -166,6 +166,13 @@ void __arch_lmb_reserve(struct lmb *lmb) } void arch_lmb_reserve(struct lmb *lmb) __attribute__((weak, alias(__arch_lmb_reserve))); +/* Allow for arch specific config before we boot */ +void __arch_preboot(void) +{ + /* please define platform specific arch_preboot() */ +} +void arch_preboot(void) __attribute__((weak, alias(__arch_preboot))); + why not a section so you will be able to have multiple callback so it can be arch or soc or board too in any combination Because the use I have for it is a simple single case at this point. If and when we need more complexity we can add it. we have already it as example the usb drivers that need to be stop before start an os I forget some but I'm sure to have seen oher Best Regards, J. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Add ability for arch code to make changes before we boot
On Aug 14, 2009, at 2:00 PM, Kumar Gala wrote: Added a arch_preboot() function that cpu specific code can implement to allow for various modifications to the state of the machine right before we boot. This can be useful to setup register state to a specific configuration. Signed-off-by: Kumar Gala ga...@kernel.crashing.org --- common/cmd_bootm.c | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) If you can review and ack this if its ok that would be great. I'd like to send this via the 85xx next tree as the patch for fixed IVORs depends on it. - k diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 86c8122..766889a 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -166,6 +166,13 @@ void __arch_lmb_reserve(struct lmb *lmb) } void arch_lmb_reserve(struct lmb *lmb) __attribute__((weak, alias(__arch_lmb_reserve))); +/* Allow for arch specific config before we boot */ +void __arch_preboot(void) +{ + /* please define platform specific arch_preboot() */ +} +void arch_preboot(void) __attribute__((weak, alias(__arch_preboot))); + #if defined(__ARM__) #define IH_INITRD_ARCH IH_ARCH_ARM #elif defined(__avr32__) @@ -543,6 +550,7 @@ int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) break; case BOOTM_STATE_OS_GO: disable_interrupts(); + arch_preboot(); boot_fn(BOOTM_STATE_OS_GO, argc, argv, images); break; } @@ -673,6 +681,8 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 1; } + arch_preboot(); + boot_fn(0, argc, argv, images); show_boot_progress (-9); -- 1.6.0.6 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Add ability for arch code to make changes before we boot
On 14:00 Fri 14 Aug , Kumar Gala wrote: Added a arch_preboot() function that cpu specific code can implement to allow for various modifications to the state of the machine right before we boot. This can be useful to setup register state to a specific configuration. Signed-off-by: Kumar Gala ga...@kernel.crashing.org --- common/cmd_bootm.c | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 86c8122..766889a 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -166,6 +166,13 @@ void __arch_lmb_reserve(struct lmb *lmb) } void arch_lmb_reserve(struct lmb *lmb) __attribute__((weak, alias(__arch_lmb_reserve))); +/* Allow for arch specific config before we boot */ +void __arch_preboot(void) +{ + /* please define platform specific arch_preboot() */ +} +void arch_preboot(void) __attribute__((weak, alias(__arch_preboot))); + why not a section so you will be able to have multiple callback so it can be arch or soc or board too in any combination Best Regards, J. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Add ability for arch code to make changes before we boot
On Aug 14, 2009, at 3:13 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: On 14:00 Fri 14 Aug , Kumar Gala wrote: Added a arch_preboot() function that cpu specific code can implement to allow for various modifications to the state of the machine right before we boot. This can be useful to setup register state to a specific configuration. Signed-off-by: Kumar Gala ga...@kernel.crashing.org --- common/cmd_bootm.c | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 86c8122..766889a 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -166,6 +166,13 @@ void __arch_lmb_reserve(struct lmb *lmb) } void arch_lmb_reserve(struct lmb *lmb) __attribute__((weak, alias(__arch_lmb_reserve))); +/* Allow for arch specific config before we boot */ +void __arch_preboot(void) +{ +/* please define platform specific arch_preboot() */ +} +void arch_preboot(void) __attribute__((weak, alias(__arch_preboot))); + why not a section so you will be able to have multiple callback so it can be arch or soc or board too in any combination Because the use I have for it is a simple single case at this point. If and when we need more complexity we can add it. - k ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot