PageRenderTime 21ms CodeModel.GetById 12ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

/arch/alpha/kernel/ns87312.c

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