Subject: Re: netboot via native bootloader
To: None <lbolt256@alkyltechnology.com>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-cobalt
Date: 10/27/2007 13:02:42
lbolt256@alkyltechnology.com wrote:

> > After ~six hour debugging, now it can load a GENERIC kernel
> > via tlp0 and bootp properly :-)
> 
> Kudo.  The tlp.c and other NIC code were made as a rush job and yet to be
> tested on real HW.  You might be suffered from my carelessness.  I will
> happily incorporate your fix(es).

Most hours were spent for investigating MI libsa network code
and debugging my own code, not your tlp.c :-)

I changed tlp.c as the following,
but I don't confirm if they are actually necessary.
(note maybe tlp is already initilized properly by the firmware
 on loading bootloader)

- declare all DMA descriptor members as volatile
- define inv() as _wbinv() to flush buffer/descs
  because invalidate could be problematic if buffer/descs
  are not cacheline aligned (if MD _inv() doesn't care it)
- don't set T0_OWN on init (maybe harmless though)
- use PCI IO space because cobalt firmware doesn't initialize mem space
  (though we can use a magic number without pcicfgread() on cobalt)
- use MIPS_KSEG0_TO_PHYS() for VTOPHYS()
  (BTW I don't like this name... VTODMAADDR() is preferred?)
- change SROM offset for MAC address (it's at offset zero on cobalt)
- pull a MII quirk reset code for cobalt from if_tlp_pci.c

Other related changes:

- use sys/lib/libsa/dev_net.c (which is not compiled in libsa.a)
  with -DSUPPORT_BOOTP
- store/pull the private "struct local *" pointer into/from
iodesc->io_netif->nif_driver->netif_ifs[iodesc->io_netif->nif_unit].dif_private
  rather than iodesc->io_netif itself (which seems used for
  debug code in MI libsa)
- mask mem/IO address from pcicfgread() with PCI_MAPREG_MEM_ADDR_MASK
  or PCI_MAPREG_IO_ADDR_MASK
- use "u_int" or "uint32_t" rather than "unsigned"

---
Izumi Tsutsui