Subject: Re: LAN Adapter driver
To: None <port-dreamcast@netbsd.org>
From: Christian Groessler <cpg@aladdin.de>
List: port-dreamcast
Date: 09/27/2002 17:01:18
Hi,
an updated patch to implement the lan adapter driver can be found on
ftp://ftp.groessler.org/pub/chris/dreamcast/netbsd/lan-adapter/lana-diff-new.gz
On 09/24/2002 12:34:42 AM ZE9 Izumi Tsutsui wrote:
>
>- The device name should be "mbe" that is defined in sys/conf/files,
> rather than "lana", and lan_adapter.c should be renamed as
> if_mbe_g2.c and so. (see sys/dev/pcmcia/if_mbe_pcmcia.c)
Ok, I've changed this. Now I recognize the system. But isa/if_fmv.c
also doesn't follow it.
>- It should have its own all bus_space functions rather than
> overriding functions in g2bus_bus_mem.c.
> (Does it require G2_LOCK/G2_UNLOCK?)
I have to admit, I don't see much difference between what the lan
adapter does and arch/mac68k/obio/wdc_obio.c does with the
mac68k_bsr2_wdc_gen function. The only difference is that the lan
adapter version doesn't do the access directly, but uses the g2 bus
space functions for that.
So I left it as it is for now.
What shall I do here? Add a stride variable to the g2 bus space handle?
>- Some magic numbers should be nuked (if possible):
>> if (((bus_space_read_1(iot, ioh, 7) >> 6) & 3) != 2) {
I fixed this with proper defines:
if ((bus_space_read_1(iot, ioh, FE_DLCR7) & FE_D7_IDENT) != FE_D7_IDENT_NICE) {
What is "FE_D7_IDENT_NICE"? Is it that nice? According to my data
sheet,
#define FE_D7_IDENT_86960 0x00
#define FE_D7_IDENT_86964 0x40
#define FE_D7_IDENT_86967 0x80
#define FE_D7_IDENT_86965 0xC0
in dev/ic/mb86960reg.h would make more sense.
>- lan_adapter.c has "Initialize ASIC" code (seems pulled from if_fmv.c),
> but is it really required?
Cut + Paste error. I've tried it and it still works without. Removed.
>- It also includes dev/ic/ate_subr.c, but is it needed?
> (Maybe we need to cleanup register configuration of mbe vs fmv.)
I need it for the ate_read_eeprom() function. There is the mac address
stored in the eeprom.
>- I don't know about sysasic, but SYSASIC_EVENT_8BIT is really needed?
I think so. I've deduced the value from information in the KOS
library. Look in
kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c and
kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c. Search for
ASIC_IRQB_B.
It's some other interrupt line, dreamcast/sysasic.c
sysasic_intr_establish() chains it through to sysasic_intr_enable()
(in syh_event). It then sets a different bit in the line
masks[event >> 5] = 1 << (event & 31); (end of sysasic.)
Maybe Marcus has some deeper insights in this area.
regards,
chris