326
327 static ddi_device_acc_attr_t hme_buf_attr = {
328 DDI_DEVICE_ATTR_V0,
329 DDI_NEVERSWAP_ACC,
330 DDI_STRICTORDER_ACC, /* probably could allow merging & caching */
331 DDI_DEFAULT_ACC,
332 };
333
334 static uchar_t pci_latency_timer = 0;
335
336 /*
337 * Module linkage information for the kernel.
338 */
339 static struct modldrv modldrv = {
340 &mod_driverops, /* Type of module. This one is a driver */
341 "Sun HME 10/100 Mb Ethernet",
342 &hme_dev_ops, /* driver ops */
343 };
344
345 static struct modlinkage modlinkage = {
346 MODREV_1, &modldrv, NULL
347 };
348
349 /* <<<<<<<<<<<<<<<<<<<<<< Register operations >>>>>>>>>>>>>>>>>>>>> */
350
351 #define GET_MIFREG(reg) \
352 ddi_get32(hmep->hme_mifregh, (uint32_t *)&hmep->hme_mifregp->reg)
353 #define PUT_MIFREG(reg, value) \
354 ddi_put32(hmep->hme_mifregh, (uint32_t *)&hmep->hme_mifregp->reg, value)
355
356 #define GET_ETXREG(reg) \
357 ddi_get32(hmep->hme_etxregh, (uint32_t *)&hmep->hme_etxregp->reg)
358 #define PUT_ETXREG(reg, value) \
359 ddi_put32(hmep->hme_etxregh, (uint32_t *)&hmep->hme_etxregp->reg, value)
360 #define GET_ERXREG(reg) \
361 ddi_get32(hmep->hme_erxregh, (uint32_t *)&hmep->hme_erxregp->reg)
362 #define PUT_ERXREG(reg, value) \
363 ddi_put32(hmep->hme_erxregh, (uint32_t *)&hmep->hme_erxregp->reg, value)
364 #define GET_MACREG(reg) \
365 ddi_get32(hmep->hme_bmacregh, (uint32_t *)&hmep->hme_bmacregp->reg)
366 #define PUT_MACREG(reg, value) \
684
685 /*
686 * ddi_dma_sync() a TMD or RMD descriptor.
687 */
688 #define HMESYNCRMD(num, who) \
689 (void) ddi_dma_sync(hmep->hme_rmd_dmah, \
690 (num * sizeof (struct hme_rmd)), \
691 sizeof (struct hme_rmd), \
692 who)
693
694 #define HMESYNCTMD(num, who) \
695 (void) ddi_dma_sync(hmep->hme_tmd_dmah, \
696 (num * sizeof (struct hme_tmd)), \
697 sizeof (struct hme_tmd), \
698 who)
699
700 /*
701 * Ethernet broadcast address definition.
702 */
703 static struct ether_addr etherbroadcastaddr = {
704 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
705 };
706
707 /*
708 * MIB II broadcast/multicast packets
709 */
710 #define IS_BROADCAST(pkt) (bcmp(pkt, ðerbroadcastaddr, ETHERADDRL) == 0)
711 #define IS_MULTICAST(pkt) ((pkt[0] & 01) == 1)
712 #define BUMP_InNUcast(hmep, pkt) \
713 if (IS_MULTICAST(pkt)) { \
714 if (IS_BROADCAST(pkt)) { \
715 hmep->hme_brdcstrcv++; \
716 } else { \
717 hmep->hme_multircv++; \
718 } \
719 }
720 #define BUMP_OutNUcast(hmep, pkt) \
721 if (IS_MULTICAST(pkt)) { \
722 if (IS_BROADCAST(pkt)) { \
723 hmep->hme_brdcstxmt++; \
724 } else { \
|
326
327 static ddi_device_acc_attr_t hme_buf_attr = {
328 DDI_DEVICE_ATTR_V0,
329 DDI_NEVERSWAP_ACC,
330 DDI_STRICTORDER_ACC, /* probably could allow merging & caching */
331 DDI_DEFAULT_ACC,
332 };
333
334 static uchar_t pci_latency_timer = 0;
335
336 /*
337 * Module linkage information for the kernel.
338 */
339 static struct modldrv modldrv = {
340 &mod_driverops, /* Type of module. This one is a driver */
341 "Sun HME 10/100 Mb Ethernet",
342 &hme_dev_ops, /* driver ops */
343 };
344
345 static struct modlinkage modlinkage = {
346 MODREV_1, { &modldrv, NULL }
347 };
348
349 /* <<<<<<<<<<<<<<<<<<<<<< Register operations >>>>>>>>>>>>>>>>>>>>> */
350
351 #define GET_MIFREG(reg) \
352 ddi_get32(hmep->hme_mifregh, (uint32_t *)&hmep->hme_mifregp->reg)
353 #define PUT_MIFREG(reg, value) \
354 ddi_put32(hmep->hme_mifregh, (uint32_t *)&hmep->hme_mifregp->reg, value)
355
356 #define GET_ETXREG(reg) \
357 ddi_get32(hmep->hme_etxregh, (uint32_t *)&hmep->hme_etxregp->reg)
358 #define PUT_ETXREG(reg, value) \
359 ddi_put32(hmep->hme_etxregh, (uint32_t *)&hmep->hme_etxregp->reg, value)
360 #define GET_ERXREG(reg) \
361 ddi_get32(hmep->hme_erxregh, (uint32_t *)&hmep->hme_erxregp->reg)
362 #define PUT_ERXREG(reg, value) \
363 ddi_put32(hmep->hme_erxregh, (uint32_t *)&hmep->hme_erxregp->reg, value)
364 #define GET_MACREG(reg) \
365 ddi_get32(hmep->hme_bmacregh, (uint32_t *)&hmep->hme_bmacregp->reg)
366 #define PUT_MACREG(reg, value) \
684
685 /*
686 * ddi_dma_sync() a TMD or RMD descriptor.
687 */
688 #define HMESYNCRMD(num, who) \
689 (void) ddi_dma_sync(hmep->hme_rmd_dmah, \
690 (num * sizeof (struct hme_rmd)), \
691 sizeof (struct hme_rmd), \
692 who)
693
694 #define HMESYNCTMD(num, who) \
695 (void) ddi_dma_sync(hmep->hme_tmd_dmah, \
696 (num * sizeof (struct hme_tmd)), \
697 sizeof (struct hme_tmd), \
698 who)
699
700 /*
701 * Ethernet broadcast address definition.
702 */
703 static struct ether_addr etherbroadcastaddr = {
704 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }
705 };
706
707 /*
708 * MIB II broadcast/multicast packets
709 */
710 #define IS_BROADCAST(pkt) (bcmp(pkt, ðerbroadcastaddr, ETHERADDRL) == 0)
711 #define IS_MULTICAST(pkt) ((pkt[0] & 01) == 1)
712 #define BUMP_InNUcast(hmep, pkt) \
713 if (IS_MULTICAST(pkt)) { \
714 if (IS_BROADCAST(pkt)) { \
715 hmep->hme_brdcstrcv++; \
716 } else { \
717 hmep->hme_multircv++; \
718 } \
719 }
720 #define BUMP_OutNUcast(hmep, pkt) \
721 if (IS_MULTICAST(pkt)) { \
722 if (IS_BROADCAST(pkt)) { \
723 hmep->hme_brdcstxmt++; \
724 } else { \
|