Changeset 12956e57 in mainline for uspace/srv/bd/ata_bd/ata_bd.c
- Timestamp:
- 2009-06-20T19:31:19Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2dfd9fa
- Parents:
- ac47b7c2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/ata_bd/ata_bd.c
rac47b7c2 r12956e57 38 38 * Currently based on the (now obsolete) ANSI X3.221-1994 (ATA-1) standard. 39 39 * At this point only reading is possible, not writing. 40 * 41 * The driver services a single controller which can have up to two disks 42 * attached. 40 43 */ 41 44 … … 47 50 #include <async.h> 48 51 #include <as.h> 49 #include <f utex.h>52 #include <fibril_sync.h> 50 53 #include <devmap.h> 51 54 #include <sys/types.h> … … 65 68 static ata_ctl_t *ctl; 66 69 67 static dev_handle_t dev_handle[MAX_DISKS]; 68 69 static atomic_t dev_futex = FUTEX_INITIALIZER; 70 70 /** Per-disk state. */ 71 71 static disk_t disk[MAX_DISKS]; 72 72 … … 90 90 printf(NAME ": ATA disk driver\n"); 91 91 92 printf("cmd_physical = 0x%x\n", cmd_physical); 93 printf("ctl_physical = 0x%x\n", ctl_physical); 92 printf("I/O address 0x%x\n", cmd_physical); 94 93 95 94 if (ata_bd_init() != EOK) … … 121 120 122 121 snprintf(name, 16, "disk%d", i); 123 rc = devmap_device_register(name, &d ev_handle[i]);122 rc = devmap_device_register(name, &disk[i].dev_handle); 124 123 if (rc != EOK) { 125 124 devmap_hangup_phone(DEVMAP_DRIVER); … … 182 181 } 183 182 184 printf("\n\nStatus = 0x%x\n", pio_read_8(&cmd->status));185 186 183 d->blocks = d->cylinders * d->heads * d->sectors; 187 184 … … 190 187 191 188 d->present = true; 189 fibril_mutex_initialize(&d->lock); 192 190 193 191 return EOK; … … 244 242 disk_id = -1; 245 243 for (i = 0; i < MAX_DISKS; i++) 246 if (d ev_handle[i]== dh)244 if (disk[i].dev_handle == dh) 247 245 disk_id = i; 248 246 … … 356 354 (h & 0x0f); 357 355 358 f utex_down(&dev_futex);356 fibril_mutex_lock(&d->lock); 359 357 360 358 /* Program a Read Sectors operation. */ … … 378 376 } 379 377 380 f utex_up(&dev_futex);378 fibril_mutex_unlock(&d->lock); 381 379 return EOK; 382 380 } … … 410 408 (h & 0x0f); 411 409 412 f utex_down(&dev_futex);410 fibril_mutex_lock(&d->lock); 413 411 414 412 /* Program a Read Sectors operation. */ … … 431 429 } 432 430 433 f utex_up(&dev_futex);431 fibril_mutex_unlock(&d->lock); 434 432 return EOK; 435 433 }
Note:
See TracChangeset
for help on using the changeset viewer.