pccard after new patches

From: Carlos Velasco <freebsd_at_newipnet.com>
Date: Sun, 18 Apr 2004 19:52:43 +0200
After latest ACPI patches by imp, I have found this related to pccard and
64k alignment:

Initial allocation for cbb is made at 0xf000000:

====
cbb0: <TI1225 PCI-CardBus Bridge> at device 3.0 on pci0
cbb0: Lazy allocation of 0x1000 bytes rid 0x10 type 3 at 0xf0000000
cbb0: Found memory at f0000000
cardbus0: <CardBus bus> on cbb0
pccard0: <16-bit PCCard bus> on cbb0

pcib0: slot 3 INTA is routed to irq 11
cbb1: <TI1225 PCI-CardBus Bridge> at device 3.1 on pci0
cbb1: Lazy allocation of 0x1000 bytes rid 0x10 type 3 at 0xf0001000
cbb1: Found memory at f0001000
cardbus1: <CardBus bus> on cbb1
pccard1: <16-bit PCCard bus> on cbb1
====

As previous cbb allocation is far of 0x88000000 (CBB_START_MEMORY), pccard
success:

====
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 0x1000, flags 16384, device pccard0
considering [0xd0000, 0xefffffff]
truncated region: [0x88000000, 0xefffffff]; size 0x68000000 (requested
0x1000)
candidate region: [0xefffffff, 0x88000000], size 0x68000000
splitting region in three parts: [0xd0000, 0x87ffffff]; [0x88000000,
0x88000fff]; [0x88001000, 0xefffffff]
cis mem map 0xdcfa6000 (resource: 0x88000000)
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, 0x2ef]; size 0x8 (requested 0x8)
candidate region: [0x2ef, 0x2e8], size 0x8
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: [0x88000000,
0xffffffff], length 0x400, flags 12288, device pccard0
considering [0xd0000, 0xefffffff]
truncated region: [0x88000000, 0xefffffff]; size 0x68000000 (requested
0x400)
candidate region: [0xefffffff, 0x88000000], size 0x68000000
splitting region in three parts: [0xd0000, 0x87ffffff]; [0x88000000,
0x880003ff]; [0x88000400, 0xefffffff]
pccard0: ccr_res == 88000000-880003ff, 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, 0x10f]; size 0x10 (requested 0x10)
candidate region: [0x10f, 0x100], size 0x10
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: [0x88000000,
0xffffffff], length 0x1000, flags 12288, device pccard0
considering [0x88000000, 0x880003ff]
region is allocated
considering [0x88000400, 0xefffffff]
truncated region: [0x88001000, 0xefffffff]; size 0x67fff000 (requested
0x1000)
candidate region: [0xefffffff, 0x88001000], size 0x67fff000
splitting region in three parts: [0x88000400, 0x88000fff]; [0x88001000,
0x88001fff]; [0x88002000, 0xefffffff]
rman_reserve_resource: <I/O memory addresses> request: [0x88001000,
0x88001fff], length 0x1000, flags 12288, device xe0
considering [0x88000400, 0xefffffff]
truncated region: [0x88001000, 0x88001fff]; size 0x1000 (requested 0x1000)
candidate region: [0x88001fff, 0x88001000], size 0x1000
splitting region in three parts: [0x88000400, 0x88000fff]; [0x88001000,
0x88001fff]; [0x88002000, 0xefffffff]
rman_reserve_resource: <I/O memory addresses> request: [0x88001000,
0x88001fff], length 0x1000, flags 12288, device pccard0
considering [0x88000400, 0xefffffff]
truncated region: [0x88001000, 0x88001fff]; size 0x1000 (requested 0x1000)
candidate region: [0x88001fff, 0x88001000], size 0x1000
splitting region in three parts: [0x88000400, 0x88000fff]; [0x88001000,
0x88001fff]; [0x88002000, 0xefffffff]
xe0: Xircom CreditCard Ethernet 10/100 + Modem 56, 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
===

However, I think that if we insert another pcmcia card (16 bits) it will
break, I have emulated it modifying hw.cbb.star_memory sysctl variable:

# sysctl hw.cbb.start_memory="0x88001000"
hw.cbb.start_memory: 2281701376 -> 2281705472

Then inserting card:

====
Status is 0x30000510
cbb0: card inserted: event=0x00000000, state=30000510
pccard0: chip_socket_enable
cbb_pcic_socket_enable:
cbb0: cbb_power: 5V
pccard0: read_cis
rman_reserve_resource: <I/O memory addresses> request: [0x88001000,
0xffffffff], length 0x1000, flags 16384, device pccard0
considering [0xd0000, 0xefffffff]
truncated region: [0x88010000, 0xefffffff]; size 0x67ff0000 (requested
0x1000)
candidate region: [0xefffffff, 0x88010000], size 0x67ff0000
splitting region in three parts: [0xd0000, 0x8800ffff]; [0x88010000,
0x88010fff]; [0x88011000, 0xefffffff]
cis mem map 0xdcfaf000 (resource: 0x88010000)
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, 0x2ef]; size 0x8 (requested 0x8)
candidate region: [0x2ef, 0x2e8], size 0x8
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: [0x88001000,
0xffffffff], length 0x400, flags 12288, device pccard0
considering [0xd0000, 0xefffffff]
truncated region: [0x88001000, 0xefffffff]; size 0x67fff000 (requested
0x400)
candidate region: [0xefffffff, 0x88001000], size 0x67fff000
splitting region in three parts: [0xd0000, 0x88000fff]; [0x88001000,
0x880013ff]; [0x88001400, 0xefffffff]
pccard0: ccr_res == 88001000-880013ff, base=ff80
pccard0: function 0 CCR at 0 offset f80: 67 0 0 0, 0 0 0 0, 0
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, 0x10f]; size 0x10 (requested 0x10)
candidate region: [0x10f, 0x100], size 0x10
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: [0x88001000,
0xffffffff], length 0x1000, flags 12288, device pccard0
considering [0x88001000, 0x880013ff]
region is allocated
considering [0x88001400, 0xefffffff]
truncated region: [0x88002000, 0xefffffff]; size 0x67ffe000 (requested
0x1000)
candidate region: [0xefffffff, 0x88002000], size 0x67ffe000
splitting region in three parts: [0x88001400, 0x88001fff]; [0x88002000,
0x88002fff]; [0x88003000, 0xefffffff]
rman_reserve_resource: <I/O memory addresses> request: [0x88002000,
0x88002fff], length 0x1000, flags 12288, device xe0
considering [0x88001400, 0xefffffff]
truncated region: [0x88002000, 0x88002fff]; size 0x1000 (requested 0x1000)
candidate region: [0x88002fff, 0x88002000], size 0x1000
splitting region in three parts: [0x88001400, 0x88001fff]; [0x88002000,
0x88002fff]; [0x88003000, 0xefffffff]
rman_reserve_resource: <I/O memory addresses> request: [0x88002000,
0x88002fff], length 0x1000, flags 12288, device pccard0
considering [0x88001400, 0xefffffff]
truncated region: [0x88002000, 0x88002fff]; size 0x1000 (requested 0x1000)
candidate region: [0x88002fff, 0x88002000], size 0x1000
splitting region in three parts: [0x88001400, 0x88001fff]; [0x88002000,
0x88002fff]; [0x88003000, 0xefffffff]
xe0: Xircom CreditCard Ethernet 10/100 + Modem 56, version 0x44/0x04,
100Mbps capable, with modem
xe0: Ethernet address: 00:10:a4:f6:2f:73
pccard0: function 0 CCR at 0 offset f80 mask 67: 67 0 0 0, 0 0 0 0, 0
====

After this last line, laptop hangs up.
If I remove the card, page fault:

====
Fatal trap 12: page fault while in kernel mode
fault virtual address   = 0xc1dfc000
fault code              = supervisor write, page not present
instruction pointer     = 0x8:0xc04b7d65
stack pointer           = 0x10:0xd6aa6c98
frame pointer           = 0x10:0xd6aa6cb8
code segment            = base 0x0, limit 0xfffff, type 0x1b
                        = DPL 0, pres 1, def32 1, gran 1
processor eflags        = interrupt enabled, resume, IOPL = 0
current process         = 22 (irq11: cbb0 cbb1+)
trap number             = 12
panic: page fault
at line 815 in file /usr/src/sys/i386/i386/trap.c

syncing disks, buffers remaining... 420 420 420 420 420 420 420 420 420 420
420 420 420 420 420 420 420 420 420 420 
giving up on 354 buffers
Uptime: 2m44s
cbb0: cbb_power: 0V
Shutting down ACPI
Automatic reboot in 15 seconds - press a key on the console to abort
Rebooting...
====

I have patched pccard to allocate 64k alignment and this solves the
problem... still not sure about why 64k alignment is needed:

# diff -u sys/dev/pccard/pccard.c sysnew/dev/pccard/
--- sys/dev/pccard/pccard.c     Wed Mar 17 17:50:38 2004
+++ sysnew/dev/pccard/pccard.c  Sun Apr 18 18:05:15 2004
_at__at_ -1075,6 +1075,7 _at__at_
        int passthrough = (device_get_parent(child) != dev);
        int isdefault = (start == 0 && end == ~0UL && count == 1);
        struct resource *r = NULL;
+       u_int align;
 
        /* XXX I'm no longer sure this is right */
        if (passthrough) {
_at__at_ -1090,8 +1091,15 _at__at_
        if (rle == NULL || rle->res == NULL) {
                /* Do we want this device to own it? */
                /* XXX I think so, but that might be lame XXX */
+
+               /* force 64k page align */
+               if (type == SYS_RES_MEMORY)
+                   align = (flags & ~RF_ALIGNMENT_MASK) |
+                       rman_make_alignment_flags(64*1024);
+               else
+                   align = flags;
                r = bus_alloc_resource(dev, type, rid, start, end,
-                 count, flags /* XXX aligment? */);
+                 count, align);
                if (r == NULL)
                    goto bad;
                resource_list_add(&dinfo->resources, type, *rid,




Regards,
Carlos Velasco
Received on Sun Apr 18 2004 - 08:51:49 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:51 UTC