ata-cypress.c (10b3b54548f2290bbe8d8f88c59c28d12b7a635d) ata-cypress.c (066f913a94b134b6d5e32b6af88f297c7da9c031)
1/*-
2 * Copyright (c) 1998 - 2008 S�ren Schmidt <sos@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 39 unchanged lines hidden (view full) ---

48#include <dev/pci/pcivar.h>
49#include <dev/pci/pcireg.h>
50#include <dev/ata/ata-all.h>
51#include <dev/ata/ata-pci.h>
52#include <ata_if.h>
53
54/* local prototypes */
55static int ata_cypress_chipinit(device_t dev);
1/*-
2 * Copyright (c) 1998 - 2008 S�ren Schmidt <sos@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 39 unchanged lines hidden (view full) ---

48#include <dev/pci/pcivar.h>
49#include <dev/pci/pcireg.h>
50#include <dev/ata/ata-all.h>
51#include <dev/ata/ata-pci.h>
52#include <ata_if.h>
53
54/* local prototypes */
55static int ata_cypress_chipinit(device_t dev);
56static void ata_cypress_setmode(device_t dev, int mode);
56static int ata_cypress_setmode(device_t dev, int target, int mode);
57
58
59/*
60 * Cypress chipset support functions
61 */
62static int
63ata_cypress_probe(device_t dev)
64{

--- 23 unchanged lines hidden (view full) ---

88
89 if (ata_setup_interrupt(dev, ata_generic_intr))
90 return ENXIO;
91
92 ctlr->setmode = ata_cypress_setmode;
93 return 0;
94}
95
57
58
59/*
60 * Cypress chipset support functions
61 */
62static int
63ata_cypress_probe(device_t dev)
64{

--- 23 unchanged lines hidden (view full) ---

88
89 if (ata_setup_interrupt(dev, ata_generic_intr))
90 return ENXIO;
91
92 ctlr->setmode = ata_cypress_setmode;
93 return 0;
94}
95
96static void
97ata_cypress_setmode(device_t dev, int mode)
96static int
97ata_cypress_setmode(device_t dev, int target, int mode)
98{
98{
99 device_t gparent = GRANDPARENT(dev);
100 struct ata_channel *ch = device_get_softc(device_get_parent(dev));
101 struct ata_device *atadev = device_get_softc(dev);
102 int error;
99 device_t parent = device_get_parent(dev);
100 struct ata_channel *ch = device_get_softc(dev);
103
101
104 mode = ata_limit_mode(dev, mode, ATA_WDMA2);
102 mode = min(mode, ATA_WDMA2);
105
103
106 /* XXX SOS missing WDMA0+1 + PIO modes */
107 if (mode == ATA_WDMA2) {
108 error = ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_SETXFER, 0, mode);
109 if (bootverbose)
110 device_printf(dev, "%ssetting WDMA2 on Cypress chip\n",
111 error ? "FAILURE " : "");
112 if (!error) {
113 pci_write_config(gparent, ch->unit ? 0x4e : 0x4c, 0x2020, 2);
114 atadev->mode = mode;
115 return;
104 /* XXX SOS missing WDMA0+1 + PIO modes */
105 if (mode == ATA_WDMA2) {
106 pci_write_config(parent, ch->unit ? 0x4e : 0x4c, 0x2020, 2);
116 }
107 }
117 }
118 /* we could set PIO mode timings, but we assume the BIOS did that */
108 /* we could set PIO mode timings, but we assume the BIOS did that */
109 return (mode);
119}
120
121ATA_DECLARE_DRIVER(ata_cypress);
110}
111
112ATA_DECLARE_DRIVER(ata_cypress);