Changeset 1057 for Whitix/branches/keobject/devices/storage/ata/ata.c
- Timestamp:
- 10/03/08 12:12:20 (3 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
Whitix/branches/keobject/devices/storage/ata/ata.c
r1001 r1057 23 23 #include <i386/pit.h> 24 24 #include <typedefs.h> 25 #include <sdevice.h>26 25 #include <i386/irq.h> 27 26 #include <module.h> … … 329 328 static int AtaAddPartition(int i,int base,struct StorageDevice* parent,struct AtaPartition* part) 330 329 { 331 char buf[32];332 330 struct Partition* newPart; 333 331 struct StorageDevice* sDevice; … … 356 354 sDevice->totalSectors=newPart->secLen; 357 355 356 #if 0 358 357 sprintf(buf,"Storage/HardDrive%c%d",'A'+base,i); 359 358 360 DevAddDevice(buf, 4, (base*64)+i+1, DEVICE_BLOCK, sDevice);359 // DevAddDevice(buf, 4, (base*64)+i+1, DEVICE_BLOCK, sDevice); 361 360 362 361 StorageDeviceAdd(sDevice, "HardDrive%c%d", 'A'+base, i); 363 362 364 363 KePrint("Partition found: %#X, %u, %u\n",(DWORD)part[i].system,part[i].startSectorAbs,part[i].sectorCount); 364 #endif 365 365 366 366 return 0; … … 395 395 { 396 396 struct StorageDevice* sDevice; 397 char buf[32];398 int err;399 397 int controlIndex=drive->parent->index, driveIndex=drive->drive; 400 398 char* format; 399 int index; 400 401 401 sDevice=(struct StorageDevice*)MemAlloc(sizeof(struct StorageDevice)); 402 402 drive->sDev=sDevice; … … 413 413 sDevice->sectors=drive->sectors; 414 414 415 sprintf(buf, "AtaDisk%d", hdIndex); 415 format = "AtaDisk%u"; 416 index = hdIndex++; 416 417 }else{ 417 418 sDevice->cylinders=sDevice->heads=sDevice->sectors=0; 418 sprintf(buf, "AtaCd%d", cdRomIndex++); 419 } 419 format = "AtaCd%u"; 420 index = cdRomIndex++; 421 } 422 423 /* And add the device */ 424 StorageDeviceInit(sDevice, DEV_ID_MAKE(ATA_MAJOR, 0)); 420 425 421 KePrint("ATA: Found %s\n", buf); 422 423 /* And add the device */ 424 err = StorageDeviceInit(sDevice, DEV_ID_MAKE(ATA_MAJOR, 0)); 425 426 if (err) 427 return err; 428 429 err = StorageDeviceAdd(sDevice, buf); 430 431 if (err) 432 return err; 433 426 StorageDeviceAdd(sDevice, format, index); 427 428 KePrint("ATA: Found %s\n", StorageDeviceGetName(sDevice)); 434 429 435 430 if (drive->type & ATA_DISK) 436 {437 431 AtaPartitionDevice(drive,(controlIndex*2)+driveIndex); 438 hdIndex++;439 }440 432 } 441 433 … … 448 440 449 441 /* Create the ATA device set. */ 450 err = StorageSetCreate(&ataSet, &ataType, "Ata");442 // err = StorageSetCreate(&ataSet, &ataType, "Ata"); 451 443 452 if (err)453 return err;444 // if (err) 445 // return err; 454 446 455 447 for (i=0; i<2; i++) … … 476 468 err=AtaTryToIdentifyDrive(drive); 477 469 AtaCtrlEnableInts(controller); 478 470 479 471 if (err) 480 472 {