add iteide(4) driver for ITE8212-based IDE controllers. from
OpenBSD, ported to NetBSD by me. ok'd by bouyer@, thorpej@.
This commit is contained in:
parent
4eaada98f4
commit
9204390fe4
@ -1,4 +1,4 @@
|
||||
# $NetBSD: mi,v 1.735 2004/11/24 20:49:18 bouyer Exp $
|
||||
# $NetBSD: mi,v 1.736 2004/12/01 22:27:45 grant Exp $
|
||||
./etc/mtree/set.man man-sys-root
|
||||
./usr/share/info/am-utils.info man-amd-info info
|
||||
./usr/share/info/as.info man-computil-info bfd,info
|
||||
@ -923,6 +923,7 @@
|
||||
./usr/share/man/cat4/isic.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/iso.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/isp.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/iteide.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/iwic.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/ix.0 man-sys-catman .cat
|
||||
./usr/share/man/cat4/iy.0 man-sys-catman .cat
|
||||
@ -3076,6 +3077,7 @@
|
||||
./usr/share/man/man4/isic.4 man-sys-man .man
|
||||
./usr/share/man/man4/iso.4 man-sys-man .man
|
||||
./usr/share/man/man4/isp.4 man-sys-man .man
|
||||
./usr/share/man/man4/iteide.4 man-sys-man .man
|
||||
./usr/share/man/man4/iwic.4 man-sys-man .man
|
||||
./usr/share/man/man4/ix.4 man-sys-man .man
|
||||
./usr/share/man/man4/iy.4 man-sys-man .man
|
||||
|
@ -1,4 +1,4 @@
|
||||
LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.390 $>
|
||||
LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.391 $>
|
||||
|
||||
|
||||
[Note: This file does not mention every change made to the NetBSD source tree.
|
||||
@ -161,3 +161,5 @@ Changes from NetBSD 2.0 to NetBSD 3.0:
|
||||
pdcsata(4): Driver for the SATA150 family of promise controllers.
|
||||
[bouyer 20041124]
|
||||
am-utils: import 6.1b5pre 20040916 [christos 20041126]
|
||||
iteide(4): Add driver for the ITE 8212 IDE controller.
|
||||
[grant 20041130]
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.337 2004/11/24 22:38:44 wiz Exp $
|
||||
# $NetBSD: Makefile,v 1.338 2004/12/01 22:27:45 grant Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/18/93
|
||||
|
||||
MAN= aac.4 acardide.4 aceride.4 acphy.4 adc.4 adv.4 \
|
||||
@ -19,7 +19,7 @@ MAN= aac.4 acardide.4 aceride.4 acphy.4 adc.4 adv.4 \
|
||||
hptide.4 icmp.4 icp.4 icsphy.4 idp.4 ifmedia.4 \
|
||||
igsfb.4 iha.4 inet.4 inphy.4 intersil7170.4 \
|
||||
ioasic.4 ioat.4 iop.4 iophy.4 iopsp.4 ip.4 ipkdb.4 ipw.4 \
|
||||
iso.4 isp.4 joy.4 kloader.4 ksyms.4 kttcp.4 lc.4 \
|
||||
iso.4 isp.4 iteide.4 joy.4 kloader.4 ksyms.4 kttcp.4 lc.4 \
|
||||
ld.4 lkm.4 lo.4 lxtphy.4 mainbus.4 makphy.4 \
|
||||
mbe.4 mca.4 mcclock.4 md.4 mfb.4 mhzc.4 midi.4 \
|
||||
mii.4 mk48txx.4 mlx.4 mly.4 mpt.4 mpu.4 mtd.4 \
|
||||
|
68
share/man/man4/iteide.4
Normal file
68
share/man/man4/iteide.4
Normal file
@ -0,0 +1,68 @@
|
||||
.\" $NetBSD: iteide.4,v 1.1 2004/12/01 22:27:45 grant Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2004 Grant Beattie.
|
||||
.\"
|
||||
.\" 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. 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.
|
||||
.\"
|
||||
.Dd November 30, 2004
|
||||
.Dt ITEIDE 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm iteide
|
||||
.Nd Integrated Technology Express IDE disk controllers driver
|
||||
.Sh SYNOPSIS
|
||||
.Cd "iteide* at pci? dev ? function ? flags 0x0000"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver supports the IT8212 IDE controller which is found on some
|
||||
Gigabyte motherboards (as
|
||||
.Dq GigaRAID )
|
||||
and some PCI cards.
|
||||
This driver provides the interface with the hardware for the
|
||||
.Xr ata 4
|
||||
driver.
|
||||
.Pp
|
||||
The optional RAID functionality of the IT8212 is not supported and
|
||||
is explicitly disabled by the
|
||||
.Nm
|
||||
driver.
|
||||
The controller will act like a regular IDE controller with no RAID
|
||||
functionality.
|
||||
.Sh SEE ALSO
|
||||
.Xr ata 4 ,
|
||||
.Xr atapi 4 ,
|
||||
.Xr intro 4 ,
|
||||
.Xr pci 4 ,
|
||||
.Xr pciide 4 ,
|
||||
.Xr wd 4 ,
|
||||
.Xr wdc 4
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm
|
||||
driver was written by
|
||||
.An Alexander Yurchenko Aq grange@openbsd.org
|
||||
and ported to
|
||||
.Ox
|
||||
by
|
||||
.An Grant Beattie Aq grant@NetBSD.org .
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: DELPHI,v 1.45 2004/11/24 20:49:21 bouyer Exp $
|
||||
# $NetBSD: DELPHI,v 1.46 2004/12/01 22:27:46 grant Exp $
|
||||
#
|
||||
# DELPHI -- one of thorpej@zembu.com's devel machines
|
||||
#
|
||||
@ -7,7 +7,7 @@ include "arch/i386/conf/std.i386"
|
||||
|
||||
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
ident "DELPHI-$Revision: 1.45 $"
|
||||
ident "DELPHI-$Revision: 1.46 $"
|
||||
|
||||
maxusers 64 # estimated number of users
|
||||
|
||||
@ -414,6 +414,7 @@ artsata* at pci? dev ? function ? # Intel i31244 SATA controller
|
||||
cmdide* at pci? dev ? function ? # CMD tech IDE controllers
|
||||
cypide* at pci? dev ? function ? # Cypress IDE controllers
|
||||
hptide* at pci? dev ? function ? # Triones/HighPoint IDE controllers
|
||||
iteide* at pci? dev ? function ? # IT Express IDE controllers
|
||||
optiide* at pci? dev ? function ? # Opti IDE controllers
|
||||
piixide* at pci? dev ? function ? # Intel IDE controllers
|
||||
pdcide* at pci? dev ? function ? # Promise IDE controllers
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: GENERIC,v 1.642 2004/11/25 16:13:34 kim Exp $
|
||||
# $NetBSD: GENERIC,v 1.643 2004/12/01 22:27:46 grant Exp $
|
||||
#
|
||||
# GENERIC machine description file
|
||||
#
|
||||
@ -22,7 +22,7 @@ include "arch/i386/conf/std.i386"
|
||||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERIC-$Revision: 1.642 $"
|
||||
#ident "GENERIC-$Revision: 1.643 $"
|
||||
|
||||
maxusers 32 # estimated number of users
|
||||
|
||||
@ -657,6 +657,7 @@ cmdide* at pci? dev ? function ? # CMD tech IDE controllers
|
||||
cypide* at pci? dev ? function ? # Cypress IDE controllers
|
||||
geodeide* at pci? dev ? function ? # AMD Geode IDE controllers
|
||||
hptide* at pci? dev ? function ? # Triones/HighPoint IDE controllers
|
||||
iteide* at pci? dev ? function ? # IT Express IDE controllers
|
||||
optiide* at pci? dev ? function ? # Opti IDE controllers
|
||||
piixide* at pci? dev ? function ? # Intel IDE controllers
|
||||
pdcide* at pci? dev ? function ? # Promise IDE controllers
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: GENERIC.MPACPI,v 1.10 2004/11/24 20:49:21 bouyer Exp $
|
||||
# $NetBSD: GENERIC.MPACPI,v 1.11 2004/12/01 22:27:46 grant Exp $
|
||||
#
|
||||
# GENERIC.MPACPI -- Generic, plus ACPI Multiprocessor support
|
||||
#
|
||||
@ -8,7 +8,7 @@ include "arch/i386/conf/std.i386"
|
||||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERIC-$Revision: 1.10 $"
|
||||
#ident "GENERIC-$Revision: 1.11 $"
|
||||
|
||||
maxusers 32 # estimated number of users
|
||||
|
||||
@ -631,6 +631,7 @@ cmdide* at pci? dev ? function ? # CMD tech IDE controllers
|
||||
cypide* at pci? dev ? function ? # Cypress IDE controllers
|
||||
geodeide* at pci? dev ? function ? # AMD Geode IDE controllers
|
||||
hptide* at pci? dev ? function ? # Triones/HighPoint IDE controllers
|
||||
iteide* at pci? dev ? function ? # IT Express IDE controllers
|
||||
optiide* at pci? dev ? function ? # Opti IDE controllers
|
||||
piixide* at pci? dev ? function ? # Intel IDE controllers
|
||||
pdcide* at pci? dev ? function ? # Promise IDE controllers
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: GENERIC_LAPTOP,v 1.121 2004/11/24 20:49:21 bouyer Exp $
|
||||
# $NetBSD: GENERIC_LAPTOP,v 1.122 2004/12/01 22:27:46 grant Exp $
|
||||
# From: NetBSD: GENERIC,v 1.414 2001/07/30 19:59:05 ad Exp
|
||||
#
|
||||
# GENERIC_LAPTOP -- GENERIC with cardbus and some USB devices enabled
|
||||
@ -8,7 +8,7 @@ include "arch/i386/conf/std.i386"
|
||||
|
||||
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERIC-$Revision: 1.121 $"
|
||||
#ident "GENERIC-$Revision: 1.122 $"
|
||||
|
||||
maxusers 32 # estimated number of users
|
||||
|
||||
@ -486,6 +486,7 @@ cmdide* at pci? dev ? function ? # CMD tech IDE controllers
|
||||
cypide* at pci? dev ? function ? # Cypress IDE controllers
|
||||
#geodeide* at pci? dev ? function ? # AMD Geode IDE controllers
|
||||
hptide* at pci? dev ? function ? # Triones/HighPoint IDE controllers
|
||||
iteide* at pci? dev ? function ? # IT Express IDE controllers
|
||||
optiide* at pci? dev ? function ? # Opti IDE controllers
|
||||
piixide* at pci? dev ? function ? # Intel IDE controllers
|
||||
pdcide* at pci? dev ? function ? # Promise IDE controllers
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: INSTALL,v 1.254 2004/11/24 20:49:22 bouyer Exp $
|
||||
# $NetBSD: INSTALL,v 1.255 2004/12/01 22:27:46 grant Exp $
|
||||
#
|
||||
# INSTALL - Installation kernel.
|
||||
#
|
||||
@ -419,6 +419,7 @@ cmdide* at pci? dev ? function ? # CMD tech IDE controllers
|
||||
cypide* at pci? dev ? function ? # Cypress IDE controllers
|
||||
geodeide* at pci? dev ? function ? # AMD Geode IDE controllers
|
||||
hptide* at pci? dev ? function ? # Triones/HighPoint IDE controllers
|
||||
iteide* at pci? dev ? function ? # IT Express IDE controllers
|
||||
optiide* at pci? dev ? function ? # Opti IDE controllers
|
||||
piixide* at pci? dev ? function ? # Intel IDE controllers
|
||||
pdcide* at pci? dev ? function ? # Promise IDE controllers
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: INSTALL_LAPTOP,v 1.74 2004/11/24 20:49:23 bouyer Exp $
|
||||
# $NetBSD: INSTALL_LAPTOP,v 1.75 2004/12/01 22:27:46 grant Exp $
|
||||
#
|
||||
# INSTALL - Installation kernel.
|
||||
#
|
||||
@ -361,6 +361,7 @@ cmdide* at pci? dev ? function ? # CMD tech IDE controllers
|
||||
cypide* at pci? dev ? function ? # Cypress IDE controllers
|
||||
#geodeide* at pci? dev ? function ? # AMD Geode IDE controllers
|
||||
hptide* at pci? dev ? function ? # Triones/HighPoint IDE controllers
|
||||
iteide* at pci? dev ? function ? # IT Express IDE controllers
|
||||
optiide* at pci? dev ? function ? # Opti IDE controllers
|
||||
piixide* at pci? dev ? function ? # Intel IDE controllers
|
||||
pdcide* at pci? dev ? function ? # Promise IDE controllers
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: IOPENER,v 1.53 2004/11/24 20:49:23 bouyer Exp $
|
||||
# $NetBSD: IOPENER,v 1.54 2004/12/01 22:27:46 grant Exp $
|
||||
#
|
||||
# IOPENER -- GENERIC-like kernel for the Netpliance i-opener
|
||||
# from: GENERIC,v 1.358 2000/07/05 04:07:25 sommerfeld Exp
|
||||
@ -8,7 +8,7 @@ include "arch/i386/conf/std.i386"
|
||||
|
||||
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "IOPENER-$Revision: 1.53 $"
|
||||
#ident "IOPENER-$Revision: 1.54 $"
|
||||
|
||||
maxusers 32 # estimated number of users
|
||||
|
||||
@ -274,6 +274,7 @@ artsata* at pci? dev ? function ? # Intel i31244 SATA controller
|
||||
cmdide* at pci? dev ? function ? # CMD tech IDE controllers
|
||||
cypide* at pci? dev ? function ? # Cypress IDE controllers
|
||||
hptide* at pci? dev ? function ? # Triones/HighPoint IDE controllers
|
||||
iteide* at pci? dev ? function ? # IT Express IDE controllers
|
||||
optiide* at pci? dev ? function ? # Opti IDE controllers
|
||||
piixide* at pci? dev ? function ? # Intel IDE controllers
|
||||
pdcide* at pci? dev ? function ? # Promise IDE controllers
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: SWINGER,v 1.57 2004/11/24 20:49:24 bouyer Exp $
|
||||
# $NetBSD: SWINGER,v 1.58 2004/12/01 22:27:46 grant Exp $
|
||||
# from NetBSD: GENERIC,v 1.325 2000/04/14 14:53:32 augustss Exp
|
||||
#
|
||||
# SWINGER -- thorpej's Abit BP6+dual Celeron
|
||||
@ -8,7 +8,7 @@ include "arch/i386/conf/std.i386"
|
||||
|
||||
#options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "SWINGER-$Revision: 1.57 $"
|
||||
#ident "SWINGER-$Revision: 1.58 $"
|
||||
|
||||
maxusers 64 # estimated number of users
|
||||
|
||||
@ -418,6 +418,7 @@ aceride* at pci? dev ? function ? # Acer Lab IDE controllers
|
||||
cmdide* at pci? dev ? function ? # CMD tech IDE controllers
|
||||
cypide* at pci? dev ? function ? # Cypress IDE controllers
|
||||
hptide* at pci? dev ? function ? # Triones/HighPoint IDE controllers
|
||||
iteide* at pci? dev ? function ? # IT Express IDE controllers
|
||||
optiide* at pci? dev ? function ? # Opti IDE controllers
|
||||
piixide* at pci? dev ? function ? # Intel IDE controllers
|
||||
pdcide* at pci? dev ? function ? # Promise IDE controllers
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: files.pci,v 1.224 2004/11/24 20:49:19 bouyer Exp $
|
||||
# $NetBSD: files.pci,v 1.225 2004/12/01 22:27:45 grant Exp $
|
||||
#
|
||||
# Config file and device description for machine-independent PCI code.
|
||||
# Included by ports that need it. Requires that the SCSI files be
|
||||
@ -237,6 +237,11 @@ device hptide {[channel = -1]}: ata, pciide_common, wdc_common
|
||||
attach hptide at pci
|
||||
file dev/pci/hptide.c hptide
|
||||
|
||||
# Integrated Technology Express IDE controllers
|
||||
device iteide {[channel = -1]}: ata, pciide_common, wdc_common
|
||||
attach iteide at pci
|
||||
file dev/pci/iteide.c iteide
|
||||
|
||||
# Opti IDE controllers
|
||||
device optiide {[channel = -1]}: ata, pciide_common, wdc_common
|
||||
attach optiide at pci
|
||||
|
254
sys/dev/pci/iteide.c
Normal file
254
sys/dev/pci/iteide.c
Normal file
@ -0,0 +1,254 @@
|
||||
/* $NetBSD: iteide.c,v 1.1 2004/12/01 22:27:45 grant Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 The NetBSD Foundation, Inc.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Grant Beattie.
|
||||
*
|
||||
* 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. 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/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/pcidevs.h>
|
||||
#include <dev/pci/pciidereg.h>
|
||||
#include <dev/pci/pciidevar.h>
|
||||
#include <dev/pci/pciide_ite_reg.h>
|
||||
|
||||
static void ite_chip_map(struct pciide_softc*, struct pci_attach_args*);
|
||||
static void ite_setup_channel(struct ata_channel*);
|
||||
|
||||
static int iteide_match(struct device *, struct cfdata *, void *);
|
||||
static void iteide_attach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(iteide, sizeof(struct pciide_softc),
|
||||
iteide_match, iteide_attach, NULL, NULL);
|
||||
|
||||
static const struct pciide_product_desc pciide_ite_products[] = {
|
||||
{ PCI_PRODUCT_ITE_IT8212,
|
||||
0,
|
||||
"Integrated Technology Express IDE controller",
|
||||
ite_chip_map,
|
||||
},
|
||||
{ 0,
|
||||
0,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
static int
|
||||
iteide_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
struct pci_attach_args *pa = aux;
|
||||
if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ITE &&
|
||||
PCI_CLASS(pa->pa_class) == PCI_CLASS_MASS_STORAGE) {
|
||||
if (pciide_lookup_product(pa->pa_id, pciide_ite_products))
|
||||
return (2);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
iteide_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct pci_attach_args *pa = aux;
|
||||
struct pciide_softc *sc = (struct pciide_softc *)self;
|
||||
|
||||
pciide_common_attach(sc, pa,
|
||||
pciide_lookup_product(pa->pa_id, pciide_ite_products));
|
||||
}
|
||||
|
||||
static void
|
||||
ite_chip_map(struct pciide_softc *sc, struct pci_attach_args *pa)
|
||||
{
|
||||
struct pciide_channel *cp;
|
||||
int channel;
|
||||
pcireg_t interface;
|
||||
bus_size_t cmdsize, ctlsize;
|
||||
pcireg_t cfg, modectl;
|
||||
|
||||
/* fake interface since IT8212 claims to be a RAID device */
|
||||
interface = PCIIDE_INTERFACE_BUS_MASTER_DMA |
|
||||
PCIIDE_INTERFACE_PCI(0) | PCIIDE_INTERFACE_PCI(1);
|
||||
|
||||
cfg = pci_conf_read(sc->sc_pc, sc->sc_tag, IT_CFG);
|
||||
modectl = pci_conf_read(sc->sc_pc, sc->sc_tag, IT_MODE);
|
||||
ATADEBUG_PRINT(("%s: cfg=0x%x, modectl=0x%x\n",
|
||||
sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cfg & IT_CFG_MASK,
|
||||
modectl & IT_MODE_MASK), DEBUG_PROBE);
|
||||
|
||||
if (pciide_chipen(sc, pa) == 0)
|
||||
return;
|
||||
|
||||
aprint_normal("%s: bus-master DMA support present",
|
||||
sc->sc_wdcdev.sc_atac.atac_dev.dv_xname);
|
||||
pciide_mapreg_dma(sc, pa);
|
||||
aprint_normal("\n");
|
||||
|
||||
sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16 | ATAC_CAP_DATA32;
|
||||
|
||||
if (sc->sc_dma_ok) {
|
||||
sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_DMA | ATAC_CAP_UDMA;
|
||||
sc->sc_wdcdev.irqack = pciide_irqack;
|
||||
}
|
||||
sc->sc_wdcdev.sc_atac.atac_pio_cap = 4;
|
||||
sc->sc_wdcdev.sc_atac.atac_dma_cap = 2;
|
||||
sc->sc_wdcdev.sc_atac.atac_udma_cap = 6;
|
||||
|
||||
sc->sc_wdcdev.sc_atac.atac_set_modes = ite_setup_channel;
|
||||
sc->sc_wdcdev.sc_atac.atac_channels = sc->wdc_chanarray;
|
||||
sc->sc_wdcdev.sc_atac.atac_nchannels = PCIIDE_NUM_CHANNELS;
|
||||
|
||||
wdc_allocate_regs(&sc->sc_wdcdev);
|
||||
|
||||
/* Disable RAID */
|
||||
modectl &= ~IT_MODE_RAID1;
|
||||
/* Disable CPU firmware mode */
|
||||
modectl &= ~IT_MODE_CPU;
|
||||
|
||||
pci_conf_write(sc->sc_pc, sc->sc_tag, IT_MODE, modectl);
|
||||
|
||||
for (channel = 0; channel < sc->sc_wdcdev.sc_atac.atac_nchannels; channel++) {
|
||||
cp = &sc->pciide_channels[channel];
|
||||
|
||||
if (pciide_chansetup(sc, channel, interface) == 0)
|
||||
continue;
|
||||
|
||||
pciide_mapchan(pa, cp, interface, &cmdsize, &ctlsize,
|
||||
pciide_pci_intr);
|
||||
}
|
||||
/* Re-read configuration registers after channels setup */
|
||||
cfg = pci_conf_read(sc->sc_pc, sc->sc_tag, IT_CFG);
|
||||
modectl = pci_conf_read(sc->sc_pc, sc->sc_tag, IT_MODE);
|
||||
ATADEBUG_PRINT(("%s: cfg=0x%x, modectl=0x%x\n",
|
||||
sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, cfg & IT_CFG_MASK,
|
||||
modectl & IT_MODE_MASK), DEBUG_PROBE);
|
||||
}
|
||||
|
||||
static void
|
||||
ite_setup_channel(struct ata_channel *chp)
|
||||
{
|
||||
struct ata_drive_datas *drvp;
|
||||
int drive, mode = 0;
|
||||
u_int32_t idedma_ctl;
|
||||
struct pciide_channel *cp = CHAN_TO_PCHAN(chp);
|
||||
struct pciide_softc *sc = CHAN_TO_PCIIDE(chp);
|
||||
int channel = chp->ch_channel;
|
||||
pcireg_t cfg, modectl;
|
||||
pcireg_t tim;
|
||||
|
||||
cfg = pci_conf_read(sc->sc_pc, sc->sc_tag, IT_CFG);
|
||||
modectl = pci_conf_read(sc->sc_pc, sc->sc_tag, IT_MODE);
|
||||
tim = pci_conf_read(sc->sc_pc, sc->sc_tag, IT_TIM(channel));
|
||||
ATADEBUG_PRINT(("%s:%d: tim=0x%x\n",
|
||||
sc->sc_wdcdev.sc_atac.atac_dev.dv_xname,
|
||||
channel, tim), DEBUG_PROBE);
|
||||
|
||||
/* Setup DMA if needed */
|
||||
pciide_channel_dma_setup(cp);
|
||||
|
||||
/* Clear all bits for this channel */
|
||||
idedma_ctl = 0;
|
||||
|
||||
/* Per channel settings */
|
||||
for (drive = 0; drive < 2; drive++) {
|
||||
drvp = &chp->ch_drive[drive];
|
||||
|
||||
/* If no drive, skip */
|
||||
if ((drvp->drive_flags & DRIVE) == 0)
|
||||
continue;
|
||||
|
||||
if ((chp->ch_atac->atac_cap & ATAC_CAP_UDMA) != 0 &&
|
||||
(drvp->drive_flags & DRIVE_UDMA) != 0) {
|
||||
/* Setup UltraDMA mode */
|
||||
drvp->drive_flags &= ~DRIVE_DMA;
|
||||
modectl &= ~IT_MODE_DMA(channel, drive);
|
||||
|
||||
#if 0
|
||||
/* Check cable, only works in CPU firmware mode */
|
||||
if (drvp->UDMA_mode > 2 &&
|
||||
(cfg & IT_CFG_CABLE(channel, drive)) == 0) {
|
||||
ATADEBUG_PRINT(("(%s:%d:%d): "
|
||||
"80-wire cable not detected\n",
|
||||
sc->sc_wdcdev.sc_atac.atac_dev.dv_xname,
|
||||
channel, drive), DEBUG_PROBE);
|
||||
drvp->UDMA_mode = 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (drvp->UDMA_mode >= 5)
|
||||
tim |= IT_TIM_UDMA5(drive);
|
||||
else
|
||||
tim &= ~IT_TIM_UDMA5(drive);
|
||||
|
||||
mode = drvp->PIO_mode;
|
||||
} else if ((chp->ch_atac->atac_cap & ATAC_CAP_DMA) != 0 &&
|
||||
(drvp->drive_flags & DRIVE_DMA) != 0) {
|
||||
/* Setup multiword DMA mode */
|
||||
drvp->drive_flags &= ~DRIVE_UDMA;
|
||||
modectl |= IT_MODE_DMA(channel, drive);
|
||||
|
||||
/* mode = min(pio, dma + 2) */
|
||||
if (drvp->PIO_mode <= (drvp->DMA_mode + 2))
|
||||
mode = drvp->PIO_mode;
|
||||
else
|
||||
mode = drvp->DMA_mode + 2;
|
||||
} else {
|
||||
goto pio;
|
||||
}
|
||||
idedma_ctl |= IDEDMA_CTL_DRV_DMA(drive);
|
||||
|
||||
pio:
|
||||
/* Setup PIO mode */
|
||||
if (mode <= 2) {
|
||||
drvp->DMA_mode = 0;
|
||||
drvp->PIO_mode = 0;
|
||||
mode = 0;
|
||||
} else {
|
||||
drvp->PIO_mode = mode;
|
||||
drvp->DMA_mode = mode - 2;
|
||||
}
|
||||
|
||||
/* Enable IORDY if PIO mode >= 3 */
|
||||
if (drvp->PIO_mode >= 3)
|
||||
cfg |= IT_CFG_IORDY(channel);
|
||||
}
|
||||
|
||||
ATADEBUG_PRINT(("%s: tim=0x%x\n",
|
||||
sc->sc_wdcdev.sc_atac.atac_dev.dv_xname, tim), DEBUG_PROBE);
|
||||
|
||||
pci_conf_write(sc->sc_pc, sc->sc_tag, IT_CFG, cfg);
|
||||
pci_conf_write(sc->sc_pc, sc->sc_tag, IT_MODE, modectl);
|
||||
pci_conf_write(sc->sc_pc, sc->sc_tag, IT_TIM(channel), tim);
|
||||
|
||||
if (idedma_ctl != 0) {
|
||||
/* Add software bits in status register */
|
||||
bus_space_write_1(sc->sc_dma_iot,
|
||||
cp->dma_iohs[IDEDMA_CTL], 0, idedma_ctl);
|
||||
}
|
||||
}
|
38
sys/dev/pci/pciide_ite_reg.h
Normal file
38
sys/dev/pci/pciide_ite_reg.h
Normal file
@ -0,0 +1,38 @@
|
||||
/* $NetBSD: pciide_ite_reg.h,v 1.1 2004/12/01 22:27:45 grant Exp $ */
|
||||
/* OpenBSD: pciide_ite_reg.h,v 1.1 2003/12/20 08:03:55 grange Exp */
|
||||
/*
|
||||
* Copyright (c) 2003 Alexander Yurchenko <grange@openbsd.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Registers definition for IT8212F
|
||||
*/
|
||||
#define IT_CFG 0x40 /* I/O configuration */
|
||||
#define IT_CFG_MASK 0x0000ffff
|
||||
#define IT_CFG_IORDY(chan) (0x0001 << (chan))
|
||||
#define IT_CFG_BLID(chan) (0x0004 << (chan))
|
||||
#define IT_CFG_CABLE(chan, drive) (0x0010 << ((chan) * 2 + (drive)))
|
||||
#define IT_CFG_DECODE(chan) (0x8000 >> ((chan) * 2))
|
||||
|
||||
#define IT_MODE 0x50 /* mode control / RAID function */
|
||||
#define IT_MODE_MASK 0x0000ffff
|
||||
#define IT_MODE_CPU 0x0001
|
||||
#define IT_MODE_50MHZ(chan) (0x0002 << (chan))
|
||||
#define IT_MODE_DMA(chan, drive) (0x0008 << ((chan) * 2 + (drive)))
|
||||
#define IT_MODE_RESET 0x0080
|
||||
#define IT_MODE_RAID1 0x0100
|
||||
|
||||
#define IT_TIM(chan) ((chan) ? 0x58 : 0x54) /* timings */
|
||||
#define IT_TIM_UDMA5(drive) (0x00800000 << (drive) * 8)
|
Loading…
Reference in New Issue
Block a user