Only in sys/dev/smbus: lmc-smbus.c diff -r -u /home/ctm/src/sys/dev/smbus/smb.c sys/dev/smbus/smb.c --- /home/ctm/src/sys/dev/smbus/smb.c Tue May 11 10:23:12 1999 +++ sys/dev/smbus/smb.c Wed May 12 10:01:03 1999 @@ -105,7 +105,7 @@ smb_probe(device_t dev) { struct smb_softc *sc = (struct smb_softc *)device_get_softc(dev); - + device_set_desc(dev,"SMBus General purpose I/O"); sc->sc_addr = smbus_get_addr(dev); /* XXX detect chip with start/stop conditions */ @@ -126,7 +126,9 @@ smbopen (dev_t dev, int flags, int fmt, struct proc *p) { struct smb_softc *sc = IIC_SOFTC(minor(dev)); - + /*This device is as dangerous as PIO*/ + if(suser(p)) + return (EPERM); if (!sc) return (EINVAL); Only in sys/dev/smbus: smb.c~ diff -r -u /home/ctm/src/sys/dev/smbus/smbconf.c sys/dev/smbus/smbconf.c --- /home/ctm/src/sys/dev/smbus/smbconf.c Wed Feb 17 02:17:35 1999 +++ sys/dev/smbus/smbconf.c Wed May 12 08:59:03 1999 @@ -36,7 +36,7 @@ #include #include #include "smbus_if.h" - +#include "smbus.h" /* * smbus_intr() */ @@ -86,16 +86,48 @@ * Allocate a new bus connected to the given parent device */ device_t -smbus_alloc_bus(device_t parent) +smbus_alloc_bus_unit(device_t parent,int unit) { device_t child; - /* add the bus to the parent */ - child = device_add_child(parent, "smbus", -1, NULL); + child = device_add_child(parent, "smbus", unit, NULL); return (child); } - +device_t +smbus_alloc_bus(device_t parent) +{ + int i; + char *value,*parent_name; + static char namebuf[32]=""; + int unit=-1,parentunit; + parent_name=devclass_get_name(device_get_devclass(parent)); + parentunit=device_get_unit(parent); + /*translate internal name to name appear in resource*/ + if(strcmp(parent_name,"intsmb")==0){ + parent_name="intpm"; + } + if(strcmp(parent_name,"bti2c")==0){ + parent_name="bktr"; + } + + /*Too long devclass name,so ignore locator*/ + if(strlen(parent_name)>20){ + printf("smbus_alloc_bus:too long parent name so ignore locator"); + }else{ + sprintf(namebuf,"%s%d",parent_name,parentunit); + } + for(i=0;ismbd_name; smbdev++) { - device_t child; - - if (devclass_find(smbdev->smbd_name)) { - child = device_add_child(dev, smbdev->smbd_name, - -1, smbdev); - device_set_desc(child, smbdev->smbd_desc); - } else if (bootverbose) - printf("smbus: %s devclass not found\n", - smbdev->smbd_name); + for (i = resource_query_string(-1,"at",buf); + i!=-1; + i=resource_query_string(i,"at",buf)) { + device_t child; + child = device_add_child(dev, resource_query_name(i), + resource_query_unit(i), 0); + } + for (i = resource_query_string(-1,"at","smbus"); + i!=-1; + i=resource_query_string(i,"at","smbus")) { + device_t child; + child = device_add_child(dev, resource_query_name(i), + resource_query_unit(i), 0); } bus_generic_attach(dev);