Skip to content

Commit

Permalink
Merge pull request #1710 from ghaerr/bioshd4
Browse files Browse the repository at this point in the history
[kernel] Change bioshd minor numbering scheme to conserve kernel data size
  • Loading branch information
ghaerr authored Sep 11, 2023
2 parents 5eaea47 + 73b9630 commit 18d1379
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 24 deletions.
4 changes: 2 additions & 2 deletions elks/arch/i86/drivers/block/bios.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#define RESET_DISK_CHG 0 /* =1 to reset BIOS on drive change fixes QEMU retry */

/* FIXME semi-copied from bioshd.c */
#define MINOR_SHIFT 5 /* =log2(NUM_MINOR) shift to get drive num*/
#define MAX_DRIVES 8 /* =256/NUM_MINOR*/
#define MINOR_SHIFT 3 /* =log2(NUM_MINOR) shift to get drive num*/
#define MAX_DRIVES 8 /* <=256/NUM_MINOR*/
#define DRIVE_FD0 4 /* =MAX_DRIVES/2 first floppy drive*/

struct drive_infot fd_types[] = { /* AT/PS2 BIOS reported floppy formats*/
Expand Down
6 changes: 3 additions & 3 deletions elks/arch/i86/drivers/block/bioshd.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
#define MAX_ERRS 5 /* maximum sector read/write error retries */

/* the following must match with /dev minor numbering scheme*/
#define NUM_MINOR 32 /* max minor devices per drive*/
#define MINOR_SHIFT 5 /* =log2(NUM_MINOR) shift to get drive num*/
#define MAX_DRIVES 8 /* =256/NUM_MINOR*/
#define NUM_MINOR 8 /* max minor devices per drive*/
#define MINOR_SHIFT 3 /* =log2(NUM_MINOR) shift to get drive num*/
#define MAX_DRIVES 8 /* <=256/NUM_MINOR*/
#define DRIVE_HD0 0
#define DRIVE_FD0 4 /* =MAX_DRIVES/2 first floppy drive*/

Expand Down
14 changes: 7 additions & 7 deletions elks/include/linuxmt/devnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

/* block devices */
#define DEV_HDA MKDEV(BIOSHD_MAJOR, 0)
#define DEV_HDB MKDEV(BIOSHD_MAJOR, 32)
#define DEV_HDC MKDEV(BIOSHD_MAJOR, 64)
#define DEV_HDD MKDEV(BIOSHD_MAJOR, 96)
#define DEV_FD0 MKDEV(BIOSHD_MAJOR, 128)
#define DEV_FD1 MKDEV(BIOSHD_MAJOR, 160)
#define DEV_FD2 MKDEV(BIOSHD_MAJOR, 192)
#define DEV_FD3 MKDEV(BIOSHD_MAJOR, 224)
#define DEV_HDB MKDEV(BIOSHD_MAJOR, 8)
#define DEV_HDC MKDEV(BIOSHD_MAJOR, 16)
#define DEV_HDD MKDEV(BIOSHD_MAJOR, 24)
#define DEV_FD0 MKDEV(BIOSHD_MAJOR, 32)
#define DEV_FD1 MKDEV(BIOSHD_MAJOR, 40)
#define DEV_FD2 MKDEV(BIOSHD_MAJOR, 48)
#define DEV_FD3 MKDEV(BIOSHD_MAJOR, 56)
#define DEV_ROM MKDEV(ROMFLASH_MAJOR, 0)

/* char devices */
Expand Down
23 changes: 11 additions & 12 deletions image/Make.devices
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ devices:

##############################################################################
# BIOS devices, hard and floppy disks.
# Limit to 4 primary partitions per disk (MBR).
# Limit to 4 primary partitions and 3 extended per disk (MBR).

$(MKDEV) /dev/hda b 3 0
$(MKDEV) /dev/hda1 b 3 1
Expand All @@ -48,17 +48,16 @@ devices:
$(MKDEV) /dev/hda5 b 3 5
$(MKDEV) /dev/hda6 b 3 6
$(MKDEV) /dev/hda7 b 3 7
$(MKDEV) /dev/hda8 b 3 8
$(MKDEV) /dev/hdb b 3 32
$(MKDEV) /dev/hdb1 b 3 33
$(MKDEV) /dev/hdb2 b 3 34
$(MKDEV) /dev/hdb3 b 3 35
$(MKDEV) /dev/hdb4 b 3 36
$(MKDEV) /dev/hdc b 3 64
$(MKDEV) /dev/hdc1 b 3 65
$(MKDEV) /dev/hdd b 3 96
$(MKDEV) /dev/fd0 b 3 128
$(MKDEV) /dev/fd1 b 3 160
$(MKDEV) /dev/hdb b 3 8
$(MKDEV) /dev/hdb1 b 3 9
$(MKDEV) /dev/hdb2 b 3 10
$(MKDEV) /dev/hdb3 b 3 11
$(MKDEV) /dev/hdb4 b 3 12
$(MKDEV) /dev/hdc b 3 16
$(MKDEV) /dev/hdc1 b 3 17
$(MKDEV) /dev/hdd b 3 24
$(MKDEV) /dev/fd0 b 3 32
$(MKDEV) /dev/fd1 b 3 40

##############################################################################
# Pseudo-TTY master devices.
Expand Down

0 comments on commit 18d1379

Please sign in to comment.