pccbb pccard rman - Something is very wrong somewhere
Carlos Velasco
freebsd at newipnet.com
Tue Apr 6 03:57:41 PDT 2004
Hello,
Investigating this problem, I have discovered two issues.
One minor bug (off-by-1) in subr_rman.c:
diff -ur sys/kern/subr_rman.c sysnew/kern/subr_rman.c
--- sys/kern/subr_rman.c Wed Jun 11 00:56:57 2003
+++ sysnew/kern/subr_rman.c Tue Apr 6 11:41:23 2004
@@ -234,7 +234,7 @@
rstart += bound - (rstart & ~bmask);
} while ((rstart & amask) != 0 && rstart < end &&
rstart < s->r_end);
- rend = ulmin(s->r_end, ulmax(rstart + count, end));
+ rend = ulmin(s->r_end, ulmax(rstart + count - 1, end));
if (rstart > rend) {
DPRINTF(("adjusted start exceeds end\n"));
continue;
And the real problem, an alignment issue that prevents pccard to work:
diff -ur sys/dev/pccbb/pccbbreg.h sysnew/dev/pccbb/pccbbreg.h
--- sys/dev/pccbb/pccbbreg.h Sat Aug 9 20:49:22 2003
+++ sysnew/dev/pccbb/pccbbreg.h Tue Apr 6 11:40:13 2004
@@ -74,8 +74,8 @@
#define CBBR_IOLIMIT0 0x30 /* len=4 */
#define CBBR_IOBASE1 0x34 /* len=4 */
#define CBBR_IOLIMIT1 0x38 /* len=4 */
-#define CBB_MEMALIGN 4096
-#define CBB_MEMALIGN_BITS 12
+#define CBB_MEMALIGN 65536
+#define CBB_MEMALIGN_BITS 16
#define CBB_IOALIGN 4
#define CBB_IOALIGN_BITS 2
We are aligning to 0x1000 (4096) and we should align to, at least, 0x10000
(65536).
This solves the problem.
Can anyone review these patches and commit them if they are right?
Regards,
Carlos Velasco
*********** REPLY SEPARATOR ***********
On 04/04/2004 at 23:42 Carlos Velasco wrote:
>Hello,
>
>I have been trying to find this exact bug but I have been unable. Any help
>would be apreciated.
>
>Using 5.2-Current
>
>Problem related to pccard using NEWCARD (OLDCARD works ok), not reading
>CIS.
>Googling I have found some reference:
>http://lists.freebsd.org/pipermail/freebsd-mobile/2003-December/002611.html
>
>Activating debugs I find something really weird:
>
>1. cbb1 allocating from beginning??
>allocating from the beginning
>2. size 0x6bffe000????
>truncated region: [0x88002000, 0xf3ffffff]; size 0x6bffe000 (requested
>0x400)
>
>If, _after boot_ , I change value hw.cbb.start_memory to 0xd0000000:
>hw.cbb.start_memory: 3489660928
>PCMCIA works.
>
>I have been investigating the issue in subr_rman.c, as I have showed that
>cbb resourses are the only that hit "region is allocated" and success
after
>it, but I haven't found the problem.
>
>Here are some logs:
>
>cbb0: <TI1225 PCI-CardBus Bridge> at device 3.0 on pci0
>rman_reserve_resource: <I/O memory addresses> request: [0x88000000,
>0xffffffff], length 0x1000, flags 12288, device cbb0
>considering [0, 0xf3ffffff]
>truncated region: [0x88000000, 0xf3ffffff]; size 0x6c000000 (requested
>0x1000)
>candidate region: [0xf3ffffff, 0x88000000], size 0x6c000000
>splitting region in three parts: [0, 0x87ffffff]; [0x88000000,
0x88000fff];
>[0x88001000, 0xf3ffffff]
>cbb0: PCI Memory allocated: 88000000
>cardbus0: <CardBus bus> on cbb0
>pccard0: <16-bit PCCard bus> on cbb0
>..
>cbb1: <TI1225 PCI-CardBus Bridge> at device 3.1 on pci0
>rman_reserve_resource: <I/O memory addresses> request: [0x88000000,
>0xffffffff], length 0x1000, flags 12288, device cbb1
>considering [0x88000000, 0x88000fff]
>region is allocated
>considering [0x88001000, 0xf3ffffff]
>truncated region: [0x88001000, 0xf3ffffff]; size 0x6bfff000 (requested
>0x1000)
>candidate region: [0xf3ffffff, 0x88001000], size 0x6bfff000
>allocating from the beginning
>cbb1: PCI Memory allocated: 88001000
>cardbus1: <CardBus bus> on cbb1
>pccard1: <16-bit PCCard bus> on cbb1
>..
>Status is 0x30000410
>cbb0: card inserted: event=0x00000000, state=30000410
>pccard0: chip_socket_enable
>cbb_pcic_socket_enable:
>cbb0: cbb_power: 5V
>pccard0: read_cis
>rman_reserve_resource: <I/O memory addresses> request: [0x88000000,
>0xffffffff], length 0x400, flags 12288, device pccard0
>considering [0x88000000, 0x88000fff]
>region is allocated
>considering [0x88001000, 0x88001fff]
>region is allocated
>considering [0x88002000, 0xf3ffffff]
>truncated region: [0x88002000, 0xf3ffffff]; size 0x6bffe000 (requested
>0x400)
>candidate region: [0xf3ffffff, 0x88002000], size 0x6bffe000
>allocating from the beginning
>cis mem map 0xdc6c9000 (resource: 0x88002000)
>pccard0: CIS tuple chain:
>CISTPL_NONE
> 00
>CISTPL_NONE
> 00
>CISTPL_NONE
> 00
>CISTPL_NONE
> 00
>CISTPL_NONE
> 00
>CISTPL_NONE
> 00
>CISTPL_NONE
> 00
>CISTPL_NONE
> 00
>CISTPL_NONE
> 00
>CISTPL_NONE
> 00
>TOO MANY CIS_NONE
>CIS is too long -- truncating
>CISTPL_END
> ff
>cis mem map dc6c9000
>CISTPL_LINKTARGET expected, code 40 observed
>pccard0: check_cis_quirks
>pccard0: Card has no functions!
>cbb0: PC Card card activation failed
>Status is 0x30000006
>
>
>After chaging start_memory:
>
>cbb0: card inserted: event=0x00000000, state=30000410
>pccard0: chip_socket_enable
>cbb_pcic_socket_enable:
>cbb0: cbb_power: 5V
>pccard0: read_cis
>rman_reserve_resource: <I/O memory addresses> request: [0xd0000000,
>0xffffffff], length 0x400, flags 12288, device pccard0
>considering [0x88002000, 0xf3ffffff]
>truncated region: [0xd0000000, 0xf3ffffff]; size 0x24000000 (requested
>0x400)
>candidate region: [0xf3ffffff, 0xd0000000], size 0x24000000
>splitting region in three parts: [0x88002000, 0xcfffffff]; [0xd0000000,
>0xd00003ff]; [0xd0000400, 0xf3ffffff]
>cis mem map 0xdd91a000 (resource: 0xd0000000)
>pccard0: CIS tuple chain:
>CISTPL_DEVICE type=null speed=null
> 01 02 00 ff
>CISTPL_DEVICE_A type=null speed=null
> 17 02 00 ff
>CISTPL_VERS_1
> 15 3b 05 00 58 69 72 63 6f 6d 00 43 72 65 64 69
> 74 43 61 72 64 20 45 74 68 65 72 6e 65 74 20 31
> 30 2f 31 30 30 20 2b 20 4d 6f 64 65 6d 20 35 36
> 00 43 45 4d 35 36 00 31 2e 30 30 00 ff
>unhandled CISTPL 88
> 88 08 73 2f f6 00 00 00 00 00
>CISTPL_MANFID
> 20 05 05 01 0a 11 46
>unhandled CISTPL 44
> 44 04 d2 3b 77 25
>CISTPL_CONFIG
> 1a 05 01 3f 80 ff 67
>CISTPL_CFTABLE_ENTRY
> 1b 14 e7 c1 9d 0f 55 4d 5d 4e e0 17 17 ea 60 e8
> 02 07 f0 bc 8e 20
>CISTPL_CFTABLE_ENTRY
> 1b 07 1f 08 ea 60 e8 03 07
>CISTPL_CFTABLE_ENTRY
> 1b 07 17 08 ea 60 f8 02 07
>CISTPL_CFTABLE_ENTRY
> 1b 07 0f 08 ea 60 f8 03 07
>CISTPL_CFTABLE_ENTRY
> 1b 03 3f 08 63
>CISTPL_FUNCID
> 21 02 02 00
>CISTPL_FUNCE
> 22 04 00 02 0f 5c
>CISTPL_FUNCE
> 22 0c 02 06 00 3f 1c 03 03 0f 07 00 01 b5
>CISTPL_FUNCE
> 22 08 13 06 00 0b 00 02 00 b5
>CISTPL_FUNCID
> 21 02 06 00
>CISTPL_FUNCE
> 22 08 04 06 00 10 a4 f6 2f 73
>unhandled CISTPL 8a
> 8a 0c 39 30 30 31 48 52 46 36 32 46 37 33
>unhandled CISTPL 8b
> 8b 04 01 00 00 00
>CISTPL_NO_LINK
> 14 00
>CISTPL_END
> ff
>pccard0: check_cis_quirks
>pccard0: CIS version PC Card Standard 5.0
>pccard0: CIS info: Xircom, CreditCard Ethernet 10/100 + Modem 56, CEM56,
>1.00
>pccard0: Manufacturer code 0x105, product 0x110a
>pccard0: function 0: network adapter, ccr addr ff80 mask 67
>pccard0: function 0, config table entry 39: I/O card; irq mask 8ebc;
iomask
>a, iospace 2e8-2ef; mwait_required rdybsy_active io8 io16 irqshare
irqpulse
>irqlevel powerdown
>pccard0: function 0, config table entry 31: I/O card; irq mask 8ebc;
iomask
>a, iospace 3e8-3ef; mwait_required rdybsy_active io8 io16 irqshare
irqpulse
>irqlevel powerdown
>pccard0: function 0, config table entry 23: I/O card; irq mask 8ebc;
iomask
>a, iospace 2f8-2ff; mwait_required rdybsy_active io8 io16 irqshare
irqpulse
>irqlevel powerdown
>pccard0: function 0, config table entry 15: I/O card; irq mask 8ebc;
iomask
>a, iospace 3f8-3ff; mwait_required rdybsy_active io8 io16 irqshare
irqpulse
>irqlevel powerdown
>pccard0: function 0, config table entry 63: I/O card; irq mask 8ebc;
iomask
>3, iospace 0-7; mwait_required rdybsy_active io8 io16 irqshare irqpulse
>irqlevel powerdown
>pccard0: functions scanning
>pccard0: Card has 1 functions. pccard_mfc is 0
>pccard0: I/O rid 0 start 2e8 end 2ef
>rman_reserve_resource: <I/O ports> request: [0x2e8, 0x2ef], length 0x8,
>flags 3072, device pccard0
>considering [0x1f8, 0x2f7]
>truncated region: [0x2e8, 0x2f0]; size 0x9 (requested 0x8)
>candidate region: [0x2f0, 0x2e8], size 0x9
>splitting region in three parts: [0x1f8, 0x2e7]; [0x2e8, 0x2ef]; [0x2f0,
>0x2f7]
>rman_reserve_resource: <Interrupt request lines> request: [0xb, 0xb],
>length 0x1, flags 4, device pccard0
>considering [0xb, 0xb]
>region is allocated
>considering [0xc, 0xc]
>s->r_start (0xc) > end (0xb)
>no unshared regions found
>cbb_pcic_socket_enable:
>cbb0: cbb_power: 0V
>cbb0: cbb_power: 5V
>rman_reserve_resource: <I/O memory addresses> request: [0xd0000000,
>0xffffffff], length 0x400, flags 12288, device pccard0
>considering [0x88002000, 0xf3ffffff]
>truncated region: [0xd0000000, 0xf3ffffff]; size 0x24000000 (requested
>0x400)
>candidate region: [0xf3ffffff, 0xd0000000], size 0x24000000
>splitting region in three parts: [0x88002000, 0xcfffffff]; [0xd0000000,
>0xd00003ff]; [0xd0000400, 0xf3ffffff]
>pccard0: ccr_res == d0000000-d00003ff, base=ff80
>pccard0: function 0 CCR at 0 offset f80: 67 0 0 0, 0 0 ff ff, ff
>xe0: <Xircom CreditCard Ethernet 10/100 + Modem 56> at port 0x2e8-0x2ef
irq
>11 function 0 config 39 on pccard0
>rman_reserve_resource: <I/O ports> request: [0x100, 0x3ff], length 0x10,
>flags 0, device pccard0
>considering [0x65, 0x16f]
>truncated region: [0x100, 0x16f]; size 0x70 (requested 0x10)
>candidate region: [0x16f, 0x100], size 0x70
>splitting region in three parts: [0x65, 0xff]; [0x100, 0x10f]; [0x110,
>0x16f]
>rman_reserve_resource: <I/O ports> request: [0x100, 0x10f], length 0x10,
>flags 4096, device xe0
>considering [0x65, 0x16f]
>truncated region: [0x100, 0x110]; size 0x11 (requested 0x10)
>candidate region: [0x110, 0x100], size 0x11
>splitting region in three parts: [0x65, 0xff]; [0x100, 0x10f]; [0x110,
>0x16f]
>rman_reserve_resource: <Interrupt request lines> request: [0xb, 0xb],
>length 0x1, flags 4, device xe0
>considering [0xb, 0xb]
>region is allocated
>considering [0xc, 0xc]
>s->r_start (0xc) > end (0xb)
>no unshared regions found
>xe0: [GIANT-LOCKED]
>rman_reserve_resource: <I/O memory addresses> request: [0xd0000000,
>0xffffffff], length 0x1000, flags 12288, device pccard0
>considering [0xd0000000, 0xd00003ff]
>region is allocated
>considering [0xd0000400, 0xf3ffffff]
>truncated region: [0xd0001000, 0xf3ffffff]; size 0x23fff000 (requested
>0x1000)
>candidate region: [0xf3ffffff, 0xd0001000], size 0x23fff000
>splitting region in three parts: [0xd0000400, 0xd0000fff]; [0xd0001000,
>0xd0001fff]; [0xd0002000, 0xf3ffffff]
>rman_reserve_resource: <I/O memory addresses> request: [0xd0001000,
>0xd0001fff], length 0x1000, flags 12288, device xe0
>considering [0xd0000400, 0xf3ffffff]
>truncated region: [0xd0001000, 0xd0002000]; size 0x1001 (requested 0x1000)
>candidate region: [0xd0002000, 0xd0001000], size 0x1001
>splitting region in three parts: [0xd0000400, 0xd0000fff]; [0xd0001000,
>0xd0001fff]; [0xd0002000, 0xf3ffffff]
>rman_reserve_resource: <I/O memory addresses> request: [0xd0001000,
>0xd0001fff], length 0x1000, flags 12288, device pccard0
>considering [0xd0000400, 0xf3ffffff]
>truncated region: [0xd0001000, 0xd0002000]; size 0x1001 (requested 0x1000)
>candidate region: [0xd0002000, 0xd0001000], size 0x1001
>splitting region in three parts: [0xd0000400, 0xd0000fff]; [0xd0001000,
>0xd0001fff]; [0xd0002000, 0xf3ffffff]
>xe0: Xircom CEM56, version 0x55/0x05, 100Mbps capable, with modem
>xe0: Ethernet address: 00:10:a4:f6:2f:73
>pccard0: function 0 CCR at 0 offset f80 mask 67: 67 80 ee e8, e8 2 67 67,
>67
>
>
>Regards,
>Carlos Velasco
>
>_______________________________________________
>freebsd-mobile at freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-mobile
>To unsubscribe, send any mail to "freebsd-mobile-unsubscribe at freebsd.org"
More information about the freebsd-mobile
mailing list