aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ide-scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/ide-scsi.c')
-rw-r--r--drivers/scsi/ide-scsi.c52
1 files changed, 36 insertions, 16 deletions
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 02bd5c487d1f..65cf84b222c5 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -429,21 +429,41 @@ static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *r
429} 429}
430 430
431#ifdef CONFIG_IDE_PROC_FS 431#ifdef CONFIG_IDE_PROC_FS
432static void idescsi_add_settings(ide_drive_t *drive) 432#define ide_scsi_devset_get(name, field) \
433{ 433static int get_##name(ide_drive_t *drive) \
434 idescsi_scsi_t *scsi = drive_to_idescsi(drive); 434{ \
435 435 idescsi_scsi_t *scsi = drive_to_idescsi(drive); \
436/* 436 return scsi->field; \
437 * drive setting name read/write data type min max mul_factor div_factor data pointer set function 437}
438 */ 438
439 ide_add_setting(drive, "bios_cyl", SETTING_RW, TYPE_INT, 0, 1023, 1, 1, &drive->bios_cyl, NULL); 439#define ide_scsi_devset_set(name, field) \
440 ide_add_setting(drive, "bios_head", SETTING_RW, TYPE_BYTE, 0, 255, 1, 1, &drive->bios_head, NULL); 440static int set_##name(ide_drive_t *drive, int arg) \
441 ide_add_setting(drive, "bios_sect", SETTING_RW, TYPE_BYTE, 0, 63, 1, 1, &drive->bios_sect, NULL); 441{ \
442 ide_add_setting(drive, "transform", SETTING_RW, TYPE_INT, 0, 3, 1, 1, &scsi->transform, NULL); 442 idescsi_scsi_t *scsi = drive_to_idescsi(drive); \
443 ide_add_setting(drive, "log", SETTING_RW, TYPE_INT, 0, 1, 1, 1, &scsi->log, NULL); 443 scsi->field = arg; \
444} 444 return 0; \
445#else 445}
446static inline void idescsi_add_settings(ide_drive_t *drive) { ; } 446
447#define ide_scsi_devset_rw(_name, _min, _max, _field) \
448ide_scsi_devset_get(_name, _field); \
449ide_scsi_devset_set(_name, _field); \
450IDE_DEVSET(_name, S_RW, _min, _max, get_##_name, set_##_name)
451
452ide_devset_rw(bios_cyl, 0, 1023, bios_cyl);
453ide_devset_rw(bios_head, 0, 255, bios_head);
454ide_devset_rw(bios_sect, 0, 63, bios_sect);
455
456ide_scsi_devset_rw(transform, 0, 3, transform);
457ide_scsi_devset_rw(log, 0, 1, log);
458
459static const struct ide_devset *idescsi_settings[] = {
460 &ide_devset_bios_cyl,
461 &ide_devset_bios_head,
462 &ide_devset_bios_sect,
463 &ide_devset_log,
464 &ide_devset_transform,
465 NULL
466};
447#endif 467#endif
448 468
449/* 469/*
@@ -461,7 +481,6 @@ static void idescsi_setup (ide_drive_t *drive, idescsi_scsi_t *scsi)
461 drive->pc_callback = ide_scsi_callback; 481 drive->pc_callback = ide_scsi_callback;
462 482
463 ide_proc_register_driver(drive, scsi->driver); 483 ide_proc_register_driver(drive, scsi->driver);
464 idescsi_add_settings(drive);
465} 484}
466 485
467static void ide_scsi_remove(ide_drive_t *drive) 486static void ide_scsi_remove(ide_drive_t *drive)
@@ -509,6 +528,7 @@ static ide_driver_t idescsi_driver = {
509 .error = idescsi_atapi_error, 528 .error = idescsi_atapi_error,
510#ifdef CONFIG_IDE_PROC_FS 529#ifdef CONFIG_IDE_PROC_FS
511 .proc = idescsi_proc, 530 .proc = idescsi_proc,
531 .settings = idescsi_settings,
512#endif 532#endif
513}; 533};
514 534