1bb5bdd38SSøren Schmidt /*- 29f82379cSSøren Schmidt * Copyright (c) 2003 - 2008 S�ren Schmidt <sos@FreeBSD.org> 3bb5bdd38SSøren Schmidt * All rights reserved. 4bb5bdd38SSøren Schmidt * 5bb5bdd38SSøren Schmidt * Redistribution and use in source and binary forms, with or without 6bb5bdd38SSøren Schmidt * modification, are permitted provided that the following conditions 7bb5bdd38SSøren Schmidt * are met: 8bb5bdd38SSøren Schmidt * 1. Redistributions of source code must retain the above copyright 9bb5bdd38SSøren Schmidt * notice, this list of conditions and the following disclaimer, 10bb5bdd38SSøren Schmidt * without modification, immediately at the beginning of the file. 11bb5bdd38SSøren Schmidt * 2. Redistributions in binary form must reproduce the above copyright 12bb5bdd38SSøren Schmidt * notice, this list of conditions and the following disclaimer in the 13bb5bdd38SSøren Schmidt * documentation and/or other materials provided with the distribution. 14bb5bdd38SSøren Schmidt * 15bb5bdd38SSøren Schmidt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16bb5bdd38SSøren Schmidt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17bb5bdd38SSøren Schmidt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18bb5bdd38SSøren Schmidt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19bb5bdd38SSøren Schmidt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20bb5bdd38SSøren Schmidt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21bb5bdd38SSøren Schmidt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22bb5bdd38SSøren Schmidt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23bb5bdd38SSøren Schmidt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24bb5bdd38SSøren Schmidt * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25bb5bdd38SSøren Schmidt * 26bb5bdd38SSøren Schmidt * $FreeBSD$ 27bb5bdd38SSøren Schmidt */ 28bb5bdd38SSøren Schmidt 29bb5bdd38SSøren Schmidt /* structure holding chipset config info */ 30bb5bdd38SSøren Schmidt struct ata_chip_id { 31566cf07aSSøren Schmidt u_int32_t chipid; 32bb5bdd38SSøren Schmidt u_int8_t chiprev; 33bb5bdd38SSøren Schmidt int cfg1; 34bb5bdd38SSøren Schmidt int cfg2; 35bb5bdd38SSøren Schmidt u_int8_t max_dma; 36bb5bdd38SSøren Schmidt char *text; 37bb5bdd38SSøren Schmidt }; 38bb5bdd38SSøren Schmidt 39bb5bdd38SSøren Schmidt /* structure describing a PCI ATA controller */ 40bb5bdd38SSøren Schmidt struct ata_pci_controller { 418ca4df32SSøren Schmidt device_t dev; 42498e5543SSøren Schmidt int r_type1; 43498e5543SSøren Schmidt int r_rid1; 44498e5543SSøren Schmidt struct resource *r_res1; 45498e5543SSøren Schmidt int r_type2; 46498e5543SSøren Schmidt int r_rid2; 47498e5543SSøren Schmidt struct resource *r_res2; 48a3b7c762SAlexander Motin int r_irq_rid; 49bb5bdd38SSøren Schmidt struct resource *r_irq; 50bb5bdd38SSøren Schmidt void *handle; 51bb5bdd38SSøren Schmidt struct ata_chip_id *chip; 52cb33306fSAlexander Motin int legacy; 536192895dSSøren Schmidt int channels; 549f8919f2SAlexander Motin int ichannels; 55bb5bdd38SSøren Schmidt int (*chipinit)(device_t); 567aab7e05SSøren Schmidt int (*suspend)(device_t); 577aab7e05SSøren Schmidt int (*resume)(device_t); 5804ff88ceSAlexander Motin int (*ch_attach)(device_t); 5904ff88ceSAlexander Motin int (*ch_detach)(device_t); 609cf4fe2eSAlexander Motin int (*ch_suspend)(device_t); 619cf4fe2eSAlexander Motin int (*ch_resume)(device_t); 620068f98fSSøren Schmidt int (*locking)(device_t, int); 630068f98fSSøren Schmidt void (*reset)(device_t); 640068f98fSSøren Schmidt void (*setmode)(device_t, int); 65bb5bdd38SSøren Schmidt struct { 66bb5bdd38SSøren Schmidt void (*function)(void *); 67bb5bdd38SSøren Schmidt void *argument; 68265da99cSSøren Schmidt } interrupt[8]; /* XXX SOS max ch# for now */ 698ca4df32SSøren Schmidt }; 708ca4df32SSøren Schmidt 71bb5bdd38SSøren Schmidt /* defines for known chipset PCI id's */ 72bb5bdd38SSøren Schmidt #define ATA_ACARD_ID 0x1191 73bb5bdd38SSøren Schmidt #define ATA_ATP850 0x00021191 74bb5bdd38SSøren Schmidt #define ATA_ATP850A 0x00041191 75bb5bdd38SSøren Schmidt #define ATA_ATP850R 0x00051191 76bb5bdd38SSøren Schmidt #define ATA_ATP860A 0x00061191 77bb5bdd38SSøren Schmidt #define ATA_ATP860R 0x00071191 78bb5bdd38SSøren Schmidt #define ATA_ATP865A 0x00081191 79bb5bdd38SSøren Schmidt #define ATA_ATP865R 0x00091191 80bb5bdd38SSøren Schmidt 81347458c9SSøren Schmidt #define ATA_ACER_LABS_ID 0x10b9 82347458c9SSøren Schmidt #define ATA_ALI_1533 0x153310b9 83347458c9SSøren Schmidt #define ATA_ALI_5229 0x522910b9 84347458c9SSøren Schmidt #define ATA_ALI_5281 0x528110b9 85347458c9SSøren Schmidt #define ATA_ALI_5287 0x528710b9 86347458c9SSøren Schmidt #define ATA_ALI_5288 0x528810b9 87347458c9SSøren Schmidt #define ATA_ALI_5289 0x528910b9 88347458c9SSøren Schmidt 89bb5bdd38SSøren Schmidt #define ATA_AMD_ID 0x1022 90bb5bdd38SSøren Schmidt #define ATA_AMD755 0x74011022 91bb5bdd38SSøren Schmidt #define ATA_AMD756 0x74091022 92bb5bdd38SSøren Schmidt #define ATA_AMD766 0x74111022 93bb5bdd38SSøren Schmidt #define ATA_AMD768 0x74411022 94bb5bdd38SSøren Schmidt #define ATA_AMD8111 0x74691022 9513a3fdf1SPoul-Henning Kamp #define ATA_AMD5536 0x209a1022 96bb5bdd38SSøren Schmidt 97347458c9SSøren Schmidt #define ATA_ADAPTEC_ID 0x9005 98347458c9SSøren Schmidt #define ATA_ADAPTEC_1420 0x02419005 99bb5bdd38SSøren Schmidt 1007ebce023SSøren Schmidt #define ATA_ATI_ID 0x1002 1017ebce023SSøren Schmidt #define ATA_ATI_IXP200 0x43491002 1027ebce023SSøren Schmidt #define ATA_ATI_IXP300 0x43691002 1037ebce023SSøren Schmidt #define ATA_ATI_IXP300_S1 0x436e1002 104200c7605SSøren Schmidt #define ATA_ATI_IXP400 0x43761002 1057ebce023SSøren Schmidt #define ATA_ATI_IXP400_S1 0x43791002 1067ebce023SSøren Schmidt #define ATA_ATI_IXP400_S2 0x437a1002 107200c7605SSøren Schmidt #define ATA_ATI_IXP600 0x438c1002 1080ef03238SSøren Schmidt #define ATA_ATI_IXP600_S1 0x43801002 109200c7605SSøren Schmidt #define ATA_ATI_IXP700 0x439c1002 1100ef03238SSøren Schmidt #define ATA_ATI_IXP700_S1 0x43901002 1117ebce023SSøren Schmidt 11288bdf804SSøren Schmidt #define ATA_CENATEK_ID 0x16ca 11388bdf804SSøren Schmidt #define ATA_CENATEK_ROCKET 0x000116ca 11488bdf804SSøren Schmidt 115bb5bdd38SSøren Schmidt #define ATA_CYRIX_ID 0x1078 116bb5bdd38SSøren Schmidt #define ATA_CYRIX_5530 0x01021078 117bb5bdd38SSøren Schmidt 118bb5bdd38SSøren Schmidt #define ATA_CYPRESS_ID 0x1080 119bb5bdd38SSøren Schmidt #define ATA_CYPRESS_82C693 0xc6931080 120bb5bdd38SSøren Schmidt 121bb5bdd38SSøren Schmidt #define ATA_DEC_21150 0x00221011 1226595b494SSøren Schmidt #define ATA_DEC_21150_1 0x00231011 123bb5bdd38SSøren Schmidt 124bb5bdd38SSøren Schmidt #define ATA_HIGHPOINT_ID 0x1103 125bb5bdd38SSøren Schmidt #define ATA_HPT366 0x00041103 126bb5bdd38SSøren Schmidt #define ATA_HPT372 0x00051103 127bb5bdd38SSøren Schmidt #define ATA_HPT302 0x00061103 128bb5bdd38SSøren Schmidt #define ATA_HPT371 0x00071103 129bb5bdd38SSøren Schmidt #define ATA_HPT374 0x00081103 130bb5bdd38SSøren Schmidt 131bb5bdd38SSøren Schmidt #define ATA_INTEL_ID 0x8086 132bb5bdd38SSøren Schmidt #define ATA_I960RM 0x09628086 133bb5bdd38SSøren Schmidt #define ATA_I82371FB 0x12308086 134bb5bdd38SSøren Schmidt #define ATA_I82371SB 0x70108086 135bb5bdd38SSøren Schmidt #define ATA_I82371AB 0x71118086 136bb5bdd38SSøren Schmidt #define ATA_I82443MX 0x71998086 137bb5bdd38SSøren Schmidt #define ATA_I82451NX 0x84ca8086 138bb5bdd38SSøren Schmidt #define ATA_I82372FB 0x76018086 139bb5bdd38SSøren Schmidt #define ATA_I82801AB 0x24218086 140bb5bdd38SSøren Schmidt #define ATA_I82801AA 0x24118086 141bb5bdd38SSøren Schmidt #define ATA_I82801BA 0x244a8086 142bb5bdd38SSøren Schmidt #define ATA_I82801BA_1 0x244b8086 143bb5bdd38SSøren Schmidt #define ATA_I82801CA 0x248a8086 144bb5bdd38SSøren Schmidt #define ATA_I82801CA_1 0x248b8086 145bb5bdd38SSøren Schmidt #define ATA_I82801DB 0x24cb8086 14660ad94deSSøren Schmidt #define ATA_I82801DB_1 0x24ca8086 1476e52134cSJohn Baldwin #define ATA_I82801EB 0x24db8086 148df6a77ddSSøren Schmidt #define ATA_I82801EB_S1 0x24d18086 149df6a77ddSSøren Schmidt #define ATA_I82801EB_R1 0x24df8086 150f2972d7eSSøren Schmidt #define ATA_I6300ESB 0x25a28086 151df6a77ddSSøren Schmidt #define ATA_I6300ESB_S1 0x25a38086 152df6a77ddSSøren Schmidt #define ATA_I6300ESB_R1 0x25b08086 153e7de1a39SSøren Schmidt #define ATA_I63XXESB2 0x269e8086 154e7de1a39SSøren Schmidt #define ATA_I63XXESB2_S1 0x26808086 155e7de1a39SSøren Schmidt #define ATA_I63XXESB2_S2 0x26818086 156e7de1a39SSøren Schmidt #define ATA_I63XXESB2_R1 0x26828086 157e7de1a39SSøren Schmidt #define ATA_I63XXESB2_R2 0x26838086 1588353d82bSSøren Schmidt #define ATA_I82801FB 0x266f8086 1598353d82bSSøren Schmidt #define ATA_I82801FB_S1 0x26518086 1608353d82bSSøren Schmidt #define ATA_I82801FB_R1 0x26528086 161e7de1a39SSøren Schmidt #define ATA_I82801FBM 0x26538086 162c46e1f53SSøren Schmidt #define ATA_I82801GB 0x27df8086 163c46e1f53SSøren Schmidt #define ATA_I82801GB_S1 0x27c08086 164c46e1f53SSøren Schmidt #define ATA_I82801GB_AH 0x27c18086 165e7de1a39SSøren Schmidt #define ATA_I82801GB_R1 0x27c38086 166e7de1a39SSøren Schmidt #define ATA_I82801GBM_S1 0x27c48086 167e7de1a39SSøren Schmidt #define ATA_I82801GBM_AH 0x27c58086 168e7de1a39SSøren Schmidt #define ATA_I82801GBM_R1 0x27c68086 169e7de1a39SSøren Schmidt #define ATA_I82801HB_S1 0x28208086 170e7de1a39SSøren Schmidt #define ATA_I82801HB_AH6 0x28218086 171e7de1a39SSøren Schmidt #define ATA_I82801HB_R1 0x28228086 172e7de1a39SSøren Schmidt #define ATA_I82801HB_AH4 0x28248086 173e7de1a39SSøren Schmidt #define ATA_I82801HB_S2 0x28258086 174e9cb9626SRemko Lodder #define ATA_I82801HBM 0x28508086 1751d69e13dSRemko Lodder #define ATA_I82801HBM_S1 0x28288086 1761d69e13dSRemko Lodder #define ATA_I82801HBM_S2 0x28298086 1771d69e13dSRemko Lodder #define ATA_I82801HBM_S3 0x282a8086 17818928d0dSSimon L. B. Nielsen #define ATA_I82801IB_S1 0x29208086 1798846f7d2SXin LI #define ATA_I82801IB_AH2 0x29218086 18018928d0dSSimon L. B. Nielsen #define ATA_I82801IB_AH6 0x29228086 18118928d0dSSimon L. B. Nielsen #define ATA_I82801IB_AH4 0x29238086 1828a282d33SRemko Lodder #define ATA_I82801IB_R1 0x29258086 18318928d0dSSimon L. B. Nielsen #define ATA_I82801IB_S2 0x29268086 1840cf07094SSøren Schmidt #define ATA_I82801JIB_S1 0x3a208086 1850cf07094SSøren Schmidt #define ATA_I82801JIB_AH 0x3a228086 1860cf07094SSøren Schmidt #define ATA_I82801JIB_R1 0x3a258086 1870cf07094SSøren Schmidt #define ATA_I82801JIB_S2 0x3a268086 1880cf07094SSøren Schmidt #define ATA_I82801JD_S1 0x3a008086 1890cf07094SSøren Schmidt #define ATA_I82801JD_AH 0x3a028086 1900cf07094SSøren Schmidt #define ATA_I82801JD_R1 0x3a058086 1910cf07094SSøren Schmidt #define ATA_I82801JD_S2 0x3a068086 192a77a43c7SSøren Schmidt #define ATA_I31244 0x32008086 193bb5bdd38SSøren Schmidt 19488bdf804SSøren Schmidt #define ATA_ITE_ID 0x1283 19577ada086SSøren Schmidt #define ATA_IT8211F 0x82111283 19688bdf804SSøren Schmidt #define ATA_IT8212F 0x82121283 197ed0c85e0SSøren Schmidt #define ATA_IT8213F 0x82131283 19888bdf804SSøren Schmidt 199797c12eeSSøren Schmidt #define ATA_JMICRON_ID 0x197b 200797c12eeSSøren Schmidt #define ATA_JMB360 0x2360197b 2010118b48bSSøren Schmidt #define ATA_JMB361 0x2361197b 202e3989d3eSSøren Schmidt #define ATA_JMB363 0x2363197b 2030118b48bSSøren Schmidt #define ATA_JMB365 0x2365197b 2040118b48bSSøren Schmidt #define ATA_JMB366 0x2366197b 205a4b07272SSøren Schmidt #define ATA_JMB368 0x2368197b 206797c12eeSSøren Schmidt 2074b55f0c7SSøren Schmidt #define ATA_MARVELL_ID 0x11ab 2084b55f0c7SSøren Schmidt #define ATA_M88SX5040 0x504011ab 2094b55f0c7SSøren Schmidt #define ATA_M88SX5041 0x504111ab 2104b55f0c7SSøren Schmidt #define ATA_M88SX5080 0x508011ab 2114b55f0c7SSøren Schmidt #define ATA_M88SX5081 0x508111ab 2124b55f0c7SSøren Schmidt #define ATA_M88SX6041 0x604111ab 2134b55f0c7SSøren Schmidt #define ATA_M88SX6081 0x608111ab 21422fe2182SSøren Schmidt #define ATA_M88SX6101 0x610111ab 2155941227fSRui Paulo #define ATA_M88SX6121 0x612111ab 21622fe2182SSøren Schmidt #define ATA_M88SX6145 0x614511ab 2174b55f0c7SSøren Schmidt 21888bdf804SSøren Schmidt #define ATA_MICRON_ID 0x1042 21988bdf804SSøren Schmidt #define ATA_MICRON_RZ1000 0x10001042 22088bdf804SSøren Schmidt #define ATA_MICRON_RZ1001 0x10011042 22188bdf804SSøren Schmidt 2225fdbb0d2SSøren Schmidt #define ATA_NATIONAL_ID 0x100b 2235fdbb0d2SSøren Schmidt #define ATA_SC1100 0x0502100b 2245fdbb0d2SSøren Schmidt 225cece26a6SRink Springer #define ATA_NETCELL_ID 0x169c 226cece26a6SRink Springer #define ATA_NETCELL_SR 0x0044169c 227cece26a6SRink Springer 228bb5bdd38SSøren Schmidt #define ATA_NVIDIA_ID 0x10de 229bb5bdd38SSøren Schmidt #define ATA_NFORCE1 0x01bc10de 230bb5bdd38SSøren Schmidt #define ATA_NFORCE2 0x006510de 231121b4783SSøren Schmidt #define ATA_NFORCE2_PRO 0x008510de 232121b4783SSøren Schmidt #define ATA_NFORCE2_PRO_S1 0x008e10de 233debffe83SDavid E. O'Brien #define ATA_NFORCE3 0x00d510de 234df6a77ddSSøren Schmidt #define ATA_NFORCE3_PRO 0x00e510de 235df6a77ddSSøren Schmidt #define ATA_NFORCE3_PRO_S1 0x00e310de 236df6a77ddSSøren Schmidt #define ATA_NFORCE3_PRO_S2 0x00ee10de 237121b4783SSøren Schmidt #define ATA_NFORCE_MCP04 0x003510de 238121b4783SSøren Schmidt #define ATA_NFORCE_MCP04_S1 0x003610de 239121b4783SSøren Schmidt #define ATA_NFORCE_MCP04_S2 0x003e10de 240121b4783SSøren Schmidt #define ATA_NFORCE_CK804 0x005310de 241121b4783SSøren Schmidt #define ATA_NFORCE_CK804_S1 0x005410de 242121b4783SSøren Schmidt #define ATA_NFORCE_CK804_S2 0x005510de 243121b4783SSøren Schmidt #define ATA_NFORCE_MCP51 0x026510de 244121b4783SSøren Schmidt #define ATA_NFORCE_MCP51_S1 0x026610de 245121b4783SSøren Schmidt #define ATA_NFORCE_MCP51_S2 0x026710de 246121b4783SSøren Schmidt #define ATA_NFORCE_MCP55 0x036e10de 247121b4783SSøren Schmidt #define ATA_NFORCE_MCP55_S1 0x037e10de 248121b4783SSøren Schmidt #define ATA_NFORCE_MCP55_S2 0x037f10de 24927568384SSøren Schmidt #define ATA_NFORCE_MCP61 0x03ec10de 25027568384SSøren Schmidt #define ATA_NFORCE_MCP61_S1 0x03e710de 25127568384SSøren Schmidt #define ATA_NFORCE_MCP61_S2 0x03f610de 25227568384SSøren Schmidt #define ATA_NFORCE_MCP61_S3 0x03f710de 253200c7605SSøren Schmidt #define ATA_NFORCE_MCP65 0x044810de 25453963e58SAlexander Motin #define ATA_NFORCE_MCP67_A0 0x055010de 25553963e58SAlexander Motin #define ATA_NFORCE_MCP67_A1 0x055110de 25653963e58SAlexander Motin #define ATA_NFORCE_MCP67_A2 0x055210de 25753963e58SAlexander Motin #define ATA_NFORCE_MCP67_A3 0x055310de 25853963e58SAlexander Motin #define ATA_NFORCE_MCP67_A4 0x055410de 25953963e58SAlexander Motin #define ATA_NFORCE_MCP67_A5 0x055510de 26053963e58SAlexander Motin #define ATA_NFORCE_MCP67_A6 0x055610de 26153963e58SAlexander Motin #define ATA_NFORCE_MCP67_A7 0x055710de 26253963e58SAlexander Motin #define ATA_NFORCE_MCP67_A8 0x055810de 26353963e58SAlexander Motin #define ATA_NFORCE_MCP67_A9 0x055910de 26453963e58SAlexander Motin #define ATA_NFORCE_MCP67_AA 0x055A10de 26553963e58SAlexander Motin #define ATA_NFORCE_MCP67_AB 0x055B10de 266200c7605SSøren Schmidt #define ATA_NFORCE_MCP67 0x056010de 267200c7605SSøren Schmidt #define ATA_NFORCE_MCP73 0x056c10de 26853963e58SAlexander Motin #define ATA_NFORCE_MCP73_A0 0x07f010de 26953963e58SAlexander Motin #define ATA_NFORCE_MCP73_A1 0x07f110de 27053963e58SAlexander Motin #define ATA_NFORCE_MCP73_A2 0x07f210de 27153963e58SAlexander Motin #define ATA_NFORCE_MCP73_A3 0x07f310de 27253963e58SAlexander Motin #define ATA_NFORCE_MCP73_A4 0x07f410de 27353963e58SAlexander Motin #define ATA_NFORCE_MCP73_A5 0x07f510de 27453963e58SAlexander Motin #define ATA_NFORCE_MCP73_A6 0x07f610de 27553963e58SAlexander Motin #define ATA_NFORCE_MCP73_A7 0x07f710de 27653963e58SAlexander Motin #define ATA_NFORCE_MCP73_A8 0x07f810de 27753963e58SAlexander Motin #define ATA_NFORCE_MCP73_A9 0x07f910de 27853963e58SAlexander Motin #define ATA_NFORCE_MCP73_AA 0x07fa10de 27953963e58SAlexander Motin #define ATA_NFORCE_MCP73_AB 0x07fb10de 280200c7605SSøren Schmidt #define ATA_NFORCE_MCP77 0x075910de 281bb5bdd38SSøren Schmidt 282bb5bdd38SSøren Schmidt #define ATA_PROMISE_ID 0x105a 283bb5bdd38SSøren Schmidt #define ATA_PDC20246 0x4d33105a 284bb5bdd38SSøren Schmidt #define ATA_PDC20262 0x4d38105a 285bb5bdd38SSøren Schmidt #define ATA_PDC20263 0x0d38105a 286bb5bdd38SSøren Schmidt #define ATA_PDC20265 0x0d30105a 287bb5bdd38SSøren Schmidt #define ATA_PDC20267 0x4d30105a 288bb5bdd38SSøren Schmidt #define ATA_PDC20268 0x4d68105a 289bb5bdd38SSøren Schmidt #define ATA_PDC20269 0x4d69105a 29005688cecSSøren Schmidt #define ATA_PDC20270 0x6268105a 291bb5bdd38SSøren Schmidt #define ATA_PDC20271 0x6269105a 292bb5bdd38SSøren Schmidt #define ATA_PDC20275 0x1275105a 293bb5bdd38SSøren Schmidt #define ATA_PDC20276 0x5275105a 294bb5bdd38SSøren Schmidt #define ATA_PDC20277 0x7275105a 29584351184SSøren Schmidt #define ATA_PDC20318 0x3318105a 29684351184SSøren Schmidt #define ATA_PDC20319 0x3319105a 29784351184SSøren Schmidt #define ATA_PDC20371 0x3371105a 29884351184SSøren Schmidt #define ATA_PDC20375 0x3375105a 299bb5bdd38SSøren Schmidt #define ATA_PDC20376 0x3376105a 30084351184SSøren Schmidt #define ATA_PDC20377 0x3377105a 30184351184SSøren Schmidt #define ATA_PDC20378 0x3373105a 30284351184SSøren Schmidt #define ATA_PDC20379 0x3372105a 303da9edda6SSøren Schmidt #define ATA_PDC20571 0x3571105a 304da9edda6SSøren Schmidt #define ATA_PDC20575 0x3d75105a 305da9edda6SSøren Schmidt #define ATA_PDC20579 0x3574105a 3068453acf1SSøren Schmidt #define ATA_PDC20771 0x3570105a 307da9edda6SSøren Schmidt #define ATA_PDC40518 0x3d18105a 30807015a1aSSøren Schmidt #define ATA_PDC40519 0x3519105a 309c7dc7718SSøren Schmidt #define ATA_PDC40718 0x3d17105a 310c7dc7718SSøren Schmidt #define ATA_PDC40719 0x3515105a 3118453acf1SSøren Schmidt #define ATA_PDC40775 0x3d73105a 3128453acf1SSøren Schmidt #define ATA_PDC40779 0x3577105a 31384351184SSøren Schmidt #define ATA_PDC20617 0x6617105a 31484351184SSøren Schmidt #define ATA_PDC20618 0x6626105a 31584351184SSøren Schmidt #define ATA_PDC20619 0x6629105a 31684351184SSøren Schmidt #define ATA_PDC20620 0x6620105a 3173cb179a8SSøren Schmidt #define ATA_PDC20621 0x6621105a 318f2972d7eSSøren Schmidt #define ATA_PDC20622 0x6622105a 3198453acf1SSøren Schmidt #define ATA_PDC20624 0x6624105a 3208453acf1SSøren Schmidt #define ATA_PDC81518 0x8002105a 321bb5bdd38SSøren Schmidt 322bb5bdd38SSøren Schmidt #define ATA_SERVERWORKS_ID 0x1166 3235fdbb0d2SSøren Schmidt #define ATA_ROSB4_ISA 0x02001166 324bb5bdd38SSøren Schmidt #define ATA_ROSB4 0x02111166 325bb5bdd38SSøren Schmidt #define ATA_CSB5 0x02121166 326bb5bdd38SSøren Schmidt #define ATA_CSB6 0x02131166 327bb5bdd38SSøren Schmidt #define ATA_CSB6_1 0x02171166 328891abbfaSSøren Schmidt #define ATA_HT1000 0x02141166 329891abbfaSSøren Schmidt #define ATA_HT1000_S1 0x024b1166 330891abbfaSSøren Schmidt #define ATA_HT1000_S2 0x024a1166 331594e3d5dSSøren Schmidt #define ATA_K2 0x02401166 332594e3d5dSSøren Schmidt #define ATA_FRODO4 0x02411166 333594e3d5dSSøren Schmidt #define ATA_FRODO8 0x02421166 334bb5bdd38SSøren Schmidt 335bb5bdd38SSøren Schmidt #define ATA_SILICON_IMAGE_ID 0x1095 33674a1b9fcSSøren Schmidt #define ATA_SII3114 0x31141095 3371c342d89SSøren Schmidt #define ATA_SII3512 0x35121095 338e158f2b8SSøren Schmidt #define ATA_SII3112 0x31121095 339a127b176SSøren Schmidt #define ATA_SII3112_1 0x02401095 340b9842b47SSøren Schmidt #define ATA_SII3124 0x31241095 341b9842b47SSøren Schmidt #define ATA_SII3132 0x31321095 34202e5ff6cSAlexander Motin #define ATA_SII3132_1 0x02421095 34374a1b9fcSSøren Schmidt #define ATA_SII0680 0x06801095 344bb5bdd38SSøren Schmidt #define ATA_CMD646 0x06461095 345bb5bdd38SSøren Schmidt #define ATA_CMD648 0x06481095 346bb5bdd38SSøren Schmidt #define ATA_CMD649 0x06491095 347bb5bdd38SSøren Schmidt 348bb5bdd38SSøren Schmidt #define ATA_SIS_ID 0x1039 349bb5bdd38SSøren Schmidt #define ATA_SISSOUTH 0x00081039 350bb5bdd38SSøren Schmidt #define ATA_SIS5511 0x55111039 351bb5bdd38SSøren Schmidt #define ATA_SIS5513 0x55131039 352b47183d5SSøren Schmidt #define ATA_SIS5517 0x55171039 353bb5bdd38SSøren Schmidt #define ATA_SIS5518 0x55181039 354bb5bdd38SSøren Schmidt #define ATA_SIS5571 0x55711039 355bb5bdd38SSøren Schmidt #define ATA_SIS5591 0x55911039 356bb5bdd38SSøren Schmidt #define ATA_SIS5596 0x55961039 357bb5bdd38SSøren Schmidt #define ATA_SIS5597 0x55971039 358bb5bdd38SSøren Schmidt #define ATA_SIS5598 0x55981039 359bb5bdd38SSøren Schmidt #define ATA_SIS5600 0x56001039 360bb5bdd38SSøren Schmidt #define ATA_SIS530 0x05301039 361bb5bdd38SSøren Schmidt #define ATA_SIS540 0x05401039 362bb5bdd38SSøren Schmidt #define ATA_SIS550 0x05501039 363bb5bdd38SSøren Schmidt #define ATA_SIS620 0x06201039 364bb5bdd38SSøren Schmidt #define ATA_SIS630 0x06301039 365bb5bdd38SSøren Schmidt #define ATA_SIS635 0x06351039 366bb5bdd38SSøren Schmidt #define ATA_SIS633 0x06331039 367bb5bdd38SSøren Schmidt #define ATA_SIS640 0x06401039 368bb5bdd38SSøren Schmidt #define ATA_SIS645 0x06451039 369bb5bdd38SSøren Schmidt #define ATA_SIS646 0x06461039 370bb5bdd38SSøren Schmidt #define ATA_SIS648 0x06481039 371bb5bdd38SSøren Schmidt #define ATA_SIS650 0x06501039 372bb5bdd38SSøren Schmidt #define ATA_SIS651 0x06511039 373bb5bdd38SSøren Schmidt #define ATA_SIS652 0x06521039 374bb5bdd38SSøren Schmidt #define ATA_SIS655 0x06551039 375bb5bdd38SSøren Schmidt #define ATA_SIS658 0x06581039 376186939d1SSøren Schmidt #define ATA_SIS661 0x06611039 377bb5bdd38SSøren Schmidt #define ATA_SIS730 0x07301039 378bb5bdd38SSøren Schmidt #define ATA_SIS733 0x07331039 379bb5bdd38SSøren Schmidt #define ATA_SIS735 0x07351039 380bb5bdd38SSøren Schmidt #define ATA_SIS740 0x07401039 381bb5bdd38SSøren Schmidt #define ATA_SIS745 0x07451039 382bb5bdd38SSøren Schmidt #define ATA_SIS746 0x07461039 383bb5bdd38SSøren Schmidt #define ATA_SIS748 0x07481039 384bb5bdd38SSøren Schmidt #define ATA_SIS750 0x07501039 385bb5bdd38SSøren Schmidt #define ATA_SIS751 0x07511039 386bb5bdd38SSøren Schmidt #define ATA_SIS752 0x07521039 387bb5bdd38SSøren Schmidt #define ATA_SIS755 0x07551039 388bb5bdd38SSøren Schmidt #define ATA_SIS961 0x09611039 389bb5bdd38SSøren Schmidt #define ATA_SIS962 0x09621039 390bb5bdd38SSøren Schmidt #define ATA_SIS963 0x09631039 391f584b219SSøren Schmidt #define ATA_SIS964 0x09641039 3920da27c62SSøren Schmidt #define ATA_SIS965 0x09651039 3938ca4df32SSøren Schmidt #define ATA_SIS180 0x01801039 3948ca4df32SSøren Schmidt #define ATA_SIS181 0x01811039 3950da27c62SSøren Schmidt #define ATA_SIS182 0x01821039 396bb5bdd38SSøren Schmidt 397bb5bdd38SSøren Schmidt #define ATA_VIA_ID 0x1106 398bb5bdd38SSøren Schmidt #define ATA_VIA82C571 0x05711106 399bb5bdd38SSøren Schmidt #define ATA_VIA82C586 0x05861106 400bb5bdd38SSøren Schmidt #define ATA_VIA82C596 0x05961106 401bb5bdd38SSøren Schmidt #define ATA_VIA82C686 0x06861106 402bb5bdd38SSøren Schmidt #define ATA_VIA8231 0x82311106 403bb5bdd38SSøren Schmidt #define ATA_VIA8233 0x30741106 404bb5bdd38SSøren Schmidt #define ATA_VIA8233A 0x31471106 405bb5bdd38SSøren Schmidt #define ATA_VIA8233C 0x31091106 406bb5bdd38SSøren Schmidt #define ATA_VIA8235 0x31771106 4078a1bddb7SSøren Schmidt #define ATA_VIA8237 0x32271106 408adf1bdacSSøren Schmidt #define ATA_VIA8237A 0x05911106 409358904bfSSøren Schmidt #define ATA_VIA8237S 0x53371106 410a5693903SSøren Schmidt #define ATA_VIA8251 0x33491106 411bb5bdd38SSøren Schmidt #define ATA_VIA8361 0x31121106 412bb5bdd38SSøren Schmidt #define ATA_VIA8363 0x03051106 413bb5bdd38SSøren Schmidt #define ATA_VIA8371 0x03911106 414bb5bdd38SSøren Schmidt #define ATA_VIA8662 0x31021106 415ba18e265SSøren Schmidt #define ATA_VIA6410 0x31641106 416ba18e265SSøren Schmidt #define ATA_VIA6420 0x31491106 4171ab4ad36SSøren Schmidt #define ATA_VIA6421 0x32491106 418bb5bdd38SSøren Schmidt 4198ca4df32SSøren Schmidt /* global prototypes ata-pci.c */ 4208ca4df32SSøren Schmidt int ata_pci_probe(device_t dev); 4218ca4df32SSøren Schmidt int ata_pci_attach(device_t dev); 4228ca4df32SSøren Schmidt int ata_pci_detach(device_t dev); 4237aab7e05SSøren Schmidt int ata_pci_suspend(device_t dev); 4247aab7e05SSøren Schmidt int ata_pci_resume(device_t dev); 4258ca4df32SSøren Schmidt struct resource * ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags); 4268ca4df32SSøren Schmidt int ata_pci_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); 427ef544f63SPaolo Pisati int ata_pci_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *function, void *argument, void **cookiep); 4288ca4df32SSøren Schmidt int ata_pci_teardown_intr(device_t dev, device_t child, struct resource *irq, void *cookie); 42904ff88ceSAlexander Motin int ata_pci_ch_attach(device_t dev); 43078d15416SAlexander Motin int ata_pci_ch_detach(device_t dev); 431a7c33e78SSøren Schmidt int ata_pci_status(device_t dev); 432f5f55db3SSøren Schmidt void ata_pci_hw(device_t dev); 433200c7605SSøren Schmidt void ata_pci_dmainit(device_t dev); 43478d15416SAlexander Motin void ata_pci_dmafini(device_t dev); 435200c7605SSøren Schmidt char *ata_pcivendor2str(device_t dev); 4368ca4df32SSøren Schmidt int ata_legacy(device_t); 43713014ca0SSøren Schmidt void ata_generic_intr(void *data); 43813014ca0SSøren Schmidt int ata_setup_interrupt(device_t dev, void *intr_func); 43913014ca0SSøren Schmidt void ata_set_desc(device_t dev); 44013014ca0SSøren Schmidt struct ata_chip_id *ata_match_chip(device_t dev, struct ata_chip_id *index); 44113014ca0SSøren Schmidt struct ata_chip_id *ata_find_chip(device_t dev, struct ata_chip_id *index, int slot); 44213014ca0SSøren Schmidt void ata_print_cable(device_t dev, u_int8_t *who); 44313014ca0SSøren Schmidt int ata_check_80pin(device_t dev, int mode); 44413014ca0SSøren Schmidt int ata_mode2idx(int mode); 44513014ca0SSøren Schmidt 44613014ca0SSøren Schmidt /* global prototypes ata-sata.c */ 44713014ca0SSøren Schmidt void ata_sata_phy_check_events(device_t dev); 4489cf4fe2eSAlexander Motin int ata_sata_scr_read(struct ata_channel *ch, int port, int reg, uint32_t *val); 4499cf4fe2eSAlexander Motin int ata_sata_scr_write(struct ata_channel *ch, int port, int reg, uint32_t val); 4509cf4fe2eSAlexander Motin int ata_sata_phy_reset(device_t dev, int port, int quick); 45113014ca0SSøren Schmidt void ata_sata_setmode(device_t dev, int mode); 45213014ca0SSøren Schmidt int ata_request2fis_h2d(struct ata_request *request, u_int8_t *fis); 45313014ca0SSøren Schmidt void ata_pm_identify(device_t dev); 45413014ca0SSøren Schmidt 45513014ca0SSøren Schmidt /* global prototypes from chipsets/ata-*.c */ 45613014ca0SSøren Schmidt int ata_ahci_chipinit(device_t); 45704ff88ceSAlexander Motin int ata_ahci_ch_attach(device_t dev); 45878d15416SAlexander Motin int ata_ahci_ch_detach(device_t dev); 4599cf4fe2eSAlexander Motin int ata_ahci_ch_suspend(device_t dev); 4609cf4fe2eSAlexander Motin int ata_ahci_ch_resume(device_t dev); 46113014ca0SSøren Schmidt void ata_ahci_reset(device_t dev); 46213014ca0SSøren Schmidt int ata_marvell_edma_chipinit(device_t); 46313014ca0SSøren Schmidt int ata_sii_chipinit(device_t); 4648ca4df32SSøren Schmidt 4658ca4df32SSøren Schmidt /* global prototypes ata-dma.c */ 4660068f98fSSøren Schmidt void ata_dmainit(device_t); 46778d15416SAlexander Motin void ata_dmafini(device_t dev); 46813014ca0SSøren Schmidt 46913014ca0SSøren Schmidt /* externs */ 47013014ca0SSøren Schmidt extern devclass_t ata_pci_devclass; 47113014ca0SSøren Schmidt 47213014ca0SSøren Schmidt /* macro for easy definition of all driver module stuff */ 47313014ca0SSøren Schmidt #define ATA_DECLARE_DRIVER(dname) \ 47413014ca0SSøren Schmidt static device_method_t __CONCAT(dname,_methods)[] = { \ 47513014ca0SSøren Schmidt DEVMETHOD(device_probe, __CONCAT(dname,_probe)), \ 47613014ca0SSøren Schmidt DEVMETHOD(device_attach, ata_pci_attach), \ 47713014ca0SSøren Schmidt DEVMETHOD(device_detach, ata_pci_detach), \ 47869c43a23SAlexander Motin DEVMETHOD(device_suspend, ata_pci_suspend), \ 47969c43a23SAlexander Motin DEVMETHOD(device_resume, ata_pci_resume), \ 48013014ca0SSøren Schmidt DEVMETHOD(device_shutdown, bus_generic_shutdown), \ 48113014ca0SSøren Schmidt DEVMETHOD(bus_alloc_resource, ata_pci_alloc_resource), \ 48213014ca0SSøren Schmidt DEVMETHOD(bus_release_resource, ata_pci_release_resource), \ 48313014ca0SSøren Schmidt DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), \ 48413014ca0SSøren Schmidt DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), \ 48513014ca0SSøren Schmidt DEVMETHOD(bus_setup_intr, ata_pci_setup_intr), \ 48613014ca0SSøren Schmidt DEVMETHOD(bus_teardown_intr, ata_pci_teardown_intr), \ 48713014ca0SSøren Schmidt { 0, 0 } \ 48813014ca0SSøren Schmidt }; \ 48913014ca0SSøren Schmidt static driver_t __CONCAT(dname,_driver) = { \ 49013014ca0SSøren Schmidt "atapci", \ 49113014ca0SSøren Schmidt __CONCAT(dname,_methods), \ 49213014ca0SSøren Schmidt sizeof(struct ata_pci_controller) \ 49313014ca0SSøren Schmidt }; \ 49413014ca0SSøren Schmidt DRIVER_MODULE(dname, pci, __CONCAT(dname,_driver), ata_pci_devclass, 0, 0); \ 49513014ca0SSøren Schmidt MODULE_VERSION(dname, 1); \ 49613014ca0SSøren Schmidt MODULE_DEPEND(dname, ata, 1, 1, 1); \ 49713014ca0SSøren Schmidt MODULE_DEPEND(dname, atapci, 1, 1, 1); 49813014ca0SSøren Schmidt 499