1/*
2 *  linux/include/asm-ppc/ide.h
3 *
4 *  Copyright (C) 1994-1996 Linus Torvalds & authors
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12/*
13 *  This file contains the ppc64 architecture specific IDE code.
14 */
15
16#ifndef __ASMPPC64_IDE_H
17#define __ASMPPC64_IDE_H
18
19#ifdef __KERNEL__
20
21#ifndef MAX_HWIFS
22#define MAX_HWIFS	4
23#endif
24
25#define ide__sti()	__sti()
26
27void ppc64_ide_fix_driveid(struct hd_driveid *id);
28#define ide_fix_driveid(id)	ppc64_ide_fix_driveid((id))
29
30static __inline__ int ide_default_irq(ide_ioreg_t base) { return 0; }
31static __inline__ ide_ioreg_t ide_default_io_base(int index) { return 0; }
32
33static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
34{
35	ide_ioreg_t reg = data_port;
36	int i;
37
38	for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
39		hw->io_ports[i] = reg;
40		reg += 1;
41	}
42	if (ctrl_port) {
43		hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
44	} else {
45		hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206;
46	}
47	if (irq != NULL)
48		*irq = 0;
49	hw->io_ports[IDE_IRQ_OFFSET] = 0;
50}
51
52static __inline__ void ide_init_default_hwifs(void)
53{
54}
55
56typedef union {
57	unsigned all			: 8;	/* all of the bits together */
58	struct {
59		unsigned head		: 4;	/* always zeros here */
60		unsigned unit		: 1;	/* drive select number, 0 or 1 */
61		unsigned bit5		: 1;	/* always 1 */
62		unsigned lba		: 1;	/* using LBA instead of CHS */
63		unsigned bit7		: 1;	/* always 1 */
64	} b;
65	} select_t;
66
67#define ide_request_irq(irq,hand,flg,dev,id)	request_irq((irq),(hand),(flg),(dev),(id))
68#define ide_free_irq(irq,dev_id)		free_irq((irq), (dev_id))
69#define ide_check_region(from,extent)		check_region((from), (extent))
70#define ide_request_region(from,extent,name)	request_region((from), (extent), (name))
71#define ide_release_region(from,extent)		release_region((from), (extent))
72
73/*
74 * The following are not needed for the non-m68k ports
75 */
76#define ide_ack_intr(hwif)		(1)
77#define ide_release_lock(lock)		do {} while (0)
78#define ide_get_lock(lock, hdlr, data)	do {} while (0)
79
80#endif /* __KERNEL__ */
81
82#endif /* __ASMPPC64_IDE_H */
83