From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zhenzhong Duan Subject: Re: rombios: add support for special CHS layout (spt=32) Date: Mon, 10 Dec 2012 10:15:31 +0800 Message-ID: <50C545C3.4000604@oracle.com> References: <50C161AD.9020803@oracle.com> <50C1E0A502000078000AEECA@nat28.tlf.novell.com> Reply-To: zhenzhong.duan@oracle.com Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <50C1E0A502000078000AEECA@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Joe Jin , xen-devel List-Id: xen-devel@lists.xenproject.org On 2012-12-07 19:27, Jan Beulich wrote: >>>> On 07.12.12 at 04:25, DuanZhenzhong wrote: >> When booting up windows VM which converted by dd scsi disk, it fails with >> "Error Loading Operating System", root cause is rombios doesn't simulate >> disk's >> logical CHS properly. Real bios uses spt=32 here. >> >> Signed-off-by: Zhenzhong Duan >> --- a/tools/firmware/rombios/rombios.c 2011-12-09 00:50:28.000000000 +0800 >> +++ b/tools/firmware/rombios/rombios.c 2012-11-20 09:42:50.000000000 +0800 >> @@ -2674,6 +2674,8 @@ void ata_detect( ) >> Bit32u sectors_low, sectors_high; >> Bit16u cylinders, heads, spt, blksize; >> Bit8u translation, removable, mode; >> + Bit8u i; >> + Bit8u *p; >> >> // default mode to PIO16 >> mode = ATA_MODE_PIO16; >> @@ -2738,14 +2740,32 @@ void ata_detect( ) >> case ATA_TRANSLATION_NONE: >> break; >> case ATA_TRANSLATION_LBA: >> - spt = 63; >> - sectors_low /= 63; >> - heads = sectors_low / 1024; >> - if (heads>128) heads = 255; >> - else if (heads>64) heads = 128; >> - else if (heads>32) heads = 64; >> - else if (heads>16) heads = 32; >> - else heads=16; >> + spt = heads = 0; >> + if (ata_cmd_data_in(device,ATA_CMD_READ_SECTORS, 1, 0, 0, 1, 0L, 0L, get_SS(),buffer) !=0 ) >> + BX_PANIC("ata-detect: Failed to read first sector\n"); >> + for(i=0; i<4; i++) { >> + p = buffer + 0x1be + i * 16; >> + if (read_dword(get_SS(), p+12) && read_byte(get_SS(), p+5)) { >> + /* We make the assumption that the partition terminates on >> + a cylinder boundary */ > Which certainly isn't a generally correct assumption, so I strongly > recommend against basing any decisions on that. > > Jan Thanks for comment. Are we the first facing this bug? Is there any workaround for this issue? zduan