/* These should basically be bus-size and endian independent (since theSONICisatleastsmartenoughthatitusesthesameendianness
as the host, unlike certain less enlightened Macintosh NICs) */ #define SONIC_READ(reg) (nubus_readw(dev->base_addr + (reg * 4) \
+ lp->reg_offset)) #define SONIC_WRITE(reg,val) (nubus_writew(val, dev->base_addr + (reg * 4) \
+ lp->reg_offset))
/* For onboard SONIC */ #define ONBOARD_SONIC_REGISTERS 0x50F0A000 #define ONBOARD_SONIC_PROM_BASE 0x50f08000
/* For the built-in SONIC in the Duo Dock */ #define DUODOCK_SONIC_REGISTERS 0xe10000 #define DUODOCK_SONIC_PROM_BASE 0xe12000
/* For Apple-style NuBus SONIC */ #define APPLE_SONIC_REGISTERS 0 #define APPLE_SONIC_PROM_BASE 0x40000
/* Daynalink LC SONIC */ #define DAYNALINK_PROM_BASE 0x400000
/* For Dayna-style NuBus SONIC (haven't seen one yet) */ #define DAYNA_SONIC_REGISTERS 0x180000 /* This is what OpenBSD says. However, this is definitely in NuBus ROMspacesoweshouldbeabletogetitbywalkingtheNuBus
resource directories */ #define DAYNA_SONIC_MAC_ADDR 0xffe004
val = SONIC_READ(SONIC_CAP2);
addr[5] = val >> 8;
addr[4] = val & 0xff;
val = SONIC_READ(SONIC_CAP1);
addr[3] = val >> 8;
addr[2] = val & 0xff;
val = SONIC_READ(SONIC_CAP0);
addr[1] = val >> 8;
addr[0] = val & 0xff;
eth_hw_addr_set(dev, addr);
if (!INVALID_MAC(dev->dev_addr)) return;
/* Still nonsense ... messed up someplace! */
printk(KERN_WARNING "macsonic: MAC address in CAM entry 15 " "seems invalid, will use a random MAC\n");
eth_hw_addr_random(dev);
}
/* Bogus probing, on the models which may or may not have Ethernet(BTW,theEthernet*is*alwaysatthesame address,andnothingelselivesthere,atleastifApple's
documentation is to be believed) */ if (commslot || macintosh_config->ident == MAC_MODEL_C610) { int card_present;
card_present = hwreg_present((void*)ONBOARD_SONIC_REGISTERS); if (!card_present) {
pr_info("Onboard/comm-slot SONIC not found\n"); return -ENODEV;
}
}
/* Danger! My arms are flailing wildly! You *must* set lp->reg_offset
* and dev->base_addr before using SONIC_READ() or SONIC_WRITE() */
dev->base_addr = ONBOARD_SONIC_REGISTERS; if (via_alt_mapping)
dev->irq = IRQ_AUTO_3; else
dev->irq = IRQ_NUBUS_9;
/* The PowerBook's SONIC is 16 bit always. */ if (macintosh_config->ident == MAC_MODEL_PB520) {
lp->reg_offset = 0;
lp->dma_bitmode = SONIC_BITMODE16;
} elseif (commslot) { /* Some of the comm-slot cards are 16 bit. But some ofthemarenot.The32-bitcardsuseoffset2and haveknownrevisions,wetryreadingtherevision registeratoffset2,ifwedon'tgetaknownrevision
we assume 16 bit at offset 0. */
lp->reg_offset = 2;
lp->dma_bitmode = SONIC_BITMODE16;
sr = SONIC_READ(SONIC_SR); if (sr == 0x0004 || sr == 0x0006 || sr == 0x0100 || sr == 0x0101) /* 83932 is 0x0004 or 0x0006, 83934 is 0x0100 or 0x0101 */
lp->dma_bitmode = SONIC_BITMODE32; else {
lp->dma_bitmode = SONIC_BITMODE16;
lp->reg_offset = 0;
}
} else { /* All onboard cards are at offset 2 with 32 bit DMA. */
lp->reg_offset = 2;
lp->dma_bitmode = SONIC_BITMODE32;
}
/* This is sometimes useful to find out how MacOS configured the card */
pr_debug("%s: DCR=0x%04x, DCR2=0x%04x\n", __func__,
SONIC_READ(SONIC_DCR) & 0xffff,
SONIC_READ(SONIC_DCR2) & 0xffff);
/* Software reset, then initialize control registers. */
SONIC_WRITE(SONIC_CMD, SONIC_CR_RST);
/* This *must* be written back to in order to restore the *extendedprogrammableoutputbits,asitmaynothavebeen
* initialised since the hardware reset. */
SONIC_WRITE(SONIC_DCR2, 0);
/* Clear *and* disable interrupts to be on the safe side */
SONIC_WRITE(SONIC_IMR, 0);
SONIC_WRITE(SONIC_ISR, 0x7fff);
/* Now look for the MAC address. */
mac_onboard_sonic_ethernet_addr(dev);
pr_info("SONIC ethernet @%08lx, MAC %pM, IRQ %d\n",
dev->base_addr, dev->dev_addr, dev->irq);
staticint mac_sonic_nubus_ethernet_addr(struct net_device *dev, unsignedlong prom_addr, int id)
{
u8 addr[ETH_ALEN]; int i;
for(i = 0; i < 6; i++)
addr[i] = SONIC_READ_PROM(i);
/* Some of the addresses are bit-reversed */ if (id != MACSONIC_DAYNA)
bit_reverse_addr(addr);
eth_hw_addr_set(dev, addr);
return0;
}
staticint macsonic_ident(struct nubus_rsrc *fres)
{ if (fres->dr_hw == NUBUS_DRHW_ASANTE_LC &&
fres->dr_sw == NUBUS_DRSW_SONIC_LC) return MACSONIC_DAYNALINK; if (fres->dr_hw == NUBUS_DRHW_SONIC &&
fres->dr_sw == NUBUS_DRSW_APPLE) { /* There has to be a better way to do this... */ if (strstr(fres->board->name, "DuoDock")) return MACSONIC_DUODOCK; else return MACSONIC_APPLE;
}
if (fres->dr_hw == NUBUS_DRHW_SMC9194 &&
fres->dr_sw == NUBUS_DRSW_DAYNA) return MACSONIC_DAYNA;
/* Danger! My arms are flailing wildly! You *must* set lp->reg_offset
* and dev->base_addr before using SONIC_READ() or SONIC_WRITE() */
dev->base_addr = base_addr;
lp->reg_offset = reg_offset;
lp->dma_bitmode = dma_bitmode;
dev->irq = SLOT2IRQ(board->slot);
/* This is sometimes useful to find out how MacOS configured the card */
dev_dbg(&board->dev, "%s: DCR=0x%04x, DCR2=0x%04x\n", __func__,
SONIC_READ(SONIC_DCR) & 0xffff,
SONIC_READ(SONIC_DCR2) & 0xffff);
/* Software reset, then initialize control registers. */
SONIC_WRITE(SONIC_CMD, SONIC_CR_RST);
SONIC_WRITE(SONIC_DCR, sonic_dcr | (dma_bitmode ? SONIC_DCR_DW : 0)); /* This *must* be written back to in order to restore the *extendedprogrammableoutputbits,sinceitmaynothavebeen
* initialised since the hardware reset. */
SONIC_WRITE(SONIC_DCR2, 0);
/* Clear *and* disable interrupts to be on the safe side */
SONIC_WRITE(SONIC_IMR, 0);
SONIC_WRITE(SONIC_ISR, 0x7fff);
/* Now look for the MAC address. */ if (mac_sonic_nubus_ethernet_addr(dev, prom_addr, id) != 0) return -ENODEV;
staticint mac_sonic_nubus_probe(struct nubus_board *board)
{ struct net_device *ndev; struct sonic_local *lp; struct nubus_rsrc *fres; int id = -1; int err;
/* The platform driver will handle a PDS or Comm Slot card (even if *ithasapseudoslotdeclarationROM).
*/ if (macintosh_config->expansion_type == MAC_EXP_PDS_COMM) return -ENODEV;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.