~ubuntu-branches/ubuntu/maverick/grub2/maverick-proposed

« back to all changes in this revision

Viewing changes to disk/ata.c

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2010-07-12 15:02:28 UTC
  • mfrom: (1.17.1 upstream) (17.3.24 sid)
  • Revision ID: james.westby@ubuntu.com-20100712150228-pcklwlp83nbgony1
Tags: 1.98+20100710-1ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Adjust for default Ubuntu boot options ("quiet splash").
  - Default to hiding the menu; holding down Shift at boot will show it.
  - Set a monochromatic theme for Ubuntu.
  - Apply Ubuntu GRUB Legacy changes to legacy update-grub script: title,
    recovery mode, quiet option, tweak how memtest86+ is displayed, and
    use UUIDs where appropriate.
  - Fix backslash-escaping in merge_debconf_into_conf.
  - Remove "GNU/Linux" from default distributor string.
  - Add crashkernel= options if kdump and makedumpfile are available.
  - If other operating systems are installed, then automatically unhide
    the menu.  Otherwise, if GRUB_HIDDEN_TIMEOUT is 0, then use keystatus
    if available to check whether Shift is pressed.  If it is, show the
    menu, otherwise boot immediately.  If keystatus is not available, then
    fall back to a short delay interruptible with Escape.
  - Allow Shift to interrupt 'sleep --interruptible'.
  - Don't display introductory message about line editing unless we're
    actually offering a shell prompt.  Don't clear the screen just before
    booting if we never drew the menu in the first place.
  - Remove some verbose messages printed before reading the configuration
    file.
  - Suppress progress messages as the kernel and initrd load for
    non-recovery kernel menu entries.
  - Keep the loopback file open so that subsequent changes to the "root"
    environment variable don't affect it.
  - Change prepare_grub_to_access_device to handle filesystems
    loop-mounted on file images.
  - Ignore devices loop-mounted from files in 10_linux.
  - Show the boot menu if the previous boot failed, that is if it failed
    to get to the end of one of the normal runlevels.
  - Handle RAID devices containing virtio components.
  - Don't generate /boot/grub/device.map during grub-install or
    grub-mkconfig by default.
  - Adjust upgrade version checks for Ubuntu.
  - Change priority to optional to match the priority of grub.
  - Don't display "GRUB loading" unless Shift is held down.
  - Adjust versions of grub-doc and grub-legacy-doc conflicts to tolerate
    our backport of the grub-doc split.
  - Fix LVM/RAID probing in the absence of /boot/grub/device.map.
  - Look for .mo files in /usr/share/locale-langpack as well, in
    preference.
  - Make sure GRUB_TIMEOUT isn't quoted unnecessarily.
  - Probe all devices in 'grub-probe --target=drive' if
    /boot/grub/device.map is missing.
  - Adjust hostdisk id for hard disks, allowing grub-setup to use its
    standard workaround for broken BIOSes.
  - grub-common Breaks: lupin-support (<< 0.30) due to a grub-mkimage
    syntax change.
  - Build-depend on qemu-kvm rather than qemu-system for grub-pc tests.
  - Use qemu rather than qemu-system-i386.
  - Extend the EFI version of grub-install to be able to install into an
    EFI System Partition mounted on /boot/efi in a location that complies
    with the EFI specification.
  - Upgrade the installed core image when upgrading grub-efi-ia32 or
    grub-efi-amd64, although only if /boot/efi/EFI/ubuntu already exists.
  - Make grub-efi-ia32 and grub-efi-amd64 depend on efibootmgr so that
    grub-install works properly.
* Canonicalise device paths when building a device map on the fly.
* Program vesafb on BIOS systems rather than efifb, and return to enabling
  gfxpayload=keep by default if the kernel has the necessary support
  built-in.

Show diffs side-by-side

added added

removed removed

Lines of Context:
768
768
/* ATAPI code.  */
769
769
 
770
770
static int
771
 
grub_atapi_iterate (int (*hook) (const char *name, int luns))
 
771
grub_atapi_iterate (int (*hook) (int bus, int luns))
772
772
{
773
773
  struct grub_ata_device *dev;
774
774
 
775
775
  for (dev = grub_ata_devices; dev; dev = dev->next)
776
776
    {
777
 
      char devname[10];
778
 
 
779
777
      grub_err_t err;
780
778
 
781
779
      err = check_device (dev);
785
783
          continue;
786
784
        }
787
785
 
788
 
      grub_snprintf (devname, sizeof (devname),
789
 
                     "ata%d", dev->port * 2 + dev->device);
790
 
 
791
786
      if (! dev->atapi)
792
787
        continue;
793
788
 
794
 
      if (hook (devname, 1))
 
789
      if (hook (dev->port * 2 + dev->device, 1))
795
790
        return 1;
796
791
    }
797
792
 
851
846
}
852
847
 
853
848
static grub_err_t
854
 
grub_atapi_open (const char *name, struct grub_scsi *scsi)
 
849
grub_atapi_open (int devnum, struct grub_scsi *scsi)
855
850
{
856
851
  struct grub_ata_device *dev;
857
852
  struct grub_ata_device *devfnd = 0;
859
854
 
860
855
  for (dev = grub_ata_devices; dev; dev = dev->next)
861
856
    {
862
 
      char devname[10];
863
 
      grub_snprintf (devname, sizeof (devname),
864
 
                     "ata%d", dev->port * 2 + dev->device);
865
 
 
866
 
      if (!grub_strcmp (devname, name))
 
857
      if (dev->port * 2 + dev->device == devnum)
867
858
        {
868
859
          devfnd = dev;
869
860
          break;
870
861
        }
871
862
    }
872
863
 
873
 
  grub_dprintf ("ata", "opening ATAPI dev `%s'\n", name);
 
864
  grub_dprintf ("ata", "opening ATAPI dev `ata%d'\n", devnum);
874
865
 
875
866
  if (! devfnd)
876
867
    return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no such ATAPI device");
887
878
  return GRUB_ERR_NONE;
888
879
}
889
880
 
890
 
static void
891
 
grub_atapi_close (struct grub_scsi *scsi)
892
 
{
893
 
  grub_free (scsi->name);
894
 
}
895
881
 
896
882
static struct grub_scsi_dev grub_atapi_dev =
897
883
  {
898
 
    .name = "ATAPI",
 
884
    .name = "ata",
 
885
    .id = GRUB_SCSI_SUBSYSTEM_ATAPI,
899
886
    .iterate = grub_atapi_iterate,
900
887
    .open = grub_atapi_open,
901
 
    .close = grub_atapi_close,
902
888
    .read = grub_atapi_read,
903
889
    .write = grub_atapi_write
904
890
  };