diff options
Diffstat (limited to 'drivers/ide/ide-tape.c')
-rw-r--r-- | drivers/ide/ide-tape.c | 74 |
1 files changed, 51 insertions, 23 deletions
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index f41983e4a4e4..7037accb0589 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -2410,28 +2410,56 @@ static void idetape_get_mode_sense_results(ide_drive_t *drive) | |||
2410 | } | 2410 | } |
2411 | 2411 | ||
2412 | #ifdef CONFIG_IDE_PROC_FS | 2412 | #ifdef CONFIG_IDE_PROC_FS |
2413 | static void idetape_add_settings(ide_drive_t *drive) | 2413 | #define ide_tape_devset_get(name, field) \ |
2414 | { | 2414 | static int get_##name(ide_drive_t *drive) \ |
2415 | idetape_tape_t *tape = drive->driver_data; | 2415 | { \ |
2416 | 2416 | idetape_tape_t *tape = drive->driver_data; \ | |
2417 | ide_add_setting(drive, "buffer", SETTING_READ, TYPE_SHORT, 0, 0xffff, | 2417 | return tape->field; \ |
2418 | 1, 2, (u16 *)&tape->caps[16], NULL); | 2418 | } |
2419 | ide_add_setting(drive, "speed", SETTING_READ, TYPE_SHORT, 0, 0xffff, | 2419 | |
2420 | 1, 1, (u16 *)&tape->caps[14], NULL); | 2420 | #define ide_tape_devset_set(name, field) \ |
2421 | ide_add_setting(drive, "buffer_size", SETTING_READ, TYPE_INT, 0, 0xffff, | 2421 | static int set_##name(ide_drive_t *drive, int arg) \ |
2422 | 1, 1024, &tape->buffer_size, NULL); | 2422 | { \ |
2423 | ide_add_setting(drive, "tdsc", SETTING_RW, TYPE_INT, IDETAPE_DSC_RW_MIN, | 2423 | idetape_tape_t *tape = drive->driver_data; \ |
2424 | IDETAPE_DSC_RW_MAX, 1000, HZ, &tape->best_dsc_rw_freq, | 2424 | tape->field = arg; \ |
2425 | NULL); | 2425 | return 0; \ |
2426 | ide_add_setting(drive, "dsc_overlap", SETTING_RW, TYPE_BYTE, 0, 1, 1, | 2426 | } |
2427 | 1, &drive->dsc_overlap, NULL); | 2427 | |
2428 | ide_add_setting(drive, "avg_speed", SETTING_READ, TYPE_INT, 0, 0xffff, | 2428 | #define ide_tape_devset_rw(_name, _min, _max, _field, _mulf, _divf) \ |
2429 | 1, 1, &tape->avg_speed, NULL); | 2429 | ide_tape_devset_get(_name, _field) \ |
2430 | ide_add_setting(drive, "debug_mask", SETTING_RW, TYPE_INT, 0, 0xffff, 1, | 2430 | ide_tape_devset_set(_name, _field) \ |
2431 | 1, &tape->debug_mask, NULL); | 2431 | __IDE_DEVSET(_name, S_RW, _min, _max, get_##_name, set_##_name, _mulf, _divf) |
2432 | } | 2432 | |
2433 | #else | 2433 | #define ide_tape_devset_r(_name, _min, _max, _field, _mulf, _divf) \ |
2434 | static inline void idetape_add_settings(ide_drive_t *drive) { ; } | 2434 | ide_tape_devset_get(_name, _field) \ |
2435 | __IDE_DEVSET(_name, S_READ, _min, _max, get_##_name, NULL, _mulf, _divf) | ||
2436 | |||
2437 | static int mulf_tdsc(ide_drive_t *drive) { return 1000; } | ||
2438 | static int divf_tdsc(ide_drive_t *drive) { return HZ; } | ||
2439 | static int divf_buffer(ide_drive_t *drive) { return 2; } | ||
2440 | static int divf_buffer_size(ide_drive_t *drive) { return 1024; } | ||
2441 | |||
2442 | ide_devset_rw(dsc_overlap, 0, 1, dsc_overlap); | ||
2443 | |||
2444 | ide_tape_devset_rw(debug_mask, 0, 0xffff, debug_mask, NULL, NULL); | ||
2445 | ide_tape_devset_rw(tdsc, IDETAPE_DSC_RW_MIN, IDETAPE_DSC_RW_MAX, | ||
2446 | best_dsc_rw_freq, mulf_tdsc, divf_tdsc); | ||
2447 | |||
2448 | ide_tape_devset_r(avg_speed, 0, 0xffff, avg_speed, NULL, NULL); | ||
2449 | ide_tape_devset_r(speed, 0, 0xffff, caps[14], NULL, NULL); | ||
2450 | ide_tape_devset_r(buffer, 0, 0xffff, caps[16], NULL, divf_buffer); | ||
2451 | ide_tape_devset_r(buffer_size, 0, 0xffff, buffer_size, NULL, divf_buffer_size); | ||
2452 | |||
2453 | static const struct ide_devset *idetape_settings[] = { | ||
2454 | &ide_devset_avg_speed, | ||
2455 | &ide_devset_buffer, | ||
2456 | &ide_devset_buffer_size, | ||
2457 | &ide_devset_debug_mask, | ||
2458 | &ide_devset_dsc_overlap, | ||
2459 | &ide_devset_speed, | ||
2460 | &ide_devset_tdsc, | ||
2461 | NULL | ||
2462 | }; | ||
2435 | #endif | 2463 | #endif |
2436 | 2464 | ||
2437 | /* | 2465 | /* |
@@ -2515,7 +2543,6 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor) | |||
2515 | drive->using_dma ? ", DMA":""); | 2543 | drive->using_dma ? ", DMA":""); |
2516 | 2544 | ||
2517 | ide_proc_register_driver(drive, tape->driver); | 2545 | ide_proc_register_driver(drive, tape->driver); |
2518 | idetape_add_settings(drive); | ||
2519 | } | 2546 | } |
2520 | 2547 | ||
2521 | static void ide_tape_remove(ide_drive_t *drive) | 2548 | static void ide_tape_remove(ide_drive_t *drive) |
@@ -2586,6 +2613,7 @@ static ide_driver_t idetape_driver = { | |||
2586 | .error = __ide_error, | 2613 | .error = __ide_error, |
2587 | #ifdef CONFIG_IDE_PROC_FS | 2614 | #ifdef CONFIG_IDE_PROC_FS |
2588 | .proc = idetape_proc, | 2615 | .proc = idetape_proc, |
2616 | .settings = idetape_settings, | ||
2589 | #endif | 2617 | #endif |
2590 | }; | 2618 | }; |
2591 | 2619 | ||