- add siisata.c in Makefile.
- use DEVTOV() to highlight vtophys() issue. - VIA NICs do not stretch less than 60 octet frames.
This commit is contained in:
parent
7ce7cf535a
commit
ac96fb2beb
|
@ -1,11 +1,11 @@
|
|||
# $NetBSD: Makefile,v 1.8 2008/04/07 11:13:14 nisimura Exp $
|
||||
# $NetBSD: Makefile,v 1.9 2008/04/07 13:25:31 nisimura Exp $
|
||||
|
||||
S= ${.CURDIR}/../../../..
|
||||
|
||||
PROG= netboot
|
||||
SRCS= entry.S main.c pci.c devopen.c dev_net.c nif.c \
|
||||
fxp.c tlp.c pcn.c sip.c nvt.c rge.c vge.c wm.c \
|
||||
atawd.c pciide.c printf.c
|
||||
atawd.c pciide.c siisata.c printf.c
|
||||
CLEANFILES+= vers.c vers.o ${PROG} ${PROG}.bin
|
||||
CFLAGS+= -Wall -Wno-main -ffreestanding -msoft-float -mmultiple
|
||||
CPPFLAGS+= -D_STANDALONE -DSUPPORT_DHCP
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: atawd.c,v 1.1 2008/04/07 11:13:14 nisimura Exp $ */
|
||||
/* $NetBSD: atawd.c,v 1.2 2008/04/07 13:25:31 nisimura Exp $ */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -32,9 +32,11 @@ struct atacdv {
|
|||
void * xxx ## _init(unsigned, unsigned)
|
||||
|
||||
ATAC_DECL(pciide);
|
||||
ATAC_DECL(siisata);
|
||||
|
||||
static struct atacdv vatacdv[] = {
|
||||
{ pciide_init, 01 },
|
||||
{ siisata_init, 0xf },
|
||||
};
|
||||
static int natacdv = sizeof(vatacdv)/sizeof(vatacdv[0]);
|
||||
struct atacdv *atac;
|
||||
|
@ -170,13 +172,13 @@ atatc_probe(void *atac)
|
|||
memset(wd, 0, sizeof(struct wd_softc));
|
||||
wd->sc_unit = ndisk;
|
||||
wd->sc_channel = &l->channel[i];
|
||||
disk[ndisk] = (void *)wd;
|
||||
error = wd_get_params(wd);
|
||||
if (error != 0)
|
||||
continue;
|
||||
error = wdgetdisklabel(wd);
|
||||
if (error != 0)
|
||||
continue;
|
||||
disk[ndisk] = (void *)wd;
|
||||
ndisk += 1;
|
||||
}
|
||||
}
|
||||
|
@ -323,7 +325,7 @@ atac_wait_for_ready(struct atac_channel *chp)
|
|||
}
|
||||
return ENXIO;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
atac_read_block(struct wd_softc *wd, struct atac_command *cmd)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nvt.c,v 1.9 2007/12/09 09:55:58 nisimura Exp $ */
|
||||
/* $NetBSD: nvt.c,v 1.10 2008/04/07 13:25:31 nisimura Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -218,11 +218,11 @@ nvt_init(unsigned tag, void *data)
|
|||
rxd[0].xd0 = htole32(R0_OWN);
|
||||
rxd[0].xd1 = htole32(FRAMESIZE << 16);
|
||||
rxd[0].xd2 = htole32(VTOPHYS(l->rxstore[0]));
|
||||
rxd[0].xd3 = htole32(&rxd[1]);
|
||||
rxd[0].xd3 = htole32(VTOPHYS(&rxd[1]));
|
||||
rxd[1].xd0 = htole32(R0_OWN);
|
||||
rxd[1].xd1 = htole32(VTOPHYS(l->rxstore[1]));
|
||||
rxd[1].xd2 = htole32(FRAMESIZE << 16);
|
||||
rxd[1].xd3 = htole32(&rxd[0]);
|
||||
rxd[1].xd3 = htole32(VTOPHYS(&rxd[0]));
|
||||
wbinv(l, sizeof(struct local));
|
||||
l->rx = 0;
|
||||
|
||||
|
@ -249,6 +249,9 @@ nvt_send(void *dev, char *buf, unsigned len)
|
|||
struct desc *txd;
|
||||
unsigned loop;
|
||||
|
||||
len = (len & T_FLMASK);
|
||||
if (len < 60)
|
||||
len = 60; /* needs to stretch to ETHER_MIN_LEN - 4 */
|
||||
wbinv(buf, len);
|
||||
txd = &l->txd;
|
||||
txd->xd3 = htole32(txd);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pciide.c,v 1.2 2008/04/07 12:33:57 nisimura Exp $ */
|
||||
/* $NetBSD: pciide.c,v 1.3 2008/04/07 13:25:31 nisimura Exp $ */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/disklabel.h>
|
||||
|
@ -9,6 +9,11 @@
|
|||
#include <lib/libsa/stand.h>
|
||||
#include "globals.h"
|
||||
|
||||
/*
|
||||
* - no vtophys() translation, vaddr_t == paddr_t.
|
||||
*/
|
||||
#define DEVTOV(pa) (uint32_t)(pa)
|
||||
|
||||
/*
|
||||
* cmdide
|
||||
* iteide
|
||||
|
@ -48,10 +53,10 @@ pciide_init(unsigned tag, unsigned data)
|
|||
for (ch = 0; ch < 2; ch += 1) {
|
||||
cp = &l->channel[ch];
|
||||
if (PCIIDE_INTERFACE_PCI(ch) & val) {
|
||||
cp->c_cmdbase = (void *)pcicfgread(tag,
|
||||
PCIIDE_REG_CMD_BASE(ch));
|
||||
cp->c_ctlbase = (void *)pcicfgread(tag,
|
||||
PCIIDE_REG_CTL_BASE(ch));
|
||||
cp->c_cmdbase = (void *)DEVTOV(pcicfgread(tag,
|
||||
PCIIDE_REG_CMD_BASE(ch)));
|
||||
cp->c_ctlbase = (void *)DEVTOV(pcicfgread(tag,
|
||||
PCIIDE_REG_CTL_BASE(ch)));
|
||||
cp->c_data = (u_int16_t *)(cp->c_cmdbase + wd_data);
|
||||
for (i = 0; i < 8; i++)
|
||||
cp->c_cmdreg[i] = cp->c_cmdbase + i;
|
||||
|
@ -60,10 +65,10 @@ pciide_init(unsigned tag, unsigned data)
|
|||
}
|
||||
else {
|
||||
tag = 0; /* !!! */
|
||||
cp->c_cmdbase = (void *)(pcicfgread(tag, 0x10) +
|
||||
PCIIDE_COMPAT_CMD_BASE(ch));
|
||||
cp->c_ctlbase = (void *)(pcicfgread(tag, 0x10) +
|
||||
PCIIDE_COMPAT_CTL_BASE(ch));
|
||||
cp->c_cmdbase = (void *)DEVTOV(pcicfgread(tag, 0x10)
|
||||
+ PCIIDE_COMPAT_CMD_BASE(ch));
|
||||
cp->c_ctlbase = (void *)DEVTOV(pcicfgread(tag, 0x10)
|
||||
+ PCIIDE_COMPAT_CTL_BASE(ch));
|
||||
cp->c_data = (u_int16_t *)(cp->c_cmdbase + wd_data);
|
||||
for (i = 0; i < 8; i++)
|
||||
cp->c_cmdreg[i] = cp->c_cmdbase + i;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: siisata.c,v 1.1 2008/04/07 12:33:57 nisimura Exp $ */
|
||||
/* $NetBSD: siisata.c,v 1.2 2008/04/07 13:25:31 nisimura Exp $ */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/disklabel.h>
|
||||
|
@ -9,6 +9,11 @@
|
|||
#include <lib/libsa/stand.h>
|
||||
#include "globals.h"
|
||||
|
||||
/*
|
||||
* - no vtophys() translation, vaddr_t == paddr_t.
|
||||
*/
|
||||
#define DEVTOV(pa) (uint32_t)(pa)
|
||||
|
||||
void *siisata_init(unsigned, unsigned);
|
||||
|
||||
#define PCIIDE_REG_CMD_BASE(chan) (0x10 + (8 * (chan)))
|
||||
|
@ -62,8 +67,8 @@ map3112chan(unsigned tag, int ch, struct atac_channel *cp)
|
|||
{
|
||||
int i;
|
||||
|
||||
cp->c_cmdbase = (void *)pcicfgread(tag, PCIIDE_REG_CMD_BASE(ch));
|
||||
cp->c_ctlbase = (void *)pcicfgread(tag, PCIIDE_REG_CTL_BASE(ch));
|
||||
cp->c_cmdbase = (void*)DEVTOV(pcicfgread(tag, PCIIDE_REG_CMD_BASE(ch)));
|
||||
cp->c_ctlbase = (void*)DEVTOV(pcicfgread(tag, PCIIDE_REG_CTL_BASE(ch)));
|
||||
cp->c_data = (u_int16_t *)(cp->c_cmdbase + wd_data);
|
||||
for (i = 0; i < 8; i++)
|
||||
cp->c_cmdreg[i] = cp->c_cmdbase + i;
|
||||
|
@ -86,7 +91,7 @@ map3114chan(unsigned tag, int ch, struct atac_channel *cp)
|
|||
int i;
|
||||
uint8_t *ba5;
|
||||
|
||||
ba5 = (uint8_t *)pcicfgread(tag, 0x24); /* PCI_BAR5 */
|
||||
ba5 = (uint8_t *)DEVTOV(pcicfgread(tag, 0x24)); /* PCI_BAR5 */
|
||||
cp->c_cmdbase = ba5 + regmap[ch].IDE_TF0;
|
||||
cp->c_ctlbase = ba5 + regmap[ch].IDE_TF8;
|
||||
cp->c_data = (u_int16_t *)(cp->c_cmdbase + wd_data);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vge.c,v 1.10 2007/12/09 09:55:58 nisimura Exp $ */
|
||||
/* $NetBSD: vge.c,v 1.11 2008/04/07 13:25:31 nisimura Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
|
@ -320,10 +320,10 @@ vge_send(void *dev, char *buf, unsigned len)
|
|||
struct tdesc *txd;
|
||||
unsigned loop;
|
||||
|
||||
wbinv(buf, len);
|
||||
len = (len & T_FLMASK);
|
||||
if (len < 60)
|
||||
len = 60; /* needs to stretch to ETHER_MIN_LEN - 4 */
|
||||
wbinv(buf, len);
|
||||
txd = &l->txd;
|
||||
txd->tf[0].lo = htole32(VTOPHYS(buf));
|
||||
txd->tf[0].hi = htole32(len << 16);
|
||||
|
|
Loading…
Reference in New Issue