Skip to content

Commit

Permalink
[kernel] Minor header file cleanup, add arch %d to PC class
Browse files Browse the repository at this point in the history
  • Loading branch information
ghaerr committed Nov 1, 2024
1 parent 57236d9 commit 277e36b
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 94 deletions.
23 changes: 22 additions & 1 deletion elks/arch/i86/drivers/block/directhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,34 @@
#include <linuxmt/fs.h>
#include <linuxmt/string.h>
#include <linuxmt/mm.h>
#include <linuxmt/directhd.h>
#include <linuxmt/debug.h>

#include <arch/hdreg.h>
#include <arch/io.h>
#include <arch/segment.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 */

/* 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)
Expand Down
2 changes: 1 addition & 1 deletion elks/include/linuxmt/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
33 changes: 0 additions & 33 deletions elks/include/linuxmt/directhd.h

This file was deleted.

60 changes: 25 additions & 35 deletions elks/include/linuxmt/fd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
33 changes: 21 additions & 12 deletions elks/include/linuxmt/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define __LINUXMT_SOCKET_H

#include <linuxmt/types.h>
#include <linuxmt/uio.h>

#define MAX_SOCK_ADDR 110 /* Sufficient size for AF_UNIX */

Expand All @@ -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

Expand All @@ -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 *);
Expand Down
11 changes: 0 additions & 11 deletions elks/include/linuxmt/uio.h

This file was deleted.

2 changes: 1 addition & 1 deletion elks/init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 277e36b

Please sign in to comment.