diff --git a/src/sys/include/sys/device.h b/src/sys/include/sys/device.h index 3c88a8f..9da2818 100644 --- a/src/sys/include/sys/device.h +++ b/src/sys/include/sys/device.h @@ -55,7 +55,7 @@ }; -int deviceAdd(int,struct deviceInterface *); +int deviceAdd(int,char,struct deviceInterface *); struct deviceNode *deviceFind(int major,int minor); #endif diff --git a/src/sys/pci/hd.c b/src/sys/pci/hd.c index 36d67aa..9671fcf 100644 --- a/src/sys/pci/hd.c +++ b/src/sys/pci/hd.c @@ -1,52 +1,27 @@ /***************************************************************************************** - Copyright (c) 2002 The UbixOS Project + Copyright (c) 2002-2004 The UbixOS Project All rights reserved. -Redistribution and use in source and binary forms, with or without modification, are -permitted provided that the following conditions are met: + Redistribution and use in source and binary forms, with or without modification, are + permitted provided that the following conditions are met: -Redistributions of source code must retain the above copyright notice, this list of -conditions, the following disclaimer and the list of authors. Redistributions in binary -form must reproduce the above copyright notice, this list of conditions, the following -disclaimer and the list of authors in the documentation and/or other materials provided -with the distribution. Neither the name of the UbixOS Project nor the names of its -contributors may be used to endorse or promote products derived from this software -without specific prior written permission. + Redistributions of source code must retain the above copyright notice, this list of + conditions, the following disclaimer and the list of authors. Redistributions in binary + form must reproduce the above copyright notice, this list of conditions, the following + disclaimer and the list of authors in the documentation and/or other materials provided + with the distribution. Neither the name of the UbixOS Project nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - $Log$ - Revision 1.6 2004/04/28 21:10:40 reddawg - Lots Of changes to make it work with existing os - - Revision 1.5 2004/04/28 02:37:34 reddawg - More updates for using the new driver subsystem - - Revision 1.4 2004/04/28 02:22:54 reddawg - This is a fiarly large commit but we are starting to use new driver model - all around - - Revision 1.3 2004/04/27 21:05:19 reddawg - Updating drivers to use new model - - Revision 1.2 2004/04/26 22:22:33 reddawg - DevFS now uses correct size of device - - Revision 1.1.1.1 2004/04/15 12:07:16 reddawg - UbixOS v1.0 - - Revision 1.12 2004/04/13 16:36:33 reddawg - Changed our copyright, it is all now under a BSD-Style license - - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $Id$ @@ -67,6 +42,7 @@ struct driveInfo *hdd3; void initHardDisk() { + struct deviceInterface *devInfo = 0x0; hdd0 = (struct driveInfo *)kmalloc(sizeof(struct driveInfo)); hdd0s1 = (struct driveInfo *)kmalloc(sizeof(struct driveInfo)); hdd1 = (struct driveInfo *)kmalloc(sizeof(struct driveInfo)); @@ -84,8 +60,23 @@ hdd2->hdDev = 0x40; hdd3->hdPort = 0x177; hdd3->hdDev = 0x50; - deviceAdd(1,0,'c',hdRead,hdWrite,hdReset,hdInit,hdIoctl,hdStop,hdStart,hdStandby,hdd0); - deviceAdd(1,1,'c',hdRead,hdWrite,hdReset,hdInit,hdIoctl,hdStop,hdStart,hdStandby,hdd0s1); + + /* Alloc memory for device structure and set it up correctly */ + devInfo = (struct deviceInterface *)kmalloc(sizeof(struct deviceInterface)); + devInfo->read = hdRead; + devInfo->write = hdWrite; + devInfo->reset = hdReset; + devInfo->init = hdInit; + devInfo->ioctl = hdIoctl; + devInfo->stop = hdStop; + devInfo->start = hdStart; + defInfo->standby = hdStandby; + defInfo->info = hdd0; + defInfo->major = 1; + deviceAdd(0,'c',devInfo); + + //deviceAdd(1,0,'c',hdRead,hdWrite,hdReset,hdInit,hdIoctl,hdStop,hdStart,hdStandby,hdd0); + //deviceAdd(1,1,'c',hdRead,hdWrite,hdReset,hdInit,hdIoctl,hdStop,hdStart,hdStandby,hdd0s1); devFsMkNod("ad0",'c',0x1,0x0); devFsMkNod("ad0s1",'c',0x1,0x1); /* @@ -323,6 +314,31 @@ } /*** + $Log$ + Revision 1.7 2004/05/19 04:07:43 reddawg + kmalloc(size,pid) no more it is no kmalloc(size); the way it should of been + + Revision 1.6 2004/04/28 21:10:40 reddawg + Lots Of changes to make it work with existing os + + Revision 1.5 2004/04/28 02:37:34 reddawg + More updates for using the new driver subsystem + + Revision 1.4 2004/04/28 02:22:54 reddawg + This is a fiarly large commit but we are starting to use new driver model + all around + + Revision 1.3 2004/04/27 21:05:19 reddawg + Updating drivers to use new model + + Revision 1.2 2004/04/26 22:22:33 reddawg + DevFS now uses correct size of device + + Revision 1.1.1.1 2004/04/15 12:07:16 reddawg + UbixOS v1.0 + + Revision 1.12 2004/04/13 16:36:33 reddawg + Changed our copyright, it is all now under a BSD-Style license + END ***/ - diff --git a/src/sys/sys/device.c b/src/sys/sys/device.c index 3b91985..651ea9e 100644 --- a/src/sys/sys/device.c +++ b/src/sys/sys/device.c @@ -35,7 +35,7 @@ /***************************************************************************************** - Function: int deviceAdd(int minor,struct deviceInterface *devInfo); + Function: int deviceAdd(int minor,char type,struct deviceInterface *devInfo); Description: This will add a device to the system @@ -44,7 +44,7 @@ 05/19/2004 - Improving Upon the spec *****************************************************************************************/ -int deviceAdd(int minor,struct deviceInterface *devInfo) { +int deviceAdd(int minor,char type,struct deviceInterface *devInfo) { struct deviceNode *tmpDev = kmalloc(sizeof(struct deviceNode)); tmpDev->prev = 0x0; tmpDev->minor = minor; @@ -78,6 +78,9 @@ /*** $Log$ + Revision 1.4 2004/05/19 14:57:25 reddawg + Changed The Device Interface + Revision 1.3 2004/05/19 04:07:43 reddawg kmalloc(size,pid) no more it is no kmalloc(size); the way it should of been