View | Details | Raw Unified | Return to bug 24073
Collapse All | Expand All

(-)src/sys/contrib/dev/oltr/if_oltr.c (-43 / +24 lines)
Lines 289-295 Link Here
289
oltr_pci_attach(device_t dev)
289
oltr_pci_attach(device_t dev)
290
{
290
{
291
        int 			i, s, rc = 0, rid,
291
        int 			i, s, rc = 0, rid,
292
				scratch_size, work_size;
292
				scratch_size;
293
	int			media = IFM_TOKEN|IFM_TOK_UTP16;
293
	int			media = IFM_TOKEN|IFM_TOK_UTP16;
294
	u_long 			command;
294
	u_long 			command;
295
	char 			PCIConfigHeader[64];
295
	char 			PCIConfigHeader[64];
Lines 339-364 Link Here
339
		goto config_failed;
339
		goto config_failed;
340
	}
340
	}
341
341
342
	switch(sc->config.type) {
343
	case TRLLD_ADAPTER_PCI4:        /* OC-3139 */
344
		work_size = 32 * 1024;
345
		break;
346
	case TRLLD_ADAPTER_PCI7:        /* OC-3540 */
347
		work_size = 256;
348
		break;
349
	default:
350
		work_size = 0;
351
	}
352
353
	if (work_size) {
354
		if ((sc->work_memory = malloc(work_size, M_DEVBUF, M_NOWAIT)) == NULL) {
355
			device_printf(dev, "failed to allocate work memory.\n");
356
		} else {
357
		TRlldAddMemory(sc->TRlldAdapter, sc->work_memory,
358
		    vtophys(sc->work_memory), work_size);
359
		}
360
	}
361
362
	/*
342
	/*
363
	 * Allocate RX/TX Pools
343
	 * Allocate RX/TX Pools
364
	 */
344
	 */
Lines 545-551 Link Here
545
static void
525
static void
546
oltr_pci_attach(pcici_t config_id, int unit)
526
oltr_pci_attach(pcici_t config_id, int unit)
547
{
527
{
548
        int 			i, s, rc = 0, scratch_size, work_size;
528
        int 			i, s, rc = 0, scratch_size;
549
	int			media = IFM_TOKEN|IFM_TOK_UTP16;
529
	int			media = IFM_TOKEN|IFM_TOK_UTP16;
550
	u_long 			command;
530
	u_long 			command;
551
	char 			PCIConfigHeader[64];
531
	char 			PCIConfigHeader[64];
Lines 600-625 Link Here
600
		goto config_failed;
580
		goto config_failed;
601
	}
581
	}
602
582
603
	switch(sc->config.type) {
604
	case TRLLD_ADAPTER_PCI4:        /* OC-3139 */
605
		work_size = 32 * 1024;
606
		break;
607
	case TRLLD_ADAPTER_PCI7:        /* OC-3540 */
608
		work_size = 256;
609
		break;
610
	default:
611
		work_size = 0;
612
	}
613
614
	if (work_size) {
615
		if ((sc->work_memory = malloc(work_size, M_DEVBUF, M_NOWAIT)) == NULL) {
616
			printf("oltr%d: failed to allocate work memory.\n", unit);
617
		} else {
618
		TRlldAddMemory(sc->TRlldAdapter, sc->work_memory,
619
		    vtophys(sc->work_memory), work_size);
620
		}
621
	}
622
623
	/*
583
	/*
624
	 * Allocate RX/TX Pools
584
	 * Allocate RX/TX Pools
625
	 */
585
	 */
Lines 843-848 Link Here
843
	struct ifnet		*ifp = &sc->arpcom.ac_if;
803
	struct ifnet		*ifp = &sc->arpcom.ac_if;
844
	struct ifmedia		*ifm = &sc->ifmedia;
804
	struct ifmedia		*ifm = &sc->ifmedia;
845
	int			poll = 0, i, rc = 0, s;
805
	int			poll = 0, i, rc = 0, s;
806
	int			work_size;
846
807
847
	/*
808
	/*
848
	 * Check adapter state, don't allow multiple inits
809
	 * Check adapter state, don't allow multiple inits
Lines 880-885 Link Here
880
	}
841
	}
881
	sc->state = OL_INIT;
842
	sc->state = OL_INIT;
882
843
844
	switch(sc->config.type) {
845
	case TRLLD_ADAPTER_PCI4:        /* OC-3139 */
846
		work_size = 32 * 1024;
847
		break;
848
	case TRLLD_ADAPTER_PCI7:        /* OC-3540 */
849
		work_size = 256;
850
		break;
851
	default:
852
		work_size = 0;
853
	}
854
855
	if (work_size) {
856
		if ((sc->work_memory = malloc(work_size, M_DEVBUF, M_NOWAIT)) == NULL) {
857
			printf("oltr%d: failed to allocate work memory (%d octets).\n", sc->unit, work_size);
858
		} else {
859
		TRlldAddMemory(sc->TRlldAdapter, sc->work_memory,
860
		    vtophys(sc->work_memory), work_size);
861
		}
862
	}
863
883
	switch(IFM_SUBTYPE(ifm->ifm_media)) {
864
	switch(IFM_SUBTYPE(ifm->ifm_media)) {
884
	case IFM_AUTO:
865
	case IFM_AUTO:
885
		rc = TRlldSetSpeed(sc->TRlldAdapter, 0); /* TRLLD_SPEED_AUTO */
866
		rc = TRlldSetSpeed(sc->TRlldAdapter, 0); /* TRLLD_SPEED_AUTO */
Lines 992-998 Link Here
992
			(void)splx(s);
973
			(void)splx(s);
993
			return;
974
			return;
994
		default:
975
		default:
995
			printf("oltr%d: unkown open error (%d)\n", sc->unit, rc);
976
			printf("oltr%d: unknown open error (%d)\n", sc->unit, rc);
996
			(void)splx(s);
977
			(void)splx(s);
997
			return;
978
			return;
998
	}
979
	}

Return to bug 24073