Deleted Added
full compact
if_ep_pccard.c (52585) if_ep_pccard.c (52589)
1/*
2 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
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

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

22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
1/*
2 * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
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

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

22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * $FreeBSD: head/sys/dev/ep/if_ep_pccard.c 52585 1999-10-28 05:06:14Z imp $
30 * $FreeBSD: head/sys/dev/ep/if_ep_pccard.c 52589 1999-10-28 06:12:58Z imp $
31 */
32
33/*
34 * Pccard support for 3C589 by:
35 * HAMADA Naoki
36 * nao@tom-yam.or.jp
37 */
38

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

68/*
69 * Initialize the device - called from Slot manager.
70 */
71static int
72ep_pccard_probe(device_t dev)
73{
74 struct ep_softc * sc = device_get_softc(dev);
75 struct ep_board * epb = &sc->epb;
31 */
32
33/*
34 * Pccard support for 3C589 by:
35 * HAMADA Naoki
36 * nao@tom-yam.or.jp
37 */
38

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

68/*
69 * Initialize the device - called from Slot manager.
70 */
71static int
72ep_pccard_probe(device_t dev)
73{
74 struct ep_softc * sc = device_get_softc(dev);
75 struct ep_board * epb = &sc->epb;
76 u_long port_start;
77 u_long port_count;
78 const char * desc;
79 int error;
80
76 const char * desc;
77 int error;
78
81 error = bus_get_resource(dev, SYS_RES_IOPORT, 0,
82 &port_start, &port_count);
83 if (error != 0)
79 error = ep_alloc(dev);
80 if (error)
84 return error;
85
81 return error;
82
86 sc->ep_io_addr = port_start;
87
88 /*
89 * XXX - Certain (newer?) 3Com cards need epb->cmd_off ==
90 * 2. Sadly, you need to have a correct cmd_off in order to
91 * identify the card. So we have to hit it with both and
92 * cross our virtual fingers. There's got to be a better way
93 * to do this. jyoung@accessus.net 09/11/1999
94 */
95
96 epb->cmd_off = 0;
97 epb->prod_id = get_e(sc, EEPROM_PROD_ID);
98 if ((desc = ep_pccard_identify(epb->prod_id)) == NULL) {
99 if (bootverbose)
100 device_printf(dev, "Pass 1 of 2 detection "
101 "failed (nonfatal)\n");
102 epb->cmd_off = 2;
103 epb->prod_id = get_e(sc, EEPROM_PROD_ID);
83 /*
84 * XXX - Certain (newer?) 3Com cards need epb->cmd_off ==
85 * 2. Sadly, you need to have a correct cmd_off in order to
86 * identify the card. So we have to hit it with both and
87 * cross our virtual fingers. There's got to be a better way
88 * to do this. jyoung@accessus.net 09/11/1999
89 */
90
91 epb->cmd_off = 0;
92 epb->prod_id = get_e(sc, EEPROM_PROD_ID);
93 if ((desc = ep_pccard_identify(epb->prod_id)) == NULL) {
94 if (bootverbose)
95 device_printf(dev, "Pass 1 of 2 detection "
96 "failed (nonfatal)\n");
97 epb->cmd_off = 2;
98 epb->prod_id = get_e(sc, EEPROM_PROD_ID);
104 if ((desc = ep_pccard_identify(epb->prod_id))) {
99 if ((desc = ep_pccard_identify(epb->prod_id)) == NULL) {
105 device_printf(dev, "Unit failed to come ready or "
106 "product ID unknown! (id 0x%x)\n", epb->prod_id);
100 device_printf(dev, "Unit failed to come ready or "
101 "product ID unknown! (id 0x%x)\n", epb->prod_id);
102 ep_free(dev);
107 return (ENXIO);
108 }
109 }
103 return (ENXIO);
104 }
105 }
110
106 device_set_desc(dev, desc);
107 ep_free(dev);
111 return (0);
112}
113
114static const char *
115ep_pccard_identify(u_short id)
116{
117 /* Determine device type and associated MII capabilities */
118 switch (id) {
119 case 0x6055: /* 3C556 */
120 return ("3Com 3C556");
121 case 0x4057: /* 3C574 */
108 return (0);
109}
110
111static const char *
112ep_pccard_identify(u_short id)
113{
114 /* Determine device type and associated MII capabilities */
115 switch (id) {
116 case 0x6055: /* 3C556 */
117 return ("3Com 3C556");
118 case 0x4057: /* 3C574 */
122 return("3Com 3C574");
119 return ("3Com 3C574");
123 case 0x4b57: /* 3C574B */
120 case 0x4b57: /* 3C574B */
124 return("3Com 3C574B, Megahertz 3CCFE574BT or "
121 return ("3Com 3C574B, Megahertz 3CCFE574BT or "
125 "Fast Etherlink 3C574-TX");
126 case 0x9058: /* 3C589 */
122 "Fast Etherlink 3C574-TX");
123 case 0x9058: /* 3C589 */
127 return("3Com Etherlink III 3C589[B/C/D]");
124 return ("3Com Etherlink III 3C589");
128 }
125 }
129 return (0);
126 return (NULL);
130}
131
132static int
133ep_pccard_card_attach(struct ep_board *epb)
134{
135 /* Determine device type and associated MII capabilities */
136 switch (epb->prod_id) {
137 case 0x6055: /* 3C556 */

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

156 struct ep_softc * sc = device_get_softc(dev);
157 int error = 0;
158
159 if ((error = ep_alloc(dev))) {
160 device_printf(dev, "ep_alloc() failed! (%d)\n", error);
161 goto bad;
162 }
163
127}
128
129static int
130ep_pccard_card_attach(struct ep_board *epb)
131{
132 /* Determine device type and associated MII capabilities */
133 switch (epb->prod_id) {
134 case 0x6055: /* 3C556 */

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

153 struct ep_softc * sc = device_get_softc(dev);
154 int error = 0;
155
156 if ((error = ep_alloc(dev))) {
157 device_printf(dev, "ep_alloc() failed! (%d)\n", error);
158 goto bad;
159 }
160
161 sc->epb.cmd_off = 0;
162 sc->epb.prod_id = get_e(sc, EEPROM_PROD_ID);
164 if (!ep_pccard_card_attach(&sc->epb)) {
165 sc->epb.cmd_off = 2;
166 sc->epb.prod_id = get_e(sc, EEPROM_PROD_ID);
167 sc->epb.res_cfg = get_e(sc, EEPROM_RESOURCE_CFG);
168 if (!ep_pccard_card_attach(&sc->epb)) {
169 device_printf(dev,
170 "Probe found ID, attach failed so ignore card!\n");
171 error = ENXIO;

--- 84 unchanged lines hidden ---
163 if (!ep_pccard_card_attach(&sc->epb)) {
164 sc->epb.cmd_off = 2;
165 sc->epb.prod_id = get_e(sc, EEPROM_PROD_ID);
166 sc->epb.res_cfg = get_e(sc, EEPROM_RESOURCE_CFG);
167 if (!ep_pccard_card_attach(&sc->epb)) {
168 device_printf(dev,
169 "Probe found ID, attach failed so ignore card!\n");
170 error = ENXIO;

--- 84 unchanged lines hidden ---