Add IDE drive support.
Note: (1) Character device major number chages to 49 from 48(in my original code). So it is necessary to rebuild device files. (2) Must use Booter 2.0.0a10 or later. (3) Default mode is cpu busy wait. It is defined by flags 0x1000. It will be more slow than before. No flags means hardware interrupt mode. But it might be able to get no interrupts. Support machines: (1) Quadra 630 series (2) PowerBook 150 Non tested machine: (1) PowerBook 190 series Approved by: briggs
This commit is contained in:
parent
e621222ce7
commit
a26fd009c9
|
@ -20,7 +20,7 @@
|
|||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# from: @(#)MAKEDEV 5.2 (Berkeley) 6/22/90
|
||||
# $NetBSD: MAKEDEV,v 1.59 2002/03/13 01:26:58 simonb Exp $
|
||||
# $NetBSD: MAKEDEV,v 1.60 2002/04/27 19:29:08 shiba Exp $
|
||||
#
|
||||
###########################################################################
|
||||
#
|
||||
|
@ -48,6 +48,7 @@
|
|||
# ccd* concatenated disk driver
|
||||
# md* memory pseudo-disk devices
|
||||
# fd* floppy disk drives (3 1/2")
|
||||
# wd* "winchester" disk drives (ST506,IDE,ESDI,RLL,...)
|
||||
#
|
||||
# Terminal ports:
|
||||
# ttye* ite consoles
|
||||
|
@ -107,7 +108,7 @@ do
|
|||
case $i in
|
||||
|
||||
all)
|
||||
makedev std wscons fd sd0 sd1 sd2 sd3 tty0 tty1 pty0
|
||||
makedev std wscons fd sd0 sd1 sd2 sd3 wd0 wd1 wd2 wd3 tty0 tty1 pty0
|
||||
makedev st0 st1 ch0 cd0 cd1 fd0 fd1 vnd0 vnd1 vnd2 vnd3
|
||||
makedev ccd0 ccd1 ccd2 ccd3 md0 ss0 uk0 uk1
|
||||
makedev raid0 raid1 raid2 raid3 raid4 raid5 raid6 raid7
|
||||
|
@ -138,7 +139,7 @@ std)
|
|||
|
||||
raminst)
|
||||
makedev std
|
||||
makedev sd0 sd1 sd2 sd3 st0 st1 cd0 cd1 md0
|
||||
makedev sd0 sd1 sd2 sd3 wd0 wd1 wd2 wd3 st0 st1 cd0 cd1 md0
|
||||
makedev adb grf0 grf1 ttye0
|
||||
makedev tty0 tty1 opty
|
||||
;;
|
||||
|
@ -235,12 +236,13 @@ ss*)
|
|||
chmod 640 $name$unit n$name$unit en$name$unit
|
||||
;;
|
||||
|
||||
sd*|fd*|vnd*|ccd*|raid*)
|
||||
sd*|fd*|wd*|vnd*|ccd*|raid*)
|
||||
case $i in
|
||||
ccd*) name=ccd; unit=${i#ccd}; blk=9; chr=20;;
|
||||
fd*) name=fd; unit=${i#fd}; blk=21; chr=43;;
|
||||
raid*) name=raid; unit=${i#raid}; blk=20; chr=42;;
|
||||
sd*) name=sd; unit=${i#sd}; blk=4; chr=13;;
|
||||
wd*) name=wd; unit=${i#wd}; blk=22; chr=49;;
|
||||
vnd*) name=vnd; unit=${i#vnd}; blk=8; chr=19;;
|
||||
esac
|
||||
rm -f $name$unit? r$name$unit?
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: GENERIC,v 1.125 2002/04/25 15:06:30 atatat Exp $
|
||||
# $NetBSD: GENERIC,v 1.126 2002/04/27 19:29:08 shiba Exp $
|
||||
#
|
||||
# GENERIC machine description file
|
||||
#
|
||||
|
@ -22,7 +22,7 @@ include "arch/mac68k/conf/std.mac68k"
|
|||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERIC-$Revision: 1.125 $"
|
||||
#ident "GENERIC-$Revision: 1.126 $"
|
||||
|
||||
maxusers 16 # estimated number of users
|
||||
|
||||
|
@ -232,6 +232,10 @@ se* at scsibus? target ? lun ? # SCSI ethernet
|
|||
ss* at scsibus? target ? lun ? # SCSI scanners
|
||||
uk* at scsibus? target ? lun ? # SCSI unknown
|
||||
|
||||
# IDE controller and devices
|
||||
wdc* at obio? flags 0x1000
|
||||
wd* at wdc? channel ? drive ?
|
||||
|
||||
|
||||
# Miscellaneous mass storage devices
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: GENERICSBC,v 1.16 2002/04/25 15:06:30 atatat Exp $
|
||||
# $NetBSD: GENERICSBC,v 1.17 2002/04/27 19:29:08 shiba Exp $
|
||||
#
|
||||
# GENERICSBC
|
||||
|
||||
|
@ -6,7 +6,7 @@ include "arch/mac68k/conf/std.mac68k"
|
|||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERICSBC-$Revision: 1.16 $"
|
||||
#ident "GENERICSBC-$Revision: 1.17 $"
|
||||
|
||||
maxusers 16 # estimated number of users
|
||||
|
||||
|
@ -216,6 +216,10 @@ se* at scsibus? target ? lun ? # SCSI ethernet
|
|||
ss* at scsibus? target ? lun ? # SCSI scanners
|
||||
uk* at scsibus? target ? lun ? # SCSI unknown
|
||||
|
||||
# IDE controller and devices
|
||||
wdc* at obio? flags 0x1000
|
||||
wd* at wdc? channel ? drive ?
|
||||
|
||||
|
||||
# Miscellaneous mass storage devices
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: INSTALL,v 1.16 2002/04/25 15:06:30 atatat Exp $
|
||||
# $NetBSD: INSTALL,v 1.17 2002/04/27 19:29:08 shiba Exp $
|
||||
#
|
||||
# INSTALL
|
||||
|
||||
|
@ -149,6 +149,10 @@ sd* at scsibus? target ? lun ? # SCSI disk drives
|
|||
cd* at scsibus? target ? lun ? # SCSI CD-ROM drives
|
||||
st* at scsibus? target ? lun ? # SCSI tape drives
|
||||
|
||||
# IDE controller and devices
|
||||
wdc* at obio? 0x1000
|
||||
wd* at wdc? channel ? drive ?
|
||||
|
||||
|
||||
# Miscellaneous mass storage devices
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: INSTALLSBC,v 1.8 2002/04/25 15:06:30 atatat Exp $
|
||||
# $NetBSD: INSTALLSBC,v 1.9 2002/04/27 19:29:08 shiba Exp $
|
||||
#
|
||||
# INSTALLSBC
|
||||
|
||||
|
@ -149,6 +149,10 @@ sd* at scsibus? target ? lun ? # SCSI disk drives
|
|||
cd* at scsibus? target ? lun ? # SCSI CD-ROM drives
|
||||
st* at scsibus? target ? lun ? # SCSI tape drives
|
||||
|
||||
# IDE controller and devices
|
||||
wdc* at obio? flags 0x1000
|
||||
wd* at wdc? channel ? drive ?
|
||||
|
||||
|
||||
# Miscellaneous mass storage devices
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.mac68k,v 1.104 2002/04/16 20:50:21 thorpej Exp $
|
||||
# $NetBSD: files.mac68k,v 1.105 2002/04/27 19:29:08 shiba Exp $
|
||||
|
||||
# mac68k-specific configuration info
|
||||
|
||||
|
@ -122,6 +122,14 @@ file arch/mac68k/obio/esp.c esp
|
|||
#attach qsc at nubus
|
||||
#file arch/mac68k/nubus/qsc.c qsc
|
||||
|
||||
#
|
||||
# Machine-independent ATA drivers
|
||||
#
|
||||
include "dev/ata/files.ata"
|
||||
|
||||
attach wdc at obio_norm with wdc_obio
|
||||
file arch/mac68k/obio/wdc_obio.c wdc_obio
|
||||
|
||||
device zsc { channel = -1 }
|
||||
attach zsc at obio_norm
|
||||
file arch/mac68k/dev/zs.c zsc needs-flag
|
||||
|
@ -189,6 +197,9 @@ major {md = 13}
|
|||
# RAIDframe
|
||||
major {raid = 20}
|
||||
|
||||
#ATA disk
|
||||
major {wd = 22}
|
||||
|
||||
# Compatibility modules
|
||||
|
||||
# NetBSD m68k a.out Binary Compatibility (COMPAT_AOUT_M68K)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: autoconf.c,v 1.55 2001/04/25 17:53:14 bouyer Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.56 2002/04/27 19:29:09 shiba Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -115,7 +115,7 @@ static void
|
|||
findbootdev()
|
||||
{
|
||||
struct device *dv;
|
||||
int major, unit, i;
|
||||
int major, unit, controller, i;
|
||||
char buf[32];
|
||||
|
||||
booted_device = NULL;
|
||||
|
@ -130,9 +130,21 @@ findbootdev()
|
|||
|
||||
unit = B_UNIT(bootdev);
|
||||
|
||||
bootdev &= ~(B_UNITMASK << B_UNITSHIFT);
|
||||
unit = target_to_unit(-1, unit, 0);
|
||||
bootdev |= (unit << B_UNITSHIFT);
|
||||
switch (major) {
|
||||
case 4: /* SCSI drive */
|
||||
bootdev &= ~(B_UNITMASK << B_UNITSHIFT); /* XXX */
|
||||
unit = target_to_unit(-1, unit, 0);
|
||||
bootdev |= (unit << B_UNITSHIFT); /* XXX */
|
||||
break;
|
||||
case 22: /* IDE drive */
|
||||
/*
|
||||
* controller(=channel=buses) uses only IDE drive.
|
||||
* Here, controller always is 0.
|
||||
*/
|
||||
controller = B_CONTROLLER(bootdev);
|
||||
unit = unit + (controller<<1);
|
||||
break;
|
||||
}
|
||||
|
||||
sprintf(buf, "%s%d", dev_name2blk[i].d_name, unit);
|
||||
for (dv = alldevs.tqh_first; dv != NULL;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: conf.c,v 1.55 2002/01/12 13:28:49 manu Exp $ */
|
||||
/* $NetBSD: conf.c,v 1.56 2002/04/27 19:29:09 shiba Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
|
@ -58,6 +58,7 @@
|
|||
#include "st.h"
|
||||
#include "vcoda.h"
|
||||
#include "vnd.h"
|
||||
#include "wd.h"
|
||||
|
||||
/* No cdev for md */
|
||||
|
||||
|
@ -71,6 +72,7 @@ bdev_decl(sd);
|
|||
bdev_decl(st);
|
||||
bdev_decl(sw);
|
||||
bdev_decl(vnd);
|
||||
bdev_decl(wd);
|
||||
|
||||
struct bdevsw bdevsw[] =
|
||||
{
|
||||
|
@ -96,6 +98,7 @@ struct bdevsw bdevsw[] =
|
|||
bdev_lkm_dummy(), /* 19 */
|
||||
bdev_disk_init(NRAID,raid), /* 20: RAIDframe disk driver */
|
||||
bdev_disk_init(NFD, fd), /* 21: Sony floppy disk */
|
||||
bdev_disk_init(NWD, wd), /* 22: IDE disk */
|
||||
};
|
||||
int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
|
||||
|
||||
|
@ -163,6 +166,7 @@ cdev_decl(zsc);
|
|||
cdev_decl(scsibus);
|
||||
cdev_decl(vc_nb_);
|
||||
cdev_decl(clockctl);
|
||||
cdev_decl(wd);
|
||||
|
||||
dev_decl(filedesc,open);
|
||||
|
||||
|
@ -217,6 +221,7 @@ struct cdevsw cdevsw[] =
|
|||
cdev_wsdisplay_init(NWSDISPLAY,wsdisplay), /* 46: frame buffers, etc. */
|
||||
cdev_vc_nb_init(NVCODA,vc_nb_), /* 47: Venus cache driver (Coda) */
|
||||
cdev_clockctl_init(NCLOCKCTL, clockctl),/* 48: clockctl pseudo device */
|
||||
cdev_disk_init(NWD, wd), /* 49: IDE disk */
|
||||
};
|
||||
int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
|
||||
|
||||
|
@ -307,6 +312,7 @@ static int chrtoblktab[] = {
|
|||
/* 46 */ NODEV,
|
||||
/* 47 */ NODEV,
|
||||
/* 48 */ NODEV,
|
||||
/* 49 */ 22,
|
||||
};
|
||||
|
||||
dev_t
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.271 2002/03/31 02:21:20 shiba Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.272 2002/04/27 19:29:09 shiba Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -1064,6 +1064,7 @@ getenvvars(flag, buf)
|
|||
extern u_long macos_boottime, MacOSROMBase;
|
||||
extern long macos_gmtbias;
|
||||
int root_scsi_id;
|
||||
u_long root_ata_dev;
|
||||
#ifdef __ELF__
|
||||
int i;
|
||||
Elf_Ehdr *ehdr;
|
||||
|
@ -1120,9 +1121,30 @@ getenvvars(flag, buf)
|
|||
* bootdev using the SCSI ID passed in via the environment.
|
||||
*/
|
||||
root_scsi_id = getenv("ROOT_SCSI_ID");
|
||||
root_ata_dev = getenv("ROOT_ATA_DEV");
|
||||
if (((mac68k_machine.booter_version < CURRENTBOOTERVER) ||
|
||||
(flag & 0x40000)) && bootdev == 0)
|
||||
bootdev = MAKEBOOTDEV(4, 0, 0, root_scsi_id, 0);
|
||||
(flag & 0x40000)) && bootdev == 0) {
|
||||
if (root_ata_dev) {
|
||||
/*
|
||||
* Consider only internal IDE drive.
|
||||
* Buses(=channel) will be always 0.
|
||||
* Because 68k Mac has only single channel.
|
||||
*/
|
||||
switch (root_ata_dev) {
|
||||
default: /* fall through */
|
||||
case 0xffffffe0: /* buses,drive = 0,0 */
|
||||
case 0x20: /* buses,drive = 1,0 */
|
||||
case 0x21: /* buses,drive = 1,1 */
|
||||
bootdev = MAKEBOOTDEV(22, 0, 0, 0, 0);
|
||||
break;
|
||||
case 0xffffffe1: /* buses,drive = 0,1 */
|
||||
bootdev = MAKEBOOTDEV(22, 0, 0, 1, 0);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
bootdev = MAKEBOOTDEV(4, 0, 0, root_scsi_id, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Booter 1.11.3 and later pass a BOOTHOWTO variable with the
|
||||
|
|
|
@ -0,0 +1,276 @@
|
|||
/* $NetBSD: wdc_obio.c,v 1.1 2002/04/27 19:29:09 shiba Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Takeshi Shibagaki All rights reserved.
|
||||
*
|
||||
* mac68k OBIO-IDE attachment created by Takeshi Shibagaki
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Charles M. Hannum.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/callout.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/intr.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/viareg.h>
|
||||
|
||||
#include <mac68k/obio/obiovar.h>
|
||||
|
||||
#include <dev/ata/atavar.h>
|
||||
#include <dev/ic/wdcvar.h>
|
||||
|
||||
#define WDC_OBIO_REG_NPORTS (8<<3)
|
||||
#define WDC_OBIO_AUXREG_OFFSET 0x38
|
||||
#define WDC_OBIO_AUXREG_NPORTS 1
|
||||
#define WDC_OBIO_ISR_OFFSET 0x101
|
||||
#define WDC_OBIO_ISR_NPORTS 1
|
||||
|
||||
static u_long IDEBase = 0x50f1a000;
|
||||
|
||||
/*
|
||||
* XXX This code currently doesn't even try to allow 32-bit data port use.
|
||||
*/
|
||||
|
||||
struct wdc_obio_softc {
|
||||
struct wdc_softc sc_wdcdev;
|
||||
struct channel_softc *wdc_chanptr;
|
||||
struct channel_softc wdc_channel;
|
||||
void *sc_ih;
|
||||
};
|
||||
|
||||
int wdc_obio_match __P((struct device *, struct cfdata *, void *));
|
||||
void wdc_obio_attach __P((struct device *, struct device *, void *));
|
||||
void wdc_obio_intr __P((void *));
|
||||
void mac68k_bsh_wdc_set_stride __P((bus_space_tag_t t,
|
||||
bus_space_handle_t *h, int stride));
|
||||
u_int16_t mac68k_bsr2_wdc_gen __P((bus_space_tag_t t,
|
||||
bus_space_handle_t *bsh, bus_size_t offset));
|
||||
|
||||
struct cfattach wdc_obio_ca = {
|
||||
sizeof(struct wdc_obio_softc), wdc_obio_match, wdc_obio_attach
|
||||
};
|
||||
|
||||
int
|
||||
wdc_obio_match(parent, match, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
struct obio_attach_args *oa = (struct obio_attach_args *) aux;
|
||||
struct channel_softc ch;
|
||||
static int wdc_matched = 0;
|
||||
int result = 0;
|
||||
|
||||
memset(&ch, 0, sizeof(ch));
|
||||
|
||||
switch (current_mac_model->machineid) {
|
||||
case MACH_MACPB150:
|
||||
case MACH_MACPB190:
|
||||
case MACH_MACPB190CS:
|
||||
case MACH_MACP580:
|
||||
case MACH_MACQ630:
|
||||
ch.cmd_iot = ch.ctl_iot = oa->oa_tag;
|
||||
|
||||
if (bus_space_map(ch.cmd_iot, IDEBase, WDC_OBIO_REG_NPORTS,
|
||||
0, &ch.cmd_ioh))
|
||||
return 0;
|
||||
|
||||
mac68k_bsh_wdc_set_stride(ch.cmd_iot, &ch.cmd_ioh, 4);
|
||||
|
||||
if (bus_space_subregion(ch.cmd_iot, ch.cmd_ioh,
|
||||
WDC_OBIO_AUXREG_OFFSET,
|
||||
WDC_OBIO_AUXREG_NPORTS, &ch.ctl_ioh))
|
||||
return 0;
|
||||
|
||||
result = wdcprobe(&ch);
|
||||
|
||||
bus_space_unmap(ch.cmd_iot, ch.cmd_ioh, WDC_OBIO_REG_NPORTS);
|
||||
|
||||
if (result)
|
||||
wdc_matched = 1;
|
||||
return (result);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bus_space_tag_t wdc_obio_isr_tag;
|
||||
static bus_space_handle_t wdc_obio_isr_hdl;
|
||||
static struct channel_softc *ch_sc = NULL;
|
||||
|
||||
void
|
||||
wdc_obio_intr(arg)
|
||||
void *arg;
|
||||
{
|
||||
unsigned char status;
|
||||
|
||||
status = bus_space_read_1(wdc_obio_isr_tag,
|
||||
wdc_obio_isr_hdl, 0);
|
||||
if (status & 0x20) {
|
||||
wdcintr(ch_sc);
|
||||
bus_space_write_1(wdc_obio_isr_tag,
|
||||
wdc_obio_isr_hdl, 0, status&~0x20);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
wdc_obio_attach(parent, self, aux)
|
||||
struct device *parent;
|
||||
struct device *self;
|
||||
void *aux;
|
||||
{
|
||||
struct wdc_obio_softc *sc = (void *)self;
|
||||
struct obio_attach_args *oa = aux;
|
||||
struct channel_softc *chp = &sc->wdc_channel;
|
||||
|
||||
oa->oa_addr = IDEBase;
|
||||
sc->wdc_channel.cmd_iot = sc->wdc_channel.ctl_iot = oa->oa_tag;
|
||||
|
||||
if (bus_space_map(sc->wdc_channel.cmd_iot, oa->oa_addr,
|
||||
WDC_OBIO_REG_NPORTS, 0, &sc->wdc_channel.cmd_ioh)) {
|
||||
printf("%s: couldn't map registers\n",
|
||||
sc->sc_wdcdev.sc_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
||||
mac68k_bsh_wdc_set_stride(sc->wdc_channel.cmd_iot,
|
||||
&sc->wdc_channel.cmd_ioh, 4);
|
||||
|
||||
if (bus_space_subregion(sc->wdc_channel.cmd_iot,
|
||||
sc->wdc_channel.cmd_ioh, WDC_OBIO_AUXREG_OFFSET,
|
||||
WDC_OBIO_AUXREG_NPORTS,
|
||||
&sc->wdc_channel.ctl_ioh))
|
||||
return;
|
||||
|
||||
wdc_obio_isr_tag = oa->oa_tag;
|
||||
|
||||
if (bus_space_map(wdc_obio_isr_tag,
|
||||
oa->oa_addr+WDC_OBIO_ISR_OFFSET,
|
||||
WDC_OBIO_ISR_NPORTS, 0, &wdc_obio_isr_hdl)) {
|
||||
printf("%s: couldn't map intr status register\n",
|
||||
sc->sc_wdcdev.sc_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (current_mac_model->machineid) {
|
||||
case MACH_MACP580:
|
||||
case MACH_MACQ630:
|
||||
/*
|
||||
* Quadra/Performa IDE generates pseudo Nubus intr at slot F
|
||||
*/
|
||||
printf(" (Quadra/Performa series IDE interface)");
|
||||
|
||||
add_nubus_intr(0xf, (void (*)(void*))wdc_obio_intr, (void *)sc);
|
||||
|
||||
break;
|
||||
case MACH_MACPB150:
|
||||
case MACH_MACPB190:
|
||||
case MACH_MACPB190CS:
|
||||
/*
|
||||
* PowerBook IDE generates pseudo NuBus intr at slot C
|
||||
*/
|
||||
printf(" (PowerBook series IDE interface)");
|
||||
|
||||
add_nubus_intr(0xc, (void (*)(void*))wdc_obio_intr, (void *)sc);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
ch_sc = chp;
|
||||
if (sc->sc_wdcdev.sc_dev.dv_cfdata->cf_flags & WDC_CAPABILITY_NOIRQ)
|
||||
sc->sc_wdcdev.cap |= WDC_CAPABILITY_NOIRQ;
|
||||
sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16;
|
||||
sc->sc_wdcdev.PIO_cap = 0;
|
||||
sc->wdc_chanptr = chp;
|
||||
sc->sc_wdcdev.channels = &sc->wdc_chanptr;
|
||||
sc->sc_wdcdev.nchannels = 1;
|
||||
chp->channel = 0;
|
||||
chp->wdc = &sc->sc_wdcdev;
|
||||
chp->ch_queue = malloc(sizeof(struct channel_queue), M_DEVBUF, M_NOWAIT);
|
||||
|
||||
if (chp->ch_queue == NULL) {
|
||||
printf("%s: can't allocate memory for command queue",
|
||||
sc->sc_wdcdev.sc_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
wdcattach(chp);
|
||||
}
|
||||
|
||||
u_int16_t
|
||||
mac68k_bsr2_wdc_gen(bus_space_tag_t t, bus_space_handle_t *bsh, bus_size_t offset)
|
||||
{
|
||||
return (*(volatile u_int16_t *) (bsh->base + offset * bsh->stride));
|
||||
}
|
||||
|
||||
void
|
||||
mac68k_bsh_wdc_set_stride(bus_space_tag_t t, bus_space_handle_t *h, int stride)
|
||||
{
|
||||
h->stride = stride;
|
||||
h->bsr1 = mac68k_bsr1_gen;
|
||||
h->bsr2 = mac68k_bsr2_wdc_gen;
|
||||
h->bsr4 = mac68k_bsr4_gen;
|
||||
h->bsrs2 = mac68k_bsrs2_gen;
|
||||
h->bsrs4 = mac68k_bsrs4_gen;
|
||||
h->bsrm1 = mac68k_bsrm1_gen;
|
||||
h->bsrm2 = mac68k_bsrm2_swap;
|
||||
h->bsrm4 = mac68k_bsrm4_swap;
|
||||
h->bsrms2 = mac68k_bsrm2;
|
||||
h->bsrms4 = mac68k_bsrm4;
|
||||
h->bsrr1 = mac68k_bsrr1_gen;
|
||||
h->bsrr2 = mac68k_bsrr2_gen;
|
||||
h->bsrr4 = mac68k_bsrr4_gen;
|
||||
h->bsrrs2 = mac68k_bsrrs2_gen;
|
||||
h->bsrrs4 = mac68k_bsrrs4_gen;
|
||||
h->bsw1 = mac68k_bsw1_gen;
|
||||
h->bsw2 = mac68k_bsw2_gen;
|
||||
h->bsw4 = mac68k_bsw4_gen;
|
||||
h->bsws2 = mac68k_bsws2_gen;
|
||||
h->bsws4 = mac68k_bsws4_gen;
|
||||
h->bswm2 = mac68k_bswm2_swap;
|
||||
h->bswm4 = mac68k_bswm4_swap;
|
||||
h->bswms2 = mac68k_bswm2;
|
||||
h->bswms4 = mac68k_bswm4;
|
||||
h->bswr1 = mac68k_bswr1_gen;
|
||||
h->bswr2 = mac68k_bswr2_gen;
|
||||
h->bswr4 = mac68k_bswr4_gen;
|
||||
h->bswrs2 = mac68k_bswrs2_gen;
|
||||
h->bswrs4 = mac68k_bswrs4_gen;
|
||||
h->bssm1 = mac68k_bssm1_gen;
|
||||
h->bssm2 = mac68k_bssm2_gen;
|
||||
h->bssm4 = mac68k_bssm4_gen;
|
||||
h->bssr1 = mac68k_bssr1_gen;
|
||||
h->bssr2 = mac68k_bssr2_gen;
|
||||
h->bssr4 = mac68k_bssr4_gen;
|
||||
}
|
Loading…
Reference in New Issue