SHA256
1
0
forked from pool/grub2

Accepting request 355410 from Base:System

1

OBS-URL: https://build.opensuse.org/request/show/355410
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=131
This commit is contained in:
Dominique Leuenberger 2016-01-28 16:18:40 +00:00 committed by Git OBS Bridge
commit da4a43972b
7 changed files with 1294 additions and 2 deletions

View File

@ -0,0 +1,28 @@
From 2e62352bc28bd5d3efafc1b5cbe211ff9e9987fd Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Tue, 20 Jan 2015 21:07:08 +0100
Subject: [PATCH] * grub-core/kern/i386/tsc.c (calibrate_tsc): Ensure
that no division by 0 occurs.
---
ChangeLog | 5 +++++
grub-core/kern/i386/tsc.c | 6 +++++-
2 files changed, 10 insertions(+), 1 deletion(-)
Index: grub-2.02~beta2/grub-core/kern/i386/tsc.c
===================================================================
--- grub-2.02~beta2.orig/grub-core/kern/i386/tsc.c
+++ grub-2.02~beta2/grub-core/kern/i386/tsc.c
@@ -122,7 +122,11 @@ calibrate_tsc (void)
grub_pit_wait (0xffff);
end_tsc = grub_get_tsc ();
- grub_tsc_rate = grub_divmod64 ((55ULL << 32), end_tsc - tsc_boot_time, 0);
+ grub_tsc_rate = 0;
+ if (end_tsc > tsc_boot_time)
+ grub_tsc_rate = grub_divmod64 ((55ULL << 32), end_tsc - tsc_boot_time, 0);
+ if (grub_tsc_rate == 0)
+ grub_tsc_rate = 5368;/* 800 MHz */
}
#endif

View File

@ -0,0 +1,31 @@
From 50ebc8f5f35a322b3736c03e16de7108932126b0 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sun, 22 Feb 2015 13:12:44 +0100
Subject: [PATCH] i386/tsc: Fix unused function warning on xen.
---
grub-core/kern/i386/tsc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: grub-2.02~beta2/grub-core/kern/i386/tsc.c
===================================================================
--- grub-2.02~beta2.orig/grub-core/kern/i386/tsc.c
+++ grub-2.02~beta2/grub-core/kern/i386/tsc.c
@@ -57,6 +57,8 @@ grub_get_tsc (void)
return (((grub_uint64_t) hi) << 32) | lo;
}
+#ifndef GRUB_MACHINE_XEN
+
static __inline int
grub_cpu_is_tsc_supported (void)
{
@@ -69,8 +71,6 @@ grub_cpu_is_tsc_supported (void)
return (d & (1 << 4)) != 0;
}
-#ifndef GRUB_MACHINE_XEN
-
static void
grub_pit_wait (grub_uint16_t tics)
{

View File

@ -0,0 +1,80 @@
From 07258815e96aab2c72593d0129d17051cbf68d27 Mon Sep 17 00:00:00 2001
From: Andrei Borzenkov <arvidjaar@gmail.com>
Date: Fri, 8 May 2015 06:15:16 +0300
Subject: [PATCH] acpi: do not skip BIOS scan if EBDA length is zero
EBDA layout is not standardized so we cannot assume first two bytes
are length. Neither is it required by ACPI standard. HP 8710W is known
to contain zeroes here.
Closes: 45002
---
grub-core/commands/acpi.c | 4 ++++
grub-core/commands/i386/pc/acpi.c | 10 ++++++----
2 files changed, 10 insertions(+), 4 deletions(-)
Index: grub-2.02~beta2/grub-core/commands/acpi.c
===================================================================
--- grub-2.02~beta2.orig/grub-core/commands/acpi.c
+++ grub-2.02~beta2/grub-core/commands/acpi.c
@@ -179,8 +179,10 @@ grub_acpi_create_ebda (void)
struct grub_acpi_rsdp_v20 *v2;
ebda = (grub_uint8_t *) (grub_addr_t) ((*((grub_uint16_t *)0x40e)) << 4);
+ grub_dprintf ("acpi", "EBDA @%p\n", ebda);
if (ebda)
ebda_kb_len = *(grub_uint16_t *) ebda;
+ grub_dprintf ("acpi", "EBDA length 0x%x\n", ebda_kb_len);
if (ebda_kb_len > 16)
ebda_kb_len = 0;
ctx.ebda_len = (ebda_kb_len + 1) << 10;
@@ -494,6 +496,8 @@ grub_cmd_acpi (struct grub_extcmd_contex
if (! rsdp)
rsdp = grub_machine_acpi_get_rsdpv1 ();
+ grub_dprintf ("acpi", "RSDP @%p\n", rsdp);
+
if (rsdp)
{
grub_uint32_t *entry_ptr;
Index: grub-2.02~beta2/grub-core/commands/i386/pc/acpi.c
===================================================================
--- grub-2.02~beta2.orig/grub-core/commands/i386/pc/acpi.c
+++ grub-2.02~beta2/grub-core/commands/i386/pc/acpi.c
@@ -29,14 +29,15 @@ grub_machine_acpi_get_rsdpv1 (void)
grub_dprintf ("acpi", "Looking for RSDP. Scanning EBDA\n");
ebda = (grub_uint8_t *) ((* ((grub_uint16_t *) 0x40e)) << 4);
ebda_len = * (grub_uint16_t *) ebda;
- if (! ebda_len)
- return 0;
+ if (! ebda_len) /* FIXME do we really need this check? */
+ goto scan_bios;
for (ptr = ebda; ptr < ebda + 0x400; ptr += 16)
if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
&& grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0
&& ((struct grub_acpi_rsdp_v10 *) ptr)->revision == 0)
return (struct grub_acpi_rsdp_v10 *) ptr;
+scan_bios:
grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n");
for (ptr = (grub_uint8_t *) 0xe0000; ptr < (grub_uint8_t *) 0x100000;
ptr += 16)
@@ -56,8 +57,8 @@ grub_machine_acpi_get_rsdpv2 (void)
grub_dprintf ("acpi", "Looking for RSDP. Scanning EBDA\n");
ebda = (grub_uint8_t *) ((* ((grub_uint16_t *) 0x40e)) << 4);
ebda_len = * (grub_uint16_t *) ebda;
- if (! ebda_len)
- return 0;
+ if (! ebda_len) /* FIXME do we really need this check? */
+ goto scan_bios;
for (ptr = ebda; ptr < ebda + 0x400; ptr += 16)
if (grub_memcmp (ptr, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
&& grub_byte_checksum (ptr, sizeof (struct grub_acpi_rsdp_v10)) == 0
@@ -67,6 +68,7 @@ grub_machine_acpi_get_rsdpv2 (void)
== 0)
return (struct grub_acpi_rsdp_v20 *) ptr;
+scan_bios:
grub_dprintf ("acpi", "Looking for RSDP. Scanning BIOS\n");
for (ptr = (grub_uint8_t *) 0xe0000; ptr < (grub_uint8_t *) 0x100000;
ptr += 16)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
From a03c1034f6062e69075056c8f31b90e159ce5244 Mon Sep 17 00:00:00 2001
From: Michael Chang <mchang@suse.com>
Date: Tue, 1 Dec 2015 18:49:38 +0300
Subject: [PATCH] i386: fix TSC calibration using PIT
Condition was accidentally reversed, so PIT calibration always failed
when PIT was present and always succeeded when PIT was missing, but in
the latter case resulted in absurdly fast clock.
Reported and tested by Vitaly Kuznetsov <vkuznets@redhat.com>
---
grub-core/kern/i386/tsc_pit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: grub-2.02~beta2/grub-core/kern/i386/tsc_pit.c
===================================================================
--- grub-2.02~beta2.orig/grub-core/kern/i386/tsc_pit.c
+++ grub-2.02~beta2/grub-core/kern/i386/tsc_pit.c
@@ -49,7 +49,7 @@ grub_pit_wait (void)
| GRUB_PIT_SPK_TMR2,
GRUB_PIT_SPEAKER_PORT);
- if ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH)) {
+ if ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH) == 0x00) {
ret = 1;
/* Wait. */
while ((grub_inb (GRUB_PIT_SPEAKER_PORT) & GRUB_PIT_SPK_TMR2_LATCH) == 0x00);

View File

@ -1,5 +1,16 @@
-------------------------------------------------------------------
Wed Mon 28 16:53:54 UTC 2015 - arvidjaar@gmail.com
Wed Jan 20 11:44:27 UTC 2016 - mchang@suse.com
- Backport upstream patches for HyperV gen2 TSC timer calbration without
RTC (bsc#904647)
* added 0001-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch
* added 0002-i386-tsc-Fix-unused-function-warning-on-xen.patch
* added 0003-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch
* added 0004-tsc-Use-alternative-delay-sources-whenever-appropria.patch
* added 0005-i386-fix-TSC-calibration-using-PIT.patch
-------------------------------------------------------------------
Wed Dec 28 16:53:54 UTC 2015 - arvidjaar@gmail.com
- Add 0001-menu-fix-line-count-calculation-for-long-lines.patch (bsc#943585)

View File

@ -1,7 +1,7 @@
#
# spec file for package grub2
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -263,6 +263,12 @@ Patch263: 0004-linux-ofpath-fix-descriptor-leak.patch
Patch264: 0005-grub-fstest-fix-descriptor-leak.patch
# Upstream patch to fix patch 0001-unix-password-Fix-file-descriptor-leak.patch
Patch265: 0001-unix-do-not-close-stdin-in-grub_passwd_get.patch
# Backport upstream patches for HyperV gen2 TSC timer calbration without RTC (bsc#904647)
Patch270: 0001-grub-core-kern-i386-tsc.c-calibrate_tsc-Ensure-that.patch
Patch271: 0002-i386-tsc-Fix-unused-function-warning-on-xen.patch
Patch272: 0003-acpi-do-not-skip-BIOS-scan-if-EBDA-length-is-zero.patch
Patch273: 0004-tsc-Use-alternative-delay-sources-whenever-appropria.patch
Patch274: 0005-i386-fix-TSC-calibration-using-PIT.patch
Requires: gettext-runtime
%if 0%{?suse_version} >= 1140
@ -535,6 +541,11 @@ mv po/grub.pot po/%{name}.pot
%patch263 -p1
%patch264 -p1
%patch265 -p1
%patch270 -p1
%patch271 -p1
%patch272 -p1
%patch273 -p1
%patch274 -p1
# Generate po/LINGUAS for message catalogs ...
./linguas.sh