diff options
Diffstat (limited to 'src/mainboard/asus/m2v')
-rw-r--r-- | src/mainboard/asus/m2v/mainboard.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/mainboard/asus/m2v/mainboard.c b/src/mainboard/asus/m2v/mainboard.c index b1ac998ccb..3d2c3cb8e4 100644 --- a/src/mainboard/asus/m2v/mainboard.c +++ b/src/mainboard/asus/m2v/mainboard.c @@ -17,9 +17,45 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <arch/io.h> #include <device/device.h> +#include <device/pci.h> +#include <device/pci_ids.h> +#include <console/console.h> +#include "southbridge/via/vt8237r/vt8237r.h" #include "chip.h" +u32 vt8237_ide_80pin_detect(struct device *dev) +{ + device_t lpc_dev; + u16 acpi_io_base; + u32 gpio_in; + u32 res; + + lpc_dev = dev_find_device(PCI_VENDOR_ID_VIA, + PCI_DEVICE_ID_VIA_VT8237A_LPC, 0); + if (!lpc_dev) + return; + + acpi_io_base = pci_read_config16(lpc_dev, 0x88); + if (!acpi_io_base || (acpi_io_base & ~1) == 0) + return; + acpi_io_base &= ~1; + + gpio_in = inl(acpi_io_base + 0x48); + /* bit 9 for primary port, clear if unconnected or 80-pin cable */ + res = gpio_in & (1<<9) ? 0 : VT8237R_IDE0_80PIN_CABLE; + /* bit 4 for secondary port, clear if unconnected or 80-pin cable */ + res |= gpio_in & (1<<4) ? 0 : VT8237R_IDE1_80PIN_CABLE; + + printk(BIOS_INFO, "Cable on %s PATA port: %d pin\n", "primary", + gpio_in & (1<<9) ? 40 : 80); + printk(BIOS_INFO, "Cable on %s PATA port: %d pin\n", "secondary", + gpio_in & (1<<4) ? 40 : 80); + + return res; +} + struct chip_operations mainboard_ops = { CHIP_NAME("ASUS M2V") }; |