ns87312.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * linux/arch/alpha/kernel/ns87312.c
  3. */
  4. #include <linux/init.h>
  5. #include <asm/io.h>
  6. #include "proto.h"
  7. /*
  8. * The SRM console *disables* the IDE interface, this code ensures it's
  9. * enabled.
  10. *
  11. * This code bangs on a control register of the 87312 Super I/O chip
  12. * that implements parallel port/serial ports/IDE/FDI. Depending on
  13. * the motherboard, the Super I/O chip can be configured through a
  14. * pair of registers that are located either at I/O ports 0x26e/0x26f
  15. * or 0x398/0x399. Unfortunately, autodetecting which base address is
  16. * in use works only once (right after a reset). The Super I/O chip
  17. * has the additional quirk that configuration register data must be
  18. * written twice (I believe this is a safety feature to prevent
  19. * accidental modification---fun, isn't it?).
  20. */
  21. void __init
  22. ns87312_enable_ide(long ide_base)
  23. {
  24. int data;
  25. unsigned long flags;
  26. local_irq_save(flags);
  27. outb(0, ide_base); /* set the index register for reg #0 */
  28. data = inb(ide_base+1); /* read the current contents */
  29. outb(0, ide_base); /* set the index register for reg #0 */
  30. outb(data | 0x40, ide_base+1); /* turn on IDE */
  31. outb(data | 0x40, ide_base+1); /* turn on IDE, really! */
  32. local_irq_restore(flags);
  33. }