22 /*
23 * Copyright 2010 QLogic Corporation. All rights reserved.
24 */
25
26 #include <qlge.h>
27 #include <sys/atomic.h>
28 #include <sys/strsubr.h>
29 #include <sys/pattr.h>
30 #include <netinet/in.h>
31 #include <netinet/ip.h>
32 #include <netinet/ip6.h>
33 #include <netinet/tcp.h>
34 #include <netinet/udp.h>
35 #include <inet/ip.h>
36
37
38
39 /*
40 * Local variables
41 */
42 static struct ether_addr ql_ether_broadcast_addr =
43 {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
44 static char version[] = "GLDv3 QLogic 81XX " VERSIONSTR;
45
46 /*
47 * Local function prototypes
48 */
49 static void ql_free_resources(qlge_t *);
50 static void ql_fini_kstats(qlge_t *);
51 static uint32_t ql_get_link_state(qlge_t *);
52 static void ql_read_conf(qlge_t *);
53 static int ql_alloc_phys(dev_info_t *, ddi_dma_handle_t *,
54 ddi_device_acc_attr_t *, uint_t, ddi_acc_handle_t *,
55 size_t, size_t, caddr_t *, ddi_dma_cookie_t *);
56 static int ql_alloc_phys_rbuf(dev_info_t *, ddi_dma_handle_t *,
57 ddi_device_acc_attr_t *, uint_t, ddi_acc_handle_t *,
58 size_t, size_t, caddr_t *, ddi_dma_cookie_t *);
59 static void ql_free_phys(ddi_dma_handle_t *, ddi_acc_handle_t *);
60 static int ql_set_routing_reg(qlge_t *, uint32_t, uint32_t, int);
61 static int ql_attach(dev_info_t *, ddi_attach_cmd_t);
62 static int ql_detach(dev_info_t *, ddi_detach_cmd_t);
63 static int ql_bringdown_adapter(qlge_t *);
8013 (void) ql_asic_reset(qlge);
8014 qlge_delay(100);
8015 }
8016
8017 return (DDI_SUCCESS);
8018 }
8019
8020 QL_STREAM_OPS(ql_ops, ql_attach, ql_detach);
8021
8022 /*
8023 * Loadable Driver Interface Structures.
8024 * Declare and initialize the module configuration section...
8025 */
8026 static struct modldrv modldrv = {
8027 &mod_driverops, /* type of module: driver */
8028 version, /* name of module */
8029 &ql_ops /* driver dev_ops */
8030 };
8031
8032 static struct modlinkage modlinkage = {
8033 MODREV_1, &modldrv, NULL
8034 };
8035
8036 /*
8037 * Loadable Module Routines
8038 */
8039
8040 /*
8041 * _init
8042 * Initializes a loadable module. It is called before any other
8043 * routine in a loadable module.
8044 */
8045 int
8046 _init(void)
8047 {
8048 int rval;
8049
8050 mac_init_ops(&ql_ops, ADAPTER_NAME);
8051 rval = mod_install(&modlinkage);
8052 if (rval != DDI_SUCCESS) {
8053 mac_fini_ops(&ql_ops);
|
22 /*
23 * Copyright 2010 QLogic Corporation. All rights reserved.
24 */
25
26 #include <qlge.h>
27 #include <sys/atomic.h>
28 #include <sys/strsubr.h>
29 #include <sys/pattr.h>
30 #include <netinet/in.h>
31 #include <netinet/ip.h>
32 #include <netinet/ip6.h>
33 #include <netinet/tcp.h>
34 #include <netinet/udp.h>
35 #include <inet/ip.h>
36
37
38
39 /*
40 * Local variables
41 */
42 static struct ether_addr ql_ether_broadcast_addr = {
43 {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}};
44 static char version[] = "GLDv3 QLogic 81XX " VERSIONSTR;
45
46 /*
47 * Local function prototypes
48 */
49 static void ql_free_resources(qlge_t *);
50 static void ql_fini_kstats(qlge_t *);
51 static uint32_t ql_get_link_state(qlge_t *);
52 static void ql_read_conf(qlge_t *);
53 static int ql_alloc_phys(dev_info_t *, ddi_dma_handle_t *,
54 ddi_device_acc_attr_t *, uint_t, ddi_acc_handle_t *,
55 size_t, size_t, caddr_t *, ddi_dma_cookie_t *);
56 static int ql_alloc_phys_rbuf(dev_info_t *, ddi_dma_handle_t *,
57 ddi_device_acc_attr_t *, uint_t, ddi_acc_handle_t *,
58 size_t, size_t, caddr_t *, ddi_dma_cookie_t *);
59 static void ql_free_phys(ddi_dma_handle_t *, ddi_acc_handle_t *);
60 static int ql_set_routing_reg(qlge_t *, uint32_t, uint32_t, int);
61 static int ql_attach(dev_info_t *, ddi_attach_cmd_t);
62 static int ql_detach(dev_info_t *, ddi_detach_cmd_t);
63 static int ql_bringdown_adapter(qlge_t *);
8013 (void) ql_asic_reset(qlge);
8014 qlge_delay(100);
8015 }
8016
8017 return (DDI_SUCCESS);
8018 }
8019
8020 QL_STREAM_OPS(ql_ops, ql_attach, ql_detach);
8021
8022 /*
8023 * Loadable Driver Interface Structures.
8024 * Declare and initialize the module configuration section...
8025 */
8026 static struct modldrv modldrv = {
8027 &mod_driverops, /* type of module: driver */
8028 version, /* name of module */
8029 &ql_ops /* driver dev_ops */
8030 };
8031
8032 static struct modlinkage modlinkage = {
8033 MODREV_1, { &modldrv, NULL }
8034 };
8035
8036 /*
8037 * Loadable Module Routines
8038 */
8039
8040 /*
8041 * _init
8042 * Initializes a loadable module. It is called before any other
8043 * routine in a loadable module.
8044 */
8045 int
8046 _init(void)
8047 {
8048 int rval;
8049
8050 mac_init_ops(&ql_ops, ADAPTER_NAME);
8051 rval = mod_install(&modlinkage);
8052 if (rval != DDI_SUCCESS) {
8053 mac_fini_ops(&ql_ops);
|