Subject: Re: [PATCH 2/3] celleb: add supporting for native CBE

From: Arnd Bergmann <[email-masked]>
Date: Tue, 4 Dec 2007 14:21:46 +0100

On Tuesday 04 December 2007, Ishizaki Kou wrote:
> This patch adds supporting for native CBE on Celleb. =A0Many codes in
> platforms/cell/ are used when native CBE environment.
>=20
> Signed-off-by: Kou Ishizaki <[email-masked]>

Ah, excellent to hear that this is now working!

I'd suggest doing the initialization in a different way, so that you don't
need to decide on so many attributes dynamically. The easiest way would
probably be to have two separate define_machine() calls in the celleb
definition, like

define_machine(celleb_beat) {
        .probe                  =3D celleb_probe_beat,
        .setup_arch             =3D celleb_setup_arch_native,
        .show_cpuinfo           =3D celleb_show_cpuinfo,
        .restart                =3D beat_restart,
        .power_off              =3D beat_power_off,
        .halt                   =3D beat_halt,
        .get_rtc_time           =3D beat_get_rtc_time,
        .set_rtc_time           =3D beat_set_rtc_time,
        .calibrate_decr         =3D generic_calibrate_decr,
        .progress               =3D celleb_progress,
        .power_save             =3D beat_power_save,
        .nvram_size             =3D beat_nvram_get_size,
        .nvram_read             =3D beat_nvram_read,
        .nvram_write            =3D beat_nvram_write,
        .set_dabr               =3D beat_set_xdabr,
        .init_IRQ               =3D beatic_init_IRQ,
        .get_irq                =3D beatic_get_irq,
        .pci_probe_mode         =3D celleb_pci_probe_mode,
        .pci_setup_phb          =3D celleb_setup_phb,
	...
};

define_machine(celleb_native) {
        .probe                  =3D celleb_probe_native,
        .setup_arch             =3D celleb_setup_arch_native,
        .show_cpuinfo           =3D celleb_show_cpuinfo,
        .restart                =3D rtas_restart,
        .power_off              =3D rtas_power_off,
        .halt                   =3D rtas_halt,
        .get_rtc_time           =3D rtas_get_rtc_time,
        .set_rtc_time           =3D rtas_set_rtc_time,
        .calibrate_decr         =3D generic_calibrate_decr,
        .progress               =3D celleb_progress,
        .init_IRQ               =3D celleb_init_IRQ_native,
        .get_irq                =3D celleb_get_irq_native,
        .pci_probe_mode         =3D celleb_pci_probe_mode,
        .pci_setup_phb          =3D celleb_setup_phb,
	...
};

=46or this, you can either have the two machine definitions in the
same celleb/setup.c, or split setup.c into machine specific files,
depending on how much ends up being shared in the end.

An interesting question still is how close the native celleb machine
definition is to the one from platforms/cell/setup.c. Maybe it's best
to have a common machine definition for these two in the end.

	Arnd <><