Bug 69127 - [patch] EtherLink III LAN PC Card 3C589D not detected
Summary: [patch] EtherLink III LAN PC Card 3C589D not detected
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 5.2-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: Warner Losh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-15 21:30 UTC by bel
Modified: 2005-01-11 00:34 UTC (History)
0 users

See Also:


Attachments
exca.patch (1.77 KB, patch)
2004-10-13 08:32 UTC, bel
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description bel 2004-07-15 21:30:33 UTC
	Some PCMCIA (PC Card) does not detected in NEWCARD code.

Fix: This patch correct?



With best regards,
 Andrew Belashov.--KeGKzWut0knP5ouV3LRlKtUtJEjnngbSIFSUGxt9Kiu6TPM1
Content-Type: text/plain; name="exca.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="exca.c.diff"

--- sys/dev/exca/exca.c.orig	Tue Oct  7 08:29:04 2003
+++ sys/dev/exca/exca.c	Thu Jul 15 22:51:02 2004
@@ -180,9 +180,12 @@
 {
 	struct mem_map_index_st *map;
 	struct pccard_mem_handle *mem;
+	uint32_t offset;
 	
 	map = &mem_map_index[win];
 	mem = &sc->mem[win];
+	offset = ((mem->cardaddr >> EXCA_CARDMEM_ADDRX_SHIFT) -
+	    (mem->addr >> EXCA_SYSMEM_ADDRX_SHIFT)) & 0x3fff;
 	exca_putb(sc, map->sysmem_start_lsb,
 	    (mem->addr >> EXCA_SYSMEM_ADDRX_SHIFT) & 0xff);
 	exca_putb(sc, map->sysmem_start_msb,
@@ -201,9 +204,9 @@
 	    (mem->addr >> EXCA_MEMREG_WIN_SHIFT) & 0xff);
 
 	exca_putb(sc, map->cardmem_lsb,
-	    (mem->cardaddr >> EXCA_CARDMEM_ADDRX_SHIFT) & 0xff);
+	    offset & 0xff);
 	exca_putb(sc, map->cardmem_msb,
-	    ((mem->cardaddr >> (EXCA_CARDMEM_ADDRX_SHIFT + 8)) &
+	    ((offset >> 8) &
 	    EXCA_CARDMEM_ADDRX_MSB_ADDR_MASK) |
 	    ((mem->kind == PCCARD_A_MEM_ATTR) ?
 	    EXCA_CARDMEM_ADDRX_MSB_REGACTIVE_ATTR : 0));
How-To-Repeat: 	Insert card. Card does not detected. Messages on console:

----------------------------------------------------
pccard0: read_cis
exca_mem_map window 0 bus 88010000+1000 card addr 0
common memory
exca_do_mem_map window 0: 0010 8010 0000 88 (88010000+00001000.00001000*00000000
)
attribtue memory
exca_do_mem_map window 0: 0010 8010 4000 88 (88010000+00001000.00001000*00000000
)
[...]
pccard0: CIS tuple chain:
unhandled CISTPL 40
 40 00
CISTPL_NONE
 00
CISTPL_NONE
 00
[...]
pccard0: Card has no functions!
cbb0: PC Card card activation failed
----------------------------------------------------
Comment 1 bel 2004-08-12 11:58:17 UTC
I have following PC Card:

3Com Etherlink III 3C589D
Ninja-ATA CD-ROM Drive
Nokia Cellular Data Card DTP-2 ver II
Cardinal MVP144C2 FAX MODEM

All cards working with this patch.
Comment 2 Tilman Keskinoz freebsd_committer freebsd_triage 2004-08-30 22:02:57 UTC
Responsible Changed
From-To: freebsd-bugs->imp

Over to imp, who wrote exca
Comment 3 bel 2004-10-13 08:32:54 UTC
Hello, Warner!

Current source code still have hidden bug in exca driver.

To reproduce problem I use two PCMCIA card or set up "hw.cbb.start_memory"
sysctl variable. For example:

# sysctl hw.cbb.start_memory=0x88010000

The problem arises, when the mapped start address (for CIS or CCR) in not align
to full address space of card. This is true for some cards (for example
3Com 3C589D).

Expanded patch attached. Note: Patch is not tested on memory cards.

--
Best regards,
Andrew Belashov.
Comment 4 Warner Losh freebsd_committer freebsd_triage 2005-01-11 00:33:44 UTC
State Changed
From-To: open->closed

Committed the offset patch, but not the pccard_cis patch because it 
doesn't seem to be needed.