if_ed_cbus.c (147256) | if_ed_cbus.c (149558) |
---|---|
1/*- 2 * Copyright (c) 1995, David Greenman 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 --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * | 1/*- 2 * Copyright (c) 1995, David Greenman 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 --- 10 unchanged lines hidden (view full) --- 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * |
27 * $FreeBSD: head/sys/dev/ed/if_ed_cbus.c 147256 2005-06-10 16:49:24Z brooks $ | 27 * $FreeBSD: head/sys/dev/ed/if_ed_cbus.c 149558 2005-08-28 23:56:25Z imp $ |
28 */ 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/socket.h> 33#include <sys/kernel.h> 34 35#include <sys/module.h> --- 201 unchanged lines hidden (view full) --- 237 else 238 ed98_alloc_port(dev, sc->port_rid); 239 } 240 if (sc->mem_used) 241 ed_alloc_memory(dev, sc->mem_rid, sc->mem_used); 242 243 ed_alloc_irq(dev, sc->irq_rid, 0); 244 | 28 */ 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/socket.h> 33#include <sys/kernel.h> 34 35#include <sys/module.h> --- 201 unchanged lines hidden (view full) --- 237 else 238 ed98_alloc_port(dev, sc->port_rid); 239 } 240 if (sc->mem_used) 241 ed_alloc_memory(dev, sc->mem_rid, sc->mem_used); 242 243 ed_alloc_irq(dev, sc->irq_rid, 0); 244 |
245 error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET, | 245 error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE, |
246 edintr, sc, &sc->irq_handle); 247 if (error) { 248 ed_release_resources(dev); 249 return (error); 250 } 251 252 return ed_attach(dev); 253} --- 357 unchanged lines hidden (view full) --- 611 612 if ((conf_maddr == 0) || (conf_msize == 0)) 613 return (ENXIO); 614 615 error = ed_alloc_memory(dev, rid, (int) conf_msize); 616 if (error) 617 return (error); 618 | 246 edintr, sc, &sc->irq_handle); 247 if (error) { 248 ed_release_resources(dev); 249 return (error); 250 } 251 252 return ed_attach(dev); 253} --- 357 unchanged lines hidden (view full) --- 611 612 if ((conf_maddr == 0) || (conf_msize == 0)) 613 return (ENXIO); 614 615 error = ed_alloc_memory(dev, rid, (int) conf_msize); 616 if (error) 617 return (error); 618 |
619 sc->mem_start = (caddr_t) rman_get_virtual(sc->mem_res); | 619 sc->mem_start = 0; |
620 sc->mem_size = conf_msize; 621 622 return (0); 623} 624 625/* 626 * Generic probe routine for testing for the existance of a DS8390. 627 * Must be called after the NIC has just been reset. This routine --- 206 unchanged lines hidden (view full) --- 834 } 835 DELAY(100); 836 837 /* 838 * Here we check the card ROM, if the checksum passes, and the 839 * type code and ethernet address check out, then we know we have 840 * an SIC card. 841 */ | 620 sc->mem_size = conf_msize; 621 622 return (0); 623} 624 625/* 626 * Generic probe routine for testing for the existance of a DS8390. 627 * Must be called after the NIC has just been reset. This routine --- 206 unchanged lines hidden (view full) --- 834 } 835 DELAY(100); 836 837 /* 838 * Here we check the card ROM, if the checksum passes, and the 839 * type code and ethernet address check out, then we know we have 840 * an SIC card. 841 */ |
842 sum = sc->mem_start[6 * 2]; | 842 sum = bus_space_read_1(sc->mem_bst, sc->mem_bsh, 6 * 2); |
843 for (i = 0; i < ETHER_ADDR_LEN; i++) | 843 for (i = 0; i < ETHER_ADDR_LEN; i++) |
844 sum ^= (sc->enaddr[i] = sc->mem_start[i * 2]); | 844 sum ^= (sc->enaddr[i] = 845 bus_space_read_1(sc->mem_bst, sc->mem_bsh, i * 2)); |
845#ifdef ED_DEBUG 846 device_printf(dev, "ed_probe_sic98: got address %6D\n", 847 sc->enaddr, ":"); 848#endif 849 if (sum != 0) 850 return (ENXIO); 851 if ((sc->enaddr[0] | sc->enaddr[1] | sc->enaddr[2]) == 0) 852 return (ENXIO); --- 206 unchanged lines hidden (view full) --- 1059 * Set window ethernet address area 1060 * board memory base 0x480000 data 256byte 1061 */ 1062 ed_winsel_CNET98(sc, 0x4800); 1063 1064 /* 1065 * Get station address from on-board ROM 1066 */ | 846#ifdef ED_DEBUG 847 device_printf(dev, "ed_probe_sic98: got address %6D\n", 848 sc->enaddr, ":"); 849#endif 850 if (sum != 0) 851 return (ENXIO); 852 if ((sc->enaddr[0] | sc->enaddr[1] | sc->enaddr[2]) == 0) 853 return (ENXIO); --- 206 unchanged lines hidden (view full) --- 1060 * Set window ethernet address area 1061 * board memory base 0x480000 data 256byte 1062 */ 1063 ed_winsel_CNET98(sc, 0x4800); 1064 1065 /* 1066 * Get station address from on-board ROM 1067 */ |
1067 bcopy(sc->mem_start, sc->enaddr, ETHER_ADDR_LEN); | 1068 bus_space_read_region_1(sc->mem_bst, sc->mem_bsh, sc->mem_start, 1069 sc->enaddr, ETHER_ADDR_LEN); |
1068 1069 sc->vendor = ED_VENDOR_MISC; 1070 sc->type_str = "CNET98"; 1071 sc->isa16bit = 0; 1072 sc->cr_proto = ED_CR_RD2; 1073 1074 /* 1075 * Set window buffer memory area --- 496 unchanged lines hidden (view full) --- 1572 if (bcmp(test_pattern, test_buffer, sizeof(test_pattern))) { 1573#ifdef ED_DEBUG 1574 printf("ed?: ed_pio_testmem: bcmp(page %x) NG", page_end); 1575#endif 1576 return (0); 1577 } 1578#endif 1579 sc->mem_size = memsize; | 1070 1071 sc->vendor = ED_VENDOR_MISC; 1072 sc->type_str = "CNET98"; 1073 sc->isa16bit = 0; 1074 sc->cr_proto = ED_CR_RD2; 1075 1076 /* 1077 * Set window buffer memory area --- 496 unchanged lines hidden (view full) --- 1574 if (bcmp(test_pattern, test_buffer, sizeof(test_pattern))) { 1575#ifdef ED_DEBUG 1576 printf("ed?: ed_pio_testmem: bcmp(page %x) NG", page_end); 1577#endif 1578 return (0); 1579 } 1580#endif 1581 sc->mem_size = memsize; |
1580 sc->mem_start = (char *) page_offset; | 1582 sc->mem_start = page_offset; |
1581 sc->mem_end = sc->mem_start + memsize; 1582 sc->tx_page_start = page_offset / ED_PAGE_SIZE; 1583 1584 /* 1585 * Use one xmit buffer if < 16k, two buffers otherwise (if not told 1586 * otherwise). 1587 */ 1588 if ((memsize < 16384) || (flags & ED_FLAGS_NO_MULTI_BUFFERING)) --- 30 unchanged lines hidden --- | 1583 sc->mem_end = sc->mem_start + memsize; 1584 sc->tx_page_start = page_offset / ED_PAGE_SIZE; 1585 1586 /* 1587 * Use one xmit buffer if < 16k, two buffers otherwise (if not told 1588 * otherwise). 1589 */ 1590 if ((memsize < 16384) || (flags & ED_FLAGS_NO_MULTI_BUFFERING)) --- 30 unchanged lines hidden --- |