ata-pci.h revision 111188
1111188Ssos/*- 2111188Ssos * Copyright (c) 2003 S�ren Schmidt <sos@FreeBSD.org> 3111188Ssos * All rights reserved. 4111188Ssos * 5111188Ssos * Redistribution and use in source and binary forms, with or without 6111188Ssos * modification, are permitted provided that the following conditions 7111188Ssos * are met: 8111188Ssos * 1. Redistributions of source code must retain the above copyright 9111188Ssos * notice, this list of conditions and the following disclaimer, 10111188Ssos * without modification, immediately at the beginning of the file. 11111188Ssos * 2. Redistributions in binary form must reproduce the above copyright 12111188Ssos * notice, this list of conditions and the following disclaimer in the 13111188Ssos * documentation and/or other materials provided with the distribution. 14111188Ssos * 3. The name of the author may not be used to endorse or promote products 15111188Ssos * derived from this software without specific prior written permission. 16111188Ssos * 17111188Ssos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18111188Ssos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19111188Ssos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20111188Ssos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21111188Ssos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22111188Ssos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23111188Ssos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24111188Ssos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25111188Ssos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26111188Ssos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27111188Ssos * 28111188Ssos * $FreeBSD: head/sys/dev/ata/ata-pci.h 111188 2003-02-20 20:02:32Z sos $ 29111188Ssos */ 30111188Ssos 31111188Ssos/* structure holding chipset config info */ 32111188Ssosstruct ata_chip_id { 33111188Ssos u_int32_t chiptype; 34111188Ssos u_int8_t chiprev; 35111188Ssos int cfg1; 36111188Ssos int cfg2; 37111188Ssos u_int8_t max_dma; 38111188Ssos char *text; 39111188Ssos}; 40111188Ssos 41111188Ssos/* structure describing a PCI ATA controller */ 42111188Ssosstruct ata_pci_controller { 43111188Ssos struct resource *r_bmio; 44111188Ssos int bmaddr; 45111188Ssos struct resource *r_irq; 46111188Ssos void *handle; 47111188Ssos struct ata_chip_id *chip; 48111188Ssos int (*chipinit)(device_t); 49111188Ssos int (*dmainit)(struct ata_channel *); 50111188Ssos void (*setmode)(struct ata_device *, int); 51111188Ssos void (*locking)(struct ata_channel *, int); 52111188Ssos int locked_ch; 53111188Ssos struct { 54111188Ssos void (*function)(void *); 55111188Ssos void *argument; 56111188Ssos } interrupt[2]; 57111188Ssos}; 58111188Ssos 59111188Ssos#define ATA_MASTERDEV(dev) ((pci_get_progif(dev) & 0x80) && \ 60111188Ssos (pci_get_progif(dev) & 0x05) != 0x05) 61111188Ssos 62111188Ssos/* defines for known chipset PCI id's */ 63111188Ssos#define ATA_ACARD_ID 0x1191 64111188Ssos#define ATA_ATP850 0x00021191 65111188Ssos#define ATA_ATP850A 0x00041191 66111188Ssos#define ATA_ATP850R 0x00051191 67111188Ssos#define ATA_ATP860A 0x00061191 68111188Ssos#define ATA_ATP860R 0x00071191 69111188Ssos#define ATA_ATP865A 0x00081191 70111188Ssos#define ATA_ATP865R 0x00091191 71111188Ssos 72111188Ssos#define ATA_AMD_ID 0x1022 73111188Ssos#define ATA_AMD755 0x74011022 74111188Ssos#define ATA_AMD756 0x74091022 75111188Ssos#define ATA_AMD766 0x74111022 76111188Ssos#define ATA_AMD768 0x74411022 77111188Ssos#define ATA_AMD8111 0x74691022 78111188Ssos 79111188Ssos#define ATA_ACER_LABS_ID 0x10b9 80111188Ssos#define ATA_ALI_5229 0x522910b9 81111188Ssos 82111188Ssos#define ATA_CYRIX_ID 0x1078 83111188Ssos#define ATA_CYRIX_5530 0x01021078 84111188Ssos 85111188Ssos#define ATA_CYPRESS_ID 0x1080 86111188Ssos#define ATA_CYPRESS_82C693 0xc6931080 87111188Ssos 88111188Ssos#define ATA_DEC_21150 0x00221011 89111188Ssos 90111188Ssos#define ATA_HIGHPOINT_ID 0x1103 91111188Ssos#define ATA_HPT366 0x00041103 92111188Ssos#define ATA_HPT372 0x00051103 93111188Ssos#define ATA_HPT302 0x00061103 94111188Ssos#define ATA_HPT371 0x00071103 95111188Ssos#define ATA_HPT374 0x00081103 96111188Ssos 97111188Ssos#define ATA_INTEL_ID 0x8086 98111188Ssos#define ATA_I960RM 0x09628086 99111188Ssos#define ATA_I82371FB 0x12308086 100111188Ssos#define ATA_I82371SB 0x70108086 101111188Ssos#define ATA_I82371AB 0x71118086 102111188Ssos#define ATA_I82443MX 0x71998086 103111188Ssos#define ATA_I82451NX 0x84ca8086 104111188Ssos#define ATA_I82372FB 0x76018086 105111188Ssos#define ATA_I82801AB 0x24218086 106111188Ssos#define ATA_I82801AA 0x24118086 107111188Ssos#define ATA_I82801BA 0x244a8086 108111188Ssos#define ATA_I82801BA_1 0x244b8086 109111188Ssos#define ATA_I82801CA 0x248a8086 110111188Ssos#define ATA_I82801CA_1 0x248b8086 111111188Ssos#define ATA_I82801DB 0x24cb8086 112111188Ssos 113111188Ssos#define ATA_NVIDIA_ID 0x10de 114111188Ssos#define ATA_NFORCE1 0x01bc10de 115111188Ssos#define ATA_NFORCE2 0x006510de 116111188Ssos 117111188Ssos#define ATA_PROMISE_ID 0x105a 118111188Ssos#define ATA_PDC20246 0x4d33105a 119111188Ssos#define ATA_PDC20262 0x4d38105a 120111188Ssos#define ATA_PDC20263 0x0d38105a 121111188Ssos#define ATA_PDC20265 0x0d30105a 122111188Ssos#define ATA_PDC20267 0x4d30105a 123111188Ssos#define ATA_PDC20268 0x4d68105a 124111188Ssos#define ATA_PDC20268R 0x6268105a 125111188Ssos#define ATA_PDC20269 0x4d69105a 126111188Ssos#define ATA_PDC20271 0x6269105a 127111188Ssos#define ATA_PDC20275 0x1275105a 128111188Ssos#define ATA_PDC20276 0x5275105a 129111188Ssos#define ATA_PDC20277 0x7275105a 130111188Ssos#define ATA_PDC20376 0x3376105a 131111188Ssos 132111188Ssos#define ATA_SERVERWORKS_ID 0x1166 133111188Ssos#define ATA_ROSB4 0x02111166 134111188Ssos#define ATA_CSB5 0x02121166 135111188Ssos#define ATA_CSB6 0x02131166 136111188Ssos#define ATA_CSB6_1 0x02171166 137111188Ssos 138111188Ssos#define ATA_SILICON_IMAGE_ID 0x1095 139111188Ssos#define ATA_SII0680 0x06801095 140111188Ssos#define ATA_CMD646 0x06461095 141111188Ssos#define ATA_CMD648 0x06481095 142111188Ssos#define ATA_CMD649 0x06491095 143111188Ssos 144111188Ssos#define ATA_SIS_ID 0x1039 145111188Ssos#define ATA_SISSOUTH 0x00081039 146111188Ssos#define ATA_SIS5511 0x55111039 147111188Ssos#define ATA_SIS5513 0x55131039 148111188Ssos#define ATA_SIS5518 0x55181039 149111188Ssos#define ATA_SIS5571 0x55711039 150111188Ssos#define ATA_SIS5591 0x55911039 151111188Ssos#define ATA_SIS5596 0x55961039 152111188Ssos#define ATA_SIS5597 0x55971039 153111188Ssos#define ATA_SIS5598 0x55981039 154111188Ssos#define ATA_SIS5600 0x56001039 155111188Ssos#define ATA_SIS530 0x05301039 156111188Ssos#define ATA_SIS540 0x05401039 157111188Ssos#define ATA_SIS550 0x05501039 158111188Ssos#define ATA_SIS620 0x06201039 159111188Ssos#define ATA_SIS630 0x06301039 160111188Ssos#define ATA_SIS635 0x06351039 161111188Ssos#define ATA_SIS633 0x06331039 162111188Ssos#define ATA_SIS640 0x06401039 163111188Ssos#define ATA_SIS645 0x06451039 164111188Ssos#define ATA_SIS646 0x06461039 165111188Ssos#define ATA_SIS648 0x06481039 166111188Ssos#define ATA_SIS650 0x06501039 167111188Ssos#define ATA_SIS651 0x06511039 168111188Ssos#define ATA_SIS652 0x06521039 169111188Ssos#define ATA_SIS655 0x06551039 170111188Ssos#define ATA_SIS658 0x06581039 171111188Ssos#define ATA_SIS730 0x07301039 172111188Ssos#define ATA_SIS733 0x07331039 173111188Ssos#define ATA_SIS735 0x07351039 174111188Ssos#define ATA_SIS740 0x07401039 175111188Ssos#define ATA_SIS745 0x07451039 176111188Ssos#define ATA_SIS746 0x07461039 177111188Ssos#define ATA_SIS748 0x07481039 178111188Ssos#define ATA_SIS750 0x07501039 179111188Ssos#define ATA_SIS751 0x07511039 180111188Ssos#define ATA_SIS752 0x07521039 181111188Ssos#define ATA_SIS755 0x07551039 182111188Ssos#define ATA_SIS961 0x09611039 183111188Ssos#define ATA_SIS962 0x09621039 184111188Ssos#define ATA_SIS963 0x09631039 185111188Ssos 186111188Ssos#define ATA_VIA_ID 0x1106 187111188Ssos#define ATA_VIA82C571 0x05711106 188111188Ssos#define ATA_VIA82C586 0x05861106 189111188Ssos#define ATA_VIA82C596 0x05961106 190111188Ssos#define ATA_VIA82C686 0x06861106 191111188Ssos#define ATA_VIA8231 0x82311106 192111188Ssos#define ATA_VIA8233 0x30741106 193111188Ssos#define ATA_VIA8233A 0x31471106 194111188Ssos#define ATA_VIA8233C 0x31091106 195111188Ssos#define ATA_VIA8235 0x31771106 196111188Ssos#define ATA_VIA8361 0x31121106 197111188Ssos#define ATA_VIA8363 0x03051106 198111188Ssos#define ATA_VIA8371 0x03911106 199111188Ssos#define ATA_VIA8662 0x31021106 200111188Ssos 201111188Ssos/* chipset setup related defines */ 202111188Ssos#define ATPOLD 1 203111188Ssos 204111188Ssos#define ALIOLD 0x01 205111188Ssos#define ALICABLE 0x02 206111188Ssos 207111188Ssos#define HPT366 0 208111188Ssos#define HPT370 1 209111188Ssos#define HPT372 2 210111188Ssos#define HPT374 3 211111188Ssos#define HPTOLD 0x01 212111188Ssos 213111188Ssos#define PROLD 0 214111188Ssos#define PRNEW 1 215111188Ssos#define PRTX2 2 216111188Ssos#define PRTX4 0x01 217111188Ssos#define PRSX6K 0x02 218111188Ssos 219111188Ssos#define SWKS33 0 220111188Ssos#define SWKS66 1 221111188Ssos#define SWKS100 2 222111188Ssos 223111188Ssos#define SII_SETCLK 1 224111188Ssos#define SII_INTR 0x01 225111188Ssos 226111188Ssos#define SIS_SOUTH 1 227111188Ssos#define SIS133NEW 2 228111188Ssos#define SIS133OLD 3 229111188Ssos#define SIS100NEW 4 230111188Ssos#define SIS100OLD 5 231111188Ssos#define SIS66 6 232111188Ssos 233111188Ssos#define VIA33 0 234111188Ssos#define VIA66 1 235111188Ssos#define VIA100 2 236111188Ssos#define VIA133 3 237111188Ssos#define AMDNVIDIA 4 238111188Ssos#define AMDCABLE 0x01 239111188Ssos#define AMDBUG 0x02 240111188Ssos#define NVIDIA 0x04 241111188Ssos#define VIACLK 0x08 242111188Ssos#define VIABUG 0x10 243111188Ssos 244111188Ssos/* global prototypes */ 245111188Ssosint ata_dmainit(struct ata_channel *); 246111188Ssosint ata_dmastart(struct ata_device *, caddr_t, int32_t, int); 247111188Ssosint ata_dmastop(struct ata_device *); 248111188Ssos 249111188Ssosint ata_generic_ident(device_t); 250111188Ssosint ata_acard_ident(device_t); 251111188Ssosint ata_ali_ident(device_t); 252111188Ssosint ata_amd_ident(device_t); 253111188Ssosint ata_cyrix_ident(device_t); 254111188Ssosint ata_cypress_ident(device_t); 255111188Ssosint ata_highpoint_ident(device_t); 256111188Ssosint ata_intel_ident(device_t); 257111188Ssosint ata_nvidia_ident(device_t); 258111188Ssosint ata_promise_ident(device_t); 259111188Ssosint ata_serverworks_ident(device_t); 260111188Ssosint ata_sii_ident(device_t); 261111188Ssosint ata_sis_ident(device_t); 262111188Ssosint ata_via_ident(device_t); 263