diff --git a/src/bin/fdisk/main.c b/src/bin/fdisk/main.c index 9d43de1..4e6d9fc 100644 --- a/src/bin/fdisk/main.c +++ b/src/bin/fdisk/main.c @@ -68,7 +68,7 @@ } else { printf("Drive Info (ad0):\n"); - fd = fopen("ad0@devfs","rb"); + fd = fopen("devfs:ad0","rb"); } fseek(fd,0,0); fread(data,512,1,fd); @@ -76,7 +76,7 @@ if (argc >= 3) { i = atoi(argv[2]); if (i == 0) { - mbr = fopen("mbr@sys","rb"); + mbr = fopen("sys:mrb","rb"); fseek(mbr,0,0); fread(data,512,1,mbr); printf("Installing Ubix MBR\n"); @@ -119,6 +119,9 @@ /*** $Log$ + Revision 1.8 2004/06/01 01:30:43 reddawg + No more warnings and organized make files + Revision 1.7 2004/05/24 13:54:52 reddawg Clean Up diff --git a/src/sys/devfs/devfs.c b/src/sys/devfs/devfs.c index ea3eefd..bfc4120 100644 --- a/src/sys/devfs/devfs.c +++ b/src/sys/devfs/devfs.c @@ -69,7 +69,7 @@ case 1: device = device_find(tmpDev->devMajor,tmpDev->devMinor); (void *)fd->start = tmpDev; - fd->size = device->size; + fd->size = device->devInfo->size; break; default: kprintf("Invalid File Mode\n"); @@ -212,6 +212,11 @@ /*** $Log$ + Revision 1.15 2004/07/23 09:10:05 reddawg + ubixfs: cleaned up some functions played with the caching a bit + vfs: renamed a bunch of functions + cleaned up a few misc bugs + Revision 1.14 2004/07/21 10:02:09 reddawg devfs: renamed functions device system: renamed functions diff --git a/src/sys/include/pci/hd.h b/src/sys/include/pci/hd.h index 3786026..05adedf 100644 --- a/src/sys/include/pci/hd.h +++ b/src/sys/include/pci/hd.h @@ -68,15 +68,35 @@ int hdStandby(); int hdInit(struct device_node *dev); -extern struct driveInfo *hdd0; -extern struct driveInfo *hdd1; -extern struct driveInfo *hdd2; -extern struct driveInfo *hdd3; +struct dos_partition { + unsigned char dp_flag; /* bootstrap flags */ + unsigned char dp_shd; /* starting head */ + unsigned char dp_ssect; /* starting sector */ + unsigned char dp_scyl; /* starting cylinder */ + unsigned char dp_type; /* partition type */ + unsigned char dp_ehd; /* end head */ + unsigned char dp_esect; /* end sector */ + unsigned char dp_ecyl; /* end cylinder */ + uInt32 dp_start; /* absolute starting sector number */ + uInt32 dp_size; /* partition size in sectors */ + }; #endif /*** $Log$ + Revision 1.6 2004/07/21 10:02:09 reddawg + devfs: renamed functions + device system: renamed functions + fdc: fixed a few potential bugs and cleaned up some unused variables + strol: fixed definition + endtask: made it print out freepage debug info + kmalloc: fixed a huge memory leak we had some unhandled descriptor insertion so some descriptors were lost + ld: fixed a pointer conversion + file: cleaned up a few unused variables + sched: broke task deletion + kprintf: fixed ogPrintf definition + Revision 1.5 2004/05/21 15:05:07 reddawg Cleaned up diff --git a/src/sys/include/sys/device.h b/src/sys/include/sys/device.h index b07a38a..f42c160 100644 --- a/src/sys/include/sys/device.h +++ b/src/sys/include/sys/device.h @@ -39,7 +39,6 @@ struct device_resource *devRec; char type; int minor; - uInt32 size; }; struct device_resource { @@ -48,6 +47,7 @@ struct device_interface { uInt8 initialized; + uInt32 size; int major; void *info; void (*read)(void *,void *,uInt32,uInt32); @@ -68,6 +68,9 @@ /*** $Log$ + Revision 1.13 2004/08/14 21:56:44 reddawg + Added initialized byte to the device system to make it easy to add child devices which use parent hardware. + Revision 1.12 2004/07/21 10:02:09 reddawg devfs: renamed functions device system: renamed functions diff --git a/src/sys/init/main.c b/src/sys/init/main.c index 299c414..26ec1a5 100644 --- a/src/sys/init/main.c +++ b/src/sys/init/main.c @@ -107,9 +107,9 @@ execFile("sys:/init",0x0,0x0,0x1); //execFile("sys:/login",0x0,0x0,0x1); - execFile("sys:/login",0x0,0x0,0x2); - execFile("sys:/login",0x0,0x0,0x3); - execFile("sys:/login",0x0,0x0,0x4); + //execFile("sys:/login",0x0,0x0,0x2); + //execFile("sys:/login",0x0,0x0,0x3); + //execFile("sys:/login",0x0,0x0,0x4); kprintf("Free Pages: [%i]\n",systemVitals->freePages); kprintf("MemoryMap: [0x%X]\n",vmmMemoryMap); @@ -121,6 +121,9 @@ /*** $Log$ + Revision 1.72 2004/08/14 21:56:44 reddawg + Added initialized byte to the device system to make it easy to add child devices which use parent hardware. + Revision 1.71 2004/08/14 11:23:02 reddawg Changes diff --git a/src/sys/isa/fdc.c b/src/sys/isa/fdc.c index e972289..8715231 100644 --- a/src/sys/isa/fdc.c +++ b/src/sys/isa/fdc.c @@ -56,7 +56,7 @@ unsigned long tbaddr = 0x80000L; int fdcInit2(struct device_node *dev) { - dev->size = (1024 * 1450); + dev->devInfo->size = (1024 * 1450); return(0x0); } @@ -303,6 +303,9 @@ /*** $Log$ + Revision 1.19 2004/08/01 20:40:45 reddawg + Net related fixes + Revision 1.18 2004/07/29 21:32:16 reddawg My quick lunchs breaks worth of updates.... diff --git a/src/sys/pci/hd.c b/src/sys/pci/hd.c index ddf3955..e0d790b 100644 --- a/src/sys/pci/hd.c +++ b/src/sys/pci/hd.c @@ -34,29 +34,22 @@ #include #include #include - -struct driveInfo *hdd0; -struct driveInfo *hdd0s1; -struct driveInfo *hdd1; -struct driveInfo *hdd2; -struct driveInfo *hdd3; void initHardDisk() { - struct device_interface *devInfo = 0x0; - hdd0 = (struct driveInfo *)kmalloc(sizeof(struct driveInfo)); - hdd0s1 = (struct driveInfo *)kmalloc(sizeof(struct driveInfo)); - hdd1 = (struct driveInfo *)kmalloc(sizeof(struct driveInfo)); - hdd2 = (struct driveInfo *)kmalloc(sizeof(struct driveInfo)); - hdd3 = (struct driveInfo *)kmalloc(sizeof(struct driveInfo)); - hdd0->hdPort = 0x1F0; - hdd0->hdDev = 0x40; - hdd0->parOffset = 0x0; - hdd1->hdPort = 0x1F0; - hdd1->hdDev = 0x50; - hdd2->hdPort = 0x177; - hdd2->hdDev = 0x40; - hdd3->hdPort = 0x177; - hdd3->hdDev = 0x50; + int i = 0x0; + struct device_interface *devInfo = 0x0; + struct device_interface *devInfo2 = 0x0; + struct dos_partition *d = 0x0; + struct driveInfo *hdd = 0x0; + struct driveInfo *hdd2 = 0x0; + char *data = 0x0; + char name[16]; + + hdd = (struct driveInfo *)kmalloc(sizeof(struct driveInfo)); + hdd->hdPort = 0x1F0; + hdd->hdDev = 0x40; + hdd->parOffset = 0x0; + /* Alloc memory for device structure and set it up correctly */ devInfo = (struct device_interface *)kmalloc(sizeof(struct device_interface)); @@ -68,43 +61,34 @@ devInfo->stop = (void *)&hdStop; devInfo->start = (void *)&hdStart; devInfo->standby = (void *)&hdStandby; - devInfo->info = hdd0; - devInfo->major = 1; - device_add(0,'c',devInfo); + devInfo->info = hdd; - devInfo = (struct device_interface *)kmalloc(sizeof(struct device_interface)); - memcpy(hdd0s1,hdd0,sizeof(struct driveInfo)); + devInfo->major = 0x1; - hdd0s1->parOffset = 63; - - devInfo->read = (void *)&hdRead; - devInfo->write = (void *)&hdWrite; - devInfo->reset = (void *)&hdReset; - devInfo->init = (void *)&hdInit; - devInfo->ioctl = (void *)&hdIoctl; - devInfo->stop = (void *)&hdStop; - devInfo->start = (void *)&hdStart; - devInfo->standby = (void *)&hdStandby; - devInfo->info = hdd0s1; - devInfo->major = 1; - device_add(1,'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); - devfs_makeNode("ad0",'c',0x1,0x0); - devfs_makeNode("ad0s1",'c',0x1,0x1); - /* - if (!initDrive(hdd1)) { - addDrive(2,1,hdd1,hdRead,hdWrite,0x0); + data = (char *)kmalloc(512); + d = (struct dos_partition *)(data + 0x1BE); + + if (device_add(0,'c',devInfo) == 0x0) { + kprintf("Adding Drive (ad0), Start: [0x0], Size: [0x%x/0x%X]\n",hdd->hdSize,hdd->hdSize*512); + devfs_makeNode("ad0",'c',0x1,0x0); + hdRead(devInfo->info,data,0x0,0x1); + for (i = 0x0;i < 0x4;i++) { + if (d[i].dp_type != 0x0) { + devInfo2 = (struct device_interface *)kmalloc(sizeof(struct device_interface)); + hdd2 = (struct driveInfo *)kmalloc(sizeof(struct driveInfo)); + memcpy(devInfo2,devInfo,sizeof(struct device_interface)); + memcpy(hdd2,hdd,sizeof(struct driveInfo)); + hdd2->parOffset = d[i].dp_start; + devInfo2->info = hdd2; + if (device_add(1,'c',devInfo2) == 0x0) { + sprintf(name,"ad0s%i",i + 1); + kprintf("Adding Partition (%s), Start: [0x%X], Size: [0x%X]\n",name,d[i].dp_start,d[i].dp_size); + devfs_makeNode(name,'c',0x1,0x1); + } + } + } } - if (!initDrive(hdd2)) { - addDrive(3,1,hdd2,hdRead,hdWrite,0x0); - } - if (!initDrive(hdd3)) { - addDrive(4,1,hdd3,hdRead,hdWrite,0x0); - } - */ + kfree(data); return; } @@ -200,7 +184,7 @@ hdd->hdSize = (hdd->hdSector[0x7B] * 256 * 256 * 256) + (hdd->hdSector[0x7A] * 256 * 256) + (hdd->hdSector[0x79] * 256) + hdd->hdSector[0x78]; hdd->hdEnable = 1; kprintf("Drive: [0x%X/0x%X], Size: [%iSectors/%iKBytes]\n",hdd->hdPort,hdd->hdDev,hdd->hdSize,((hdd->hdSize*512)/1024)); - dev->size = hdd->hdSize*512; + dev->devInfo->size = hdd->hdSize*512; dev->devInfo->initialized = 0x1; return(0x0); } @@ -331,6 +315,9 @@ /*** $Log$ + Revision 1.14 2004/08/14 21:56:44 reddawg + Added initialized byte to the device system to make it easy to add child devices which use parent hardware. + Revision 1.13 2004/08/02 11:43:17 reddawg Fixens diff --git a/src/sys/sys/device.c b/src/sys/sys/device.c index 4d625ee..62055c4 100644 --- a/src/sys/sys/device.c +++ b/src/sys/sys/device.c @@ -63,6 +63,7 @@ devices = tmpDev; spinUnlock(&deviceSpinLock); + if (tmpDev->devInfo->initialized == 0x0) return(tmpDev->devInfo->init(tmpDev)); else @@ -138,6 +139,9 @@ /*** $Log$ + Revision 1.14 2004/08/14 21:56:44 reddawg + Added initialized byte to the device system to make it easy to add child devices which use parent hardware. + Revision 1.13 2004/07/21 10:02:09 reddawg devfs: renamed functions device system: renamed functions