2N/A * GRUB -- GRand Unified Bootloader 2N/A * Copyright (C) 2009 Free Software Foundation, Inc. 2N/A * GRUB is free software: you can redistribute it and/or modify 2N/A * it under the terms of the GNU General Public License as published by 2N/A * the Free Software Foundation, either version 3 of the License, or 2N/A * (at your option) any later version. 2N/A * GRUB is distributed in the hope that it will be useful, 2N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of 2N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 2N/A * GNU General Public License for more details. 2N/A * You should have received a copy of the GNU General Public License 2N/A/* At the moment, only two IDE ports are supported. */ 2N/A /* IDE port to use. */ 2N/A /* IO addresses on which the registers for this device can be 2N/A /* Two devices can be connected to a single cable. Use this field 2N/A to select device 0 (commonly known as "master") or device 1 2N/A (commonly known as "slave"). */ 2N/A /* ATA requires 400ns (after a write to CMD register) or 2N/A 1 PIO cycle (after a DRQ block transfer) before 2N/A first check of BSY. */ 2N/A /* Read in the data, word by word. */ 2N/A /* Write the data, word by word. */ 2N/A/* ATA pass through support, used by hdparm.mod. */ 2N/A "ATAPI non-12 byte commands not supported");
2N/A grub_dprintf (
"pata",
"pata_pass_through: cmd=0x%x, features=0x%x, sectors=0x%x\n",
2N/A /* Set registers. */ 2N/A /* Start command. */ 2N/A /* Wait for !BSY. */ 2N/A /* Wait for !BSY. */ 2N/A /* OK if DRQ is asserted and interrupt reason is as expected. */ 2N/A /* Write the packet. */ 2N/A /* Transfer data. */ 2N/A /* Wait for !BSY. */ 2N/A /* Count of last transfer may be uneven. */ 2N/A "invalid ATAPI transfer count");
2N/A /* Check for write error. */ 2N/A /* Wait for !BSY. */ 2N/A /* Return registers. */ 2N/A /* Try to detect if the port is in use by writing to it, 2N/A waiting for a while and reading it again. If the value 2N/A was preserved, there is a device connected. */ 2N/A /* The above test may detect a second (slave) device 2N/A connected to a SATA controller which supports only one 2N/A (master) device. It is not safe to use the status register 2N/A READY bit to check for controller channel existence. Some 2N/A ATAPI commands (RESET, DIAGNOSTIC) may clear this bit. */ 2N/A /* Setup the device information. */ 2N/A /* Register the device. */ 2N/A /* AMD CS5536 Southbridge. */ 2N/A /* Check if this class ID matches that of a PCI IDE Controller. */ 2N/A /* Set to 0 when the channel operated in compatibility mode. */ 2N/A /* We don't support non-compatibility mode for CS5536. */ 2N/A /* If the channel is in compatibility mode, just assign the 2N/A default registers. */ 2N/A /* Read the BARs, which either contain a mmapped IO address 2N/A or the IO port address. */ 2N/A /* Check if the BARs describe an IO region. */ 2N/A "PCI dev (%d,%d,%d) compat=%d rega=0x%x\n",
2N/A /* Most errors raised by grub_ata_device_initialize() are harmless. 2N/A They just indicate this particular drive is not responding, most 2N/A likely because it doesn't exist. We might want to ignore specific 2N/A error types here, instead of printing them. */ 2N/A for (i = 0; i <
2; i++)
2N/A /* To prevent two drivers operating on the same disks. */ 2N/A /* ATA initialization. */