From owner-freebsd-mobile Wed Jul 24 3:12: 1 2002 Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C821337B400 for ; Wed, 24 Jul 2002 03:11:53 -0700 (PDT) Received: from plum.flirble.org (plum.flirble.org [195.40.6.20]) by mx1.FreeBSD.org (Postfix) with ESMTP id 590EC43E31 for ; Wed, 24 Jul 2002 03:11:52 -0700 (PDT) (envelope-from andy@flirble.org) Received: from andy (helo=localhost) by plum.flirble.org with local-esmtp (Exim 3.20 #3) id 17XJ7V-000LXJ-00; Wed, 24 Jul 2002 11:11:49 +0100 Date: Wed, 24 Jul 2002 11:11:49 +0100 (BST) From: Andrew Back X-X-Sender: andy@plum.flirble.org To: "M. Warner Losh" Cc: tony@valemount.com, Subject: Re: PCI -> PCMCIA Adapter woes - patch In-Reply-To: <20020723.184204.123399222.imp@bsdimp.com> Message-ID: <20020724110719.V82387-100000@plum.flirble.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-mobile@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hi, Well I tried both patches. First applying Tony's, rebuilding the kernel and rebooting. Then with loader.conf changes. And then backed out the patch and tried Warner's, with and without loader.conf mods. I got the same result every time, detects card insertion and removal, but 'null' cards. When I try 'pccardc dumpcis' with a card inserted I get: read returned -1 bytes (expected 2) cannot allocate memory Have I missed something else? Like set memory address in rc.conf for pccard bridge? Cheers, Andrew On Tue, 23 Jul 2002, M. Warner Losh wrote: > OK. Here's my first cut at a patch. Lemme know if it works for you? > Seems to work for me on my laptop, but its IRQMUX register is > initialized so this code has no effect. Also, if you are using > hw.pcic.init_routing=1 can you try it w/o it too. It is a little > longer than your patch, but should work well. > > Warner > > Index: pcic_pci.c > =================================================================== > RCS file: /cache/ncvs/src/sys/pccard/pcic_pci.c,v > diff -u -r1.58 -r1.57 > --- //depot/user/imp/newcard/pccard/pcic_pci.c 2002/07/20 15:35:40 > +++ //depot/user/imp/newcard/pccard/pcic_pci.c 2002/07/23 21:54:33 > @@ -699,6 +699,61 @@ > static int > pcic_pci_ti12xx_func(struct pcic_slot *sp, enum pcic_intr_way way) > { > + u_int32_t syscntl, devcntl, cardcntl, muxctl; > + device_t dev = sp->sc->dev; > + > + syscntl = pci_read_config(dev, TI113X_PCI_SYSTEM_CONTROL, 4); > + devcntl = pci_read_config(dev, TI113X_PCI_DEVICE_CONTROL, 1); > + cardcntl = pci_read_config(dev, TI113X_PCI_CARD_CONTROL, 1); > + muxctl = pci_read_config(dev, TI12XX_PCI_IRQMUX, 4); > + > + /* > + * Special code for the Orinoco cards (and a few others). They > + * seem to need this special code to make them work only over pci > + * interrupts. Sadly, doing this code also causes problems for > + * many laptops, so we have to make it controlled by a tunable. > + * Actually, experience has shown that this rarely, if ever, > + * helps. > + */ > + if (way == pcic_iw_pci) { > + /* > + * pcic_init_routing seems to do nothing useful towards > + * fixing the hang problems. I plan on removing it in > + * 4.8 or so. > + */ > + if (pcic_init_routing) { > + devcntl &= ~TI113X_DEVCNTL_INTR_MASK; > + pci_write_config(dev, TI113X_PCI_DEVICE_CONTROL, > + devcntl, 1); > + syscntl |= TI113X_SYSCNTL_INTRTIE; > + } > + /* > + * I'm not sure that this helps/hurts things at all and > + * plan on removing it in the 4.8 time frame unless someone > + * can show that it really helps. > + */ > + syscntl &= ~TI113X_SYSCNTL_SMIENB; > + pci_write_config(dev, TI113X_PCI_SYSTEM_CONTROL, syscntl, 1); > + > + /* > + * Some PCI add-in cards don't have good EEPROMs on them, > + * so they get this MUX register wrong. The MUX register > + * defaults to 0, which is usually wrong for this register, > + * so we initialize it to make sense. > + * > + * We don't bother to turn it off in the ISA case since it > + * is an initialization issue. > + */ > + if (muxctl == 0) { > + muxctl = (muxctl & ~TI12XX_IRQMUX_PIN0) | > + TI12XX_IRQMUX_PIN0_INTA; > + if ((syscntl & TI113X_SYSCNTL_INTRTIE) == 0) > + muxctl = (muxctl & ~TI12XX_IRQMUX_PIN1) | > + TI12XX_IRQMUX_PIN1_INTB; > + pci_write_config(dev, TI12XX_PCI_IRQMUX, muxctl, 4); > + } > + > + } > return (pcic_pci_gen_func(sp, way)); > } > > @@ -727,7 +782,6 @@ > { > u_int32_t syscntl, diagctl, devcntl, cardcntl; > u_int32_t device_id = pci_get_devid(dev); > - struct pcic_softc *sc = device_get_softc(dev); > int ti113x = (device_id == PCI_DEVICE_ID_PCIC_TI1031) || > (device_id == PCI_DEVICE_ID_PCIC_TI1130) || > (device_id == PCI_DEVICE_ID_PCIC_TI1131); > @@ -762,28 +816,10 @@ > * register doesn't exist on the 1130 (and likely the 1131, > * but without a datasheet it is impossible to know). > * Some 12xx chips may not have it, but setting it is > - * believed to be harmless. > + * believed to be harmless on those models. > */ > pci_write_config(dev, TI12XX_PCI_MULTIMEDIA_CONTROL, 0, 4); > } > - /* > - * Special code for the Orinoco cards (and a few others). They > - * seem to need this special code to make them work only over pci > - * interrupts. Sadly, doing this code also causes problems for > - * many laptops, so we have to make it controlled by a tunable. > - */ > - if (sc->func_route == pcic_iw_pci) { > - if (pcic_init_routing) { > - devcntl &= ~TI113X_DEVCNTL_INTR_MASK; > - pci_write_config(dev, TI113X_PCI_DEVICE_CONTROL, > - devcntl, 1); > - devcntl = pci_read_config(dev, > - TI113X_PCI_DEVICE_CONTROL, 1); > - syscntl |= TI113X_SYSCNTL_INTRTIE; > - } > - syscntl &= ~TI113X_SYSCNTL_SMIENB; > - pci_write_config(dev, TI113X_PCI_SYSTEM_CONTROL, syscntl, 1); > - } > if (cardcntl & TI113X_CARDCNTL_RING_ENA) > printf("[ring enable]"); > if (cardcntl & TI113X_CARDCNTL_SPKR_ENA) > Index: pcic_pci.h > =================================================================== > RCS file: /cache/ncvs/src/sys/pccard/pcic_pci.h,v > diff -u -r1.58 -r1.57 > --- //depot/user/imp/newcard/pccard/pcic_pci.h 2002/07/20 09:03:01 > +++ //depot/user/imp/newcard/pccard/pcic_pci.h 2002/07/23 21:54:33 > @@ -43,6 +43,7 @@ > /* Texas Instruments PCI-1130/1131 CardBus Controller */ > #define TI113X_PCI_SYSTEM_CONTROL 0x80 /* System Control */ > #define TI12XX_PCI_MULTIMEDIA_CONTROL 0x84 /* Zoom Video */ > +#define TI12XX_PCI_IRQMUX 0x8c /* multifunction pins */ > #define TI113X_PCI_RETRY_STATUS 0x90 /* Retry Status */ > #define TI113X_PCI_CARD_CONTROL 0x91 /* Card Control */ > #define TI113X_PCI_DEVICE_CONTROL 0x92 /* Device Control */ > @@ -60,6 +61,17 @@ > #define TI113X_SYSCNTL_KEEP_CLK 0x00000002u > #define TI113X_SYSCNTL_CLKRUN_ENA 0x00000001u > > +/* IRQMUX register (TI12XX_IRQMUX == 0x8c) */ > +#define TI12XX_IRQMUX_PIN0 0x0000000fu > +#define TI12XX_IRQMUX_PIN0_INTA 0x2 > +#define TI12XX_IRQMUX_PIN1 0x000000f0u > +#define TI12XX_IRQMUX_PIN1_INTB 0x20 > +#define TI12XX_IRQMUX_PIN2 0x00000f00u > +#define TI12XX_IRQMUX_PIN3 0x0000f000u > +#define TI12XX_IRQMUX_PIN4 0x000f0000u > +#define TI12XX_IRQMUX_PIN5 0x00f00000u > +#define TI12XX_IRQMUX_PIN6 0x0f000000u > + > /* Card control register (TI113X_CARD_CONTROL == 0x91) */ > #define TI113X_CARDCNTL_RING_ENA 0x80u > #define TI113X_CARDCNTL_ZOOM_VIDEO 0x40u > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-mobile" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message