From 277e36b7e61df0e4028c449cdeacd8bb763cc186 Mon Sep 17 00:00:00 2001 From: Greg Haerr Date: Thu, 31 Oct 2024 21:39:48 -0700 Subject: [PATCH] [kernel] Minor header file cleanup, add arch %d to PC class --- elks/arch/i86/drivers/block/directhd.c | 23 +++++++++- elks/include/linuxmt/config.h | 2 +- elks/include/linuxmt/directhd.h | 33 -------------- elks/include/linuxmt/fd.h | 60 +++++++++++--------------- elks/include/linuxmt/socket.h | 33 ++++++++------ elks/include/linuxmt/uio.h | 11 ----- elks/init/main.c | 2 +- 7 files changed, 70 insertions(+), 94 deletions(-) delete mode 100644 elks/include/linuxmt/directhd.h delete mode 100644 elks/include/linuxmt/uio.h diff --git a/elks/arch/i86/drivers/block/directhd.c b/elks/arch/i86/drivers/block/directhd.c index 9fb4d7f2e..3722a0771 100644 --- a/elks/arch/i86/drivers/block/directhd.c +++ b/elks/arch/i86/drivers/block/directhd.c @@ -12,13 +12,34 @@ #include #include #include -#include #include #include #include #include +/* define offsets from base port address */ +#define DIRECTHD_ERROR 1 +#define DIRECTHD_SEC_COUNT 2 +#define DIRECTHD_SECTOR 3 +#define DIRECTHD_CYLINDER_LO 4 +#define DIRECTHD_CYLINDER_HI 5 +#define DIRECTHD_DH 6 +#define DIRECTHD_STATUS 7 +#define DIRECTHD_COMMAND 7 + +/* define drive masks */ +#define DIRECTHD_DRIVE0 0xa0 +#define DIRECTHD_DRIVE1 0xb0 + +/* define drive commands */ +#define DIRECTHD_DRIVE_ID 0xec /* drive id */ +#define DIRECTHD_READ 0x20 /* read with retry */ +#define DIRECTHD_WRITE 0x30 /* write with retry */ + +/* other definitions */ +#define MAX_DRIVES 4 /* 2 per i/o channel and 2 i/o channels */ + /* maybe we should have word-wide input here instead of byte-wide ? */ #define STATUS(port) inb_p(port + DIRECTHD_STATUS) #define ERROR(port) inb_p(port + DIRECTHD_ERROR) diff --git a/elks/include/linuxmt/config.h b/elks/include/linuxmt/config.h index 8c94b84c3..94fa4e3c9 100644 --- a/elks/include/linuxmt/config.h +++ b/elks/include/linuxmt/config.h @@ -103,7 +103,7 @@ #define DEF_SETUPSEG DEF_INITSEG + 0x20 #define DEF_SYSMAX 0x2F00 /* maximum system size (=.text+.fartext+.data) */ -/* Segmemnt DMASEG up to DMASEGEND is used as a bounce buffer of at least 1K (=BLOCKSIZE) +/* Segment DMASEG up to DMASEGEND is used as a bounce buffer of at least 1K (=BLOCKSIZE) * below the first 64K boundary (=0x1000:0) for use with the old 8237 DMA controller. * If floppy track caching is enabled, this area is also used for the track buffer * for direct DMA access using multisector I/O. diff --git a/elks/include/linuxmt/directhd.h b/elks/include/linuxmt/directhd.h deleted file mode 100644 index 05695f9de..000000000 --- a/elks/include/linuxmt/directhd.h +++ /dev/null @@ -1,33 +0,0 @@ -/* directhd.h header for ELKS kernel - Copyright (C) 1998 Blaz Antonic - */ - -#ifndef __LINUXMT_DIRECTHD_H -#define __LINUXMT_DIRECTHD_H - -/* define offsets from base port address */ -#define DIRECTHD_ERROR 1 -#define DIRECTHD_SEC_COUNT 2 -#define DIRECTHD_SECTOR 3 -#define DIRECTHD_CYLINDER_LO 4 -#define DIRECTHD_CYLINDER_HI 5 -#define DIRECTHD_DH 6 -#define DIRECTHD_STATUS 7 -#define DIRECTHD_COMMAND 7 - -/* define drive masks */ -#define DIRECTHD_DRIVE0 0xa0 -#define DIRECTHD_DRIVE1 0xb0 - -/* define drive commands */ -#define DIRECTHD_DRIVE_ID 0xec /* drive id */ -#define DIRECTHD_READ 0x20 /* read with retry */ -#define DIRECTHD_WRITE 0x30 /* write with retry */ - -/* other definitions */ -#define MAX_DRIVES 4 /* 2 per i/o channel and 2 i/o channels */ - -#if 0 -#define DIRECTHD_DEVICE_NAME "dhd" -#endif - -#endif diff --git a/elks/include/linuxmt/fd.h b/elks/include/linuxmt/fd.h index 9e2981d41..3ee42dd86 100644 --- a/elks/include/linuxmt/fd.h +++ b/elks/include/linuxmt/fd.h @@ -12,43 +12,33 @@ #define DFPROC #endif -#define FDCLRPRM 0 /* clear user-defined parameters */ -#define FDSETPRM 1 /* set user-defined parameters for current media */ -#define FDDEFPRM 2 /* set user-defined parameters until explicitly cleared */ -#define FDGETPRM 3 /* get disk parameters */ -#define FDMSGON 4 /* issue kernel messages on media type change */ -#define FDMSGOFF 5 /* don't issue kernel messages on media type change */ -#define FDFMTBEG 6 /* begin formatting a disk */ -#define FDFMTTRK 7 /* format the specified track */ -#define FDFMTEND 8 /* end formatting a disk */ -#define FDSETEMSGTRESH 10 /* set fdc error reporting treshold */ -#define FDFLUSH 11 /* flush buffers for media; either for verifying media, - * or for handling a media change without closing the - * file descriptor */ - -#define FD_FILL_BYTE 0xF6 /* format fill byte */ - -#define FORMAT_NONE 0 /* no format request */ -#define FORMAT_WAIT 1 /* format request is waiting */ -#define FORMAT_BUSY 2 /* formatting in progress */ -#define FORMAT_OKAY 3 /* successful completion */ -#define FORMAT_ERROR 4 /* formatting error */ +#if UNUSED +#define FDCLRPRM 0 /* clear user-defined parameters */ +#define FDSETPRM 1 /* set user-defined parameters for current media */ +#define FDDEFPRM 2 /* set user-defined parameters until explicitly cleared */ +#define FDGETPRM 3 /* get disk parameters */ +#define FDMSGON 4 /* issue kernel messages on media type change */ +#define FDMSGOFF 5 /* don't issue kernel messages on media type change */ +#define FDFMTBEG 6 /* begin formatting a disk */ +#define FDFMTTRK 7 /* format the specified track */ +#define FDFMTEND 8 /* end formatting a disk */ +#define FDSETEMSGTRESH 10 /* set fdc error reporting treshold */ +#define FDFLUSH 11 /* flush buffers for media; either for verifying media, + * or for handling a media change without closing the + * file descriptor */ +#endif struct floppy_struct { - unsigned int size, /* nr of 512-byte sectors total */ - sect, /* sectors per track */ - head, /* nr of heads */ - track, /* nr of tracks */ - stretch; /* !=0 means double track steps */ - unsigned char gap, /* gap1 size */ - rate, /* data rate. |= 0x40 for perpendicular */ - spec1, /* stepping rate, head unload time */ - fmt_gap; /* gap2 size */ - const char *name; /* used only for predefined formats */ -}; - -struct format_descr { - unsigned int device, head, track; + unsigned int size, /* nr of 512-byte sectors total */ + sect, /* sectors per track */ + head, /* nr of heads */ + track, /* nr of tracks */ + stretch; /* !=0 means double track steps */ + unsigned char gap, /* gap1 size */ + rate, /* data rate. |= 0x40 for perpendicular */ + spec1, /* stepping rate, head unload time */ + fmt_gap; /* gap2 size */ + const char *name; /* used only for predefined formats */ }; #endif diff --git a/elks/include/linuxmt/socket.h b/elks/include/linuxmt/socket.h index ff7fb7275..9c97fc1c5 100644 --- a/elks/include/linuxmt/socket.h +++ b/elks/include/linuxmt/socket.h @@ -2,7 +2,6 @@ #define __LINUXMT_SOCKET_H #include -#include #define MAX_SOCK_ADDR 110 /* Sufficient size for AF_UNIX */ @@ -27,17 +26,7 @@ struct linger { int l_linger; /* How long to linger for */ }; -struct msghdr { - void * msg_name; - int msg_namelen; - struct iovec * msg_iov; - int msg_iovlen; - void * msg_control; - int msg_controllen; - int msg_flags; -}; - -#define AF_INET 0 /* Only implemented type */ +#define AF_INET 0 #define AF_UNIX 1 #define AF_NANO 2 @@ -52,6 +41,26 @@ struct msghdr { #define SOCK_SEQPACKET 5 /* sequential packet socket */ #ifdef __KERNEL__ + +#if UNUSED +struct iovec { + void *iov_base; /* BSD uses caddr_t (same thing in effect) */ + int iov_len; +}; + +#define UIO_MAXIOV 16 + +struct msghdr { + void * msg_name; + int msg_namelen; + struct iovec * msg_iov; + int msg_iovlen; + void * msg_control; + int msg_controllen; + int msg_flags; +}; +#endif + struct proto_ops; struct socket; int sock_register(int,struct proto_ops *); diff --git a/elks/include/linuxmt/uio.h b/elks/include/linuxmt/uio.h deleted file mode 100644 index 28d983efe..000000000 --- a/elks/include/linuxmt/uio.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __LINUXMT_UIO_H -#define __LINUXMT_UIO_H - -struct iovec { - void *iov_base; /* BSD uses caddr_t (same thing in effect) */ - int iov_len; -}; - -#define UIO_MAXIOV 16 - -#endif diff --git a/elks/init/main.c b/elks/init/main.c index 9d02091bb..f3c3750c2 100644 --- a/elks/init/main.c +++ b/elks/init/main.c @@ -211,7 +211,7 @@ static void INITPROC kernel_init(void) static void INITPROC kernel_banner(seg_t init, seg_t extra) { #ifdef CONFIG_ARCH_IBMPC - printk("PC/%cT class machine, ", (sys_caps & CAP_PC_AT) ? 'A' : 'X'); + printk("PC/%cT class arch %d, ", (sys_caps & CAP_PC_AT) ? 'A' : 'X', SETUP_CPU_TYPE); #endif #ifdef CONFIG_ARCH_PC98