Skip to content

Commit

Permalink
[POWERPC] spu_manage: fix spu_unit_number for celleb device tree
Browse files Browse the repository at this point in the history
This fixes a regression introduced with 2.6.23-rc4 after on some
confusion about the device tree interfaces.

IBM QS21 device trees provide "physical-id", so we changed the code to
run on that and remain compatible with all IBM machines.

However, the Toshiba Celleb device tree provides the "unit-id" property,
which was in the Linux code, but never used in this way on IBM hardware.

Legacy device tree used the reg property for the physical id of an spe.
This patch fixes find_spu_unit_number to look for the spu id in that order.
The length is checked to avoid misinterpretation in case the attributes
unit-id or reg do not contain the id.

Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Cc: Jeremy Kerr <jk@ozlabs.org>
  • Loading branch information
Christian Krafft authored and Arnd Bergmann committed Aug 29, 2007
1 parent 5cc44e0 commit aac2e68
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arch/powerpc/platforms/cell/spu_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,18 @@ static u64 __init find_spu_unit_number(struct device_node *spe)
{
const unsigned int *prop;
int proplen;

/* new device trees should provide the physical-id attribute */
prop = of_get_property(spe, "physical-id", &proplen);
if (proplen == 4)
return (u64)*prop;

/* celleb device tree provides the unit-id */
prop = of_get_property(spe, "unit-id", &proplen);
if (proplen == 4)
return (u64)*prop;

/* legacy device trees provide the id in the reg attribute */
prop = of_get_property(spe, "reg", &proplen);
if (proplen == 4)
return (u64)*prop;
Expand Down

0 comments on commit aac2e68

Please sign in to comment.