Received: from list by lists.gnu.org with archive (Exim 4.71) id 1c81UZ-00068z-DG for mharc-grub-devel@gnu.org; Sat, 19 Nov 2016 03:59:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47080) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c81UV-00068P-Sn for grub-devel@gnu.org; Sat, 19 Nov 2016 03:59:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c81US-0004gI-NQ for grub-devel@gnu.org; Sat, 19 Nov 2016 03:59:19 -0500 Received: from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]:32884) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c81US-0004fG-GH for grub-devel@gnu.org; Sat, 19 Nov 2016 03:59:16 -0500 Received: by mail-qt0-x244.google.com with SMTP id n6so20613226qtd.0 for ; Sat, 19 Nov 2016 00:59:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to; bh=QPFNRR0NIMLZoPEg/glD2sfAOKKHsaL9f6utaeQ0C54=; b=z0GNl+OEixfWCDYzmFOCApnJPFKQ5kppXQXgr3nz2q/yLXxQqMwoH2sJUZyX5TMU60 RcCd/11vJJIPu/uWHgkonWuua76vRZanIs1X+bbDxpV0joOEZNUKktAohhDRF1VSHc2/ ygUZypL7r68CbMS3NOjgmeajmLxmqT/UIHHeefI+teqBGG5Z/LU+bMe/TTn0CSrIaTx6 sYsdRS/ZuqlbpOah6b2YYZEQ267uacIFLufrDOTeMTLm8UprsSwDmYm55JrZt7Ww0LuS yk3qL18C3Cu4FoyaX0jhNj6G4zh21ewb+lc35TYmOPEFwdhijiVr3e2TjEbgtcpzIqQN meFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to; bh=QPFNRR0NIMLZoPEg/glD2sfAOKKHsaL9f6utaeQ0C54=; b=ZMriHzqNn8U8rlqxCncaUhhCpavvXp6iSrorGfcHMBLzkZkkt7DXwGLlK9DEgNf1+t pwETSnO35UWPQMfHYmtxuky346njuiKjtxCzyJYDERN9oacs4key87eJ6gXHrP4VCTID HjLD0YACI3iuLyogoFzYunrrMoRYGZ6gwF/WmdFGFhWE/UfAABr4RHovantg1aJWoK1q nlTPm/NGOHtHK46MNsoJdi1DachzZCuBZ9aHp6S/cz3nHMJRy0oF2WW9Cx8Vfjkdz7U+ Avs2vr7eRtcVw9VoGI9nw02bHduuigLKejnZtBB9mASQVjb1/jJFLsKhXe6PJNOVqfc6 epMQ== X-Gm-Message-State: AKaTC02ms/LdgQ+OjHhU5UWGj44QRSNFqJNXPYUq7N0x/JEwfSpn0HaT9hZ42fdh/yUREA== X-Received: by 10.25.66.213 with SMTP id p204mr926619lfa.110.1479545955147; Sat, 19 Nov 2016 00:59:15 -0800 (PST) Received: from [192.168.1.44] (ppp109-252-90-55.pppoe.spdop.ru. [109.252.90.55]) by smtp.gmail.com with ESMTPSA id s64sm3263696lfs.38.2016.11.19.00.59.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Nov 2016 00:59:13 -0800 (PST) Subject: Re: [PATCH] disk/mdraid1x: Fix >2TB RAID detection with BIOS To: Robert LeBlanc References: <20161117200907.18342-1-robert@leblancnet.us> <3d20e6ef-8c14-fea3-84a7-96b28c648fef@gmail.com> Cc: The development of GNU GRUB From: Andrei Borzenkov Message-ID: <2473dccf-4466-3cab-3fef-76f6366fe28a@gmail.com> Date: Sat, 19 Nov 2016 11:59:12 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------2870F159D6F1C7AB5614C57E" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c0d::244 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Nov 2016 08:59:21 -0000 This is a multi-part message in MIME format. --------------2870F159D6F1C7AB5614C57E Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 18.11.2016 23:43, Robert LeBlanc пишет: > > grub> ls -l > Device hd0: No known filesystem detected - Sector size 512B - Total size > 2147483648KiB > Partition hd0,gpt2: No known filesystem detected - Partition start at > 2048KiB - Total size 5368707055.5KiB > Partition hd0,gpt1: No known filesystem detected - Partition start at > 1024KiB - Total size 1024KiB Oh. Could you please run attached patch on top of pure GIT (without your patch) and send me output. It adds some debug print to biosdisk driver so we can try to guess what happens. After building, generate minimal image to avoid too much output bor@bor-Latitude-E5450:~/build/grub$ echo "set debug=biosdisk" > /tmp/load.cfg bor@bor-Latitude-E5450:~/build/grub$ pkgdatadir=$PWD ./grub-mkimage -O i386-pc -d grub-core -o grub.img -p "(md/xxx)/" -c /tmp/load.cfg biosdisk mdraid1x Actual array name is irrelevant and is there simply to force raid scan. After that copy it to /boot, go to GRUB CLI and run multiboot /boot/grub.img boot --------------2870F159D6F1C7AB5614C57E Content-Type: text/x-patch; name="biosdisk.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="biosdisk.patch" From: Andrei Borzenkov Subject: [PATCH] biosdisk: debug output for disk parameters Add debug output to track BIOS behavior with 4Kn disks. --- grub-core/disk/i386/pc/biosdisk.c | 45 +++++++++++++++++++++++++++++++++= ++---- include/grub/i386/pc/biosdisk.h | 1 + 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/grub-core/disk/i386/pc/biosdisk.c b/grub-core/disk/i386/pc/b= iosdisk.c index f0aadd1..ef69f13 100644 --- a/grub-core/disk/i386/pc/biosdisk.c +++ b/grub-core/disk/i386/pc/biosdisk.c @@ -84,6 +84,8 @@ grub_biosdisk_rw_int13_extensions (int ah, int drive, v= oid *dap) =20 grub_bios_interrupt (0x13, ®s); return (regs.eax >> 8) & 0xff; + // return regs.flags & GRUB_CPU_INT_FLAGS_CARRY ? (regs.eax >> 8) & 0x= ff : 0; + } =20 /* @@ -335,6 +337,7 @@ grub_biosdisk_open (const char *name, grub_disk_t dis= k) grub_uint64_t total_sectors =3D 0; int drive; struct grub_biosdisk_data *data; + int ret; =20 drive =3D grub_biosdisk_get_drive (name); if (drive < 0) @@ -369,11 +372,17 @@ grub_biosdisk_open (const char *name, grub_disk_t d= isk) struct grub_biosdisk_drp *drp =3D (struct grub_biosdisk_drp *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR; =20 + grub_dprintf ("biosdisk", "%s: int13 version=3D%u\n", disk->name, ver= sion); /* Clear out the DRP. */ grub_memset (drp, 0, sizeof (*drp)); drp->size =3D sizeof (*drp); - if (! grub_biosdisk_get_diskinfo_int13_extensions (drive, drp)) + if (! (ret =3D grub_biosdisk_get_diskinfo_int13_extensions (drive, dr= p))) { + grub_dprintf ("biosdisk", "%s: DRP size=3D%u flags=3D%x c=3D%u h=3D= %u s=3D%u t=3D%" + PRIuGRUB_UINT64_T " bpi=3D%u\n", + disk->name, drp->size, drp->flags, drp->cylinders, drp->heads, + drp->sectors, drp->total_sectors, drp->bytes_per_sector); + data->flags =3D GRUB_BIOSDISK_FLAG_LBA; =20 if (drp->total_sectors) @@ -394,16 +403,22 @@ grub_biosdisk_open (const char *name, grub_disk_t d= isk) disk->log_sector_size++); } } + else + grub_dprintf ("biosdisk", "%s: int13 get ext failed %x\n", disk->na= me, ret); } + else + grub_dprintf ("biosdisk", "%s: int13 check ext failed\n", disk->name); } =20 if (! (data->flags & GRUB_BIOSDISK_FLAG_CDROM)) { - if (grub_biosdisk_get_diskinfo_standard (drive, + if ((ret =3D grub_biosdisk_get_diskinfo_standard (drive, &data->cylinders, &data->heads, - &data->sectors) !=3D 0) + &data->sectors)) !=3D 0) { + grub_dprintf ("biosdisk", "%s: get_diskinfo failed %x\n", disk->name,= ret); + if (total_sectors && (data->flags & GRUB_BIOSDISK_FLAG_LBA)) { data->sectors =3D 63; @@ -419,6 +434,9 @@ grub_biosdisk_open (const char *name, grub_disk_t dis= k) return grub_error (GRUB_ERR_BAD_DEVICE, "%s cannot get C/H/S valu= es", disk->name); } } + else + grub_dprintf ("biosdisk", "%s: C/H/S=3D%lu/%lu/%lu\n", disk->name, + data->cylinders, data->heads, data->sectors); =20 if (data->sectors =3D=3D 0) data->sectors =3D 63; @@ -461,6 +479,7 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk, unsigned segment) { struct grub_biosdisk_data *data =3D disk->data; + int ret; =20 /* VirtualBox fails with sectors above 2T on CDs. Since even BD-ROMS are never that big anyway, return error. */ @@ -501,19 +520,37 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk, disk->name); } else - if (grub_biosdisk_rw_int13_extensions (cmd + 0x42, data->drive, = dap)) + if ((ret =3D grub_biosdisk_rw_int13_extensions (cmd + 0x42, data= ->drive, dap))) { + grub_dprintf ("biosdisk", "%s: ext sec=3D%" PRIuGRUB_UINT64_T " siz= e=3D%" + PRIuGRUB_SIZE " ret=3D%u\n", + disk->name, sector, size, ret); + /* Fall back to the CHS mode. */ data->flags &=3D ~GRUB_BIOSDISK_FLAG_LBA; disk->total_sectors =3D data->cylinders * data->heads * data->secto= rs; return grub_biosdisk_rw (cmd, disk, sector, size, segment); } + else if (!(data->flags & GRUB_BIOSDISK_FLAG_DPRINT)) + { + grub_dprintf ("biosdisk", "%s: ext sec=3D%" PRIuGRUB_UINT64_T " siz= e=3D%" + PRIuGRUB_SIZE "\n", + disk->name, sector, size); + data->flags |=3D GRUB_BIOSDISK_FLAG_DPRINT; + } } else { unsigned coff, hoff, soff; unsigned head; =20 + if (!(data->flags & GRUB_BIOSDISK_FLAG_DPRINT)) + { + grub_dprintf ("biosdisk", "%s: legacy sec=3D%" PRIuGRUB_UINT64_T " si= ze=3D%" + PRIuGRUB_SIZE "\n", + disk->name, sector, size); + data->flags |=3D GRUB_BIOSDISK_FLAG_DPRINT; + } /* It is impossible to reach over 8064 MiB (a bit less than LBA24)= with the traditional CHS access. */ if (sector > diff --git a/include/grub/i386/pc/biosdisk.h b/include/grub/i386/pc/biosd= isk.h index 3d80716..fa0862f 100644 --- a/include/grub/i386/pc/biosdisk.h +++ b/include/grub/i386/pc/biosdisk.h @@ -24,6 +24,7 @@ =20 #define GRUB_BIOSDISK_FLAG_LBA 1 #define GRUB_BIOSDISK_FLAG_CDROM 2 +#define GRUB_BIOSDISK_FLAG_DPRINT 4 =20 #define GRUB_BIOSDISK_CDTYPE_NO_EMUL 0 #define GRUB_BIOSDISK_CDTYPE_1_2_M 1 --=20 tg: (0d663b5..) t/biosdisk (depends on: master) --------------2870F159D6F1C7AB5614C57E--