Split block/character protocols and libdriver
This patch separates the character and block driver communication protocols. The old character protocol remains the same, but a new block protocol is introduced. The libdriver library is replaced by two new libraries: libchardriver and libblockdriver. Their exposed API, and drivers that use them, have been updated accordingly. Together, libbdev and libblockdriver now completely abstract away the message format used by the block protocol. As the memory driver is both a character and a block device driver, it now implements its own message loop. The most important semantic change made to the block protocol is that it is no longer possible to return both partial results and an error for a single transfer. This simplifies the interaction between the caller and the driver, as the I/O vector no longer needs to be copied back. Also, drivers are now no longer supposed to decide based on the layout of the I/O vector when a transfer should be cut short. Put simply, transfers are now supposed to either succeed completely, or result in an error. After this patch, the state of the various pieces is as follows: - block protocol: stable - libbdev API: stable for synchronous communication - libblockdriver API: needs slight revision (the drvlib/partition API in particular; the threading API will also change shortly) - character protocol: needs cleanup - libchardriver API: needs cleanup accordingly - driver restarts: largely unsupported until endpoint changes are reintroduced As a side effect, this patch eliminates several bugs, hacks, and gcc -Wall and -W warnings all over the place. It probably introduces a few new ones, too. Update warning: this patch changes the protocol between MFS and disk drivers, so in order to use old/new images, the MFS from the ramdisk must be used to mount all file systems.
This commit is contained in:
@@ -5,11 +5,11 @@
|
||||
INCS+= env.h fetch.h hgfs.h lib.h libutil.h timers.h
|
||||
|
||||
INCS+= minix/acpi.h minix/ansi.h minix/audio_fw.h minix/bitmap.h \
|
||||
minix/bdev.h \
|
||||
minix/callnr.h minix/com.h minix/compiler.h minix/config.h \
|
||||
minix/const.h minix/cpufeature.h minix/crtso.h minix/debug.h \
|
||||
minix/devio.h minix/devman.h minix/dmap.h minix/driver.h \
|
||||
minix/driver_mt.h minix/drivers.h minix/drvlib.h minix/ds.h \
|
||||
minix/bdev.h minix/blockdriver.h minix/blockdriver_mt.h \
|
||||
minix/callnr.h minix/chardriver.h minix/com.h minix/compiler.h \
|
||||
minix/config.h minix/const.h minix/cpufeature.h minix/crtso.h \
|
||||
minix/debug.h minix/devio.h minix/devman.h minix/dmap.h \
|
||||
minix/driver.h minix/drivers.h minix/drvlib.h minix/ds.h \
|
||||
minix/endpoint.h minix/fslib.h minix/gcov.h minix/hash.h \
|
||||
minix/ioctl.h minix/input.h minix/ipc.h minix/ipcconst.h \
|
||||
minix/keymap.h minix/limits.h minix/mthread.h minix/minlib.h \
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define AUDIO_FW_H
|
||||
|
||||
#include <minix/drivers.h>
|
||||
#include <minix/driver.h>
|
||||
#include <minix/chardriver.h>
|
||||
#include <sys/ioc_sound.h>
|
||||
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
#ifndef __MINIX_BDEV_H
|
||||
#define __MINIX_BDEV_H
|
||||
|
||||
#define BDEV_NOFLAGS 0
|
||||
|
||||
extern void bdev_driver(dev_t dev, endpoint_t endpt);
|
||||
|
||||
extern int bdev_open(dev_t dev, int access);
|
||||
extern int bdev_close(dev_t dev);
|
||||
|
||||
extern int bdev_read(dev_t dev, u64_t pos, char *buf, int count, int flags);
|
||||
extern int bdev_write(dev_t dev, u64_t pos, char *buf, int count, int flags);
|
||||
extern int bdev_gather(dev_t dev, u64_t pos, iovec_t *vec, int count,
|
||||
int flags, vir_bytes *size);
|
||||
extern int bdev_scatter(dev_t dev, u64_t pos, iovec_t *vec, int count,
|
||||
int flags, vir_bytes *size);
|
||||
extern ssize_t bdev_read(dev_t dev, u64_t pos, char *buf, size_t count,
|
||||
int flags);
|
||||
extern ssize_t bdev_write(dev_t dev, u64_t pos, char *buf, size_t count,
|
||||
int flags);
|
||||
extern ssize_t bdev_gather(dev_t dev, u64_t pos, iovec_t *vec, int count,
|
||||
int flags);
|
||||
extern ssize_t bdev_scatter(dev_t dev, u64_t pos, iovec_t *vec, int count,
|
||||
int flags);
|
||||
extern int bdev_ioctl(dev_t dev, int request, void *buf);
|
||||
|
||||
#endif /* __MINIX_BDEV_H */
|
||||
|
||||
54
common/include/minix/blockdriver.h
Normal file
54
common/include/minix/blockdriver.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifndef _MINIX_BLOCKDRIVER_H
|
||||
#define _MINIX_BLOCKDRIVER_H
|
||||
|
||||
#include <minix/driver.h>
|
||||
|
||||
typedef int thread_id_t;
|
||||
|
||||
/* Entry points into the device dependent code of block drivers. */
|
||||
struct blockdriver {
|
||||
_PROTOTYPE( int (*bdr_open), (dev_t minor, int access) );
|
||||
_PROTOTYPE( int (*bdr_close), (dev_t minor) );
|
||||
_PROTOTYPE( ssize_t (*bdr_transfer), (dev_t minor, int do_write, u64_t pos,
|
||||
endpoint_t endpt, iovec_t *iov, unsigned count, int flags) );
|
||||
_PROTOTYPE( int (*bdr_ioctl), (dev_t minor, unsigned int request,
|
||||
endpoint_t endpt, cp_grant_id_t grant) );
|
||||
_PROTOTYPE( void (*bdr_cleanup), (void) );
|
||||
_PROTOTYPE( struct device *(*bdr_part), (dev_t minor) );
|
||||
_PROTOTYPE( void (*bdr_geometry), (dev_t minor, struct partition *part) );
|
||||
_PROTOTYPE( void (*bdr_intr), (unsigned int irqs) );
|
||||
_PROTOTYPE( void (*bdr_alarm), (clock_t stamp) );
|
||||
_PROTOTYPE( int (*bdr_other), (message *m_ptr) );
|
||||
_PROTOTYPE( int (*bdr_thread), (dev_t minor, thread_id_t *threadp) );
|
||||
};
|
||||
|
||||
/* Functions defined by libblockdriver. These can be used for both
|
||||
* singlethreaded and multithreaded drivers.
|
||||
*/
|
||||
_PROTOTYPE( void blockdriver_announce, (void) );
|
||||
|
||||
#ifndef _DRIVER_MT_API
|
||||
/* Additional functions for the singlethreaded version. These allow the driver
|
||||
* to either use the stock driver_task(), or implement its own message loop.
|
||||
* To avoid accidents, these functions are not exposed when minix/driver_mt.h
|
||||
* has been included previously.
|
||||
*/
|
||||
_PROTOTYPE( int blockdriver_receive_mq, (message *m_ptr, int *status_ptr) );
|
||||
_PROTOTYPE( void blockdriver_process, (struct blockdriver *dp, message *m_ptr,
|
||||
int ipc_status) );
|
||||
_PROTOTYPE( void blockdriver_terminate, (void) );
|
||||
_PROTOTYPE( void blockdriver_task, (struct blockdriver *bdp) );
|
||||
_PROTOTYPE( int blockdriver_mq_queue, (message *m_ptr, int status) );
|
||||
#endif /* !_DRIVER_MT_API */
|
||||
|
||||
/* Parameters for the disk drive. */
|
||||
#define SECTOR_SIZE 512 /* physical sector size in bytes */
|
||||
#define SECTOR_SHIFT 9 /* for division */
|
||||
#define SECTOR_MASK 511 /* and remainder */
|
||||
|
||||
#define CD_SECTOR_SIZE 2048 /* sector size of a CD-ROM in bytes */
|
||||
|
||||
/* Size of the DMA buffer buffer in bytes. */
|
||||
#define DMA_BUF_SIZE (DMA_SECTORS * SECTOR_SIZE)
|
||||
|
||||
#endif /* _MINIX_BLOCKDRIVER_H */
|
||||
16
common/include/minix/blockdriver_mt.h
Normal file
16
common/include/minix/blockdriver_mt.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef _MINIX_BLOCKDRIVER_MT_H
|
||||
#define _MINIX_BLOCKDRIVER_MT_H
|
||||
|
||||
#define DRIVER_MT_API 1 /* do not expose the singlethreaded API */
|
||||
#include <minix/blockdriver.h>
|
||||
|
||||
/* The maximum number of worker threads. */
|
||||
#define DRIVER_MT_MAX_WORKERS 32
|
||||
|
||||
_PROTOTYPE( void blockdriver_mt_task, (struct blockdriver *driver_tab) );
|
||||
_PROTOTYPE( void blockdriver_mt_sleep, (void) );
|
||||
_PROTOTYPE( void blockdriver_mt_wakeup, (thread_id_t id) );
|
||||
_PROTOTYPE( void blockdriver_mt_stop, (void) );
|
||||
_PROTOTYPE( void blockdriver_mt_terminate, (void) );
|
||||
|
||||
#endif /* _MINIX_BLOCKDRIVER_MT_H */
|
||||
41
common/include/minix/chardriver.h
Normal file
41
common/include/minix/chardriver.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef _MINIX_CHARDRIVER_H
|
||||
#define _MINIX_CHARDRIVER_H
|
||||
|
||||
#include <minix/driver.h>
|
||||
|
||||
/* Entry points into the device dependent code of character drivers. */
|
||||
struct chardriver {
|
||||
_PROTOTYPE( int (*cdr_open), (message *m_ptr) );
|
||||
_PROTOTYPE( int (*cdr_close), (message *m_ptr) );
|
||||
_PROTOTYPE( int (*cdr_ioctl), (message *m_ptr) );
|
||||
_PROTOTYPE( struct device *(*cdr_prepare), (dev_t device) );
|
||||
_PROTOTYPE( int (*cdr_transfer), (endpoint_t endpt, int opcode,
|
||||
u64_t position, iovec_t *iov, unsigned int nr_req,
|
||||
endpoint_t user_endpt) );
|
||||
_PROTOTYPE( void (*cdr_cleanup), (void) );
|
||||
_PROTOTYPE( void (*cdr_alarm), (message *m_ptr) );
|
||||
_PROTOTYPE( int (*cdr_cancel), (message *m_ptr) );
|
||||
_PROTOTYPE( int (*cdr_select), (message *m_ptr) );
|
||||
_PROTOTYPE( int (*cdr_other), (message *m_ptr) );
|
||||
};
|
||||
|
||||
#define CHARDRIVER_SYNC 0 /* use the synchronous protocol */
|
||||
#define CHARDRIVER_ASYNC 1 /* use the asynchronous protocol */
|
||||
|
||||
#define IS_CDEV_MINOR_RQ(type) (IS_DEV_RQ(type) && (type) != DEV_STATUS)
|
||||
|
||||
/* Functions defined by libchardriver. */
|
||||
_PROTOTYPE( void chardriver_announce, (void) );
|
||||
_PROTOTYPE( void chardriver_process, (struct chardriver *cdp, int driver_type,
|
||||
message *m_ptr, int ipc_status) );
|
||||
_PROTOTYPE( void chardriver_terminate, (void) );
|
||||
_PROTOTYPE( void chardriver_task, (struct chardriver *cdp, int driver_type) );
|
||||
|
||||
_PROTOTYPE( int do_nop, (message *m_ptr) );
|
||||
_PROTOTYPE( void nop_cleanup, (void) );
|
||||
_PROTOTYPE( void nop_alarm, (message *m_ptr) );
|
||||
_PROTOTYPE( int nop_cancel, (message *m_ptr) );
|
||||
_PROTOTYPE( int nop_select, (message *m_ptr) );
|
||||
_PROTOTYPE( int nop_ioctl, (message *m_ptr) );
|
||||
|
||||
#endif /* _MINIX_CHARDRIVER_H */
|
||||
@@ -8,8 +8,8 @@
|
||||
* 1 - 0xFF POSIX requests (see callnr.h)
|
||||
* 0x200 - 0x2FF Data link layer requests and responses
|
||||
* 0x300 - 0x3FF Bus controller requests and responses
|
||||
* 0x400 - 0x4FF Block and character device requests
|
||||
* 0x500 - 0x5FF Block and character device responses
|
||||
* 0x400 - 0x4FF Character device requests
|
||||
* 0x500 - 0x5FF Character device responses
|
||||
* 0x600 - 0x6FF Kernel calls to SYSTEM task
|
||||
* 0x700 - 0x7FF Reincarnation Server (RS) requests
|
||||
* 0x800 - 0x8FF Data Store (DS) requests
|
||||
@@ -25,6 +25,7 @@
|
||||
* 0x1200 - 0x12FF Devman
|
||||
* 0x1300 - 0x13FF TTY Input
|
||||
* 0x1400 - 0x14FF VFS-FS transaction IDs
|
||||
* 0x1500 - 0x15FF Block device requests and responses
|
||||
*
|
||||
* Zero and negative values are widely used for OK and error responses.
|
||||
*/
|
||||
@@ -182,12 +183,12 @@
|
||||
|
||||
|
||||
/*===========================================================================*
|
||||
* Messages for BLOCK and CHARACTER device drivers *
|
||||
* Messages for CHARACTER device drivers *
|
||||
*===========================================================================*/
|
||||
|
||||
/* Message types for device drivers. */
|
||||
#define DEV_RQ_BASE 0x400 /* base for device request types */
|
||||
#define DEV_RS_BASE 0x500 /* base for device response types */
|
||||
/* Message types for character device drivers. */
|
||||
#define DEV_RQ_BASE 0x400 /* base for character device request types */
|
||||
#define DEV_RS_BASE 0x500 /* base for character device response types */
|
||||
|
||||
#define CANCEL (DEV_RQ_BASE + 0) /* force a task to cancel */
|
||||
#define DEV_OPEN (DEV_RQ_BASE + 6) /* open a minor device */
|
||||
@@ -215,7 +216,7 @@
|
||||
|
||||
#define IS_DEV_RS(type) (((type) & ~0xff) == DEV_RS_BASE)
|
||||
|
||||
/* Field names for messages to block and character device drivers. */
|
||||
/* Field names for messages to character device drivers. */
|
||||
#define DEVICE m2_i1 /* major-minor device */
|
||||
#define USER_ENDPT m2_i2 /* which endpoint initiated this call? */
|
||||
#define COUNT m2_i3 /* how many bytes to transfer */
|
||||
@@ -225,7 +226,7 @@
|
||||
#define ADDRESS m2_p1 /* core buffer address */
|
||||
#define IO_GRANT m2_p1 /* grant id (for DEV_*_S variants) */
|
||||
|
||||
/* Field names for DEV_SELECT messages to device drivers. */
|
||||
/* Field names for DEV_SELECT messages to character device drivers. */
|
||||
#define DEV_MINOR m2_i1 /* minor device */
|
||||
#define DEV_SEL_OPS m2_i2 /* which select operations are requested */
|
||||
|
||||
@@ -1216,4 +1217,43 @@
|
||||
#define VFS_TRANSID (VFS_TRANSACTION_BASE + 1)
|
||||
#define IS_VFS_FS_TRANSID(type) (((type) & ~0xff) == VFS_TRANSACTION_BASE)
|
||||
|
||||
/*===========================================================================*
|
||||
* Messages for block devices *
|
||||
*===========================================================================*/
|
||||
|
||||
/* Base type for block device requests and responses. */
|
||||
#define BDEV_RQ_BASE 0x1500
|
||||
#define BDEV_RS_BASE 0x1580
|
||||
|
||||
#define IS_BDEV_RQ(type) (((type) & ~0x7f) == BDEV_RQ_BASE)
|
||||
#define IS_BDEV_RS(type) (((type) & ~0x7f) == BDEV_RS_BASE)
|
||||
|
||||
/* Message types for block device requests. */
|
||||
#define BDEV_OPEN (BDEV_RQ_BASE + 0) /* open a minor device */
|
||||
#define BDEV_CLOSE (BDEV_RQ_BASE + 1) /* close a minor device */
|
||||
#define BDEV_READ (BDEV_RQ_BASE + 2) /* read into a buffer */
|
||||
#define BDEV_WRITE (BDEV_RQ_BASE + 3) /* write from a buffer */
|
||||
#define BDEV_GATHER (BDEV_RQ_BASE + 4) /* read into a vector */
|
||||
#define BDEV_SCATTER (BDEV_RQ_BASE + 5) /* write from a vector */
|
||||
#define BDEV_IOCTL (BDEV_RQ_BASE + 6) /* I/O control operation */
|
||||
|
||||
/* Message types for block device responses. */
|
||||
#define BDEV_REPLY (BDEV_RS_BASE + 0) /* general reply code */
|
||||
|
||||
/* Field names for block device messages. */
|
||||
#define BDEV_MINOR m10_i1 /* minor device number */
|
||||
#define BDEV_STATUS m10_i1 /* OK or error code */
|
||||
#define BDEV_ACCESS m10_i2 /* access bits for open requests */
|
||||
#define BDEV_REQUEST m10_i2 /* I/O control request */
|
||||
#define BDEV_COUNT m10_i2 /* number of bytes or elements in transfer */
|
||||
#define BDEV_GRANT m10_i3 /* grant ID of buffer or vector */
|
||||
#define BDEV_FLAGS m10_i4 /* transfer flags */
|
||||
#define BDEV_ID m10_l1 /* opaque request ID */
|
||||
#define BDEV_POS_LO m10_l2 /* transfer position (low bits) */
|
||||
#define BDEV_POS_HI m10_l3 /* transfer position (high bits) */
|
||||
|
||||
/* Bits in 'BDEV_FLAGS' field of block device transfer requests. */
|
||||
# define BDEV_NOFLAGS 0x00 /* no flags are set */
|
||||
# define BDEV_FORCEWRITE 0x01 /* force write to disk immediately */
|
||||
|
||||
/* _MINIX_COM_H */
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef struct { u16_t port; u32_t value; } pvl_pair_t;
|
||||
(pv).port = _p; \
|
||||
(pv).value = _v; \
|
||||
if((pv).port != _p || (pv).value != _v) { \
|
||||
printf("%s:%d: actual port: 0x%x != 0x%lx || " \
|
||||
"actual value: 0x%x != 0x%lx\n", \
|
||||
printf("%s:%d: actual port: 0x%x != 0x%x || " \
|
||||
"actual value: 0x%x != 0x%x\n", \
|
||||
__FILE__, __LINE__, (pv).port, _p, (pv).value, _v); \
|
||||
panic("pv_set(" #pv ", " #p ", " #v ")"); \
|
||||
} \
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#ifndef __MINIX_DRIVER_H__
|
||||
#define __MINIX_DRIVER_H__
|
||||
#ifndef _MINIX_DRIVER_H
|
||||
#define _MINIX_DRIVER_H
|
||||
|
||||
/* Types and constants shared between the generic and device dependent
|
||||
* device driver code.
|
||||
*/
|
||||
/* Types and constants shared between block and character drivers. */
|
||||
|
||||
#define _POSIX_SOURCE 1 /* tell headers to include POSIX stuff */
|
||||
#define _MINIX 1 /* tell headers to include MINIX stuff */
|
||||
@@ -21,36 +19,13 @@
|
||||
#include <minix/syslib.h>
|
||||
#include <minix/sysutil.h>
|
||||
#include <minix/endpoint.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
#include <errno.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <minix/partition.h>
|
||||
#include <minix/u64.h>
|
||||
|
||||
typedef int thread_id_t;
|
||||
|
||||
/* Info about and entry points into the device dependent code. */
|
||||
struct driver {
|
||||
_PROTOTYPE( char *(*dr_name), (void) );
|
||||
_PROTOTYPE( int (*dr_open), (struct driver *dp, message *m_ptr) );
|
||||
_PROTOTYPE( int (*dr_close), (struct driver *dp, message *m_ptr) );
|
||||
_PROTOTYPE( int (*dr_ioctl), (struct driver *dp, message *m_ptr) );
|
||||
_PROTOTYPE( struct device *(*dr_prepare), (int device) );
|
||||
_PROTOTYPE( int (*dr_transfer), (int proc_nr, int opcode, u64_t position,
|
||||
iovec_t *iov, unsigned nr_req) );
|
||||
_PROTOTYPE( void (*dr_cleanup), (void) );
|
||||
_PROTOTYPE( void (*dr_geometry), (struct partition *entry) );
|
||||
_PROTOTYPE( void (*dr_alarm), (struct driver *dp, message *m_ptr) );
|
||||
_PROTOTYPE( int (*dr_cancel), (struct driver *dp, message *m_ptr) );
|
||||
_PROTOTYPE( int (*dr_select), (struct driver *dp, message *m_ptr) );
|
||||
_PROTOTYPE( int (*dr_other), (struct driver *dp, message *m_ptr) );
|
||||
_PROTOTYPE( void (*dr_hw_int), (struct driver *dp, message *m_ptr) );
|
||||
_PROTOTYPE( int (*dr_thread), (dev_t dev, thread_id_t *threadp) );
|
||||
};
|
||||
#include <minix/partition.h>
|
||||
|
||||
/* Base and size of a partition in bytes. */
|
||||
struct device {
|
||||
@@ -58,52 +33,12 @@ struct device {
|
||||
u64_t dv_size;
|
||||
};
|
||||
|
||||
#define DRIVER_STD 0 /* Use the standard reply protocol */
|
||||
#define DRIVER_ASYN 1 /* Use the new asynchronous protocol */
|
||||
/* Generic receive function for all drivers. */
|
||||
#ifndef driver_receive
|
||||
#define driver_receive sef_receive_status
|
||||
#endif
|
||||
|
||||
/* Maximum supported number of concurrently opened minor devices. */
|
||||
#define MAX_NR_OPEN_DEVICES 256
|
||||
|
||||
#define IS_DEV_MINOR_RQ(type) (IS_DEV_RQ(type) && (type) != DEV_STATUS)
|
||||
|
||||
/* Functions defined by libdriver. These can be used for both singlethreaded
|
||||
* and multithreaded drivers.
|
||||
*/
|
||||
_PROTOTYPE( void driver_announce, (void) );
|
||||
_PROTOTYPE( char *no_name, (void) );
|
||||
_PROTOTYPE( int do_nop, (struct driver *dp, message *m_ptr) );
|
||||
_PROTOTYPE( struct device *nop_prepare, (int device) );
|
||||
_PROTOTYPE( void nop_cleanup, (void) );
|
||||
_PROTOTYPE( void nop_task, (void) );
|
||||
_PROTOTYPE( void nop_alarm, (struct driver *dp, message *m_ptr) );
|
||||
_PROTOTYPE( int nop_cancel, (struct driver *dp, message *m_ptr) );
|
||||
_PROTOTYPE( int nop_select, (struct driver *dp, message *m_ptr) );
|
||||
_PROTOTYPE( int do_diocntl, (struct driver *dp, message *m_ptr) );
|
||||
_PROTOTYPE( int nop_ioctl, (struct driver *dp, message *m_ptr) );
|
||||
|
||||
#ifndef _DRIVER_MT_API
|
||||
/* Additional functions for the singlethreaded version. These allow the driver
|
||||
* to either use the stock driver_task(), or implement its own message loop.
|
||||
* To avoid accidents, these functions are not exposed when minix/driver_mt.h
|
||||
* has been included previously.
|
||||
*/
|
||||
_PROTOTYPE( int driver_receive, (endpoint_t src, message *m_ptr,
|
||||
int *status_ptr) );
|
||||
_PROTOTYPE( int driver_receive_mq, (message *m_ptr, int *status_ptr) );
|
||||
_PROTOTYPE( void driver_handle_msg, (struct driver *dp, int type,
|
||||
message *m_ptr, int ipc_status) );
|
||||
_PROTOTYPE( void driver_terminate, (void) );
|
||||
_PROTOTYPE( void driver_task, (struct driver *dr, int type) );
|
||||
_PROTOTYPE( int driver_mq_queue, (message *m_ptr, int status) );
|
||||
#endif /* !_DRIVER_MT_API */
|
||||
|
||||
/* Parameters for the disk drive. */
|
||||
#define SECTOR_SIZE 512 /* physical sector size in bytes */
|
||||
#define SECTOR_SHIFT 9 /* for division */
|
||||
#define SECTOR_MASK 511 /* and remainder */
|
||||
|
||||
#define CD_SECTOR_SIZE 2048 /* sector size of a CD-ROM in bytes */
|
||||
|
||||
/* Size of the DMA buffer buffer in bytes. */
|
||||
#define DMA_BUF_SIZE (DMA_SECTORS * SECTOR_SIZE)
|
||||
|
||||
#endif /* __MINIX_DRIVER_H__ */
|
||||
#endif /* _MINIX_DRIVER_H */
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#ifndef _MINIX_DRIVER_MT_H
|
||||
#define _MINIX_DRIVER_MT_H
|
||||
|
||||
#define DRIVER_MT_API 1 /* do not expose the singlethreaded API */
|
||||
#include <minix/driver.h>
|
||||
|
||||
/* The maximum number of worker threads. */
|
||||
#define DRIVER_MT_MAX_WORKERS 32
|
||||
|
||||
_PROTOTYPE( void driver_mt_task, (struct driver *driver_p, int driver_type) );
|
||||
_PROTOTYPE( void driver_mt_sleep, (void) );
|
||||
_PROTOTYPE( void driver_mt_wakeup, (thread_id_t id) );
|
||||
_PROTOTYPE( void driver_mt_stop, (void) );
|
||||
_PROTOTYPE( void driver_mt_terminate, (void) );
|
||||
|
||||
#endif /* _MINIX_DRIVER_MT_H */
|
||||
@@ -4,19 +4,9 @@
|
||||
|
||||
#include <machine/partition.h>
|
||||
|
||||
_PROTOTYPE( void partition, (struct driver *dr, int device, int style, int atapi) );
|
||||
_PROTOTYPE( void partition, (struct blockdriver *bdr, int device, int style,
|
||||
int atapi) );
|
||||
|
||||
/* BIOS parameter table layout. */
|
||||
#define bp_cylinders(t) (* (u16_t *) (&(t)[0]))
|
||||
#define bp_heads(t) (* (u8_t *) (&(t)[2]))
|
||||
#define bp_reduced_wr(t) (* (u16_t *) (&(t)[3]))
|
||||
#define bp_precomp(t) (* (u16_t *) (&(t)[5]))
|
||||
#define bp_max_ecc(t) (* (u8_t *) (&(t)[7]))
|
||||
#define bp_ctlbyte(t) (* (u8_t *) (&(t)[8]))
|
||||
#define bp_landingzone(t) (* (u16_t *) (&(t)[12]))
|
||||
#define bp_sectors(t) (* (u8_t *) (&(t)[14]))
|
||||
|
||||
/* Miscellaneous. */
|
||||
#define DEV_PER_DRIVE (1 + NR_PARTITIONS)
|
||||
#define MINOR_t0 64
|
||||
#define MINOR_r0 120
|
||||
|
||||
@@ -29,6 +29,8 @@ typedef struct {int m7i1, m7i2, m7i3, m7i4, m7i5; char *m7p1, *m7p2;} mess_7;
|
||||
typedef struct {int m8i1, m8i2; char *m8p1, *m8p2, *m8p3, *m8p4;} mess_8;
|
||||
typedef struct {long m9l1, m9l2, m9l3, m9l4, m9l5;
|
||||
short m9s1, m9s2, m9s3, m9s4; } mess_9;
|
||||
typedef struct {int m10i1, m10i2, m10i3, m10i4;
|
||||
long m10l1, m10l2, m10l3; } mess_10;
|
||||
|
||||
typedef struct {
|
||||
endpoint_t m_source; /* who sent the message */
|
||||
@@ -43,6 +45,7 @@ typedef struct {
|
||||
mess_8 m_m8;
|
||||
mess_6 m_m6;
|
||||
mess_9 m_m9;
|
||||
mess_10 m_m10;
|
||||
} m_u;
|
||||
} message;
|
||||
|
||||
@@ -118,6 +121,14 @@ typedef struct {
|
||||
#define m9_s3 m_u.m_m9.m9s3
|
||||
#define m9_s4 m_u.m_m9.m9s4
|
||||
|
||||
#define m10_i1 m_u.m_m10.m10i1
|
||||
#define m10_i2 m_u.m_m10.m10i2
|
||||
#define m10_i3 m_u.m_m10.m10i3
|
||||
#define m10_i4 m_u.m_m10.m10i4
|
||||
#define m10_l1 m_u.m_m10.m10l1
|
||||
#define m10_l2 m_u.m_m10.m10l2
|
||||
#define m10_l3 m_u.m_m10.m10l3
|
||||
|
||||
/*==========================================================================*
|
||||
* Minix run-time system (IPC). *
|
||||
*==========================================================================*/
|
||||
|
||||
Reference in New Issue
Block a user