Date: Sun, 16 May 2004 14:33:50 -0700 (PDT) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 52882 for review Message-ID: <200405162133.i4GLXopZ020809@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=52882 Change 52882 by peter@peter_overcee on 2004/05/16 14:33:43 IFC @52881 Affected files ... .. //depot/projects/hammer/sys/amd64/amd64/pmap.c#65 integrate .. //depot/projects/hammer/sys/amd64/amd64/support.S#22 integrate .. //depot/projects/hammer/sys/amd64/conf/GENERIC#39 integrate .. //depot/projects/hammer/sys/amd64/conf/NOTES#28 integrate .. //depot/projects/hammer/sys/amd64/include/pmap.h#32 integrate .. //depot/projects/hammer/sys/dev/cy/cy.c#2 integrate .. //depot/projects/hammer/sys/dev/iicbus/iic.c#6 integrate .. //depot/projects/hammer/sys/dev/iicbus/iicbus.c#4 integrate .. //depot/projects/hammer/sys/dev/smbus/smb.c#6 integrate .. //depot/projects/hammer/sys/dev/smbus/smb.h#2 integrate Differences ... ==== //depot/projects/hammer/sys/amd64/amd64/pmap.c#65 (text+ko) ==== @@ -75,7 +75,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.457 2004/04/16 03:45:28 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.458 2004/05/16 20:44:41 peter Exp $"); /* * Manages physical address maps. ==== //depot/projects/hammer/sys/amd64/amd64/support.S#22 (text+ko) ==== @@ -27,7 +27,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/amd64/amd64/support.S,v 1.108 2004/04/05 23:55:13 imp Exp $ + * $FreeBSD: src/sys/amd64/amd64/support.S,v 1.109 2004/05/16 20:46:13 peter Exp $ */ #include "opt_ddb.h" ==== //depot/projects/hammer/sys/amd64/conf/GENERIC#39 (text+ko) ==== @@ -16,7 +16,7 @@ # If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # -# $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.407 2004/05/02 20:40:18 marcel Exp $ +# $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.408 2004/05/16 20:57:01 peter Exp $ machine amd64 cpu HAMMER ==== //depot/projects/hammer/sys/amd64/conf/NOTES#28 (text+ko) ==== @@ -5,7 +5,7 @@ # machine independent notes, look in /sys/conf/NOTES. # # (XXX from i386:NOTES,v 1.1158) -# $FreeBSD: src/sys/amd64/conf/NOTES,v 1.12 2004/03/13 22:16:34 peter Exp $ +# $FreeBSD: src/sys/amd64/conf/NOTES,v 1.13 2004/05/16 21:27:29 peter Exp $ # # We don't have modules on amd64. @@ -295,6 +295,7 @@ # # Miscellaneous hardware: # +# cy: Cyclades serial driver # digi: Digiboard driver # Notes on the Specialix SI/XIO driver: @@ -305,14 +306,7 @@ device cy options CY_PCI_FASTINTR # Use with cy_pci unless irq is shared -hint.cy.0.at="isa" -hint.cy.0.irq="10" -hint.cy.0.maddr="0xd4000" -hint.cy.0.msize="0x2000" device digi -hint.digi.0.at="isa" -hint.digi.0.port="0x104" -hint.digi.0.maddr="0xd0000" # BIOS & FEP/OS components of device digi. device digi_CX device digi_CX_PCI @@ -323,7 +317,7 @@ device digi_Xr # sx device is i386 and pc98 only at the moment. device sx -options SX_DEBUG +options SX_DEBUG # HOT1 Xilinx 6200 card (http://www.vcc.com/) device xrpu ==== //depot/projects/hammer/sys/amd64/include/pmap.h#32 (text+ko) ==== @@ -39,7 +39,7 @@ * * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 - * $FreeBSD: src/sys/amd64/include/pmap.h,v 1.114 2004/05/16 20:30:46 peter Exp $ + * $FreeBSD: src/sys/amd64/include/pmap.h,v 1.115 2004/05/16 20:44:41 peter Exp $ */ #ifndef _MACHINE_PMAP_H_ ==== //depot/projects/hammer/sys/dev/cy/cy.c#2 (text+ko) ==== @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/cy/cy.c,v 1.144 2004/05/01 18:09:16 bde Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/cy/cy.c,v 1.145 2004/05/16 21:22:45 peter Exp $"); #include "opt_compat.h" @@ -2768,7 +2768,6 @@ struct com_s *basecom; u_char car; int cy_align; - register_t eflags; cy_addr iobase; #ifdef SMP int need_unlock; @@ -2779,7 +2778,6 @@ car = com->unit & CD1400_CAR_CHAN; cy_align = com->cy_align; iobase = com->iobase; - eflags = read_eflags(); critical_enter(); #ifdef SMP need_unlock = 0; @@ -2808,7 +2806,6 @@ struct com_s *basecom; u_char car; int cy_align; - register_t eflags; cy_addr iobase; #ifdef SMP int need_unlock; @@ -2818,7 +2815,6 @@ car = com->unit & CD1400_CAR_CHAN; cy_align = com->cy_align; iobase = com->iobase; - eflags = read_eflags(); critical_enter(); #ifdef SMP need_unlock = 0; ==== //depot/projects/hammer/sys/dev/iicbus/iic.c#6 (text+ko) ==== @@ -23,12 +23,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/iicbus/iic.c,v 1.30 2004/02/21 21:10:42 phk Exp $ + * $FreeBSD: src/sys/dev/iicbus/iic.c,v 1.31 2004/05/16 21:19:59 joerg Exp $ * */ #include <sys/param.h> #include <sys/kernel.h> #include <sys/systm.h> +#include <sys/malloc.h> #include <sys/module.h> #include <sys/bus.h> #include <sys/conf.h> @@ -246,6 +247,7 @@ device_t parent = device_get_parent(iicdev); struct iiccmd *s = (struct iiccmd *)data; int error, count; + char *buf = NULL; if (!sc) return (EINVAL); @@ -278,19 +280,37 @@ break; case I2CWRITE: - error = iicbus_write(parent, s->buf, s->count, &count, 10); + if (s->count <= 0) { + error = EINVAL; + break; + } + buf = malloc((unsigned long)s->count, M_TEMP, M_WAITOK); + error = copyin(s->buf, buf, s->count); + if (error) + break; + error = iicbus_write(parent, buf, s->count, &count, 10); break; case I2CREAD: - error = iicbus_read(parent, s->buf, s->count, &count, s->last, 10); + if (s->count <= 0) { + error = EINVAL; + break; + } + buf = malloc((unsigned long)s->count, M_TEMP, M_WAITOK); + error = iicbus_read(parent, buf, s->count, &count, s->last, 10); + if (error) + break; + error = copyout(buf, s->buf, s->count); break; default: - error = ENODEV; + error = ENOTTY; } iicbus_release_bus(device_get_parent(iicdev), iicdev); + if (buf != NULL) + free(buf, M_TEMP); return (error); } ==== //depot/projects/hammer/sys/dev/iicbus/iicbus.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/iicbus/iicbus.c,v 1.18 2004/05/12 13:43:41 joerg Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/iicbus/iicbus.c,v 1.19 2004/05/16 21:11:46 joerg Exp $"); /* * Autoconfiguration and support routines for the Philips serial I2C bus @@ -140,7 +140,9 @@ #endif /* attach any known device */ - device_add_child(dev, NULL, -1); + device_add_child(dev, "ic", -1); + device_add_child(dev, "iic", -1); + device_add_child(dev, "iicsmb", -1); bus_generic_attach(dev); ==== //depot/projects/hammer/sys/dev/smbus/smb.c#6 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/smbus/smb.c,v 1.31 2004/02/21 21:10:47 phk Exp $ + * $FreeBSD: src/sys/dev/smbus/smb.c,v 1.32 2004/05/16 21:18:45 joerg Exp $ * */ #include <sys/param.h> @@ -194,6 +194,9 @@ device_t smbdev = IIC_DEVICE(minor(dev)); struct smb_softc *sc = IIC_SOFTC(minor(dev)); device_t parent = device_get_parent(smbdev); + char buf[SMB_MAXBLOCKSIZE]; + char c; + short w; int error = 0; struct smbcmd *s = (struct smbcmd *)data; @@ -234,37 +237,66 @@ break; case SMB_READB: - if (s->data.byte_ptr) + if (s->data.byte_ptr) { error = smbus_error(smbus_readb(parent, s->slave, - s->cmd, s->data.byte_ptr)); + s->cmd, &c)); + if (error) + break; + error = copyout(&c, s->data.byte_ptr, + sizeof(*(s->data.byte_ptr))); + } break; case SMB_READW: - if (s->data.word_ptr) + if (s->data.word_ptr) { error = smbus_error(smbus_readw(parent, s->slave, - s->cmd, s->data.word_ptr)); + s->cmd, &w)); + if (error == 0) { + error = copyout(&w, s->data.word_ptr, + sizeof(*(s->data.word_ptr))); + } + } break; case SMB_PCALL: - if (s->data.process.rdata) + if (s->data.process.rdata) { + error = smbus_error(smbus_pcall(parent, s->slave, s->cmd, - s->data.process.sdata, s->data.process.rdata)); + s->data.process.sdata, &w)); + if (error) + break; + error = copyout(&w, s->data.process.rdata, + sizeof(*(s->data.process.rdata))); + } + break; case SMB_BWRITE: - if (s->count && s->data.byte_ptr) + if (s->count && s->data.byte_ptr) { + if (s->count > SMB_MAXBLOCKSIZE) + s->count = SMB_MAXBLOCKSIZE; + error = copyin(s->data.byte_ptr, buf, s->count); + if (error) + break; error = smbus_error(smbus_bwrite(parent, s->slave, - s->cmd, s->count, s->data.byte_ptr)); + s->cmd, s->count, buf)); + } break; case SMB_BREAD: - if (s->count && s->data.byte_ptr) + if (s->count && s->data.byte_ptr) { + if (s->count > SMB_MAXBLOCKSIZE) + s->count = SMB_MAXBLOCKSIZE; error = smbus_error(smbus_bread(parent, s->slave, - s->cmd, s->count, s->data.byte_ptr)); + s->cmd, s->count, buf)); + if (error) + break; + error = copyout(buf, s->data.byte_ptr, s->count); + } break; default: - error = ENODEV; + error = ENOTTY; } /* release the bus */ ==== //depot/projects/hammer/sys/dev/smbus/smb.h#2 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/smbus/smb.h,v 1.3 1999/08/28 00:44:24 peter Exp $ + * $FreeBSD: src/sys/dev/smbus/smb.h,v 1.4 2004/05/16 21:18:45 joerg Exp $ * */ #ifndef __SMB_H @@ -49,10 +49,15 @@ } data; }; +/* + * SMBus spec 2.0 says block transfers may be at most 32 bytes. + */ +#define SMB_MAXBLOCKSIZE 32 + #define SMB_QUICK_WRITE _IOW('i', 1, struct smbcmd) #define SMB_QUICK_READ _IOW('i', 2, struct smbcmd) #define SMB_SENDB _IOW('i', 3, struct smbcmd) -#define SMB_RECVB _IOW('i', 4, struct smbcmd) +#define SMB_RECVB _IOWR('i', 4, struct smbcmd) #define SMB_WRITEB _IOW('i', 5, struct smbcmd) #define SMB_WRITEW _IOW('i', 6, struct smbcmd) #define SMB_READB _IOW('i', 7, struct smbcmd)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200405162133.i4GLXopZ020809>