at_wini: PCI-only now; one controller per instance

- remove non-PCI support, since all supported platforms with at_wini
  devices also have PCI support by now;
- correspondingly, stop using information from the BIOS altogether;
- limit each driver instance to one controller, to be in line with
  the general MINIX3 one-instance-per-controller driver model; this
  limits the number of disks per at_wini instance to four;
- go through the controllers by the order of their occurrence in the
  PCI table, thus removing the exception for compatibility devices;
- let the second at_wini instance shut down silently if there is only
  one IDE controller;
- clean up some extra code we don't need anymore, and resolve some
  WARNS=5 level warnings.

Overall, these changes should simplify automatic loading of the right
disk drivers at boot time in the future.

Change-Id: Ia64d08cfbeb9916abd68c9c2941baeb87d02a806
This commit is contained in:
David van Moolenbroek 2013-10-02 19:37:00 +02:00 committed by Lionel Sambuc
parent 89332ecdf1
commit 6d466f941b
5 changed files with 251 additions and 516 deletions

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,6 @@
#define VERBOSE 0 /* display identify messages during boot */ #define VERBOSE 0 /* display identify messages during boot */
#define VERBOSE_DMA 0 /* display DMA debugging information */ #define VERBOSE_DMA 0 /* display DMA debugging information */
#define ENABLE_ATAPI 1 /* add ATAPI cd-rom support to driver */
#define ATAPI_DEBUG 0 /* To debug ATAPI code. */ #define ATAPI_DEBUG 0 /* To debug ATAPI code. */
@ -129,7 +128,6 @@
* regular LBA. * regular LBA.
*/ */
#if ENABLE_ATAPI
#define ERROR_SENSE 0xF0 /* sense key mask */ #define ERROR_SENSE 0xF0 /* sense key mask */
#define SENSE_NONE 0x00 /* no sense key */ #define SENSE_NONE 0x00 /* no sense key */
#define SENSE_RECERR 0x10 /* recovered error */ #define SENSE_RECERR 0x10 /* recovered error */
@ -156,7 +154,6 @@
#define REG_CNT_LO 4 /* low byte of cylinder number */ #define REG_CNT_LO 4 /* low byte of cylinder number */
#define REG_CNT_HI 5 /* high byte of cylinder number */ #define REG_CNT_HI 5 /* high byte of cylinder number */
#define REG_DRIVE 6 /* drive select */ #define REG_DRIVE 6 /* drive select */
#endif
#define REG_STATUS 7 /* status */ #define REG_STATUS 7 /* status */
#define STATUS_BSY 0x80 /* controller busy */ #define STATUS_BSY 0x80 /* controller busy */
@ -167,15 +164,10 @@
#define STATUS_CORR 0x04 /* correctable error occurred */ #define STATUS_CORR 0x04 /* correctable error occurred */
#define STATUS_CHECK 0x01 /* check error */ #define STATUS_CHECK 0x01 /* check error */
#if ENABLE_ATAPI
#define ATAPI_PACKETCMD 0xA0 /* packet command */ #define ATAPI_PACKETCMD 0xA0 /* packet command */
#define ATAPI_IDENTIFY 0xA1 /* identify drive */ #define ATAPI_IDENTIFY 0xA1 /* identify drive */
#define SCSI_READ10 0x28 /* read from disk */ #define SCSI_READ10 0x28 /* read from disk */
#define SCSI_SENSE 0x03 /* sense request */ #define SCSI_SENSE 0x03 /* sense request */
#endif /* ATAPI */
/* Interrupt request lines. */
#define NO_IRQ 0 /* no IRQ set yet */
#define ATAPI_PACKETSIZE 12 #define ATAPI_PACKETSIZE 12
#define SENSE_PACKETSIZE 18 #define SENSE_PACKETSIZE 18
@ -185,16 +177,16 @@
#define ERR_BAD_SECTOR (-2) /* block marked bad detected */ #define ERR_BAD_SECTOR (-2) /* block marked bad detected */
/* Some controllers don't interrupt, the clock will wake us up. */ /* Some controllers don't interrupt, the clock will wake us up. */
#define WAKEUP_SECS 32 /* drive may be out for 31 seconds max */ #define WAKEUP_SECS 32 /* drive may be out for 31 seconds max */
#define WAKEUP_TICKS (WAKEUP_SECS*system_hz) #define WAKEUP_TICKS (WAKEUP_SECS*system_hz)
/* Miscellaneous. */ /* Miscellaneous. */
#define MAX_DRIVES 8 #define MAX_DRIVES 4 /* max number of actual drives per instance */
#define COMPAT_DRIVES 4 #define MAX_DRIVENODES 8 /* number of drive nodes, for node numbering */
#define MAX_SECS 256 /* controller can transfer this many sectors */ #define MAX_SECS 256 /* controller can transfer this many sectors */
#define MAX_ERRORS 4 /* how often to try rd/wt before quitting */ #define MAX_ERRORS 4 /* how often to try rd/wt before quitting */
#define NR_MINORS (MAX_DRIVES * DEV_PER_DRIVE) #define NR_MINORS (MAX_DRIVENODES * DEV_PER_DRIVE)
#define NR_SUBDEVS (MAX_DRIVES * SUB_PER_DRIVE) #define NR_SUBDEVS (MAX_DRIVENODES * SUB_PER_DRIVE)
#define DELAY_USECS 1000 /* controller timeout in microseconds */ #define DELAY_USECS 1000 /* controller timeout in microseconds */
#define DELAY_TICKS 1 /* controller timeout in ticks */ #define DELAY_TICKS 1 /* controller timeout in ticks */
#define DEF_TIMEOUT_USECS 5000000L /* controller timeout in microseconds */ #define DEF_TIMEOUT_USECS 5000000L /* controller timeout in microseconds */
@ -203,18 +195,15 @@
#define INITIALIZED 0x01 /* drive is initialized */ #define INITIALIZED 0x01 /* drive is initialized */
#define DEAF 0x02 /* controller must be reset */ #define DEAF 0x02 /* controller must be reset */
#define SMART 0x04 /* drive supports ATA commands */ #define SMART 0x04 /* drive supports ATA commands */
#if ENABLE_ATAPI
#define ATAPI 0x08 /* it is an ATAPI device */ #define ATAPI 0x08 /* it is an ATAPI device */
#else
#define ATAPI 0 /* don't bother with ATAPI; optimise out */
#endif
#define IDENTIFIED 0x10 /* w_identify done successfully */ #define IDENTIFIED 0x10 /* w_identify done successfully */
#define IGNORING 0x20 /* w_identify failed once */ #define IGNORING 0x20 /* w_identify failed once */
#define NO_DMA_VAR "ata_no_dma" #define NO_DMA_VAR "ata_no_dma"
/* BIOS parameter table layout. */ #define ATA_IF_NATIVE0 (1L << 0) /* first channel is in native mode */
#define bp_cylinders(t) (t[0] | (t[1] << 8)) #define ATA_IF_NATIVE1 (1L << 2) /* second channel is in native mode */
#define bp_heads(t) (t[2])
#define bp_precomp(t) (t[5] | (t[6] << 8)) extern int sef_cb_lu_prepare(int state);
#define bp_sectors(t) (t[14]) extern int sef_cb_lu_state_isvalid(int state);
extern void sef_cb_lu_state_dump(int state);

View File

@ -40,7 +40,7 @@ then if [ -e $ACPI -a -n "`sysenv acpi`" ]
/bin/service -c up /sbin/virtio_blk -dev /dev/c0d0 -label virtio_blk_0 -args instance=0 /bin/service -c up /sbin/virtio_blk -dev /dev/c0d0 -label virtio_blk_0 -args instance=0
else else
/bin/service -c up /sbin/at_wini -dev /dev/c0d0 -label at_wini_0 /bin/service -c up /sbin/at_wini -dev /dev/c0d0 -label at_wini_0
/bin/service -cr up /sbin/at_wini -dev /dev/c1d0 -label at_wini_1 -args instance=1 /bin/service -cr up /sbin/at_wini -dev /dev/c1d0 -label at_wini_1 -args instance=1 2>/dev/null || :
fi fi
/bin/umount /proc >/dev/null /bin/umount /proc >/dev/null
fi fi

View File

@ -368,12 +368,14 @@ service at_wini
DEVIO # 21 DEVIO # 21
SDEVIO # 22 SDEVIO # 22
VDEVIO # 23 VDEVIO # 23
READBIOS # 35
; ;
pci class pci class # Match these PCI classes:
1/1 # Mass storage / IDE 1/1 # Mass storage / IDE
1/80 # Mass storage / Other (80 hex) ;
1/4 # Mass storage / RAID pci device # In addition, match these devices:
1106:3149 # VIA VT6420 RAID (1/4)
1095:3512/1095:6512 # Silicon Image SATA RAID (1/4)
1095:3114/1095:3114 # Silicon Image SATA RAID (1/80)
; ;
}; };

View File

@ -93,23 +93,9 @@
*/ */
#define NR_MEMS 16 #define NR_MEMS 16
/* Click to byte conversions (and vice versa). */
#define HCLICK_SHIFT 4 /* log2 of HCLICK_SIZE */
#define HCLICK_SIZE 16 /* hardware segment conversion magic */
#if CLICK_SIZE >= HCLICK_SIZE
#define click_to_hclick(n) ((n) << (CLICK_SHIFT - HCLICK_SHIFT))
#else
#define click_to_hclick(n) ((n) >> (HCLICK_SHIFT - CLICK_SHIFT))
#endif
#define hclick_to_physb(n) ((phys_bytes) (n) << HCLICK_SHIFT)
#define physb_to_hclick(n) ((n) >> HCLICK_SHIFT)
#define CLICK2ABS(v) ((v) << CLICK_SHIFT) #define CLICK2ABS(v) ((v) << CLICK_SHIFT)
#define ABS2CLICK(a) ((a) >> CLICK_SHIFT) #define ABS2CLICK(a) ((a) >> CLICK_SHIFT)
#define ABS -999 /* this process means absolute memory */
/* Flag bits for i_mode in the inode. */ /* Flag bits for i_mode in the inode. */
#define I_TYPE 0170000 /* this field gives inode type */ #define I_TYPE 0170000 /* this field gives inode type */
#define I_UNIX_SOCKET 0140000 /* unix domain socket */ #define I_UNIX_SOCKET 0140000 /* unix domain socket */