[U-Boot] [PATCH] LaCie kirkwood boards: allow disk > 2TB

Frédéric Leroy
2013-06-13T13:36:54Z

Le 13/06/2013 15:21, Albert ARIBAUD a ?crit :

> > I guess CONFIG_LBA48 is also broken in common/cmd_ide.c :
> >
> > ulong ide_write(int device, ulong blknr, lbaint_t blkcnt, const void
> > *buffer)
> > {
> > ulong n = 0;
> > unsigned char c;
> >
> > #ifdef CONFIG_LBA48
> > unsigned char lba48 = 0;
> >
> > if (blknr & 0x0000fffff0000000ULL) { <= issue
> > /* more than 28 bits used, use 48bit mode */
> > lba48 = 1;
> > }
> > #endif
>
> How is this broken exactly, and what is the fix?

If you have a device with 0x100000000 blocks and a target architecture
with sizeof(ulong)=32, then it will fail to switch to lba48.
The right thing to do is to use lbaint_t instead of ulong blknr.