Deleted Added
full compact
ichsmb.c (143160) ichsmb.c (147253)
1/*-
2 * ichsmb.c
3 *
4 * Author: Archie Cobbs <archie@freebsd.org>
5 * Copyright (c) 2000 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

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

31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 */
37
38#include <sys/cdefs.h>
1/*-
2 * ichsmb.c
3 *
4 * Author: Archie Cobbs <archie@freebsd.org>
5 * Copyright (c) 2000 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

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

31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 */
37
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/sys/dev/ichsmb/ichsmb.c 143160 2005-03-05 18:17:35Z imp $");
39__FBSDID("$FreeBSD: head/sys/dev/ichsmb/ichsmb.c 147253 2005-06-10 16:12:43Z takawata $");
40
41/*
42 * Support for the SMBus controller logical device which is part of the
43 * Intel 81801AA (ICH) and 81801AB (ICH0) I/O controller hub chips.
44 *
45 * This driver assumes that the generic SMBus code will ensure that
46 * at most one process at a time calls into the SMBus methods below.
47 */

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

91
92/*
93 * Handle probe-time duties that are independent of the bus
94 * our device lives on.
95 */
96int
97ichsmb_probe(device_t dev)
98{
40
41/*
42 * Support for the SMBus controller logical device which is part of the
43 * Intel 81801AA (ICH) and 81801AB (ICH0) I/O controller hub chips.
44 *
45 * This driver assumes that the generic SMBus code will ensure that
46 * at most one process at a time calls into the SMBus methods below.
47 */

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

91
92/*
93 * Handle probe-time duties that are independent of the bus
94 * our device lives on.
95 */
96int
97ichsmb_probe(device_t dev)
98{
99 device_t smb;
100
101 /* Add child: an instance of the "smbus" device */
102 if ((smb = device_add_child(dev, DRIVER_SMBUS, -1)) == NULL) {
103 log(LOG_ERR, "%s: no \"%s\" child found\n",
104 device_get_nameunit(dev), DRIVER_SMBUS);
105 return (ENXIO);
106 }
107 return (BUS_PROBE_DEFAULT);
108}
109
110/*
111 * Handle attach-time duties that are independent of the bus
112 * our device lives on.
113 */
114int
115ichsmb_attach(device_t dev)
116{
117 const sc_p sc = device_get_softc(dev);
118 int error;
99 return (BUS_PROBE_DEFAULT);
100}
101
102/*
103 * Handle attach-time duties that are independent of the bus
104 * our device lives on.
105 */
106int
107ichsmb_attach(device_t dev)
108{
109 const sc_p sc = device_get_softc(dev);
110 int error;
111 device_t smb;
119
112
113 /* Add child: an instance of the "smbus" device */
114 if ((smb = device_add_child(dev, DRIVER_SMBUS, -1)) == NULL) {
115 log(LOG_ERR, "%s: no \"%s\" child found\n",
116 device_get_nameunit(dev), DRIVER_SMBUS);
117 return (ENXIO);
118 }
119
120 /* Clear interrupt conditions */
121 bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_STA, 0xff);
122
123 /* Add "smbus" child */
124 if ((error = bus_generic_attach(dev)) != 0) {
125 log(LOG_ERR, "%s: failed to attach child: %d\n",
126 device_get_nameunit(dev), error);
127 return (ENXIO);

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

670 }
671 if (sc->io_res != NULL) {
672 bus_release_resource(dev,
673 SYS_RES_IOPORT, sc->io_rid, sc->io_res);
674 sc->io_res = NULL;
675 }
676}
677
120 /* Clear interrupt conditions */
121 bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_STA, 0xff);
122
123 /* Add "smbus" child */
124 if ((error = bus_generic_attach(dev)) != 0) {
125 log(LOG_ERR, "%s: failed to attach child: %d\n",
126 device_get_nameunit(dev), error);
127 return (ENXIO);

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

670 }
671 if (sc->io_res != NULL) {
672 bus_release_resource(dev,
673 SYS_RES_IOPORT, sc->io_rid, sc->io_res);
674 sc->io_res = NULL;
675 }
676}
677
678int ichsmb_detach(device_t dev)
679{
680#if 0
681 const sc_p sc = device_get_softc(dev);
682 bus_generic_detach(dev);
683 device_delete_child(dev, sc->smb);
684 ichsmb_release_resources(sc);
685
686 return 0;
687#else
688 /*smbus drivers don't handle detach child properly*/
689 return EBUSY;
690#endif
691}