Re: Driver tpm(4) and third party packages for trusted platform modules
In message 20100811203042.ga26...@modermoor.genua.de, Hans-Joerg Hoexer wrote: Hi, On Wed, Aug 04, 2010 at 07:39:41PM +0900, Takanori Watanabe wrote: Update my patch. Split bus attachment from main driver file (need to update sys/conf/files), add detach method for convinience, and attach softc to cdev.si_drv1 . I've updated our diff for 9-current, including your patch. Ok, I've commit them to the head. ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: Driver tpm(4) and third party packages for trusted platform modules
In message 201008040347.o743leer046...@sana.init-main.com, wrote: Quick review and hack: 1.How about attaching it as acpi child driver? In some case, TPM may appear in ACPI namespace (with _HID) and TPM spec defines ACPI method to handle TPM specific request. 2. Is identify method needed? Writing device hint will attach isa child driver, I think. 3.Module build I don't know it is proper in TPM nature. Update my patch. Split bus attachment from main driver file (need to update sys/conf/files), add detach method for convinience, and attach softc to cdev.si_drv1 . diff -ruN src/sys/dev/tpm/tpm.c src.new/sys/dev/tpm/tpm.c --- src/sys/dev/tpm/tpm.c 2010-08-04 12:39:05.0 +0900 +++ src.new/sys/dev/tpm/tpm.c 2010-08-04 19:32:44.0 +0900 @@ -49,6 +49,7 @@ #include dev/isa/isareg.h #include dev/isa/isavar.h #endif +#include tpmvar.h #ifndef __FreeBSD__ /* XXX horrible hack for tcsd (-lpthread) workaround on OpenBSD */ @@ -142,43 +143,10 @@ /* Set when enabling legacy interface in host bridge. */ int tpm_enabled; -struct tpm_softc { -#ifndef __FreeBSD__ - struct device sc_dev; -#endif - void *sc_ih; - - int (*sc_init)(struct tpm_softc *, int, const char *); - int (*sc_start)(struct tpm_softc *, int); - int (*sc_read)(struct tpm_softc *, void *, int, size_t *, int); - int (*sc_write)(struct tpm_softc *, void *, int); - int (*sc_end)(struct tpm_softc *, int, int); - - bus_space_tag_t sc_bt, sc_batm; - bus_space_handle_t sc_bh, sc_bahm; - - u_int32_t sc_devid; - u_int32_t sc_rev; - u_int32_t sc_stat; - u_int32_t sc_capabilities; - - int sc_flags; -#defineTPM_OPEN0x0001 - - int sc_vector; -#ifdef __FreeBSD__ - void*intr_cookie; -#endif - -#ifndef __FreeBSD__ - void*sc_powerhook; -#endif - int sc_suspend; -}; #ifdef __FreeBSD__ #defineTPMSOFTC(dev) \ -((struct tpm_softc *)devclass_get_softc(tpm_devclass, dev2unit(dev))) + ((struct tpm_softc *)dev-si_drv1) d_open_t tpmopen; d_close_t tpmclose; @@ -229,7 +197,6 @@ { 0, , TPM_DEV_NOINTS }, }; -int tpm_tis12_probe(bus_space_tag_t, bus_space_handle_t); int tpm_tis12_irqinit(struct tpm_softc *, int, int); int tpm_tis12_init(struct tpm_softc *, int, const char *); int tpm_tis12_start(struct tpm_softc *, int); @@ -239,8 +206,6 @@ #ifdef __FreeBSD__ void tpm_intr(void *); -int tpm_suspend(device_t); -int tpm_resume(device_t); #else int tpm_intr(void *); void tpm_powerhook(int, void *); @@ -264,67 +229,45 @@ int tpm_legacy_end(struct tpm_softc *, int, int); #ifdef __FreeBSD__ + /* * FreeBSD specific code for probing and attaching TPM to device tree. */ +#if 0 static void tpm_identify(driver_t *driver, device_t parent) { BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, tpm, 0); } +#endif -static int -tpm_probe(device_t dev) -{ - struct tpm_softc *sc = device_get_softc(dev); - bus_space_tag_t iot; - bus_space_handle_t ioh; - struct resource *mem_res; - int rv, mem_rid; - - bzero(sc, sizeof(struct tpm_softc)); - - mem_rid = 0; - mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, mem_rid, - RF_ACTIVE); - if (mem_res == NULL) - return (ENXIO); - iot = rman_get_bustag(mem_res); - ioh = rman_get_bushandle(mem_res); - - if ((rv = tpm_tis12_probe(iot, ioh))) - device_set_desc(dev, Trusted Platform Module); - - bus_release_resource(dev, SYS_RES_MEMORY, mem_rid, mem_res); - return rv ? 0 : ENXIO; -} -static int +int tpm_attach(device_t dev) { struct tpm_softc *sc = device_get_softc(dev); - struct resource *mem_res; - int mem_rid; - int irq_rid, irq; - struct resource *irq_res; + int irq; - mem_rid = 0; - mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, mem_rid, + sc-mem_rid = 0; + sc-mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, sc-mem_rid, RF_ACTIVE); - if (mem_res == NULL) + if (sc-mem_res == NULL) return ENXIO; - sc-sc_bt = rman_get_bustag(mem_res); - sc-sc_bh = rman_get_bushandle(mem_res); + sc-sc_bt = rman_get_bustag(sc-mem_res); + sc-sc_bh = rman_get_bushandle(sc-mem_res); - irq_rid = 0; - irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, irq_rid, + sc-irq_rid = 0; + sc-irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, sc-irq_rid, RF_ACTIVE | RF_SHAREABLE); - if (irq_res != NULL) - irq = rman_get_start(irq_res); + if (sc-irq_res != NULL) + irq = rman_get_start(sc-irq_res); else irq = IRQUNK; + /*In case PnP probe this may contain some initialization.*/ + tpm_tis12_probe(sc-sc_bt, sc-sc_bh); + if
Re: Driver tpm(4) and third party packages for trusted platform modules
In message 20100802120236.gb29...@modermoor.genua.de, Hans-Joerg Hoexer wrote: Hi, we have developed a driver tpm(4) for various TPMs for OpenBSD 4.7 and FreeBSD 8.0 and have ported and updated several third party packages to enable use of TPMs on Open- and FreeBSD. This enables applications like OpenSSH to generate and store private keys inside a TPM. The supported TPMs are: - Atmel 97SC3203 - Broadcom BCM0102 - Infineon SLB 9635 TT 1.2 - Intel INTC0102 - Sinosun SNS SSX35 - STM ST19WP18 - Winbond WEC WPCT200 The supported third party packages are: - openCryptoki 2.3.1: An PKCS#11 implementation, including support for TPMs. OpenSSH can use this library to generate and store private RSA keys inside a TPM. - openssl_tpm_engine 0.4.1: An openssl engine supporting TPMs. - tpm-emulator 0.7.0: An emulator providing the functionality of a TPM. Used for development purposes. - tpm-tools 1.3.5: Various tools for managing a TPM, including key generation. - trousers 0.3.5: An implementation of the Trusted Software Stack. This is the backend libary for the afore mentioned packages. - trousers testsuite 0.2: A testsuite for trousers. - TrustedGRUB 1.1.4: An TPM enabled version of grub, including support for natively booting OpenBSD. A patch including the driver tpm(4) is attached, more information, full source code and patches for third party packages can be found at http://bsssd.sourceforge.net. Nice! Quick review and hack: 1.How about attaching it as acpi child driver? In some case, TPM may appear in ACPI namespace (with _HID) and TPM spec defines ACPI method to handle TPM specific request. 2. Is identify method needed? Writing device hint will attach isa child driver, I think. 3.Module build I don't know it is proper in TPM nature. === diff -ruN src/sys/dev/tpm/tpm.c src.new/sys/dev/tpm/tpm.c --- src/sys/dev/tpm/tpm.c 2010-08-04 12:39:05.0 +0900 +++ src.new/sys/dev/tpm/tpm.c 2010-08-04 12:27:41.0 +0900 @@ -264,15 +264,22 @@ int tpm_legacy_end(struct tpm_softc *, int, int); #ifdef __FreeBSD__ +static struct isa_pnp_id tpm_ids[] = { + {0x32021114, Trusted Platform Module}, + + {0} +}; + /* * FreeBSD specific code for probing and attaching TPM to device tree. */ +#if 0 static void tpm_identify(driver_t *driver, device_t parent) { BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, tpm, 0); } - +#endif static int tpm_probe(device_t dev) { @@ -281,8 +288,14 @@ bus_space_handle_t ioh; struct resource *mem_res; int rv, mem_rid; + int ret; bzero(sc, sizeof(struct tpm_softc)); + + if((ret = ISA_PNP_PROBE(device_get_parent(dev), dev, tpm_ids)) + = 0){ + return ret; + } mem_rid = 0; mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, mem_rid, @@ -362,7 +375,9 @@ } static device_method_t tpm_methods[] = { +#if 0 DEVMETHOD(device_identify, tpm_identify), +#endif DEVMETHOD(device_probe, tpm_probe), DEVMETHOD(device_attach,tpm_attach), DEVMETHOD(device_suspend, tpm_suspend), @@ -377,6 +392,7 @@ static devclass_t tpm_devclass; DRIVER_MODULE(tpm, isa, tpm_driver, tpm_devclass, 0, 0); +DRIVER_MODULE(tpm, acpi, tpm_driver, tpm_devclass, 0, 0); #else /* * OpenBSD specific code for probing and attaching TPM to device tree. diff -ruN src/sys/modules/tpm/Makefile src.new/sys/modules/tpm/Makefile --- src/sys/modules/tpm/Makefile1970-01-01 09:00:00.0 +0900 +++ src.new/sys/modules/tpm/Makefile2010-08-04 12:43:59.0 +0900 @@ -0,0 +1,8 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../dev/tpm + +KMOD= tpm +SRCS= tpm.c isa_if.h opt_acpi.h acpi_if.h bus_if.h device_if.h + +.include bsd.kmod.mk ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Re: Switching to SMM with FreeBSD 6.2 onwards
In message 17314.10813...@web45811.mail.sp1.yahoo.com, Won De Erick wrote: Hi All, I'm not quite familiar with FreeBSD, but I want to do the following in 6.2/7.1 . /* Raise IOPL to 3 to open all I/O ports */ /* something like 'i386_iopl(3)' */ ... see i386_get_ioperm(2) or io(4). /* Open SMRAM access */ outl(unsigned int port, unsigned long int data); Also, I appreciate comments on the following wrapper: static inline outl(unsigned int port, unsigned long int data) { asm(outl %0, %1 : : a (data), dN (port)); } My goal is to switch the processor to SMM by triggering SMI from userland. Probably this will work. So what do you want ask about that? ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org
Core i7 anyone else?
Hi, I recently bought Core i7 machine(for 145,000JPY: about $1500) and sometimes hangs up oddly. When in the state, some specific process only works and replys ping, but not reply any useful information. I suspect it may caused by CPU power management, so I cut almost all CPU power management feature on BIOS parameter. Are there any people encouterd such trouble? And on this machine build world in SCHED_ULE(15min.) is slower than SCHED_4BSD(12min.). ===dmesg=== http://www.init-main.com/corei7.dmesg or http://pastebin.com/m187f77aa (if host is down) =DSDT http://www.init-main.com/corei7.asl or http://pastebin.com/m6879984a ==some sysctls== hw.machine: i386 hw.model: Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz hw.ncpu: 8 hw.byteorder: 1234 hw.physmem: 3202322432 hw.usermem: 2956083200 hw.pagesize: 4096 hw.floatingpoint: 1 hw.machine_arch: i386 hw.realmem: 3211264000 == machdep.enable_panic_key: 0 machdep.adjkerntz: -32400 machdep.wall_cmos_clock: 1 machdep.disable_rtc_set: 0 machdep.disable_mtrrs: 0 machdep.guessed_bootdev: 2686451712 machdep.idle: acpi machdep.idle_available: spin, mwait, mwait_hlt, hlt, acpi, machdep.hlt_cpus: 0 machdep.prot_fault_translation: 0 machdep.panic_on_nmi: 1 machdep.kdb_on_nmi: 1 machdep.tsc_freq: 2684011396 machdep.i8254_freq: 1193182 machdep.acpi_timer_freq: 3579545 machdep.acpi_root: 1024240 machdep.hlt_logical_cpus: 0 machdep.logical_cpus_mask: 254 machdep.hyperthreading_allowed: 1 == kern.sched.preemption: 0 kern.sched.topology_spec: groups group level=1 cache-level=0 cpu count=8 mask=0xff0, 1, 2, 3, 4, 5, 6, 7/cpu flags/flags /group /groups kern.sched.steal_thresh: 3 kern.sched.steal_idle: 1 kern.sched.steal_htt: 1 kern.sched.balance_interval: 133 kern.sched.balance: 1 kern.sched.affinity: 1 kern.sched.idlespinthresh: 4 kern.sched.idlespins: 1 kern.sched.static_boost: 160 kern.sched.preempt_thresh: 0 kern.sched.interact: 30 kern.sched.slice: 13 kern.sched.name: ULE === ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Driver for a 3G mobile phone.
In message [EMAIL PROTECTED], M. Warner Losh wrote: takawata-san, I have looked over this patch, and it looks good to me. Will you have time to commit it soon, or would you like someone else to commit for you? I'll commit it soon. Thanks. ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
Re-enabling ACPI module.
Hi, I looked in the new APIC code you commit. The thing that prevent ACPI subsystem from moduler is the way we aquire ACPI root pointer, I think. Right? If so, we can took this in way. 1. Move u_long i386_acpi_root; to machdep.c and madt.c use i386_acpi_root variable, instead of calling AcpiOsGetRootPointer. If Boot loader failed to detect ACPI root pointer, the MADT table is not used, even if the OS can detect it. 2. Re-imprement AcpiOsGetRootPointer so that it does not use AcpiFindRootPointer(). Which do you think better? ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
#ifdef IPDIVERT in sys/netinet/ip_fw2.c?
Do we need #ifdef IPDIVERT in sys/ne I don't think it is needed, because ip_fw2 always accepts DIVERT packet and the option is only used for print out if IPDIVERT option is enabled or not. I tried to run natd in kernel with IPDIVERT enabled and IPFW not enabled, with ipfw kernel module. And it workes. % dmesg ... ipfw2 initialized, divert disabled, rule-based forwarding enabled, default to de ny, logging disabled acpi_cpu: throttling enabled, 2 steps (100% to 50.0%), currently 100.0% ... % kldstat Id Refs AddressSize Name 1 41 0xc040 2de980 kernel 22 0xc06df000 1d634linux.ko 31 0xc06fd000 9310 ipfw.ko 41 0xc0707000 b3ec if_fxp.ko 53 0xc0713000 1c174miibus.ko 61 0xc073 8080 if_rl.ko 71 0xc0739000 7988 ng_pppoe.ko 82 0xc0741000 49f0 ng_ether.ko 98 0xc0746000 14b2cnetgraph.ko 101 0xc075b000 59b8 snd_cmi.ko 112 0xc0761000 1e678snd_pcm.ko 129 0xc078 13088agp.ko 131 0xc0794000 1f3c bktr_mem.ko 141 0xc0796000 31c4 joy.ko 151 0xc079a000 7e1c fdc.ko 161 0xc07a2000 1af2c4 nvidia.ko 171 0xc0952000 4ce2cacpi.ko 181 0xc63ab000 5000 ip6fw.ko 191 0xc63d6000 1b000nfsserver.ko 201 0xc6422000 3000 daemon_saver.ko 211 0xc643d000 4000 ng_socket.ko 221 0xc6441000 4000 ng_iface.ko 231 0xc6447000 8000 ng_ppp.ko 241 0xc646d000 4000 ng_bpf.ko 251 0xc6471000 5000 ng_vjc.ko % ps auxwww|grep natd root 211 0.0 0.0 804 348 ?? Is 10:04PM 0:00.06 /sbin/natd -dynamic -n ng0 '#ifdef' should be avoided as possible, because Do you need the message to indicate IPDIVERT is enabled? If it is not needed so much, just change the message to dike the #ifdef. --- /sys/netinet/ip_fw2.c Fri Sep 26 19:14:22 2003 +++ ip_fw2.cTue Oct 14 22:45:41 2003 @@ -2928,13 +2928,8 @@ } ip_fw_default_rule = layer3_chain.rules; - printf(ipfw2 initialized, divert %s, + printf(ipfw2 initialized, rule-based forwarding enabled, default to %s, logging , -#ifdef IPDIVERT - enabled, -#else - disabled, -#endif default_rule.cmd[0].opcode == O_ACCEPT ? accept : deny); If you still need it, this should be converted to a reference to global variable. How do you think about it? ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
Does anyone work on making ATA moduler?
Hi,There is a problem when PCMCIA related stuff is used as module, ATA CF is not recognized. This is because PCMCIA atachment is not compiled when pccard(4) is not compiled in. To fix it, we have to supply PCMCIA attachment in any form. One way is to make a kernel module that contains only ATA/PCMCIA attachment with this Makefile == .PATH: ${.CURDIR}/../../dev/ata KMOD= atacard SRCS= ata-card.c SRCS+= bus_if.h device_if.h card_if.h power_if.h .include bsd.kmod.mk === Then two question. 1. May I commit this workaround? 2. Are there any people working on ATA for making it fully moduler? ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: HTT on single CPU?
In message [EMAIL PROTECTED], Thomas T. Veldhouse wrote: Actually, a 2.4 could have HT. Intel extends Hyper-Threading Technology? to a variety of desktop PCs, with the new Intel Pentium 4 processor, featuring an advanced 800 MHz system bus and speeds ranging from 2.40C to 3.20 GHz. Hyper-Threading Technology from Intel enables the processor to execute two threads (parts of a software program) in parallel - so your software can run more efficiently and you can multitask more effectively. - Original Message - From: Brooks Davis [EMAIL PROTECTED] To: Jens Rehsack [EMAIL PROTECTED] Cc: Andrey Chernov [EMAIL PROTECTED]; [EMAIL PROTECTED]; Lukas Ertl [EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 10:07 AM Subject: Re: HTT on single CPU? On Wed, Jul 09, 2003 at 02:47:18PM +0200, Jens Rehsack wrote: Andrey Chernov wrote: snip Features=0xbfebfbffFPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA ,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE P4's below ~3.1GHz do not actually provide logical CPU support. -- Brooks I also have Pentium4 2.53GHz Processor. I have i845G motherboard, And the vendor says that the board does not support Pentium4 3.06GHz CPU. Can I run with HTT enabled if I buy a Pentium 4 3.06G CPU? ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: How to crash FreeBSD for educational purposes?
In message EB808F8B7354D311AE3200508B319CC7CE7F24@OOELKHCO12, Rath, Egon wrote: Hi there! I am currently playing around with analyzing crash dumps on FreeBSD. Are there any ways to crash the system to get a dump? For example, Check ddb(4). Use panic subcommand. Or can i force the system to write the current memory content to the dump-device without crashing the whole system? No, as far as I know. To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-hackers in the body of the message
Re: cvs commit: src/sys/dev/usb usbdevs
Log: MFNetBSD: FTDI USB-serial converter chips description. I ported a FTDI USB serial converter driver from NetBSD. http://people.freebsd.org/uftdi.tar.gz ~ ~ ~ ~ ~ To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-hackers in the body of the message
Re: Beep after shutdown
In message 002101c22d73$972ec970$[EMAIL PROTECTED], Sean Hamilton wrote: Greetings, The fact that FreeBSD does not beep after it finishes shutting down has costed me dozens of hours of reformatting inconsistent filesystems, and probably all sorts of little bits of data loss which I'm just unaware of. I've tried to hack this into the kernel myself, without much luck. The best I got it to do was start beeping but never end, since the timer related stuff had already been killed off. This wound up being more irritating than useful. Anybody clueful want to point me in the right direction? Following patch is Chiharu Shibata's patch for old 4-stable. The article on the patch is published in FreeBSD press(http://www.ux.mycom.co.jp/). http://plaza17.mbn.or.jp/~chi/myprog/FreeBSD/scbeep.diff To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-hackers in the body of the message
unionfs and getcwd problem.
Hi, I had trouble with unionfs when it calles getcwd(3) when I mount some directory on the directry in same file system,like mount -t union /usr/home/foo/bar /usr/src/sys/ . I investigate the problem by inserting debug print in getcwd.c. Then I found issuing __getcwd(2) in getcwd(3) failed, and climb up filesystem tree as the next way. But it failed when it reaches to mount point. It seems that st_dev and st_ino member returns the same number as the underlying filesystem so it failed to recognize mount point. So I tried the patch as follows taken from nullfs. Are there any problem with this patch? Takanori Watanabe a href=http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html; Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A --- union_vnops.c~ Tue Oct 2 00:01:37 2001 +++ union_vnops.c Mon Feb 25 22:44:51 2002 @@ -957,6 +957,8 @@ union_newsize(ap-a_vp, VNOVAL, vap-va_size); } + ap-a_vap-va_fsid = ap-a_vp-v_mount-mnt_stat.f_fsid.val[0]; + if ((vap != ap-a_vap) (vap-va_type == VDIR)) ap-a_vap-va_nlink += vap-va_nlink; return (0); To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-hackers in the body of the message
Re: IICBUS_READ
In message [EMAIL PROTECTED], s $B$5$s$$$o$/(B: I've look at /sys/dev/iicbus/iiconf.c: int iicbus_read(device_t bus, char *buf, int len, int *read, int last, int delay ) { struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus); /* a slave must have been started with the appropriate address */ if (!sc-started || !(sc-started LSB)) return (EINVAL); return (IICBUS_READ(device_get_parent(bus), buf, len, read, last, de lay)); } Where is defined IICBUS_READ ? /sys/${MACHINE}/compile/${YOURCONF}/iicbus_if.h This is generated from /sys/dev/iicbus/iicbus_if.m . Takanori Watanabe a href=http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html; Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-hackers in the body of the message
Re: IBM ACP modem driver
In message [EMAIL PROTECTED], Simon Walton $B$5$s$$$o$/(B: A couple of months ago IBM released the source to their linux modem driver for the thinkpad 600 600E: There is one more WinModem driver : Lucent Winmodem driver. This was made by WATANABE Kiyoshi [EMAIL PROTECTED] . http://www.geocities.com/wtnbkysh/ Unfortunately it is for 4-STABLE, so I tried to rewrite it for CURRENT, but not succeeded to work yet. The partly rewrite version is here: http://people.freebsd.org/~takawata/ltmdmsio.c To use this, you need to download driver for linux (at Lucent site or http://walbran.org/sean/linux/stodolsk/ltmodem-5.78e.tar.gz) and get ltmdmobj.o Then link it.(In the archive , there is no documents written in English.) I am happy if someone port it to CURRENT. Takanori Watanabe a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html" Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: driver: probe not called when smbus child
In message [EMAIL PROTECTED], Willem van Engen $B$5$s$$$o$/(B: And you will need to know grandparent device name to bind the device collectly.(Or should we need a way to get device attribute such as Mother board, Video Capture BitBang,Video Capture Cooked,VGA Card and etc.) I don't quite understand this; I guess I don't know enough about newbus or so. Do you want your driver attached to Video Capture device? 'device_identify' method is called from all parent bus. Takanori Watanabe a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html" Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: PCI changes break HP Docking Station
In message [EMAIL PROTECTED], Brooks Davis $B$5$s$$$o$/(B: I plugged my HP Omnibook 4150 into my dock for the first time in a couple months only to discover that I couldn't attach any of the PCI devices in it. I'm running -current as of sometime in the last week or so. I traced the problem to the new PCI code comitted six weeks ago. Specificaly: Would you send me raw memory block,by executing acpidump -o omnibook.dsdt? Device docking can be handled by ACPI. Takanori Watanabe a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html" Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
How can I stop HDD or LCD Display ?
Hi, My laptop seems to be transition to S1 sleep. But HDD and LCD did not suspend I think driver or userland program should catch suspend request and send power off request to the devices. How can I do it? For display, it seems that request Xserver to invoke DPMS,but how about console? For HDD, Linux or NetBSD have userland tool to request stopping HDD. In FreeBSD? Thanks. Takanori Watanabe a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html" Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: CFR: Generalized power-management interface
In message [EMAIL PROTECTED], Mitsuru IWASAKI $B$5$s$$$o$/(B : Hi, I've update the patch based on some comments so far and added wmpm (actually ACPI support for wmapm which is utility for WindowMaker) ports files as a example. http://people.freebsd.org/~iwasaki/acpi/power-20010113.tar.gz What about treating it as a part of ioctl in existing device, then make symbolic link to a generalzed name,instead of consuming new major number? Takanori Watanabe a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html" Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: CFR: Generalized power-management interface
In message [EMAIL PROTECTED], Mitsuru IWASAKI $B$5$s$$$o$/(B : I've update the patch based on some comments so far and added wmpm (actually ACPI support for wmapm which is utility for WindowMaker) ports files as a example. http://people.freebsd.org/~iwasaki/acpi/power-20010113.tar.gz What about treating it as a part of ioctl in existing device, then make symbolic link to a generalzed name,instead of consuming new major number? Does `existing device' mean APM or ACPI? Yes . We don't know which power management system is enabled on the actual system, so it's impossible. We need one mandatory device for PM to be generalized. I think the opposite way is more reasonable. Why? Is it bad to check whether the device is available or not in rc? Takanori Watanabe a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html" Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: AMD System Management driver and Newbus
In message [EMAIL PROTECTED], "M atthew C. Forman" $B$5$s$$$o$/(B: First, sorry this is a bit long; I probably should have split it up, but when I get going... Y'Know... I've done some work on a driver for the SMBus functions of the AMD 756 chip found on K7-based motherboards, based on alpm.c from -CURRENT. This works nicely on my system (Gigabyte GA7IXE-4 with Athlon 700MHz), but is currently using old-style PCI shims. Since this is my first go at doing anything in the FreeBSD kernel, I didn't realise that this was not a Good Thing, so I've been trying to get it to work with Newbus; please see below. Anyway, for anyone who'd like to try the old-style compatability version, please feel free to pull the diffs from: http://www.3d-med.cse.dmu.ac.uk/~mcf/amdpm_oldpci.tar.gz My newbus efforts are not going too well; specifically I'm having a hard time with bus_alloc_resource, which refuses to allocate any I/O space for me. I've tried all sorts of things, but it just won't work. If anyone can spot anything idiotic I've done, please let me know; you may just save my hair! This driver seems to be based on alpm.c, and alpm.c is based on intpm.c intpm.c is now NEWBUS-ifyed. #Indeed, I was intended to write driver for Power Management part , #such as GPIO etc. So I divide the driver to PCI head and SMBus part. #But As reading through ACPI spec,I convinced that this should be treated #by ACPI fixed feature . $BEOJUB:5*(B $B?@8MBg3XBg3X1!+A32J3X85f2J(BD3$BpJs%a%G%#%"2J3X@l96(B a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html" Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Call for review:PECOFF(Win32 Execution format) module.
Hi, I want to commit pecoff module under sys/compat/. The code is at http://people.freebsd.org/~takawata/pecoff.tar.gz This is kernel part of PEACE(http://chiharu.haun.org/peace/),that is announced as NewFeature of NetBSD1.5. Currently one more kernel module is needed to use PEACE in FreeBSD. If there is no objection, I will commit it. Thanks. Takanori Watanabe a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html" Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
PEACE - Portable Executable win32 API Compatible Environment.
Hi, I ported kernel part of PEACE from NetBSD.(That is in sys/compat/pecoff/*). What is PEACE PEACE is Win32 API Compatible environment for (Originally) NetBSD. It consist of three parts: Kernel part to load PE format executable onto process memory space. Dynamic Linker to link with PE format DLL. Libraries to translate Win32 API call to NetBSD native system call. Yes, this scheme is more like BSD/OS's LAP than FreeBSD Linux ABI module. For more infomation: http://chiharu.hauN.ORG/peace/ Status: FreeBSD Specific: - I ported executable loader moudule to FreeBSD. - FreeBSD native libraries is not yet available,so I wrote a module to add(or replace) system call so that the libraries can be run. - It requires following changes to sys/imgact.h and kern/kern_exec.c to be able to change size of memory area to hold dynamic linker argument from executable image loader. --- sys/imgact.h.orig Mon Sep 18 02:18:46 2000 +++ sys/imgact.hMon Sep 18 02:19:25 2000 @@ -58,6 +58,7 @@ struct vm_page *firstpage; /* first page that we mapped */ char *fname;/* pointer to filename of executable (user space) */ unsigned long ps_strings; /* PS_STRINGS for BSD/OS binaries */ + size_t auxarg_size; }; #ifdef _KERNEL --- kern/kern_exec.c.orig Fri Jul 14 15:44:45 2000 +++ kern/kern_exec.cMon Sep 18 02:59:45 2000 @@ -127,6 +127,7 @@ imgp-vp = NULL; imgp-firstpage = NULL; imgp-ps_strings = 0; + imgp-auxarg_size=0; /* * Allocate temporary demand zeroed space for argument and @@ -613,14 +614,21 @@ * If we have a valid auxargs ptr, prepare some room * on the stack. */ - if (imgp-auxargs) + if (imgp-auxargs){ +/* +* 'AT_COUNT*2' is size for the ELF Auxargs data. +* This is for lower compatibility. +*/ + imgp-auxarg_size=(imgp-auxarg_size)?imgp-auxarg_size + :(AT_COUNT*2); /* * The '+ 2' is for the null pointers at the end of each of the -* arg and env vector sets, and 'AT_COUNT*2' is room for the -* ELF Auxargs data. +* arg and env vector sets,and imgp-auxarg_size is room for argument +* of Runtime loader. */ vectp = (char **)(destp - (imgp-argc + imgp-envc + 2 + - AT_COUNT*2) * sizeof(char*)); + imgp-auxarg_size) * sizeof(char*)); + } else /* * The '+ 2' is for the null pointers at the end of each of the You can get These modules at http://www.planet.sci.kobe-u.ac.jp/~takawata/peace/peace4fbsd-kmodule.tar.gz General status: - Some command line application like FTP.EXE, CMD.EXE ,EXTRAC32.EXE can be run. - Simplest GUI application can be run,such as whello.exe ,distributed in PEACE website. ToDO priority order. - Merge the patch to precede .(Who should I ask about it?) - Merge pecoff loader module to FreeBSD. - Create native ld.so.dll ,pecoff format of libc.a and libc.dll . - Share library sources with NetBSD version as much as we can. NOTE: I don't subscribe freebsd-emulation. Thanks in advance . Takanori Watanabe a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html" Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: PEACE - Portable Executable win32 API Compatible Environment.
In message [EMAIL PROTECTED], Steve Kargl wrote: Dag-Erling Smorgrav wrote: Takanori Watanabe [EMAIL PROTECTED] writes: PEACE is Win32 API Compatible environment for (Originally) NetBSD. It consist of three parts: Kernel part to load PE format executable onto process memory space. Dynamic Linker to link with PE format DLL. Libraries to translate Win32 API call to NetBSD native system call. What is the difference between PEACE and WINE? Wine is actually trying to completely replace MS windows (include win3.1, win95, win98, and winnt). SO, wine includes code for the old 16 bit API(s) and it is trying to replace all on the MS dll's with built-in dll. Yes ,but more essential difference is the way the executable binaries are treated. In FreeBSD Linux ABI support,executable binariies are treated as a executable text and kernel translate system calls so static Linux binaries can be run. ++ |Linux | | binary | |+ Lib | || +--^-+ | -v---KERNEL |Linux Syscall| |Entry| +-+ In Wine, Wine behaves as operation system that runs under FreeBSD and from FreeBSD, Windows executable is treated as data file. +Wine+ | ++ | | |Windows | | | |App.+lib| | | +^---+ | | | | +--v-| | Internal Lib | +^---+ | v--KERNEL (Native system entry) In PEACE,kernel execute PE executable (NE Win16 Binaries and DOS application is not supported) directry and prepare library imprementing win32 API by FreeBSD native system call and replace some win32 library by it. +--+ |Win32 Exec| |+some native |Lib. ++ | || +-+| |replaced lib +---^--+ | | --vKERNEL--- (Native sysent) That is my understanding. Takanori Watanabe a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html" Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Merging ACPI related code is on the way.
Hi, I have committed orthognal part of ACPI driver. The rest part will be committed after a few days. I put the part at URL:http://people.freebsd.org/~takawata/sysdiff. This can be applied for HEAD. Please test and report about it if there is serious problem,such as breaking build. Thanks. Takanori Watanabe a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html" Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
FreeBSD-CURRENT on Bochs VM.
Hi, I heard that bochs (ports/emulators/bochs) gets now LGPLed, so I tryed to run FreeBSD-CURRENT on bochs VM,then I got two problems. 1.ISA PnP module try to read 0x??3 address. and Virtual VGA controller in bochs does not accept to read on 0x3e3 then the bochs VM panics. 2.ATA driver always issues ATA_C_SETFEATURES(0xef) command and the command is not acceped by virtual disk controller on bochs does not accept the command then the bochs VM panics. I'll also report bochs ML about this.But Just FYI. Takanori Watanabe a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html" Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: an lm79 device driver
In message [EMAIL PROTECTED], Todd Han sen wrote: Brian Powell and I recently finished implementing a FreeBSD device driver for the lm79 system monitor by national semiconductor. We are interested in submitting it for inclusion in the FreeBSD kernel. However, we are also very interested in getting constructive feedback on our design. You can access the driver at: http://millenium.atcg.com/~taco/lm79.html. Below is a listing of features and areas we would like some ideas on in order to pursue further. BTW, if this device driver ever gets into FreeBSD we are interested in further developing it and supporting it as well. I checked it.And it seems to be written in before-2.2 manner.And ISA only device. I also wrote a simple driver that supports LM78/79 ,W83781 ,AS88127F as a device of smbus.For ISA device, I wrote a device driver that pretend SMbus.I sent PR about the ISA driver part at i386/14891. Will you have a look my code at URL:http://www.planet.sci.kobe-u.ac.jp/~takawata/smbus/sys/lm-new.tar.gz ? Takanori Watanabe. a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html" Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: mrtg,FreeBSD, asus p2b temperature
In message [EMAIL PROTECTED], Oliver Fromme wrote: Someone has a method of monitoring temperatures via a probe at a reasonable cost and inputting it to the computer but I don't remember where I saw it. Not necessary. The mainboards of the ASUS P2B series have everything onboard that you need. We have it working with the intpm0 driver and a tool called "lm" that I donwloaded from somewhere in Japan (forgot the URL, sorry). Call me?;-) If you mention lm.c, it is available from http://www.planet.sci.kobe-u.ac.jp/~takawata/smbus/examples/ . However, the problem is, it only works with 3.0-current from around January. It doesn't work with any recent -stable or -current. I suspected it was because of newbus, so I tried to port it, but without success. :-( It *does* work on recent CURRENT.You need not to patch for CURRENT kernel,just config(8) with controller intpm0 controller smbus0 device smb0 . But will not work on STABLE or RELEASE because intpm(4) is not merged. I port it to 3.2-STABLE , and I send it for Nicolas,the GURU of IICBus/SMbus. There is another tool to monitor Templature as an applet for Window Maker. (sysutils/wmhm/) Takanori Watanabe a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html" Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: mrtg,FreeBSD, asus p2b temperature
In message [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: But will not work on STABLE or RELEASE because intpm(4) is not merged. I port it to 3.2-STABLE , and I send it for Nicolas,the GURU of IICBus/SMbus . Not perfectly yet. I only pointed out the bug that was containd in the patch he send to me.I checked by my spd.c .But I don't sure whether the code was correct. Basically,import Revision 1.4 of intpm.c and newest version of intpmreg.h , and add the imported file to conf/files . The patch he send to me(gziped) This contains bug in the patch applied to smbconf.c @@ -109,11 +137,11 @@ . This will cause infinite loop when you issue request. 'while(error !=EWOULDBLOCK)' is wrong because this loop should be ended when error==0 . And here is the merged version of intpm.c The merged from current version of intpm.c(gziped)
Re: damn ATX power supplies...
In message [EMAIL PROTECTED], Nicolas Souchu wrote: On Sun, Sep 12, 1999 at 10:51:13PM +0100, Tony Finch wrote: Peter Wemm [EMAIL PROTECTED] wrote: On newer motherboards, it's addressable on the SMB bus (along with the SIMMS, the LM78/LM75/etc, the embedded LM75 in the newer CPU, etc). Anyway, the newer devices are programmable to do things like the 4-second power off delay, auto-on with AC, maintain previous state when AC restored, alarm clock time auto start, as well as the usual "turn off now" command from the APM bios. I think 4-second power off delay etc. is not so related with SMBus but power management controller on PCI.And that should be probed via ACPI BIOS table,not PCI probe,though I wrote a patch for intpm so that it install power off handler. URL:http://www.planet.sci.kobe-u.ac.jp/~takawata/smbus/sys/intpmpm.tar.gz Is there any software out there that speaks to /dev/smb? intelligently? We have some Dell boxen with loads of SMB stuff in them; it'd be nice to be able to see what's going on there. Alternatively, are there freely-available SMB specs? I have some piece of program.(Accessing SPD,LM75/LM78) URL:http://www.planet.sci.kobe-u.ac.jp/~takawata/smbus/ But general problem is that there is no way to probe from hardware. And on PIIX4, most hardware monitoring chip have ISA interface and accessable at port 0x295,0x296. BTW I looked datasheet of i810 chipset URL:http://developer.intel.com/design/chipsets/datashts/29065503.pdf and find SMBus functional and Power Management functional is separated. Though I don't write the driver for it because I don't have it. Takanori Watanabe a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html" Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A P.S. Are there any people to work on audio and telephony device on i810? To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message
Re: damn ATX power supplies...
In message 19990916220426.04...@breizh.free.fr, Nicolas Souchu wrote: On Sun, Sep 12, 1999 at 10:51:13PM +0100, Tony Finch wrote: Peter Wemm pe...@netplex.com.au wrote: On newer motherboards, it's addressable on the SMB bus (along with the SIMMS, the LM78/LM75/etc, the embedded LM75 in the newer CPU, etc). Anyway, the newer devices are programmable to do things like the 4-second power off delay, auto-on with AC, maintain previous state when AC restored, alarm clock time auto start, as well as the usual turn off now command from the APM bios. I think 4-second power off delay etc. is not so related with SMBus but power management controller on PCI.And that should be probed via ACPI BIOS table,not PCI probe,though I wrote a patch for intpm so that it install power off handler. URL:http://www.planet.sci.kobe-u.ac.jp/~takawata/smbus/sys/intpmpm.tar.gz Is there any software out there that speaks to /dev/smb? intelligently? We have some Dell boxen with loads of SMB stuff in them; it'd be nice to be able to see what's going on there. Alternatively, are there freely-available SMB specs? I have some piece of program.(Accessing SPD,LM75/LM78) URL:http://www.planet.sci.kobe-u.ac.jp/~takawata/smbus/ But general problem is that there is no way to probe from hardware. And on PIIX4, most hardware monitoring chip have ISA interface and accessable at port 0x295,0x296. BTW I looked datasheet of i810 chipset URL:http://developer.intel.com/design/chipsets/datashts/29065503.pdf and find SMBus functional and Power Management functional is separated. Though I don't write the driver for it because I don't have it. Takanori Watanabe a href=http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html; Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A P.S. Are there any people to work on audio and telephony device on i810? To Unsubscribe: send mail to majord...@freebsd.org with unsubscribe freebsd-hackers in the body of the message
New(bus|pnp)-ifyed joy(4)
Hi, I write patch for joy.c so that it recognize CS4235 Game port by PnP. API do work,but hardware seems to be uninitialized. (Read returns only 0x8000) Are there any person who review this? To use PnP Interface, write simply device joy0 and add your GAME port ID to joy_ids[]; Takanori Watanabe a href="http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html" Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A BTW. diff -u /home/ctm/src/sys/i386/isa/isa_compat.h ./isa_compat.h --- /home/ctm/src/sys/i386/isa/isa_compat.h Thu Sep 9 08:17:07 1999 +++ ./isa_compat.h Thu Sep 9 09:27:49 1999 @@ -140,7 +140,9 @@ extern struct isa_driver spigotdriver; extern struct isa_driver gpdriver; extern struct isa_driver gscdriver; +#if 0 extern struct isa_driver joydriver; +#endif extern struct isa_driver cydriver; extern struct isa_driver dgbdriver; extern struct isa_driver dgmdriver; @@ -371,7 +373,7 @@ #if NSPIGOT 0 { INTR_TYPE_MISC, spigotdriver }, #endif -#if NJOY 0 +#if 0 { INTR_TYPE_MISC, joydriver }, #endif diff -u /home/ctm/src/sys/i386/isa/joy.c ./joy.c --- /home/ctm/src/sys/i386/isa/joy.cFri Aug 27 03:17:58 1999 +++ ./joy.c Thu Sep 9 10:04:56 1999 @@ -35,12 +35,19 @@ #include sys/kernel.h #include sys/uio.h + + #include machine/clock.h #include machine/joystick.h +#include machine/bus.h -#include i386/isa/isa.h -#include i386/isa/isa_device.h +#include sys/bus.h +#include sys/rman.h +#include machine/resource.h +#include isa/isareg.h +#include isa/isavar.h #include i386/isa/timerreg.h +#include "isa_if.h" /* The game port can manage 4 buttons and 4 variable resistors (usually 2 * joysticks, each with 2 buttons and 2 pots.) via the port at address 0x201. @@ -65,17 +72,17 @@ #define JOY_TIMEOUT 2000 /* 2 milliseconds */ #endif -static struct { -int port; +struct joy_softc{ +bus_space_tag_t bt; +bus_space_handle_t port; int x_off[2], y_off[2]; int timeout[2]; -} joy[NJOY]; +} ; -static int joyprobe (struct isa_device *); -static int joyattach (struct isa_device *); +static int joy_probe (device_t); +static int joy_attach (device_t); -struct isa_driver joydriver = {joyprobe, joyattach, "joy"}; #define CDEV_MAJOR 51 static d_open_tjoyopen; @@ -107,12 +114,17 @@ static int get_tick __P((void)); - +devclass_t joy_devclass; +static struct isa_pnp_id joy_ids[] = { + {0x0100630e,"CS4235 PnP Joystick"}, + {0} +}; static int -joyprobe (struct isa_device *dev) +joy_probe (device_t dev) { static int once; - +if(ISA_PNP_PROBE(device_get_parent(dev),dev,joy_ids)==ENXIO) + return ENXIO; if (!once++) cdevsw_add(joy_cdevsw); #ifdef WANT_JOYSTICK_CONNECTED @@ -120,60 +132,77 @@ DELAY (1); /* 10 ms delay */ return (inb (dev-id_iobase) 0x0f) != 0x0f; #else -return 1; +return 0; #endif } static int -joyattach (struct isa_device *dev) +joy_attach (device_t dev) { -intunit = dev-id_unit; - -joy[unit].port = dev-id_iobase; -joy[unit].timeout[0] = joy[unit].timeout[1] = 0; -printf("joy%d: joystick\n", unit); +intunit = device_get_unit(dev); +int rid=0; +struct resource *res; +struct joy_softc *joy=device_get_softc(dev); +res=bus_alloc_resource(dev,SYS_RES_IOPORT,rid,0,~0,8,RF_ACTIVE); +if(res==NULL) + return ENXIO; +joy-bt =rman_get_bustag(res); +joy-port = rman_get_bushandle(res); +joy-timeout[0] = joy-timeout[1] = 0; +printf("joy%d : joystick\n ", unit); make_dev(joy_cdevsw, 0, 0, 0, 0600, "joy%d", unit); -return 1; +return 0; } +static device_method_t joy_methods[]={ + DEVMETHOD(device_probe,joy_probe), + DEVMETHOD(device_attach,joy_attach), + {0,0} +}; +static driver_t joy_isa_driver ={ + "joy", + joy_methods, + sizeof (struct joy_softc) +}; +DRIVER_MODULE(joy,isa,joy_isa_driver,joy_devclass,0,0); static int joyopen (dev_t dev, int flags, int fmt, struct proc *p) { -int unit = UNIT (dev); int i = joypart (dev); +struct joy_softc *joy=devclass_get_softc(joy_devclass,UNIT(dev)); -if (joy[unit].timeout[i]) +if (joy-timeout[i]) return EBUSY; -joy[unit].x_off[i] = joy[unit].y_off[i] = 0; -joy[unit].timeout[i] = JOY_TIMEOUT; +joy-x_off[i] = joy-y_off[i] = 0; +joy-timeout[i] = JOY_TIMEOUT; return 0; } static int joyclose (dev_t dev, int flags, int fmt, struct proc *p) { -int unit = UNIT (dev); int i = joypart (dev); - -joy[unit].timeout[i] = 0; +struct joy_softc *joy=devclass_get_softc(joy_devclass,UNIT(dev)); +joy-timeout[i] = 0; return 0; } static int joyread (dev_t dev, struct uio *uio, int flag) { -int unit = UNIT(dev); -int port = joy[unit].port; +struct joy_softc *joy=devclass_get_softc(joy_devclass,UNIT(dev)); +int port = joy-port; +
New(bus|pnp)-ifyed joy(4)
Hi, I write patch for joy.c so that it recognize CS4235 Game port by PnP. API do work,but hardware seems to be uninitialized. (Read returns only 0x8000) Are there any person who review this? To use PnP Interface, write simply device joy0 and add your GAME port ID to joy_ids[]; Takanori Watanabe a href=http://www.planet.sci.kobe-u.ac.jp/~takawata/key.html; Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A BTW. diff -u /home/ctm/src/sys/i386/isa/isa_compat.h ./isa_compat.h --- /home/ctm/src/sys/i386/isa/isa_compat.h Thu Sep 9 08:17:07 1999 +++ ./isa_compat.h Thu Sep 9 09:27:49 1999 @@ -140,7 +140,9 @@ extern struct isa_driver spigotdriver; extern struct isa_driver gpdriver; extern struct isa_driver gscdriver; +#if 0 extern struct isa_driver joydriver; +#endif extern struct isa_driver cydriver; extern struct isa_driver dgbdriver; extern struct isa_driver dgmdriver; @@ -371,7 +373,7 @@ #if NSPIGOT 0 { INTR_TYPE_MISC, spigotdriver }, #endif -#if NJOY 0 +#if 0 { INTR_TYPE_MISC, joydriver }, #endif diff -u /home/ctm/src/sys/i386/isa/joy.c ./joy.c --- /home/ctm/src/sys/i386/isa/joy.cFri Aug 27 03:17:58 1999 +++ ./joy.c Thu Sep 9 10:04:56 1999 @@ -35,12 +35,19 @@ #include sys/kernel.h #include sys/uio.h + + #include machine/clock.h #include machine/joystick.h +#include machine/bus.h -#include i386/isa/isa.h -#include i386/isa/isa_device.h +#include sys/bus.h +#include sys/rman.h +#include machine/resource.h +#include isa/isareg.h +#include isa/isavar.h #include i386/isa/timerreg.h +#include isa_if.h /* The game port can manage 4 buttons and 4 variable resistors (usually 2 * joysticks, each with 2 buttons and 2 pots.) via the port at address 0x201. @@ -65,17 +72,17 @@ #define JOY_TIMEOUT 2000 /* 2 milliseconds */ #endif -static struct { -int port; +struct joy_softc{ +bus_space_tag_t bt; +bus_space_handle_t port; int x_off[2], y_off[2]; int timeout[2]; -} joy[NJOY]; +} ; -static int joyprobe (struct isa_device *); -static int joyattach (struct isa_device *); +static int joy_probe (device_t); +static int joy_attach (device_t); -struct isa_driver joydriver = {joyprobe, joyattach, joy}; #define CDEV_MAJOR 51 static d_open_tjoyopen; @@ -107,12 +114,17 @@ static int get_tick __P((void)); - +devclass_t joy_devclass; +static struct isa_pnp_id joy_ids[] = { + {0x0100630e,CS4235 PnP Joystick}, + {0} +}; static int -joyprobe (struct isa_device *dev) +joy_probe (device_t dev) { static int once; - +if(ISA_PNP_PROBE(device_get_parent(dev),dev,joy_ids)==ENXIO) + return ENXIO; if (!once++) cdevsw_add(joy_cdevsw); #ifdef WANT_JOYSTICK_CONNECTED @@ -120,60 +132,77 @@ DELAY (1); /* 10 ms delay */ return (inb (dev-id_iobase) 0x0f) != 0x0f; #else -return 1; +return 0; #endif } static int -joyattach (struct isa_device *dev) +joy_attach (device_t dev) { -intunit = dev-id_unit; - -joy[unit].port = dev-id_iobase; -joy[unit].timeout[0] = joy[unit].timeout[1] = 0; -printf(joy%d: joystick\n, unit); +intunit = device_get_unit(dev); +int rid=0; +struct resource *res; +struct joy_softc *joy=device_get_softc(dev); +res=bus_alloc_resource(dev,SYS_RES_IOPORT,rid,0,~0,8,RF_ACTIVE); +if(res==NULL) + return ENXIO; +joy-bt =rman_get_bustag(res); +joy-port = rman_get_bushandle(res); +joy-timeout[0] = joy-timeout[1] = 0; +printf(joy%d : joystick\n , unit); make_dev(joy_cdevsw, 0, 0, 0, 0600, joy%d, unit); -return 1; +return 0; } +static device_method_t joy_methods[]={ + DEVMETHOD(device_probe,joy_probe), + DEVMETHOD(device_attach,joy_attach), + {0,0} +}; +static driver_t joy_isa_driver ={ + joy, + joy_methods, + sizeof (struct joy_softc) +}; +DRIVER_MODULE(joy,isa,joy_isa_driver,joy_devclass,0,0); static int joyopen (dev_t dev, int flags, int fmt, struct proc *p) { -int unit = UNIT (dev); int i = joypart (dev); +struct joy_softc *joy=devclass_get_softc(joy_devclass,UNIT(dev)); -if (joy[unit].timeout[i]) +if (joy-timeout[i]) return EBUSY; -joy[unit].x_off[i] = joy[unit].y_off[i] = 0; -joy[unit].timeout[i] = JOY_TIMEOUT; +joy-x_off[i] = joy-y_off[i] = 0; +joy-timeout[i] = JOY_TIMEOUT; return 0; } static int joyclose (dev_t dev, int flags, int fmt, struct proc *p) { -int unit = UNIT (dev); int i = joypart (dev); - -joy[unit].timeout[i] = 0; +struct joy_softc *joy=devclass_get_softc(joy_devclass,UNIT(dev)); +joy-timeout[i] = 0; return 0; } static int joyread (dev_t dev, struct uio *uio, int flag) { -int unit = UNIT(dev); -int port = joy[unit].port; +struct joy_softc *joy=devclass_get_softc(joy_devclass,UNIT(dev)); +int port = joy-port; +int bt=joy-bt; int i, t0, t1; int state = 0, x = 0, y = 0; struct joystick c
Re: ISA LM78 driver help
In message pine.bsf.4.05.9905221943010.13140-100...@medulla.hippocampus.net, Marc Nicholas wrote: Hello there... I have an application where I require access to an LM78 health monitor chip on a certain type of industrial PC motherboard we use. Unfortunately, the LM78 is tied to ISA and not I2C/SMBus. Can anyone recommend a good framework to start writing a driver for this beastie? I've never actually written a driver before (*gulp*), so please treat me gently ;-) In essense, the chip sits at 0x290 with an address line at 0x290+5 and a data line at 0x290+6. I'd be happy writing a program that merely peeks and pokes in that address area, rather than a fully-fledged driver... TIA. I have two imprementation about it. One is userland imprementation based on code by Shimizu-san. It is available at http://www.planet.sci.kobe-u.ac.jp/~takawata/smbus/examples/xmbmon104.new.tar.gz And I wrote experimental kernel driver for LM78. http://www.planet.sci.kobe-u.ac.jp/~takawata/smbus/sys/lm-dist.tar.gz Regards, Takanori Watanabe a href=http://www.planet.kobe-u.ac.jp/~takawata/key.html; Public Key/a Key fingerprint = 2C 51 E2 78 2C E1 C5 2D 0F F1 20 A3 11 3A 62 2A To Unsubscribe: send mail to majord...@freebsd.org with unsubscribe freebsd-hackers in the body of the message