Changeset 521 for Whitix/branches/hybrid
- Timestamp:
- 05/24/08 09:48:31 (3 months ago)
- Location:
- Whitix/branches/hybrid/devices
- Files:
-
- 10 modified
-
Makefile (modified) (2 diffs)
-
net/ne2k-pci.c (modified) (5 diffs)
-
storage/Makefile (modified) (1 diff)
-
storage/ata/Makefile (modified) (1 diff)
-
storage/ata/ata-cd.c (modified) (3 diffs)
-
storage/ata/ata-disk.c (modified) (3 diffs)
-
storage/ata/ata-identify.c (modified) (8 diffs)
-
storage/ata/ata.c (modified) (5 diffs)
-
storage/floppy.c (modified) (6 diffs)
-
storage/ramdisk.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
Whitix/branches/hybrid/devices/Makefile
r235 r521 2 2 include ../make.inc 3 3 4 OBJS = misc.o 4 MODULES = misc.sys 5 5 6 build: $( OBJS)6 build: $(MODULES) 7 7 make -C input 8 8 make -C net … … 10 10 make -C storage 11 11 12 modules_install: 13 cp *.sys ../CdRoot/System/Modules/Core 14 make -C input modules_install 15 make -C net modules_install 16 make -C pci modules_install 17 make -C storage modules_install 18 12 19 clean: 13 rm *. o-f20 rm *.sys -f 14 21 make -C net clean 15 22 make -C storage clean -
Whitix/branches/hybrid/devices/net/ne2k-pci.c
r246 r521 30 30 { 31 31 // struct NetDevice* netDev=(struct NetDevice*)data; 32 printf("Ne2kIrq\n");32 KePrint("Ne2kIrq\n"); 33 33 34 34 return 0; … … 37 37 int Ne2kSend(struct NetDevice* device, struct SocketBuffer* sockBuff) 38 38 { 39 printf("Ne2kSend\n");39 KePrint("Ne2kSend\n"); 40 40 return 0; 41 41 } … … 73 73 if (ret) 74 74 { 75 printf("NE2K: Could not enable device.\n");75 KePrint("NE2K: Could not enable device.\n"); 76 76 return -EIO; 77 77 } … … 86 86 if (!netDev) 87 87 { 88 printf("NE2K: Could not allocate network device.\n");88 KePrint("NE2K: Could not allocate network device.\n"); 89 89 return -EIO; 90 90 } … … 99 99 if (ret) 100 100 { 101 printf("NE2K: Could not enable device irq.\n");101 KePrint("NE2K: Could not enable device irq.\n"); 102 102 return -EIO; 103 103 } 104 104 105 printf("NE2K: Found device. I/O base = %#X, irq = %u\n", ioAddr, device->irq);105 KePrint("NE2K: Found device. I/O base = %#X, irq = %u\n", ioAddr, device->irq); 106 106 107 107 /* Get the station (MAC) address. */ -
Whitix/branches/hybrid/devices/storage/Makefile
r1 r521 2 2 include ../../make.inc 3 3 4 OBJS = floppy.o ramdisk.o sdevice.o 4 MODULES = floppy.sys ramdisk.sys 5 5 6 build: $( OBJS)6 build: $(MODULES) 7 7 make -C ata 8 9 modules_install: 10 make -C ata modules_install 11 cp *.sys ../../CdRoot/System/Modules/Storage 8 12 9 13 clean: 10 14 make -C ata clean 11 rm *.o -f15 rm *.o *.sys -f -
Whitix/branches/hybrid/devices/storage/ata/Makefile
r1 r521 2 2 include ../../../make.inc 3 3 4 OBJS = ata.o ata-disk.o ata-cd.o ata-identify.o 4 MODULES = ata.sys ata-disk.sys ata-cd.sys ata-identify.sys 5 5 6 build: $(OBJS) 6 build: $(MODULES) 7 ld -r $(MODULES) -o ata_ide.sys 8 9 modules_install: 10 cp ata_ide.sys ../../../CdRoot/System/Modules/Storage/ 7 11 8 12 clean: 9 rm *.o -f13 rm *.o *.sys -f -
Whitix/branches/hybrid/devices/storage/ata/ata-cd.c
r235 r521 143 143 if (request->retries > 5) 144 144 { 145 printf("ATA-CD: failed to read, error = %#X, count = %u, status = %d\n",inb(CTRL_REG(drive->parent,REG_ERROR)),145 KePrint("ATA-CD: failed to read, error = %#X, count = %u, status = %d\n",inb(CTRL_REG(drive->parent,REG_ERROR)), 146 146 AtapiTransferCount(drive->parent),status); 147 147 StorageEndRequest(drive->sDev,EIO); … … 187 187 { 188 188 case ATAPI_PHASE_ABORT: 189 printf("Drive aborted the command.\n");189 KePrint("Drive aborted the command.\n"); 190 190 AtapiError(drive,request,status); 191 191 break; … … 212 212 213 213 default: 214 printf("Bad phase, %d\n",phase);214 KePrint("Bad phase, %d\n",phase); 215 215 }; 216 216 -
Whitix/branches/hybrid/devices/storage/ata/ata-disk.c
r68 r521 32 32 if (!request) 33 33 { 34 printf("AtaRwInterrupt: request is null?\n");34 KePrint("AtaRwInterrupt: request is null?\n"); 35 35 return; 36 36 } … … 38 38 if (status & STATE_ERR || status & STATE_DF) 39 39 { 40 printf("AtaRwInterrupt: failure reading sector %u\n",request->sector);40 KePrint("AtaRwInterrupt: failure reading sector %u\n",request->sector); 41 41 /* Failure? If so, do it again */ 42 42 drive->busy=0; … … 49 49 if (AtaWaitForState(drive->parent,STATE_BUSY | STATE_DRQ,STATE_DRQ)) 50 50 { 51 printf("Timed out waiting for read\n");51 KePrint("Timed out waiting for read\n"); 52 52 drive->busy=0; 53 53 AtaRequest(drive); -
Whitix/branches/hybrid/devices/storage/ata/ata-identify.c
r68 r521 116 116 int ret=0; 117 117 118 Sleep(50);118 // Sleep(50); 119 119 120 120 if (cmd == CMD_ATA_PIDENTIFY) … … 124 124 125 125 timeout=((cmd == CMD_ATA_IDENTIFY) ? 3000 : 1000)/2; 126 startTime= time;126 startTime=PitGetQuantums(); 127 127 128 128 SaveFlags(flags); … … 131 131 do 132 132 { 133 if (( time-startTime) > timeout)133 if ((PitGetQuantums()-startTime) > timeout) 134 134 { 135 135 IrqRestoreFlags(flags); 136 printf("Identify timed out: reg = %#X\n",(DWORD)reg);136 KePrint("Identify timed out: reg = %#X\n",(DWORD)reg); 137 137 return 2; 138 138 } 139 139 140 Sleep(50); /* Don't keep pestering the drive */140 // Sleep(50); /* Don't keep pestering the drive */ 141 141 142 142 reg=inb(CTRL_REG(drive->parent,REG_CONTROL)); 143 143 }while (reg & STATE_BUSY); 144 144 145 Sleep(50);145 // Sleep(50); 146 146 147 147 if ((inb(CTRL_REG(drive->parent,REG_STATUS)) & (STATE_DRQ | STATE_BUSY | STATE_ERR)) == STATE_DRQ) … … 185 185 return -ENOMEM; 186 186 187 Sleep(50);187 // Sleep(50); 188 188 AtaSelectDrive(drive); 189 Sleep(50);189 // Sleep(50); 190 190 191 191 reg=inb(CTRL_REG(drive->parent,REG_SELECT)); … … 195 195 /* Select drive 0 and exit */ 196 196 outb(CTRL_REG(drive->parent,REG_STATUS),LDH_DEFAULT); 197 Sleep(50);197 // Sleep(50); 198 198 return 2; 199 199 } … … 218 218 else if (ret == 2 && cmd == CMD_ATA_PIDENTIFY) 219 219 { 220 printf("No response (%#02X) - resetting drive interface\n",inb(CTRL_REG(drive->parent,REG_COMMAND)));221 Sleep(50);220 KePrint("No response (%#02X) - resetting drive interface\n",inb(CTRL_REG(drive->parent,REG_COMMAND))); 221 // Sleep(50); 222 222 AtaSelectDrive(drive); 223 Sleep(50);223 // Sleep(50); 224 224 outb(CTRL_REG(drive->parent,REG_COMMAND),ATAPI_CMD_SRST); 225 225 226 startTime= time;226 startTime=PitGetQuantums(); 227 227 228 228 IrqSaveFlags(flags); … … 230 230 231 231 do 232 Sleep(50); 233 while ((inb(CTRL_REG(drive->parent,REG_COMMAND)) & STATE_BUSY) && (time-startTime) > 3000); 232 // Sleep(50); 233 asm("nop"); 234 while ((inb(CTRL_REG(drive->parent,REG_COMMAND)) & STATE_BUSY) && (PitGetQuantums()-startTime) > 3000); 234 235 235 236 ret=AtaDoIdentify(drive,cmd); … … 278 279 return -EIO; 279 280 280 printf("CD/DVD drive\n");281 KePrint("CD/DVD drive\n"); 281 282 }else 282 printf("Hard Drive\n");283 KePrint("Hard Drive\n"); 283 284 284 285 /* Exit with drive 0 selected */ 285 286 outb(CTRL_REG(drive->parent,REG_SELECT),LDH_DEFAULT); 286 Sleep(50);287 // Sleep(50); 287 288 inb(CTRL_REG(drive->parent,REG_STATUS)); 288 289 -
Whitix/branches/hybrid/devices/storage/ata/ata.c
r254 r521 74 74 sti(); 75 75 76 for (startTime= time; time-startTime<100;)76 for (startTime=PitGetQuantums(); PitGetQuantums()-startTime<100;) 77 77 { 78 78 status=inb(CTRL_REG(controller,REG_CONTROL)); … … 199 199 while (timeOut--) 200 200 { 201 Sleep(10);202 201 reg=inb(CTRL_REG(controller,REG_STATUS)); 203 202 if (!(reg & STATE_BUSY)) … … 232 231 233 232 /* Needs a small delay loop */ 234 Sleep(1);233 // Sleep(1); 235 234 236 235 outb(CTRL_REG(controller,REG_CONTROL),CTL_EIGHTHEADS); 237 236 238 Sleep(10);237 // Sleep(10); 239 238 240 239 /* Wait at most 35 (!) seconds for it to unbusy itself */ … … 247 246 248 247 outb(CTRL_REG(controller,REG_CONTROL),CTL_EIGHTHEADS); 249 Sleep(1);248 // Sleep(1); 250 249 AtaWaitNotBusy(controller,1000); 251 250 252 251 outb(CTRL_REG(controller,REG_SELECT),LDH_DEFAULT | 1 << 4); 253 252 outb(CTRL_REG(controller,REG_CONTROL),CTL_EIGHTHEADS); 254 Sleep(1);253 // Sleep(1); 255 254 AtaWaitNotBusy(controller,1000); 256 255 … … 356 355 StorageQueueInit(sDevice); 357 356 358 printf("Partition found: %#X, %u, %u\n",(DWORD)part[i].system,part[i].startSectorAbs,part[i].sectorCount);357 KePrint("Partition found: %#X, %u, %u\n",(DWORD)part[i].system,part[i].startSectorAbs,part[i].sectorCount); 359 358 360 359 return 0; -
Whitix/branches/hybrid/devices/storage/floppy.c
r159 r521 209 209 if (fdc->sr0 & 0x10) 210 210 { 211 printf("Recal failed, trying again\n");211 KePrint("Recal failed, trying again\n"); 212 212 FdcRecal(fdc); 213 213 return; … … 226 226 if (!(fdc->handler)) 227 227 { 228 printf("floppy: No handler for interrupt, %#X\n",fdc->busy);228 KePrint("floppy: No handler for interrupt, %#X\n",fdc->busy); 229 229 return 0; 230 230 } … … 243 243 if (UNLIKELY(err)) 244 244 { 245 printf("Floppy: I/O error, starting again\n");246 247 printf("Floppy registers: \n");245 KePrint("Floppy: I/O error, starting again\n"); 246 247 KePrint("Floppy registers: \n"); 248 248 int i; 249 249 for (i=0; i<num; i++) 250 printf("%d: %#X\n",i,(DWORD)fdc->status[i]);251 252 printf("err = %d,num = %d\n",err,num);250 KePrint("%d: %#X\n",i,(DWORD)fdc->status[i]); 251 252 KePrint("err = %d,num = %d\n",err,num); 253 253 254 254 currRequest->retries++; … … 266 266 { 267 267 /* Write protected */ 268 printf("Floppy is write-protected\n");268 KePrint("Floppy is write-protected\n"); 269 269 }else if (fdc->status[1] & 0x4) 270 270 { 271 printf("No data. Unreadable\n");272 printf("Floppy thinks chs is %d,%d,%d\n",fdc->status[3],fdc->status[4],fdc->status[5]);271 KePrint("No data. Unreadable\n"); 272 KePrint("Floppy thinks chs is %d,%d,%d\n",fdc->status[3],fdc->status[4],fdc->status[5]); 273 273 } 274 274 } … … 338 338 if ((fdc->sr0 & 0xF8) != SEEK_SUCCESS || fdc->currTrack != fdc->rwTrack) 339 339 { 340 printf("Floppy seek failed\n");340 KePrint("Floppy seek failed\n"); 341 341 342 342 /* If a seek is not possible, a disk may not even be in the drive */ … … 474 474 IrqSaveFlags(flags); 475 475 476 printf("Resetting floppy\n");476 KePrint("Resetting floppy\n"); 477 477 478 478 fdc->handler=FdcResetInterrupt; -
Whitix/branches/hybrid/devices/storage/ramdisk.c
r61 r521 98 98 } 99 99 100 printf("%d ramdisks loaded, of size %d\n",MAX_RAMDISKS,RAMDISK_SIZE);100 KePrint("%d ramdisks loaded, of size %d\n",MAX_RAMDISKS,RAMDISK_SIZE); 101 101 102 102 return 0;
