wdvar.h revision 1.2
11.2Slukem/* $NetBSD: wdvar.h,v 1.2 2003/10/08 04:25:44 lukem Exp $ */ 21.1Scdi 31.1Scdi/*- 41.1Scdi * Copyright (c) 2003 The NetBSD Foundation, Inc. 51.1Scdi * Copyright (c) 2001 Dynarc AB, Sweden. All rights reserved. 61.1Scdi * 71.1Scdi * This code is derived from software written by Anders Magnusson, 81.1Scdi * ragge@ludd.luth.se 91.1Scdi * 101.1Scdi * Redistribution and use in source and binary forms, with or without 111.1Scdi * modification, are permitted provided that the following conditions 121.1Scdi * are met: 131.1Scdi * 1. Redistributions of source code must retain the above copyright 141.1Scdi * notice, this list of conditions and the following disclaimer. 151.1Scdi * 2. Redistributions in binary form must reproduce the above copyright 161.1Scdi * notice, this list of conditions and the following disclaimer in the 171.1Scdi * documentation and/or other materials provided with the distribution. 181.1Scdi * 3. The name of the author may not be used to endorse or promote products 191.1Scdi * derived from this software without specific prior written permission 201.1Scdi * 211.1Scdi * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 221.1Scdi * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 231.1Scdi * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 241.1Scdi * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 251.1Scdi * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 261.1Scdi * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 271.1Scdi * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 281.1Scdi * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 291.1Scdi * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 301.1Scdi * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 311.1Scdi */ 321.1Scdi 331.1Scdi#ifndef _STAND_WDVAR_H 341.1Scdi#define _STAND_WDVAR_H 351.1Scdi 361.1Scdi#include <dev/ic/wdcreg.h> 371.1Scdi#include <dev/ata/atareg.h> 381.1Scdi#include <dev/pci/pciidereg.h> 391.1Scdi 401.1Scdi#include <mips/cpuregs.h> 411.1Scdi 421.1Scdi#include <sys/disklabel.h> 431.2Slukem#include <sys/bootblock.h> 441.1Scdi 451.1Scdi#define WDC_TIMEOUT 2000000 461.1Scdi#define PCIIDE_CHANNEL_NDEV 2 471.1Scdi#define NUNITS (PCIIDE_CHANNEL_NDEV * PCIIDE_NUM_CHANNELS) 481.1Scdi 491.1Scdistruct channel_softc { 501.1Scdi volatile u_int8_t *c_base; 511.1Scdi volatile u_int16_t *c_data; 521.1Scdi 531.1Scdi u_int8_t compatchan; 541.1Scdi}; 551.1Scdi 561.1Scdistruct wd_softc { 571.1Scdi#define WDF_LBA 0x0001 581.1Scdi#define WDF_LBA48 0x0002 591.1Scdi u_int16_t sc_flags; 601.1Scdi 611.1Scdi u_int8_t sc_part; 621.1Scdi u_int8_t sc_unit; 631.1Scdi 641.1Scdi u_int64_t sc_capacity; 651.1Scdi 661.1Scdi struct ataparams sc_params; 671.1Scdi struct disklabel sc_label; 681.1Scdi struct channel_softc sc_channel; 691.1Scdi}; 701.1Scdi 711.1Scdistruct wdc_command { 721.1Scdi u_int8_t drive; /* drive id */ 731.1Scdi 741.1Scdi u_int8_t r_command; /* Parameters to upload to registers */ 751.1Scdi u_int8_t r_head; 761.1Scdi u_int16_t r_cyl; 771.1Scdi u_int8_t r_sector; 781.1Scdi u_int8_t r_count; 791.1Scdi u_int8_t r_precomp; 801.1Scdi 811.1Scdi u_int16_t bcount; 821.1Scdi void *data; 831.1Scdi 841.1Scdi u_int64_t r_blkno; 851.1Scdi}; 861.1Scdi 871.1Scdiint wdc_init (struct wd_softc*, u_int8_t*); 881.1Scdiint wdccommand (struct wd_softc*, struct wdc_command*); 891.1Scdiint wdccommandext (struct wd_softc*, struct wdc_command*); 901.1Scdiint wdc_exec_read (struct wd_softc*, u_int8_t, daddr_t, void*); 911.1Scdiint wdc_exec_identify (struct wd_softc*, void*); 921.1Scdi 931.1Scdiint pciide_init (struct channel_softc*, u_int8_t*); 941.1Scdi 951.1Scdi#endif /* _STAND_WDVAR_H */ 96