pata_amd.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. /*
  2. * pata_amd.c - AMD PATA for new ATA layer
  3. * (C) 2005-2006 Red Hat Inc
  4. *
  5. * Based on pata-sil680. Errata information is taken from data sheets
  6. * and the amd74xx.c driver by Vojtech Pavlik. Nvidia SATA devices are
  7. * claimed by sata-nv.c.
  8. *
  9. * TODO:
  10. * Variable system clock when/if it makes sense
  11. * Power management on ports
  12. *
  13. *
  14. * Documentation publically available.
  15. */
  16. #include <linux/kernel.h>
  17. #include <linux/module.h>
  18. #include <linux/pci.h>
  19. #include <linux/init.h>
  20. #include <linux/blkdev.h>
  21. #include <linux/delay.h>
  22. #include <scsi/scsi_host.h>
  23. #include <linux/libata.h>
  24. #define DRV_NAME "pata_amd"
  25. #define DRV_VERSION "0.4.1"
  26. /**
  27. * timing_setup - shared timing computation and load
  28. * @ap: ATA port being set up
  29. * @adev: drive being configured
  30. * @offset: port offset
  31. * @speed: target speed
  32. * @clock: clock multiplier (number of times 33MHz for this part)
  33. *
  34. * Perform the actual timing set up for Nvidia or AMD PATA devices.
  35. * The actual devices vary so they all call into this helper function
  36. * providing the clock multipler and offset (because AMD and Nvidia put
  37. * the ports at different locations).
  38. */
  39. static void timing_setup(struct ata_port *ap, struct ata_device *adev, int offset, int speed, int clock)
  40. {
  41. static const unsigned char amd_cyc2udma[] = {
  42. 6, 6, 5, 4, 0, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3, 7
  43. };
  44. struct pci_dev *pdev = to_pci_dev(ap->host->dev);
  45. struct ata_device *peer = ata_dev_pair(adev);
  46. int dn = ap->port_no * 2 + adev->devno;
  47. struct ata_timing at, apeer;
  48. int T, UT;
  49. const int amd_clock = 33333; /* KHz. */
  50. u8 t;
  51. T = 1000000000 / amd_clock;
  52. UT = T;
  53. if (clock >= 2)
  54. UT = T / 2;
  55. if (ata_timing_compute(adev, speed, &at, T, UT) < 0) {
  56. dev_printk(KERN_ERR, &pdev->dev, "unknown mode %d.\n", speed);
  57. return;
  58. }
  59. if (peer) {
  60. /* This may be over conservative */
  61. if (peer->dma_mode) {
  62. ata_timing_compute(peer, peer->dma_mode, &apeer, T, UT);
  63. ata_timing_merge(&apeer, &at, &at, ATA_TIMING_8BIT);
  64. }
  65. ata_timing_compute(peer, peer->pio_mode, &apeer, T, UT);
  66. ata_timing_merge(&apeer, &at, &at, ATA_TIMING_8BIT);
  67. }
  68. if (speed == XFER_UDMA_5 && amd_clock <= 33333) at.udma = 1;
  69. if (speed == XFER_UDMA_6 && amd_clock <= 33333) at.udma = 15;
  70. /*
  71. * Now do the setup work
  72. */
  73. /* Configure the address set up timing */
  74. pci_read_config_byte(pdev, offset + 0x0C, &t);
  75. t = (t & ~(3 << ((3 - dn) << 1))) | ((clamp_val(at.setup, 1, 4) - 1) << ((3 - dn) << 1));
  76. pci_write_config_byte(pdev, offset + 0x0C , t);
  77. /* Configure the 8bit I/O timing */
  78. pci_write_config_byte(pdev, offset + 0x0E + (1 - (dn >> 1)),
  79. ((clamp_val(at.act8b, 1, 16) - 1) << 4) | (clamp_val(at.rec8b, 1, 16) - 1));
  80. /* Drive timing */
  81. pci_write_config_byte(pdev, offset + 0x08 + (3 - dn),
  82. ((clamp_val(at.active, 1, 16) - 1) << 4) | (clamp_val(at.recover, 1, 16) - 1));
  83. switch (clock) {
  84. case 1:
  85. t = at.udma ? (0xc0 | (clamp_val(at.udma, 2, 5) - 2)) : 0x03;
  86. break;
  87. case 2:
  88. t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 2, 10)]) : 0x03;
  89. break;
  90. case 3:
  91. t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 1, 10)]) : 0x03;
  92. break;
  93. case 4:
  94. t = at.udma ? (0xc0 | amd_cyc2udma[clamp_val(at.udma, 1, 15)]) : 0x03;
  95. break;
  96. default:
  97. return;
  98. }
  99. /* UDMA timing */
  100. if (at.udma)
  101. pci_write_config_byte(pdev, offset + 0x10 + (3 - dn), t);
  102. }
  103. /**
  104. * amd_pre_reset - perform reset handling
  105. * @link: ATA link
  106. * @deadline: deadline jiffies for the operation
  107. *
  108. * Reset sequence checking enable bits to see which ports are
  109. * active.
  110. */
  111. static int amd_pre_reset(struct ata_link *link, unsigned long deadline)
  112. {
  113. static const struct pci_bits amd_enable_bits[] = {
  114. { 0x40, 1, 0x02, 0x02 },
  115. { 0x40, 1, 0x01, 0x01 }
  116. };
  117. struct ata_port *ap = link->ap;
  118. struct pci_dev *pdev = to_pci_dev(ap->host->dev);
  119. if (!pci_test_config_bits(pdev, &amd_enable_bits[ap->port_no]))
  120. return -ENOENT;
  121. return ata_sff_prereset(link, deadline);
  122. }
  123. /**
  124. * amd_cable_detect - report cable type
  125. * @ap: port
  126. *
  127. * AMD controller/BIOS setups record the cable type in word 0x42
  128. */
  129. static int amd_cable_detect(struct ata_port *ap)
  130. {
  131. static const u32 bitmask[2] = {0x03, 0x0C};
  132. struct pci_dev *pdev = to_pci_dev(ap->host->dev);
  133. u8 ata66;
  134. pci_read_config_byte(pdev, 0x42, &ata66);
  135. if (ata66 & bitmask[ap->port_no])
  136. return ATA_CBL_PATA80;
  137. return ATA_CBL_PATA40;
  138. }
  139. /**
  140. * amd_fifo_setup - set the PIO FIFO for ATA/ATAPI
  141. * @ap: ATA interface
  142. * @adev: ATA device
  143. *
  144. * Set the PCI fifo for this device according to the devices present
  145. * on the bus at this point in time. We need to turn the post write buffer
  146. * off for ATAPI devices as we may need to issue a word sized write to the
  147. * device as the final I/O
  148. */
  149. static void amd_fifo_setup(struct ata_port *ap)
  150. {
  151. struct ata_device *adev;
  152. struct pci_dev *pdev = to_pci_dev(ap->host->dev);
  153. static const u8 fifobit[2] = { 0xC0, 0x30};
  154. u8 fifo = fifobit[ap->port_no];
  155. u8 r;
  156. ata_for_each_dev(adev, &ap->link, ENABLED) {
  157. if (adev->class == ATA_DEV_ATAPI)
  158. fifo = 0;
  159. }
  160. if (pdev->device == PCI_DEVICE_ID_AMD_VIPER_7411) /* FIFO is broken */
  161. fifo = 0;
  162. /* On the later chips the read prefetch bits become no-op bits */
  163. pci_read_config_byte(pdev, 0x41, &r);
  164. r &= ~fifobit[ap->port_no];
  165. r |= fifo;
  166. pci_write_config_byte(pdev, 0x41, r);
  167. }
  168. /**
  169. * amd33_set_piomode - set initial PIO mode data
  170. * @ap: ATA interface
  171. * @adev: ATA device
  172. *
  173. * Program the AMD registers for PIO mode.
  174. */
  175. static void amd33_set_piomode(struct ata_port *ap, struct ata_device *adev)
  176. {
  177. amd_fifo_setup(ap);
  178. timing_setup(ap, adev, 0x40, adev->pio_mode, 1);
  179. }
  180. static void amd66_set_piomode(struct ata_port *ap, struct ata_device *adev)
  181. {
  182. amd_fifo_setup(ap);
  183. timing_setup(ap, adev, 0x40, adev->pio_mode, 2);
  184. }
  185. static void amd100_set_piomode(struct ata_port *ap, struct ata_device *adev)
  186. {
  187. amd_fifo_setup(ap);
  188. timing_setup(ap, adev, 0x40, adev->pio_mode, 3);
  189. }
  190. static void amd133_set_piomode(struct ata_port *ap, struct ata_device *adev)
  191. {
  192. amd_fifo_setup(ap);
  193. timing_setup(ap, adev, 0x40, adev->pio_mode, 4);
  194. }
  195. /**
  196. * amd33_set_dmamode - set initial DMA mode data
  197. * @ap: ATA interface
  198. * @adev: ATA device
  199. *
  200. * Program the MWDMA/UDMA modes for the AMD and Nvidia
  201. * chipset.
  202. */
  203. static void amd33_set_dmamode(struct ata_port *ap, struct ata_device *adev)
  204. {
  205. timing_setup(ap, adev, 0x40, adev->dma_mode, 1);
  206. }
  207. static void amd66_set_dmamode(struct ata_port *ap, struct ata_device *adev)
  208. {
  209. timing_setup(ap, adev, 0x40, adev->dma_mode, 2);
  210. }
  211. static void amd100_set_dmamode(struct ata_port *ap, struct ata_device *adev)
  212. {
  213. timing_setup(ap, adev, 0x40, adev->dma_mode, 3);
  214. }
  215. static void amd133_set_dmamode(struct ata_port *ap, struct ata_device *adev)
  216. {
  217. timing_setup(ap, adev, 0x40, adev->dma_mode, 4);
  218. }
  219. /* Both host-side and drive-side detection results are worthless on NV
  220. * PATAs. Ignore them and just follow what BIOS configured. Both the
  221. * current configuration in PCI config reg and ACPI GTM result are
  222. * cached during driver attach and are consulted to select transfer
  223. * mode.
  224. */
  225. static unsigned long nv_mode_filter(struct ata_device *dev,
  226. unsigned long xfer_mask)
  227. {
  228. static const unsigned int udma_mask_map[] =
  229. { ATA_UDMA2, ATA_UDMA1, ATA_UDMA0, 0,
  230. ATA_UDMA3, ATA_UDMA4, ATA_UDMA5, ATA_UDMA6 };
  231. struct ata_port *ap = dev->link->ap;
  232. char acpi_str[32] = "";
  233. u32 saved_udma, udma;
  234. const struct ata_acpi_gtm *gtm;
  235. unsigned long bios_limit = 0, acpi_limit = 0, limit;
  236. /* find out what BIOS configured */
  237. udma = saved_udma = (unsigned long)ap->host->private_data;
  238. if (ap->port_no == 0)
  239. udma >>= 16;
  240. if (dev->devno == 0)
  241. udma >>= 8;
  242. if ((udma & 0xc0) == 0xc0)
  243. bios_limit = ata_pack_xfermask(0, 0, udma_mask_map[udma & 0x7]);
  244. /* consult ACPI GTM too */
  245. gtm = ata_acpi_init_gtm(ap);
  246. if (gtm) {
  247. acpi_limit = ata_acpi_gtm_xfermask(dev, gtm);
  248. snprintf(acpi_str, sizeof(acpi_str), " (%u:%u:0x%x)",
  249. gtm->drive[0].dma, gtm->drive[1].dma, gtm->flags);
  250. }
  251. /* be optimistic, EH can take care of things if something goes wrong */
  252. limit = bios_limit | acpi_limit;
  253. /* If PIO or DMA isn't configured at all, don't limit. Let EH
  254. * handle it.
  255. */
  256. if (!(limit & ATA_MASK_PIO))
  257. limit |= ATA_MASK_PIO;
  258. if (!(limit & (ATA_MASK_MWDMA | ATA_MASK_UDMA)))
  259. limit |= ATA_MASK_MWDMA | ATA_MASK_UDMA;
  260. ata_port_printk(ap, KERN_DEBUG, "nv_mode_filter: 0x%lx&0x%lx->0x%lx, "
  261. "BIOS=0x%lx (0x%x) ACPI=0x%lx%s\n",
  262. xfer_mask, limit, xfer_mask & limit, bios_limit,
  263. saved_udma, acpi_limit, acpi_str);
  264. return xfer_mask & limit;
  265. }
  266. /**
  267. * nv_probe_init - cable detection
  268. * @lin: ATA link
  269. *
  270. * Perform cable detection. The BIOS stores this in PCI config
  271. * space for us.
  272. */
  273. static int nv_pre_reset(struct ata_link *link, unsigned long deadline)
  274. {
  275. static const struct pci_bits nv_enable_bits[] = {
  276. { 0x50, 1, 0x02, 0x02 },
  277. { 0x50, 1, 0x01, 0x01 }
  278. };
  279. struct ata_port *ap = link->ap;
  280. struct pci_dev *pdev = to_pci_dev(ap->host->dev);
  281. if (!pci_test_config_bits(pdev, &nv_enable_bits[ap->port_no]))
  282. return -ENOENT;
  283. return ata_sff_prereset(link, deadline);
  284. }
  285. /**
  286. * nv100_set_piomode - set initial PIO mode data
  287. * @ap: ATA interface
  288. * @adev: ATA device
  289. *
  290. * Program the AMD registers for PIO mode.
  291. */
  292. static void nv100_set_piomode(struct ata_port *ap, struct ata_device *adev)
  293. {
  294. timing_setup(ap, adev, 0x50, adev->pio_mode, 3);
  295. }
  296. static void nv133_set_piomode(struct ata_port *ap, struct ata_device *adev)
  297. {
  298. timing_setup(ap, adev, 0x50, adev->pio_mode, 4);
  299. }
  300. /**
  301. * nv100_set_dmamode - set initial DMA mode data
  302. * @ap: ATA interface
  303. * @adev: ATA device
  304. *
  305. * Program the MWDMA/UDMA modes for the AMD and Nvidia
  306. * chipset.
  307. */
  308. static void nv100_set_dmamode(struct ata_port *ap, struct ata_device *adev)
  309. {
  310. timing_setup(ap, adev, 0x50, adev->dma_mode, 3);
  311. }
  312. static void nv133_set_dmamode(struct ata_port *ap, struct ata_device *adev)
  313. {
  314. timing_setup(ap, adev, 0x50, adev->dma_mode, 4);
  315. }
  316. static void nv_host_stop(struct ata_host *host)
  317. {
  318. u32 udma = (unsigned long)host->private_data;
  319. /* restore PCI config register 0x60 */
  320. pci_write_config_dword(to_pci_dev(host->dev), 0x60, udma);
  321. }
  322. static struct scsi_host_template amd_sht = {
  323. ATA_BMDMA_SHT(DRV_NAME),
  324. };
  325. static const struct ata_port_operations amd_base_port_ops = {
  326. .inherits = &ata_bmdma32_port_ops,
  327. .prereset = amd_pre_reset,
  328. };
  329. static struct ata_port_operations amd33_port_ops = {
  330. .inherits = &amd_base_port_ops,
  331. .cable_detect = ata_cable_40wire,
  332. .set_piomode = amd33_set_piomode,
  333. .set_dmamode = amd33_set_dmamode,
  334. };
  335. static struct ata_port_operations amd66_port_ops = {
  336. .inherits = &amd_base_port_ops,
  337. .cable_detect = ata_cable_unknown,
  338. .set_piomode = amd66_set_piomode,
  339. .set_dmamode = amd66_set_dmamode,
  340. };
  341. static struct ata_port_operations amd100_port_ops = {
  342. .inherits = &amd_base_port_ops,
  343. .cable_detect = ata_cable_unknown,
  344. .set_piomode = amd100_set_piomode,
  345. .set_dmamode = amd100_set_dmamode,
  346. };
  347. static struct ata_port_operations amd133_port_ops = {
  348. .inherits = &amd_base_port_ops,
  349. .cable_detect = amd_cable_detect,
  350. .set_piomode = amd133_set_piomode,
  351. .set_dmamode = amd133_set_dmamode,
  352. };
  353. static const struct ata_port_operations nv_base_port_ops = {
  354. .inherits = &ata_bmdma_port_ops,
  355. .cable_detect = ata_cable_ignore,
  356. .mode_filter = nv_mode_filter,
  357. .prereset = nv_pre_reset,
  358. .host_stop = nv_host_stop,
  359. };
  360. static struct ata_port_operations nv100_port_ops = {
  361. .inherits = &nv_base_port_ops,
  362. .set_piomode = nv100_set_piomode,
  363. .set_dmamode = nv100_set_dmamode,
  364. };
  365. static struct ata_port_operations nv133_port_ops = {
  366. .inherits = &nv_base_port_ops,
  367. .set_piomode = nv133_set_piomode,
  368. .set_dmamode = nv133_set_dmamode,
  369. };
  370. static void amd_clear_fifo(struct pci_dev *pdev)
  371. {
  372. u8 fifo;
  373. /* Disable the FIFO, the FIFO logic will re-enable it as
  374. appropriate */
  375. pci_read_config_byte(pdev, 0x41, &fifo);
  376. fifo &= 0x0F;
  377. pci_write_config_byte(pdev, 0x41, fifo);
  378. }
  379. static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
  380. {
  381. static const struct ata_port_info info[10] = {
  382. { /* 0: AMD 7401 - no swdma */
  383. .flags = ATA_FLAG_SLAVE_POSS,
  384. .pio_mask = ATA_PIO4,
  385. .mwdma_mask = ATA_MWDMA2,
  386. .udma_mask = ATA_UDMA2,
  387. .port_ops = &amd33_port_ops
  388. },
  389. { /* 1: Early AMD7409 - no swdma */
  390. .flags = ATA_FLAG_SLAVE_POSS,
  391. .pio_mask = ATA_PIO4,
  392. .mwdma_mask = ATA_MWDMA2,
  393. .udma_mask = ATA_UDMA4,
  394. .port_ops = &amd66_port_ops
  395. },
  396. { /* 2: AMD 7409 */
  397. .flags = ATA_FLAG_SLAVE_POSS,
  398. .pio_mask = ATA_PIO4,
  399. .mwdma_mask = ATA_MWDMA2,
  400. .udma_mask = ATA_UDMA4,
  401. .port_ops = &amd66_port_ops
  402. },
  403. { /* 3: AMD 7411 */
  404. .flags = ATA_FLAG_SLAVE_POSS,
  405. .pio_mask = ATA_PIO4,
  406. .mwdma_mask = ATA_MWDMA2,
  407. .udma_mask = ATA_UDMA5,
  408. .port_ops = &amd100_port_ops
  409. },
  410. { /* 4: AMD 7441 */
  411. .flags = ATA_FLAG_SLAVE_POSS,
  412. .pio_mask = ATA_PIO4,
  413. .mwdma_mask = ATA_MWDMA2,
  414. .udma_mask = ATA_UDMA5,
  415. .port_ops = &amd100_port_ops
  416. },
  417. { /* 5: AMD 8111 - no swdma */
  418. .flags = ATA_FLAG_SLAVE_POSS,
  419. .pio_mask = ATA_PIO4,
  420. .mwdma_mask = ATA_MWDMA2,
  421. .udma_mask = ATA_UDMA6,
  422. .port_ops = &amd133_port_ops
  423. },
  424. { /* 6: AMD 8111 UDMA 100 (Serenade) - no swdma */
  425. .flags = ATA_FLAG_SLAVE_POSS,
  426. .pio_mask = ATA_PIO4,
  427. .mwdma_mask = ATA_MWDMA2,
  428. .udma_mask = ATA_UDMA5,
  429. .port_ops = &amd133_port_ops
  430. },
  431. { /* 7: Nvidia Nforce */
  432. .flags = ATA_FLAG_SLAVE_POSS,
  433. .pio_mask = ATA_PIO4,
  434. .mwdma_mask = ATA_MWDMA2,
  435. .udma_mask = ATA_UDMA5,
  436. .port_ops = &nv100_port_ops
  437. },
  438. { /* 8: Nvidia Nforce2 and later - no swdma */
  439. .flags = ATA_FLAG_SLAVE_POSS,
  440. .pio_mask = ATA_PIO4,
  441. .mwdma_mask = ATA_MWDMA2,
  442. .udma_mask = ATA_UDMA6,
  443. .port_ops = &nv133_port_ops
  444. },
  445. { /* 9: AMD CS5536 (Geode companion) */
  446. .flags = ATA_FLAG_SLAVE_POSS,
  447. .pio_mask = ATA_PIO4,
  448. .mwdma_mask = ATA_MWDMA2,
  449. .udma_mask = ATA_UDMA5,
  450. .port_ops = &amd100_port_ops
  451. }
  452. };
  453. const struct ata_port_info *ppi[] = { NULL, NULL };
  454. static int printed_version;
  455. int type = id->driver_data;
  456. void *hpriv = NULL;
  457. u8 fifo;
  458. int rc;
  459. if (!printed_version++)
  460. dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
  461. rc = pcim_enable_device(pdev);
  462. if (rc)
  463. return rc;
  464. pci_read_config_byte(pdev, 0x41, &fifo);
  465. /* Check for AMD7409 without swdma errata and if found adjust type */
  466. if (type == 1 && pdev->revision > 0x7)
  467. type = 2;
  468. /* Serenade ? */
  469. if (type == 5 && pdev->subsystem_vendor == PCI_VENDOR_ID_AMD &&
  470. pdev->subsystem_device == PCI_DEVICE_ID_AMD_SERENADE)
  471. type = 6; /* UDMA 100 only */
  472. /*
  473. * Okay, type is determined now. Apply type-specific workarounds.
  474. */
  475. ppi[0] = &info[type];
  476. if (type < 3)
  477. ata_pci_bmdma_clear_simplex(pdev);
  478. if (pdev->vendor == PCI_VENDOR_ID_AMD)
  479. amd_clear_fifo(pdev);
  480. /* Cable detection on Nvidia chips doesn't work too well,
  481. * cache BIOS programmed UDMA mode.
  482. */
  483. if (type == 7 || type == 8) {
  484. u32 udma;
  485. pci_read_config_dword(pdev, 0x60, &udma);
  486. hpriv = (void *)(unsigned long)udma;
  487. }
  488. /* And fire it up */
  489. return ata_pci_sff_init_one(pdev, ppi, &amd_sht, hpriv);
  490. }
  491. #ifdef CONFIG_PM
  492. static int amd_reinit_one(struct pci_dev *pdev)
  493. {
  494. struct ata_host *host = dev_get_drvdata(&pdev->dev);
  495. int rc;
  496. rc = ata_pci_device_do_resume(pdev);
  497. if (rc)
  498. return rc;
  499. if (pdev->vendor == PCI_VENDOR_ID_AMD) {
  500. amd_clear_fifo(pdev);
  501. if (pdev->device == PCI_DEVICE_ID_AMD_VIPER_7409 ||
  502. pdev->device == PCI_DEVICE_ID_AMD_COBRA_7401)
  503. ata_pci_bmdma_clear_simplex(pdev);
  504. }
  505. ata_host_resume(host);
  506. return 0;
  507. }
  508. #endif
  509. static const struct pci_device_id amd[] = {
  510. { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_COBRA_7401), 0 },
  511. { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_VIPER_7409), 1 },
  512. { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_VIPER_7411), 3 },
  513. { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_OPUS_7441), 4 },
  514. { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_8111_IDE), 5 },
  515. { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_IDE), 7 },
  516. { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE), 8 },
  517. { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE), 8 },
  518. { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE), 8 },
  519. { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE), 8 },
  520. { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE), 8 },
  521. { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE), 8 },
  522. { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE), 8 },
  523. { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE), 8 },
  524. { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE), 8 },
  525. { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE), 8 },
  526. { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE), 8 },
  527. { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE), 8 },
  528. { PCI_VDEVICE(NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE), 8 },
  529. { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CS5536_IDE), 9 },
  530. { },
  531. };
  532. static struct pci_driver amd_pci_driver = {
  533. .name = DRV_NAME,
  534. .id_table = amd,
  535. .probe = amd_init_one,
  536. .remove = ata_pci_remove_one,
  537. #ifdef CONFIG_PM
  538. .suspend = ata_pci_device_suspend,
  539. .resume = amd_reinit_one,
  540. #endif
  541. };
  542. static int __init amd_init(void)
  543. {
  544. return pci_register_driver(&amd_pci_driver);
  545. }
  546. static void __exit amd_exit(void)
  547. {
  548. pci_unregister_driver(&amd_pci_driver);
  549. }
  550. MODULE_AUTHOR("Alan Cox");
  551. MODULE_DESCRIPTION("low-level driver for AMD and Nvidia PATA IDE");
  552. MODULE_LICENSE("GPL");
  553. MODULE_DEVICE_TABLE(pci, amd);
  554. MODULE_VERSION(DRV_VERSION);
  555. module_init(amd_init);
  556. module_exit(amd_exit);