Added IBM Personal Power Series 830 IDE controller support.
This commit is contained in:
parent
2d1f93d643
commit
ed9081de2a
@ -1,4 +1,4 @@
|
||||
# $NetBSD: GENERIC,v 1.50 2002/05/02 14:58:36 nonaka Exp $
|
||||
# $NetBSD: GENERIC,v 1.51 2002/05/02 15:17:56 nonaka Exp $
|
||||
#
|
||||
# GENERIC machine description file
|
||||
#
|
||||
@ -22,7 +22,7 @@ include "arch/prep/conf/std.prep"
|
||||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERIC-$Revision: 1.50 $"
|
||||
#ident "GENERIC-$Revision: 1.51 $"
|
||||
|
||||
maxusers 32
|
||||
|
||||
@ -63,6 +63,7 @@ options DDB # in-kernel debugger
|
||||
# Compatibility options
|
||||
options COMPAT_13 # NetBSD 1.3,
|
||||
options COMPAT_14 # NetBSD 1.4,
|
||||
options COMPAT_15 # NetBSD 1.5,
|
||||
options COMPAT_43 # and 4.3BSD
|
||||
#options COMPAT_LINUX # Linux binary compatibility
|
||||
#options TCP_COMPAT_42 # 4.2BSD TCP/IP bug compat. Not recommended.
|
||||
@ -183,6 +184,10 @@ pcic0 at isa? port 0x3e0 iomem 0xd0000 iosiz 0x10000
|
||||
# ISA Plug-and-Play bus support
|
||||
isapnp0 at isa?
|
||||
|
||||
# on-board I/O for IBM Personal Power Series 830 IDE controller
|
||||
obio0 at mainbus0
|
||||
|
||||
|
||||
# Console Devices
|
||||
|
||||
# wscons
|
||||
@ -251,6 +256,13 @@ uk* at scsibus? target ? lun ? # SCSI unknown
|
||||
|
||||
# IDE and related devices
|
||||
|
||||
# IBM Personal Power Series 830 IDE controller
|
||||
wdc0 at obio? port 0x1f0 irq 13
|
||||
wdc1 at obio? port 0x170 irq 13
|
||||
|
||||
# ISA Plug-and-Play IDE controllers
|
||||
wdc* at isapnp?
|
||||
|
||||
# PCMCIA IDE controllers
|
||||
wdc* at pcmcia? function ?
|
||||
|
||||
@ -304,10 +316,6 @@ ne* at isapnp? # NE2000-compatible Ethernet
|
||||
ep* at pcmcia? function ? # 3Com 3c589 and 3c562 Ethernet
|
||||
ne* at pcmcia? function ? # NE2000-compatible Ethernet
|
||||
|
||||
mhzc* at pcmcia? function ? # Megahertz Ethernet/Modem combo cards
|
||||
com* at mhzc?
|
||||
sm* at mhzc?
|
||||
|
||||
# MII/PHY support
|
||||
dmphy* at mii? phy ? # Davicom DM9101 PHYs
|
||||
exphy* at mii? phy ? # 3Com internal PHYs
|
||||
@ -412,10 +420,14 @@ midi* at pcppi? # MIDI interface to the PC speaker
|
||||
# The spkr driver provides a simple tone interface to the built in speaker.
|
||||
spkr0 at pcppi? # PC speaker
|
||||
|
||||
|
||||
# Joysticks
|
||||
|
||||
# ISA Plug-and-Play joysticks
|
||||
joy* at isapnp? # Game ports (usually on audio cards)
|
||||
|
||||
# ISA joysticks. Probe is a little strange; add only if you have one.
|
||||
joy0 at isa? port 0x201
|
||||
#joy0 at isa? port 0x201
|
||||
|
||||
|
||||
# Pseudo-Devices
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: INSTALL,v 1.18 2002/05/02 14:58:36 nonaka Exp $
|
||||
# $NetBSD: INSTALL,v 1.19 2002/05/02 15:17:57 nonaka Exp $
|
||||
#
|
||||
# INSTALL -- Installation kernel
|
||||
#
|
||||
@ -103,6 +103,10 @@ pcic0 at isa? port 0x3e0 iomem 0xd0000 iosiz 0x10000
|
||||
# ISA Plug-and-Play bus support
|
||||
isapnp0 at isa?
|
||||
|
||||
# on-board I/O for IBM Personal Power Series 830 IDE controller
|
||||
obio0 at mainbus0
|
||||
|
||||
|
||||
# Console Devices
|
||||
|
||||
# wscons
|
||||
@ -160,6 +164,13 @@ cd* at scsibus? target ? lun ? # SCSI CD-ROM drives
|
||||
|
||||
# IDE and related devices
|
||||
|
||||
# IBM Personal Power Series 830 IDE controller
|
||||
wdc0 at obio? port 0x1f0 irq 13
|
||||
wdc1 at obio? port 0x170 irq 13
|
||||
|
||||
# ISA Plug-and-Play IDE controllers
|
||||
wdc* at isapnp?
|
||||
|
||||
# PCMCIA IDE controllers
|
||||
wdc* at pcmcia? function ?
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: files.prep,v 1.33 2002/05/02 14:58:36 nonaka Exp $
|
||||
# $NetBSD: files.prep,v 1.34 2002/05/02 15:17:57 nonaka Exp $
|
||||
#
|
||||
# prep-specific configuration info
|
||||
#
|
||||
@ -201,3 +201,12 @@ file dev/isa/i82365_isa.c pcic_isa
|
||||
file dev/isa/i82365_isasubr.c pcic_isa
|
||||
|
||||
include "dev/pcmcia/files.pcmcia"
|
||||
|
||||
# on-board I/O
|
||||
define obio {[port = -1], [size = 0], [iomem = -1], [iosiz = 0], [irq = -1]}
|
||||
device obio: obio
|
||||
attach obio at mainbus
|
||||
file arch/prep/dev/obio.c obio needs-flag
|
||||
|
||||
attach wdc at obio with wdc_obio
|
||||
file arch/prep/dev/wdc_obio.c wdc_obio needs-flag
|
||||
|
201
sys/arch/prep/dev/obio.c
Normal file
201
sys/arch/prep/dev/obio.c
Normal file
@ -0,0 +1,201 @@
|
||||
/* $NetBSD: obio.c,v 1.1 2002/05/02 15:17:58 nonaka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Charles M. Hannum.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/extent.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/pio.h>
|
||||
#include <machine/intr.h>
|
||||
#include <machine/platform.h>
|
||||
|
||||
#include <prep/dev/obiovar.h>
|
||||
|
||||
#include <dev/isa/isareg.h>
|
||||
|
||||
#include "wdc_obio.h"
|
||||
|
||||
static int obio_found = 0;
|
||||
|
||||
static int obio_match(struct device *, struct cfdata *, void *);
|
||||
static void obio_attach(struct device *, struct device *, void *);
|
||||
static int obio_print(void *, const char *);
|
||||
static int obio_search(struct device *, struct cfdata *, void *);
|
||||
|
||||
struct cfattach obio_ca = {
|
||||
sizeof(struct device), obio_match, obio_attach
|
||||
};
|
||||
|
||||
extern struct cfdriver obio_cd;
|
||||
|
||||
static int
|
||||
obio_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
|
||||
if (obio_found)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
obio_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
|
||||
obio_found = 1;
|
||||
|
||||
printf("\n");
|
||||
|
||||
(void)config_search(obio_search, self, aux);
|
||||
}
|
||||
|
||||
static int
|
||||
obio_search(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct obio_attach_args oa;
|
||||
const char **p;
|
||||
|
||||
p = platform->obiodevs;
|
||||
if (p == NULL)
|
||||
return 0;
|
||||
|
||||
for (; *p != NULL; p++) {
|
||||
if (strcmp(cf->cf_driver->cd_name, *p) == 0) {
|
||||
oa.oa_iot = &prep_isa_io_space_tag;
|
||||
oa.oa_memt = &prep_isa_mem_space_tag;
|
||||
oa.oa_iobase = cf->cf_iobase;
|
||||
oa.oa_iosize = cf->cf_iosize;
|
||||
oa.oa_maddr = cf->cf_maddr;
|
||||
oa.oa_msize = cf->cf_msize;
|
||||
oa.oa_irq = cf->cf_irq == 2 ? 9 : cf->cf_irq;
|
||||
|
||||
if ((*cf->cf_attach->ca_match)(parent, cf, &oa) > 0)
|
||||
config_attach(parent, cf, &oa, obio_print);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
obio_print(void *args, const char *name)
|
||||
{
|
||||
struct obio_attach_args *oa = args;
|
||||
|
||||
if (oa->oa_iosize)
|
||||
printf(" port 0x%x", oa->oa_iobase);
|
||||
if (oa->oa_iosize > 1)
|
||||
printf("-0x%x", oa->oa_iobase + oa->oa_iosize - 1);
|
||||
if (oa->oa_msize)
|
||||
printf(" mem 0x%x", oa->oa_maddr);
|
||||
if (oa->oa_msize > 1)
|
||||
printf("-0x%x", oa->oa_maddr + oa->oa_msize - 1);
|
||||
if (oa->oa_irq != IRQUNK)
|
||||
printf(" irq %d", oa->oa_irq);
|
||||
return (UNCONF);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up an interrupt handler to start being called.
|
||||
*/
|
||||
void *
|
||||
obio_intr_establish(int irq, int type, int level, int (*ih_fun)(void *),
|
||||
void *ih_arg)
|
||||
{
|
||||
|
||||
return (void *)intr_establish(irq, type, level, ih_fun, ih_arg);
|
||||
}
|
||||
|
||||
/*
|
||||
* Deregister an interrupt handler.
|
||||
*/
|
||||
void
|
||||
obio_intr_disestablish(void *arg)
|
||||
{
|
||||
|
||||
intr_disestablish(arg);
|
||||
}
|
||||
|
||||
/*
|
||||
* obio bus resource mapping
|
||||
*/
|
||||
#if NWDC_OBIO > 0
|
||||
static bus_space_handle_t wdc0_cmd;
|
||||
static bus_space_handle_t wdc0_ctl;
|
||||
static bus_space_handle_t wdc1_cmd;
|
||||
static bus_space_handle_t wdc1_ctl;
|
||||
#endif
|
||||
|
||||
void
|
||||
obio_reserve_resource_map(void)
|
||||
{
|
||||
const char **p;
|
||||
|
||||
for (p = platform->obiodevs; *p != NULL; p++) {
|
||||
#if NWDC_OBIO > 0
|
||||
if (strcmp(*p, "wdc") == 0) {
|
||||
bus_space_map(&prep_isa_io_space_tag, IO_WD1, 8,
|
||||
0, &wdc0_cmd);
|
||||
bus_space_map(&prep_isa_io_space_tag, IO_WD1 + 0x206, 1,
|
||||
0, &wdc0_ctl);
|
||||
bus_space_map(&prep_isa_io_space_tag, IO_WD2, 8,
|
||||
0, &wdc1_cmd);
|
||||
bus_space_map(&prep_isa_io_space_tag, IO_WD2 + 0x206, 1,
|
||||
0, &wdc1_ctl);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
obio_reserve_resource_unmap(void)
|
||||
{
|
||||
const char **p;
|
||||
|
||||
for (p = platform->obiodevs; *p != NULL; p++) {
|
||||
#if NWDC_OBIO > 0
|
||||
if (strcmp(*p, "wdc") == 0) {
|
||||
bus_space_unmap(&prep_isa_io_space_tag, wdc0_cmd, 8);
|
||||
bus_space_unmap(&prep_isa_io_space_tag, wdc0_ctl, 1);
|
||||
bus_space_unmap(&prep_isa_io_space_tag, wdc1_cmd, 8);
|
||||
bus_space_unmap(&prep_isa_io_space_tag, wdc1_ctl, 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
125
sys/arch/prep/dev/obiovar.h
Normal file
125
sys/arch/prep/dev/obiovar.h
Normal file
@ -0,0 +1,125 @@
|
||||
/* $NetBSD: obiovar.h,v 1.1 2002/05/02 15:17:58 nonaka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
|
||||
* NASA Ames Research Center.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Chris G. Demetriou
|
||||
* Copyright (c) 1992 Berkeley Software Design, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 Berkeley Software
|
||||
* Design, Inc.
|
||||
* 4. The name of Berkeley Software Design must not be used to endorse
|
||||
* or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN, INC. ``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 BERKELEY SOFTWARE DESIGN, INC. 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.
|
||||
*
|
||||
* BSDI Id: isavar.h,v 1.5 1992/12/01 18:06:00 karels Exp
|
||||
*/
|
||||
|
||||
#ifndef _PREP_OBIOVAR_H_
|
||||
#define _PREP_OBIOVAR_H_
|
||||
|
||||
#include <sys/queue.h>
|
||||
#include <machine/bus.h>
|
||||
|
||||
/*
|
||||
* driver attach arguments
|
||||
*/
|
||||
struct obio_attach_args {
|
||||
bus_space_tag_t oa_iot; /* i/o space tag */
|
||||
bus_space_tag_t oa_memt; /* mem space tag */
|
||||
|
||||
int oa_iobase; /* base i/o address */
|
||||
int oa_iosize; /* span of ports used */
|
||||
int oa_irq; /* interrupt request */
|
||||
int oa_maddr; /* physical i/o mem addr */
|
||||
u_int oa_msize; /* size of i/o memory */
|
||||
void *oa_aux; /* driver specific */
|
||||
};
|
||||
|
||||
#include "locators.h"
|
||||
|
||||
#define IOBASEUNK OBIOCF_PORT_DEFAULT /* i/o address is unknown */
|
||||
#define IRQUNK OBIOCF_IRQ_DEFAULT /* interrupt request line is unknown */
|
||||
#define MADDRUNK OBIOCF_IOMEM_DEFAULT /* shared memory address is unknown */
|
||||
|
||||
/*
|
||||
* master bus
|
||||
*/
|
||||
struct obio_softc {
|
||||
struct device sc_dev; /* base device */
|
||||
|
||||
bus_space_tag_t sc_iot; /* io space tag */
|
||||
bus_space_tag_t sc_memt; /* mem space tag */
|
||||
};
|
||||
|
||||
#define cf_iobase cf_loc[OBIOCF_PORT]
|
||||
#define cf_iosize cf_loc[OBIOCF_SIZE]
|
||||
#define cf_maddr cf_loc[OBIOCF_IOMEM]
|
||||
#define cf_msize cf_loc[OBIOCF_IOSIZ]
|
||||
#define cf_irq cf_loc[OBIOCF_IRQ]
|
||||
|
||||
void *obio_intr_establish(int irq, int type, int level,
|
||||
int (*ih_fun)(void *), void *ih_arg);
|
||||
void obio_intr_disestablish(void *handler);
|
||||
void obio_reserve_resource_map(void);
|
||||
void obio_reserve_resource_unmap(void);
|
||||
|
||||
#endif /* _PREP_OBIOVAR_H_ */
|
146
sys/arch/prep/dev/wdc_obio.c
Normal file
146
sys/arch/prep/dev/wdc_obio.c
Normal file
@ -0,0 +1,146 @@
|
||||
/* $NetBSD: wdc_obio.c,v 1.1 2002/05/02 15:17:59 nonaka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Charles M. Hannum and by Onno van der Linden.
|
||||
*
|
||||
* 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 the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``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 FOUNDATION OR CONTRIBUTORS
|
||||
* 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 <machine/bus.h>
|
||||
#include <machine/intr.h>
|
||||
|
||||
#include <dev/ata/atavar.h>
|
||||
#include <dev/ic/wdcvar.h>
|
||||
|
||||
#include <prep/dev/obiovar.h>
|
||||
|
||||
#define WDC_OBIO_REG_NPORTS 8
|
||||
#define WDC_OBIO_AUXREG_OFFSET 0x206
|
||||
#define WDC_OBIO_AUXREG_NPORTS 1 /* XXX "fdc" owns ports 0x3f7/0x377 */
|
||||
|
||||
/* options passed via the 'flags' config keyword */
|
||||
#define WDC_OPTIONS_32 0x01 /* try to use 32bit data I/O */
|
||||
|
||||
struct wdc_obio_softc {
|
||||
struct wdc_softc sc_wdcdev;
|
||||
struct channel_softc *wdc_chanptr;
|
||||
struct channel_softc wdc_channel;
|
||||
void *sc_ih;
|
||||
};
|
||||
|
||||
static int wdc_obio_probe(struct device *, struct cfdata *, void *);
|
||||
static void wdc_obio_attach(struct device *, struct device *, void *);
|
||||
|
||||
struct cfattach wdc_obio_ca = {
|
||||
sizeof(struct wdc_obio_softc), wdc_obio_probe, wdc_obio_attach
|
||||
};
|
||||
|
||||
static int
|
||||
wdc_obio_probe(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
struct channel_softc ch;
|
||||
struct obio_attach_args *oa = aux;
|
||||
int result = 0;
|
||||
|
||||
bzero(&ch, sizeof(ch));
|
||||
ch.cmd_iot = oa->oa_iot;
|
||||
if (bus_space_map(ch.cmd_iot, oa->oa_iobase, WDC_OBIO_REG_NPORTS, 0,
|
||||
&ch.cmd_ioh))
|
||||
goto out;
|
||||
|
||||
ch.ctl_iot = oa->oa_iot;
|
||||
if (bus_space_map(ch.ctl_iot, oa->oa_iobase + WDC_OBIO_AUXREG_OFFSET,
|
||||
WDC_OBIO_AUXREG_NPORTS, 0, &ch.ctl_ioh))
|
||||
goto outunmap;
|
||||
|
||||
result = wdcprobe(&ch);
|
||||
if (result) {
|
||||
oa->oa_iosize = WDC_OBIO_REG_NPORTS;
|
||||
oa->oa_msize = 0;
|
||||
}
|
||||
|
||||
bus_space_unmap(ch.ctl_iot, ch.ctl_ioh, WDC_OBIO_AUXREG_NPORTS);
|
||||
outunmap:
|
||||
bus_space_unmap(ch.cmd_iot, ch.cmd_ioh, WDC_OBIO_REG_NPORTS);
|
||||
out:
|
||||
return (result);
|
||||
}
|
||||
|
||||
static void
|
||||
wdc_obio_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct wdc_obio_softc *sc = (void *)self;
|
||||
struct obio_attach_args *oa = aux;
|
||||
|
||||
printf("\n");
|
||||
|
||||
sc->wdc_channel.cmd_iot = oa->oa_iot;
|
||||
sc->wdc_channel.ctl_iot = oa->oa_iot;
|
||||
if (bus_space_map(sc->wdc_channel.cmd_iot, oa->oa_iobase,
|
||||
WDC_OBIO_REG_NPORTS, 0, &sc->wdc_channel.cmd_ioh) ||
|
||||
bus_space_map(sc->wdc_channel.ctl_iot,
|
||||
oa->oa_iobase + WDC_OBIO_AUXREG_OFFSET, WDC_OBIO_AUXREG_NPORTS,
|
||||
0, &sc->wdc_channel.ctl_ioh)) {
|
||||
printf("%s: couldn't map registers\n",
|
||||
sc->sc_wdcdev.sc_dev.dv_xname);
|
||||
}
|
||||
sc->wdc_channel.data32iot = sc->wdc_channel.cmd_iot;
|
||||
sc->wdc_channel.data32ioh = sc->wdc_channel.cmd_ioh;
|
||||
|
||||
sc->sc_ih = obio_intr_establish(oa->oa_irq, IST_LEVEL,
|
||||
IPL_BIO, wdcintr, &sc->wdc_channel);
|
||||
|
||||
sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_PREATA;
|
||||
if (sc->sc_wdcdev.sc_dev.dv_cfdata->cf_flags & WDC_OPTIONS_32)
|
||||
sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA32;
|
||||
sc->sc_wdcdev.PIO_cap = 0;
|
||||
sc->wdc_chanptr = &sc->wdc_channel;
|
||||
sc->sc_wdcdev.channels = &sc->wdc_chanptr;
|
||||
sc->sc_wdcdev.nchannels = 1;
|
||||
sc->wdc_channel.channel = 0;
|
||||
sc->wdc_channel.wdc = &sc->sc_wdcdev;
|
||||
sc->wdc_channel.ch_queue = malloc(sizeof(struct channel_queue),
|
||||
M_DEVBUF, M_NOWAIT);
|
||||
if (sc->wdc_channel.ch_queue == NULL) {
|
||||
printf("%s: can't allocate memory for command queue",
|
||||
sc->sc_wdcdev.sc_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
wdcattach(&sc->wdc_channel);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: platform.h,v 1.4 2002/05/02 14:48:27 nonaka Exp $ */
|
||||
/* $NetBSD: platform.h,v 1.5 2002/05/02 15:17:59 nonaka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -52,6 +52,7 @@ struct platform {
|
||||
void (*ext_intr)(void);
|
||||
void (*cpu_setup)(struct device *);
|
||||
void (*reset)(void);
|
||||
const char **obiodevs;
|
||||
};
|
||||
|
||||
struct plattab {
|
||||
@ -60,6 +61,7 @@ struct plattab {
|
||||
};
|
||||
|
||||
extern struct platform *platform;
|
||||
extern const char *obiodevs_nodev[];
|
||||
|
||||
int ident_platform(void);
|
||||
int platform_generic_match(struct platform *);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ibm_6050.c,v 1.4 2002/05/02 14:48:27 nonaka Exp $ */
|
||||
/* $NetBSD: ibm_6050.c,v 1.5 2002/05/02 15:17:59 nonaka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -41,6 +41,11 @@
|
||||
#include <machine/intr.h>
|
||||
#include <machine/platform.h>
|
||||
|
||||
static const char *obiodevs_ibm_6050[] = {
|
||||
"wdc",
|
||||
NULL
|
||||
};
|
||||
|
||||
struct platform platform_ibm_6050 = {
|
||||
"IBM PPS Model 6050/6070 (E)", /* model */
|
||||
platform_generic_match, /* match */
|
||||
@ -49,6 +54,7 @@ struct platform platform_ibm_6050 = {
|
||||
ext_intr_ivr, /* ext_intr */
|
||||
cpu_setup_ibm_generic, /* cpu_setup */
|
||||
reset_prep_generic, /* reset */
|
||||
obiodevs_ibm_6050, /* obiodevs */
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ibm_7248.c,v 1.4 2002/05/02 14:48:27 nonaka Exp $ */
|
||||
/* $NetBSD: ibm_7248.c,v 1.5 2002/05/02 15:18:00 nonaka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -49,6 +49,7 @@ struct platform platform_ibm_7248 = {
|
||||
ext_intr_ivr, /* ext_intr */
|
||||
cpu_setup_ibm_generic, /* cpu_setup */
|
||||
reset_prep_generic, /* reset */
|
||||
obiodevs_nodev, /* obiodevs */
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mainbus.c,v 1.9 2002/05/02 14:36:43 nonaka Exp $ */
|
||||
/* $NetBSD: mainbus.c,v 1.10 2002/05/02 15:18:00 nonaka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
@ -33,6 +33,7 @@
|
||||
#include "opt_pci.h"
|
||||
#include "opt_residual.h"
|
||||
|
||||
#include "obio.h"
|
||||
#include "pci.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -47,6 +48,8 @@
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/pciconf.h>
|
||||
|
||||
#include <prep/dev/obiovar.h>
|
||||
|
||||
#include <machine/platform.h>
|
||||
#include <machine/residual.h>
|
||||
|
||||
@ -79,7 +82,6 @@ mainbus_match(parent, match, aux)
|
||||
|
||||
if (mainbus_found)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -113,6 +115,10 @@ mainbus_attach(parent, self, aux)
|
||||
ca.ca_node = 0;
|
||||
config_found(self, &ca, mainbus_print);
|
||||
|
||||
#if NOBIO > 0
|
||||
obio_reserve_resource_map();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX Note also that the presence of a PCI bus should
|
||||
* XXX _always_ be checked, and if present the bus should be
|
||||
@ -143,6 +149,18 @@ mainbus_attach(parent, self, aux)
|
||||
mba.mba_pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
|
||||
config_found(self, &mba.mba_pba, mainbus_print);
|
||||
#endif
|
||||
|
||||
#if NOBIO > 0
|
||||
obio_reserve_resource_unmap();
|
||||
|
||||
if (platform->obiodevs != obiodevs_nodev) {
|
||||
bzero(&mba, sizeof(mba));
|
||||
mba.mba_pba.pba_busname = "obio";
|
||||
mba.mba_pba.pba_iot = &prep_isa_io_space_tag;
|
||||
mba.mba_pba.pba_memt = &prep_isa_mem_space_tag;
|
||||
config_found(self, &mba.mba_pba, mainbus_print);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mot_ulmb60xa.c,v 1.3 2002/05/02 14:58:37 nonaka Exp $ */
|
||||
/* $NetBSD: mot_ulmb60xa.c,v 1.4 2002/05/02 15:18:00 nonaka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@ -80,6 +80,7 @@ struct platform platform_mot_ulmb60xa = {
|
||||
ext_intr_ivr, /* ext_intr */
|
||||
cpu_setup_unknown, /* cpu_setup */
|
||||
reset_prep_generic, /* reset */
|
||||
obiodevs_nodev, /* obiodevs */
|
||||
};
|
||||
|
||||
static int
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: platform.c,v 1.6 2002/05/02 14:58:37 nonaka Exp $ */
|
||||
/* $NetBSD: platform.c,v 1.7 2002/05/02 15:18:01 nonaka Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -53,12 +53,17 @@ static struct platform platform_unknown = {
|
||||
ext_intr, /* ext_intr */
|
||||
cpu_setup_unknown, /* cpu_setup */
|
||||
reset_unknown, /* reset */
|
||||
obiodevs_nodev, /* obiodevs */
|
||||
};
|
||||
|
||||
static struct plattab plattab_unknown = {
|
||||
NULL, 0
|
||||
};
|
||||
|
||||
const char *obiodevs_nodev[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
struct platform *platform = &platform_unknown;
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user