ata-netcell.c (10b3b54548f2290bbe8d8f88c59c28d12b7a635d) ata-netcell.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

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

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_netcell_chipinit(device_t dev);
56static int ata_netcell_ch_attach(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

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

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_netcell_chipinit(device_t dev);
56static int ata_netcell_ch_attach(device_t dev);
57static void ata_netcell_setmode(device_t dev, int mode);
58
57
59
60/*
61 * NetCell chipset support functions
62 */
63static int
64ata_netcell_probe(device_t dev)
65{
66 struct ata_pci_controller *ctlr = device_get_softc(dev);
67

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

77ata_netcell_chipinit(device_t dev)
78{
79 struct ata_pci_controller *ctlr = device_get_softc(dev);
80
81 if (ata_setup_interrupt(dev, ata_generic_intr))
82 return ENXIO;
83
84 ctlr->ch_attach = ata_netcell_ch_attach;
58/*
59 * NetCell chipset support functions
60 */
61static int
62ata_netcell_probe(device_t dev)
63{
64 struct ata_pci_controller *ctlr = device_get_softc(dev);
65

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

75ata_netcell_chipinit(device_t dev)
76{
77 struct ata_pci_controller *ctlr = device_get_softc(dev);
78
79 if (ata_setup_interrupt(dev, ata_generic_intr))
80 return ENXIO;
81
82 ctlr->ch_attach = ata_netcell_ch_attach;
85 ctlr->ch_detach = ata_pci_ch_detach;
86 ctlr->setmode = ata_netcell_setmode;
83 ctlr->setmode = ata_generic_setmode;
87 return 0;
88}
89
90static int
91ata_netcell_ch_attach(device_t dev)
92{
93 struct ata_channel *ch = device_get_softc(dev);
94
95 /* setup the usual register normal pci style */
96 if (ata_pci_ch_attach(dev))
97 return ENXIO;
98
99 /* the NetCell only supports 16 bit PIO transfers */
100 ch->flags |= ATA_USE_16BIT;
84 return 0;
85}
86
87static int
88ata_netcell_ch_attach(device_t dev)
89{
90 struct ata_channel *ch = device_get_softc(dev);
91
92 /* setup the usual register normal pci style */
93 if (ata_pci_ch_attach(dev))
94 return ENXIO;
95
96 /* the NetCell only supports 16 bit PIO transfers */
97 ch->flags |= ATA_USE_16BIT;
101
102 return 0;
103}
104
98 return 0;
99}
100
105static void
106ata_netcell_setmode(device_t dev, int mode)
107{
108 struct ata_device *atadev = device_get_softc(dev);
109
110 mode = ata_limit_mode(dev, mode, ATA_UDMA2);
111 mode = ata_check_80pin(dev, mode);
112 if (!ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_SETXFER, 0, mode))
113 atadev->mode = mode;
114}
115
116ATA_DECLARE_DRIVER(ata_netcell);
101ATA_DECLARE_DRIVER(ata_netcell);