WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH]: Fix rombios to correctly report size of disks >

To: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>, Xen Devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH]: Fix rombios to correctly report size of disks >16GB
From: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Date: Thu, 22 Jul 2010 19:07:13 +0100
Cc:
Delivery-date: Thu, 22 Jul 2010 11:08:09 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1279820544.1723.2029.camel@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcspxZgooBh3rpFKQwGqyw/X0ReNnwAAx2fv
Thread-topic: [Xen-devel] [PATCH]: Fix rombios to correctly report size of disks >16GB
User-agent: Microsoft-Entourage/12.24.0.100205
On 22/07/2010 18:42, "Gianni Tedesco" <gianni.tedesco@xxxxxxxxxx> wrote:

> Cosmetic patch for rombios to display the correct sizes of disks larger
> than 16GB - a problem caused by needlessly casting sizeinmb variable
> down to 16bits.

For say a 17GB drive sizeinmb=17000 which can be represented with fewer than
16 bits. I don't see how the code as it is will ever print the wrong thing,
except for drives bigger than 64TB! Also I'm not sure but I think the
integer size here may be 16 bits, and the %u format specifier would only
print 16-bit values in that case anyway.

 -- Keir

> Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
> 
> diff -r 01917c0da12a tools/firmware/rombios/rombios.c
> --- a/tools/firmware/rombios/rombios.c Thu Jul 22 13:49:40 2010 +0100
> +++ b/tools/firmware/rombios/rombios.c Thu Jul 22 18:40:26 2010 +0100
> @@ -2856,9 +2856,9 @@ void ata_detect( )
>            printf("ata%d %s: ",channel,slave?" slave":"master");
>            i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c);
>  if (sizeinmb < (1UL<<16))
> -            printf(" ATA-%d Hard-Disk (%4u MBytes)\n", version,
> (Bit16u)sizeinmb);
> +            printf(" ATA-%d Hard-Disk (%4u MBytes)\n", version, sizeinmb);
>  else
> -            printf(" ATA-%d Hard-Disk (%4u GBytes)\n", version,
> (Bit16u)(sizeinmb>>10));
> +            printf(" ATA-%d Hard-Disk (%4u GBytes)\n", version,
> (sizeinmb>>10));
>            break;
>          case ATA_TYPE_ATAPI:
>            printf("ata%d %s: ",channel,slave?" slave":"master");
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel