Initial dirty ATA support

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-11-03 00:03:09 +01:00
parent 811c0d8b5c
commit b4f4e1f733
2 changed files with 53 additions and 2 deletions

View file

@ -198,4 +198,10 @@ at_keyboard_mod_SOURCES = term/at_keyboard.c
at_keyboard_mod_CFLAGS = $(COMMON_CFLAGS)
at_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS)
# For ata_pthru.mod.
pkglib_MODULES += ata_pthru.mod
ata_pthru_mod_SOURCES = disk/ata_pthru.c
ata_pthru_mod_CFLAGS = $(COMMON_CFLAGS)
ata_pthru_mod_LDFLAGS = $(COMMON_LDFLAGS)
include $(srcdir)/conf/common.mk

View file

@ -27,8 +27,10 @@
#include <grub/machine/machine.h>
/* At the moment, only two IDE ports are supported. */
static const grub_port_t grub_ata_ioaddress[] = { 0x1f0, 0x170 };
static const grub_port_t grub_ata_ioaddress2[] = { 0x3f6, 0x376 };
static const grub_port_t grub_ata_ioaddress[] = { 0xbfd001f0};
static const grub_port_t grub_ata_ioaddress2[] = { 0xbfd003f6};
//static const grub_port_t grub_ata_ioaddress[] = { 0x1f0, 0x170 };
//static const grub_port_t grub_ata_ioaddress2[] = { 0x3f6, 0x376 };
static struct grub_ata_device *grub_ata_devices;
@ -388,6 +390,7 @@ grub_ata_device_initialize (int port, int device, int addr, int addr2)
return 0;
}
#if 0
static int NESTED_FUNC_ATTR
grub_ata_pciinit (grub_pci_device_t dev,
grub_pci_id_t pciid __attribute__((unused)))
@ -485,6 +488,48 @@ grub_ata_initialize (void)
grub_pci_iterate (grub_ata_pciinit);
return 0;
}
#endif
static grub_err_t
grub_ata_initialize (void)
{
int rega;
int regb;
rega = grub_ata_ioaddress[0];
regb = grub_ata_ioaddress2[0];
grub_dprintf ("ata",
"rega=0x%x regb=0x%x\n",
rega, regb);
if (rega && regb)
{
grub_errno = GRUB_ERR_NONE;
grub_ata_device_initialize (0, 0, rega, regb);
/* Most errors raised by grub_ata_device_initialize() are harmless.
They just indicate this particular drive is not responding, most
likely because it doesn't exist. We might want to ignore specific
error types here, instead of printing them. */
if (grub_errno)
{
grub_print_error ();
grub_errno = GRUB_ERR_NONE;
}
grub_ata_device_initialize (0, 1, rega, regb);
/* Likewise. */
if (grub_errno)
{
grub_print_error ();
grub_errno = GRUB_ERR_NONE;
}
}
return 0;
}
static void