Re: [PATCH] NEWCARD: pccardc power support
In message: <[EMAIL PROTECTED]> Mitsuru IWASAKI <[EMAIL PROTECTED]> writes: : BTW, I think that some developers are interested in devd. : Do we have mailing list for it? Not currently. I can create one if people are interested. I've also been thinking of a good way we can have the above power support in current until we can make it generic. Warner To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Re: [PATCH] NEWCARD: pccardc power support
Hi, > In message: <[EMAIL PROTECTED]> > Mitsuru IWASAKI <[EMAIL PROTECTED]> writes: > : I've implemented pccardc power and boot_deactivated support code for > : NEWCARD. They are needed for some mobile users including me. > : > : - Add pccardc power support code. Yes, it's OLDCARD compatible. > : - Add new loader tunable hw.cbb.boot_deactivated to prevent pccards > :from attaching automatically. [snip] > So this is a good hack, and likely useful to a lot of people. > However, I'd like to see a more thoughtful design of a good device > control interface. I think that it dovetails nicely with the work I'm > doing for devd. Yes, my understanding of the goal of devd is that. Also I understand that NEWCARD users will be eager for suggested features until devd development is completed. So I'll leave the patches for such a people for a while at: http://people.freebsd.org/~iwasaki/pccard/cbb-pccardc-power-support-20021029.diff BTW, I think that some developers are interested in devd. Do we have mailing list for it? Thanks To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Re: [PATCH] NEWCARD: pccardc power support
Hi Mitsuru, I was also thinking about this so I'm very happy with your patch! It works great here! This is very usefull for me as I have an internal pccard that I prefer not to be active all time. Thanks Mark On Tue, Oct 29, 2002 at 08:55:32PM +0900, Mitsuru IWASAKI wrote: > I've implemented pccardc power and boot_deactivated support code for > NEWCARD. They are needed for some mobile users including me. > > - Add pccardc power support code. Yes, it's OLDCARD compatible. > - Add new loader tunable hw.cbb.boot_deactivated to prevent pccards >from attaching automatically. > > Some people want to keep pccards in slots all the time even if they > don't want to use the pccard. They can power pccard on via pccardc > command now (and in OLDCARD days) when it's required, so automatic > attaching pccards at boot time is not desired behavior for them. > > This is quick hack actually (took about 1 hour), so it's not > clean at all. > But it's good enough for prototype, working great for me actually :) -- Mark SantcroosRIPE Network Coordination Centre http://www.ripe.net/home/mark/New Projects Group/TTM To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
Re: [PATCH] NEWCARD: pccardc power support
In message: <[EMAIL PROTECTED]> Mitsuru IWASAKI <[EMAIL PROTECTED]> writes: : I've implemented pccardc power and boot_deactivated support code for : NEWCARD. They are needed for some mobile users including me. : : - Add pccardc power support code. Yes, it's OLDCARD compatible. : - Add new loader tunable hw.cbb.boot_deactivated to prevent pccards :from attaching automatically. : : Some people want to keep pccards in slots all the time even if they : don't want to use the pccard. They can power pccard on via pccardc : command now (and in OLDCARD days) when it's required, so automatic : attaching pccards at boot time is not desired behavior for them. : : This is quick hack actually (took about 1 hour), so it's not : clean at all. : But it's good enough for prototype, working great for me actually :) Interesting. I'd like to be able to do this on my laptop with PCI devices that I'm not currently using (like say the sound chip, the usb bus, the firewire bus, and the one pci device that no driver attaches to). I'd also like the ability to turn on and off USB devices as well. These busses have different power interfaces (PCI gives you 4 levels of power, while USB gives you 2). While we're at it, I'd also like to see a way to attach/detach pccard devices w/o having to remove the card or unload the driver. I think that a good power/device control interface would be useful to have. So this is a good hack, and likely useful to a lot of people. However, I'd like to see a more thoughtful design of a good device control interface. I think that it dovetails nicely with the work I'm doing for devd. Warner To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message
[PATCH] NEWCARD: pccardc power support
Hi, I've implemented pccardc power and boot_deactivated support code for NEWCARD. They are needed for some mobile users including me. - Add pccardc power support code. Yes, it's OLDCARD compatible. - Add new loader tunable hw.cbb.boot_deactivated to prevent pccards from attaching automatically. Some people want to keep pccards in slots all the time even if they don't want to use the pccard. They can power pccard on via pccardc command now (and in OLDCARD days) when it's required, so automatic attaching pccards at boot time is not desired behavior for them. This is quick hack actually (took about 1 hour), so it's not clean at all. But it's good enough for prototype, working great for me actually :) Enjoy! Index: pccbb.c === RCS file: /home/ncvs/src/sys/dev/pccbb/pccbb.c,v retrieving revision 1.59 diff -u -r1.59 pccbb.c --- pccbb.c 11 Oct 2002 04:30:59 - 1.59 +++ pccbb.c 29 Oct 2002 10:55:48 - @@ -86,6 +86,8 @@ #include #include #include +#include +#include #include #include #include @@ -210,6 +212,13 @@ SYSCTL_ULONG(_hw_cbb, OID_AUTO, debug, CTLFLAG_RW, &cbb_debug, 0, "Verbose cardbus bridge debugging"); +int cbb_boot_deactivated = 0; +TUNABLE_INT("hw.cbb.boot_deactivated", &cbb_boot_deactivated); +SYSCTL_INT(_hw_cbb, OID_AUTO, boot_deactivated, CTLFLAG_RD, +&cbb_boot_deactivated, 0, +"Override the automatic powering up of pccards at boot."); + + static int cbb_chipset(uint32_t pci_id, const char **namep); static int cbb_probe(device_t brdev); static voidcbb_chipinit(struct cbb_softc *sc); @@ -264,6 +273,93 @@ static voidcbb_write_config(device_t brdev, int b, int s, int f, int reg, uint32_t val, int width); +static d_open_tcrdopen; +static d_close_t crdclose; +static d_ioctl_t crdioctl; + +#define CDEV_MAJOR 50 +static struct cdevsw crd_cdevsw = { + /* open */ crdopen, + /* close */ crdclose, + /* read */ noread, + /* write */ nowrite, + /* ioctl */ crdioctl, + /* poll */ nopoll, + /* mmap */ nommap, + /* strategy */ nostrategy, + /* name */ "crd", + /* maj */ CDEV_MAJOR, + /* dump */ nodump, + /* psize */ nopsize, + /* flags */ 0, +}; + +#define PIOCSVIR _IOW('P', 10, int) /* Virtual insert/remove */ + +static int +crdopen(dev_t dev, int oflags, int devtype, d_thread_t *td) +{ + if (dev == NULL || dev->si_drv1 == NULL) { + return (ENXIO); + } + + return (0); +} + +static int +crdclose(dev_t dev, int fflag, int devtype, d_thread_t *td) +{ + return (0); +} + +static int +crdioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, d_thread_t *td) +{ + struct cbb_softc *sc; + int error; + int pwval; + + sc = dev->si_drv1; + error = 0; + + switch(cmd) { + /* +* Set power values. +*/ + case PIOCSVIR: + pwval = *(int *)data; + + switch (pwval) { + case 0: + if (!(sc->flags & CBB_CARD_OK)) { + error = EINVAL; + break; + } + + sc->flags |= CBB_INACTIVATE; + cbb_removal(sc); + break; + + case 1: + if (sc->flags & CBB_CARD_OK) { + error = EINVAL; + break; + } + + sc->flags &= ~CBB_INACTIVATE; + cbb_insert(sc); + break; + } + + break; + + default: + error = ENOTTY; + } + + return (error); +} + /* */ static __inline void @@ -560,6 +656,8 @@ { struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(brdev); int rid; + int unit; + dev_t cbb_dev_t; mtx_init(&sc->mtx, device_get_nameunit(brdev), "cbb", MTX_DEF); cv_init(&sc->cv, "cbb cv"); @@ -680,6 +778,10 @@ /* reset interrupt */ cbb_set(sc, CBB_SOCKET_EVENT, cbb_get(sc, CBB_SOCKET_EVENT)); + if (cbb_boot_deactivated) { + sc->flags |= CBB_INACTIVATE; + } + /* Start the thread */ if (kthread_create(cbb_event_thread, sc, &sc->event_thread, 0, 0, "%s%d", device_get_name(sc->dev), device_get_unit(sc->dev))) { @@ -687,6 +789,10 @@ panic ("cbb_create_event_thread"); } + unit = device_get_unit(sc->dev); + cbb_dev_t = make_dev(&crd_cdevsw, unit, 0, 0, 0664, "card%d", unit); + cbb_dev_t->si_drv1 = sc; + return (0); err: if (sc->irq_res) @@ -913,10 +1019,14 @@ statu