|
@@ -78,24 +78,21 @@ static inline void bflush(const struct b44_private *bp, u32 reg, u32 timeout)
|
78
|
78
|
|
79
|
79
|
|
80
|
80
|
/**
|
81
|
|
- * Return non-zero if the installed RAM is within
|
82
|
|
- * the limit given and zero if it is outside.
|
83
|
|
- * Hopefully will be removed soon.
|
|
81
|
+ * Check if card can access address
|
|
82
|
+ *
|
|
83
|
+ * @v address Virtual address
|
|
84
|
+ * @v address_ok Card can access address
|
84
|
85
|
*/
|
85
|
|
-int phys_ram_within_limit(u64 limit)
|
86
|
|
-{
|
87
|
|
- struct memory_map memmap;
|
88
|
|
- struct memory_region *highest = NULL;
|
89
|
|
- get_memmap(&memmap);
|
|
86
|
+static inline __attribute__ (( always_inline )) int
|
|
87
|
+b44_address_ok ( void *address ) {
|
90
|
88
|
|
91
|
|
- if (memmap.count == 0)
|
92
|
|
- return 0;
|
93
|
|
- highest = &memmap.regions[memmap.count - 1];
|
|
89
|
+ /* Card can address anything with a 30-bit address */
|
|
90
|
+ if ( ( virt_to_bus ( address ) & ~B44_30BIT_DMA_MASK ) == 0 )
|
|
91
|
+ return 1;
|
94
|
92
|
|
95
|
|
- return (highest->end < limit);
|
|
93
|
+ return 0;
|
96
|
94
|
}
|
97
|
95
|
|
98
|
|
-
|
99
|
96
|
/**
|
100
|
97
|
* Ring cells waiting to be processed are between 'tx_cur' and 'pending'
|
101
|
98
|
* indexes in the ring.
|
|
@@ -404,6 +401,7 @@ static void b44_populate_rx_descriptor(struct b44_private *bp, u32 idx)
|
404
|
401
|
*/
|
405
|
402
|
static void b44_rx_refill(struct b44_private *bp, u32 pending)
|
406
|
403
|
{
|
|
404
|
+ struct io_buffer *iobuf;
|
407
|
405
|
u32 i;
|
408
|
406
|
|
409
|
407
|
// skip pending
|
|
@@ -411,11 +409,17 @@ static void b44_rx_refill(struct b44_private *bp, u32 pending)
|
411
|
409
|
if (bp->rx_iobuf[i] != NULL)
|
412
|
410
|
continue;
|
413
|
411
|
|
414
|
|
- bp->rx_iobuf[i] = alloc_iob(RX_PKT_BUF_SZ);
|
415
|
|
- if (!bp->rx_iobuf[i]) {
|
|
412
|
+ iobuf = alloc_iob(RX_PKT_BUF_SZ);
|
|
413
|
+ if (!iobuf) {
|
416
|
414
|
DBG("Refill rx ring failed!!\n");
|
417
|
415
|
break;
|
418
|
416
|
}
|
|
417
|
+ if (!b44_address_ok(iobuf->data)) {
|
|
418
|
+ DBG("Refill rx ring bad address!!\n");
|
|
419
|
+ free_iob(iobuf);
|
|
420
|
+ break;
|
|
421
|
+ }
|
|
422
|
+ bp->rx_iobuf[i] = iobuf;
|
419
|
423
|
|
420
|
424
|
b44_populate_rx_descriptor(bp, i);
|
421
|
425
|
}
|
|
@@ -444,6 +448,10 @@ static int b44_init_rx_ring(struct b44_private *bp)
|
444
|
448
|
bp->rx = malloc_dma(B44_RX_RING_LEN_BYTES, B44_DMA_ALIGNMENT);
|
445
|
449
|
if (!bp->rx)
|
446
|
450
|
return -ENOMEM;
|
|
451
|
+ if (!b44_address_ok(bp->rx)) {
|
|
452
|
+ free_dma(bp->rx, B44_RX_RING_LEN_BYTES);
|
|
453
|
+ return -ENOTSUP;
|
|
454
|
+ }
|
447
|
455
|
|
448
|
456
|
memset(bp->rx_iobuf, 0, sizeof(bp->rx_iobuf));
|
449
|
457
|
|
|
@@ -472,6 +480,10 @@ static int b44_init_tx_ring(struct b44_private *bp)
|
472
|
480
|
bp->tx = malloc_dma(B44_TX_RING_LEN_BYTES, B44_DMA_ALIGNMENT);
|
473
|
481
|
if (!bp->tx)
|
474
|
482
|
return -ENOMEM;
|
|
483
|
+ if (!b44_address_ok(bp->tx)) {
|
|
484
|
+ free_dma(bp->tx, B44_TX_RING_LEN_BYTES);
|
|
485
|
+ return -ENOTSUP;
|
|
486
|
+ }
|
475
|
487
|
|
476
|
488
|
memset(bp->tx, 0, B44_TX_RING_LEN_BYTES);
|
477
|
489
|
memset(bp->tx_iobuf, 0, sizeof(bp->tx_iobuf));
|
|
@@ -644,17 +656,6 @@ static int b44_probe(struct pci_device *pci)
|
644
|
656
|
struct b44_private *bp;
|
645
|
657
|
int rc;
|
646
|
658
|
|
647
|
|
- /*
|
648
|
|
- * Bail out if more than 1GB of physical RAM is installed.
|
649
|
|
- * This limitation will be removed later when dma mapping
|
650
|
|
- * is merged into mainline.
|
651
|
|
- */
|
652
|
|
- if (!phys_ram_within_limit(B44_30BIT_DMA_MASK)) {
|
653
|
|
- DBG("Sorry, this version of the driver does not\n"
|
654
|
|
- "support systems with more than 1GB of RAM.\n");
|
655
|
|
- return -ENOMEM;
|
656
|
|
- }
|
657
|
|
-
|
658
|
659
|
/* Set up netdev */
|
659
|
660
|
netdev = alloc_etherdev(sizeof(*bp));
|
660
|
661
|
if (!netdev)
|
|
@@ -793,6 +794,10 @@ static int b44_transmit(struct net_device *netdev, struct io_buffer *iobuf)
|
793
|
794
|
return -ENOBUFS;
|
794
|
795
|
}
|
795
|
796
|
|
|
797
|
+ /* Check for addressability */
|
|
798
|
+ if (!b44_address_ok(iobuf->data))
|
|
799
|
+ return -ENOTSUP;
|
|
800
|
+
|
796
|
801
|
/* Will call netdev_tx_complete() on the iobuf later */
|
797
|
802
|
bp->tx_iobuf[cur] = iobuf;
|
798
|
803
|
|