From patchwork Sat Nov 19 08:59:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrei Borzenkov X-Patchwork-Id: 83086 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp504651qge; Sat, 19 Nov 2016 00:59:52 -0800 (PST) X-Received: by 10.55.18.30 with SMTP id c30mr5160596qkh.213.1479545992050; Sat, 19 Nov 2016 00:59:52 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l125si7673023qkd.129.2016.11.19.00.59.51 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 19 Nov 2016 00:59:52 -0800 (PST) Received-SPF: pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=grub-devel-bounces+patch=linaro.org@gnu.org; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Received: from localhost ([::1]:40573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c81V1-00068U-IB for patch@linaro.org; Sat, 19 Nov 2016 03:59:51 -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> 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: 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: , Reply-To: The development of GNU GRUB Cc: The development of GNU GRUB Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: "Grub-devel" 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 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel 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/biosdisk.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, void *dap) grub_bios_interrupt (0x13, ®s); return (regs.eax >> 8) & 0xff; + // return regs.flags & GRUB_CPU_INT_FLAGS_CARRY ? (regs.eax >> 8) & 0xff : 0; + } /* @@ -335,6 +337,7 @@ grub_biosdisk_open (const char *name, grub_disk_t disk) grub_uint64_t total_sectors = 0; int drive; struct grub_biosdisk_data *data; + int ret; drive = grub_biosdisk_get_drive (name); if (drive < 0) @@ -369,11 +372,17 @@ grub_biosdisk_open (const char *name, grub_disk_t disk) struct grub_biosdisk_drp *drp = (struct grub_biosdisk_drp *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR; + grub_dprintf ("biosdisk", "%s: int13 version=%u\n", disk->name, version); /* Clear out the DRP. */ grub_memset (drp, 0, sizeof (*drp)); drp->size = sizeof (*drp); - if (! grub_biosdisk_get_diskinfo_int13_extensions (drive, drp)) + if (! (ret = grub_biosdisk_get_diskinfo_int13_extensions (drive, drp))) { + grub_dprintf ("biosdisk", "%s: DRP size=%u flags=%x c=%u h=%u s=%u t=%" + PRIuGRUB_UINT64_T " bpi=%u\n", + disk->name, drp->size, drp->flags, drp->cylinders, drp->heads, + drp->sectors, drp->total_sectors, drp->bytes_per_sector); + data->flags = GRUB_BIOSDISK_FLAG_LBA; if (drp->total_sectors) @@ -394,16 +403,22 @@ grub_biosdisk_open (const char *name, grub_disk_t disk) disk->log_sector_size++); } } + else + grub_dprintf ("biosdisk", "%s: int13 get ext failed %x\n", disk->name, ret); } + else + grub_dprintf ("biosdisk", "%s: int13 check ext failed\n", disk->name); } if (! (data->flags & GRUB_BIOSDISK_FLAG_CDROM)) { - if (grub_biosdisk_get_diskinfo_standard (drive, + if ((ret = grub_biosdisk_get_diskinfo_standard (drive, &data->cylinders, &data->heads, - &data->sectors) != 0) + &data->sectors)) != 0) { + grub_dprintf ("biosdisk", "%s: get_diskinfo failed %x\n", disk->name, ret); + if (total_sectors && (data->flags & GRUB_BIOSDISK_FLAG_LBA)) { data->sectors = 63; @@ -419,6 +434,9 @@ grub_biosdisk_open (const char *name, grub_disk_t disk) return grub_error (GRUB_ERR_BAD_DEVICE, "%s cannot get C/H/S values", disk->name); } } + else + grub_dprintf ("biosdisk", "%s: C/H/S=%lu/%lu/%lu\n", disk->name, + data->cylinders, data->heads, data->sectors); if (data->sectors == 0) data->sectors = 63; @@ -461,6 +479,7 @@ grub_biosdisk_rw (int cmd, grub_disk_t disk, unsigned segment) { struct grub_biosdisk_data *data = disk->data; + int ret; /* 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 = grub_biosdisk_rw_int13_extensions (cmd + 0x42, data->drive, dap))) { + grub_dprintf ("biosdisk", "%s: ext sec=%" PRIuGRUB_UINT64_T " size=%" + PRIuGRUB_SIZE " ret=%u\n", + disk->name, sector, size, ret); + /* Fall back to the CHS mode. */ data->flags &= ~GRUB_BIOSDISK_FLAG_LBA; disk->total_sectors = data->cylinders * data->heads * data->sectors; return grub_biosdisk_rw (cmd, disk, sector, size, segment); } + else if (!(data->flags & GRUB_BIOSDISK_FLAG_DPRINT)) + { + grub_dprintf ("biosdisk", "%s: ext sec=%" PRIuGRUB_UINT64_T " size=%" + PRIuGRUB_SIZE "\n", + disk->name, sector, size); + data->flags |= GRUB_BIOSDISK_FLAG_DPRINT; + } } else { unsigned coff, hoff, soff; unsigned head; + if (!(data->flags & GRUB_BIOSDISK_FLAG_DPRINT)) + { + grub_dprintf ("biosdisk", "%s: legacy sec=%" PRIuGRUB_UINT64_T " size=%" + PRIuGRUB_SIZE "\n", + disk->name, sector, size); + data->flags |= 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/biosdisk.h index 3d80716..fa0862f 100644 --- a/include/grub/i386/pc/biosdisk.h +++ b/include/grub/i386/pc/biosdisk.h @@ -24,6 +24,7 @@ #define GRUB_BIOSDISK_FLAG_LBA 1 #define GRUB_BIOSDISK_FLAG_CDROM 2 +#define GRUB_BIOSDISK_FLAG_DPRINT 4 #define GRUB_BIOSDISK_CDTYPE_NO_EMUL 0 #define GRUB_BIOSDISK_CDTYPE_1_2_M 1 -- tg: (0d663b5..) t/biosdisk (depends on: master)