1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-30 16:51:41 +00:00

Move configuration of work_memory to oltr_init() rather than

oltr_pci_attach().  This only affects the OC-3139 and OC-3540.

MFC candidate.

PR:		kern/24074
This commit is contained in:
Matthew N. Dodd 2001-03-08 01:38:58 +00:00
parent 3a51557243
commit af1ac47537
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=73972

View File

@ -288,7 +288,7 @@ static int
oltr_pci_attach(device_t dev)
{
int i, s, rc = 0, rid,
scratch_size, work_size;
scratch_size;
int media = IFM_TOKEN|IFM_TOK_UTP16;
u_long command;
char PCIConfigHeader[64];
@ -338,26 +338,6 @@ oltr_pci_attach(device_t dev)
goto config_failed;
}
switch(sc->config.type) {
case TRLLD_ADAPTER_PCI4: /* OC-3139 */
work_size = 32 * 1024;
break;
case TRLLD_ADAPTER_PCI7: /* OC-3540 */
work_size = 256;
break;
default:
work_size = 0;
}
if (work_size) {
if ((sc->work_memory = malloc(work_size, M_DEVBUF, M_NOWAIT)) == NULL) {
device_printf(dev, "failed to allocate work memory.\n");
} else {
TRlldAddMemory(sc->TRlldAdapter, sc->work_memory,
vtophys(sc->work_memory), work_size);
}
}
/*
* Allocate RX/TX Pools
*/
@ -544,7 +524,7 @@ oltr_pci_probe(pcici_t config_id, pcidi_t device_id)
static void
oltr_pci_attach(pcici_t config_id, int unit)
{
int i, s, rc = 0, scratch_size, work_size;
int i, s, rc = 0, scratch_size;
int media = IFM_TOKEN|IFM_TOK_UTP16;
u_long command;
char PCIConfigHeader[64];
@ -598,26 +578,6 @@ oltr_pci_attach(pcici_t config_id, int unit)
goto config_failed;
}
switch(sc->config.type) {
case TRLLD_ADAPTER_PCI4: /* OC-3139 */
work_size = 32 * 1024;
break;
case TRLLD_ADAPTER_PCI7: /* OC-3540 */
work_size = 256;
break;
default:
work_size = 0;
}
if (work_size) {
if ((sc->work_memory = malloc(work_size, M_DEVBUF, M_NOWAIT)) == NULL) {
printf("oltr%d: failed to allocate work memory.\n", unit);
} else {
TRlldAddMemory(sc->TRlldAdapter, sc->work_memory,
vtophys(sc->work_memory), work_size);
}
}
/*
* Allocate RX/TX Pools
*/
@ -839,6 +799,7 @@ oltr_init(void * xsc)
struct ifnet *ifp = &sc->arpcom.ac_if;
struct ifmedia *ifm = &sc->ifmedia;
int poll = 0, i, rc = 0, s;
int work_size;
/*
* Check adapter state, don't allow multiple inits
@ -876,6 +837,26 @@ oltr_init(void * xsc)
}
sc->state = OL_INIT;
switch(sc->config.type) {
case TRLLD_ADAPTER_PCI4: /* OC-3139 */
work_size = 32 * 1024;
break;
case TRLLD_ADAPTER_PCI7: /* OC-3540 */
work_size = 256;
break;
default:
work_size = 0;
}
if (work_size) {
if ((sc->work_memory = malloc(work_size, M_DEVBUF, M_NOWAIT)) == NULL) {
printf("oltr%d: failed to allocate work memory (%d octets).\n", sc->unit, work_size);
} else {
TRlldAddMemory(sc->TRlldAdapter, sc->work_memory,
vtophys(sc->work_memory), work_size);
}
}
switch(IFM_SUBTYPE(ifm->ifm_media)) {
case IFM_AUTO:
rc = TRlldSetSpeed(sc->TRlldAdapter, 0); /* TRLLD_SPEED_AUTO */
@ -988,7 +969,7 @@ oltr_init(void * xsc)
(void)splx(s);
return;
default:
printf("oltr%d: unkown open error (%d)\n", sc->unit, rc);
printf("oltr%d: unknown open error (%d)\n", sc->unit, rc);
(void)splx(s);
return;
}