From f7e489ca2fa4e005537ed3f2b525b5eca4852ab5 Mon Sep 17 00:00:00 2001 From: Neal Andrew Crook Date: Sat, 21 May 2016 16:06:33 +0100 Subject: [PATCH] Fix for ISSUE 344: migrate DEVICE_xx to CONFIG_xx, change DRIVE_COUNT to IDE_DRIVE_COUNT (for consistency with SD_DRIVE_COUNT), rename CONFIG_SDC to CONFIG_COCOSDC. --- Kernel/PORTING | 16 ++++++++++++++++ Kernel/dev/devide.h | 13 ++++++++----- Kernel/dev/devide_discard.c | 2 +- Kernel/dev/devsd.h | 2 +- Kernel/platform-coco3/config.h | 3 ++- Kernel/platform-coco3/devices.c | 2 +- Kernel/platform-dragon-nx32/config.h | 3 ++- Kernel/platform-msx2/config.h | 2 +- Kernel/platform-msx2/devmegasd.c | 2 +- Kernel/platform-n8vem-mark4/config.h | 4 ++-- Kernel/platform-p112/config.h | 2 +- Kernel/platform-zeta-v2/config.h | 2 +- 12 files changed, 37 insertions(+), 16 deletions(-) diff --git a/Kernel/PORTING b/Kernel/PORTING index ae994f68..318b0305 100644 --- a/Kernel/PORTING +++ b/Kernel/PORTING @@ -105,6 +105,22 @@ Porting Fuzix to a new Z80 based machine generally requires the following If you need to put your MBR elsewhere, use this. Even with this defined, block 0 is still checked first and a valid MBR there is used in preference. + CONFIG_IDE, IDE_DRIVE_COUNT + CONFIG_SD, SD_DRIVE_COUNT + CONFIG_FLOPPY + CONFIG_P112_FLOPPY + CONFIG_COCOSDC (Darren Atkinson's "CoCoSDC" floppy emulator cartridge) + The common kernel files don't provide any support for these different block + devices. Support for block devices is provided per-platform by the + platform-specific Makefile (ie, by pulling in IDE support code from + Kernel/dev or from platform-specific source files) and by entries in the + device driver switch table and calls in device_init(). Examine devices.c + for a few different platforms to get the idea. You might use (eg) CONFIG_SD + in your platform code in order to allow a build with and without SD support. + + MAX_BLKDEV is the total number of block devices. Current examples include + IDE, FLOPPY, SD, COCOSDC, SCSI, ROM and RAM disks. + - Set the basic system parameters TICKSPERSEC - clock rate diff --git a/Kernel/dev/devide.h b/Kernel/dev/devide.h index 206f6b2f..9d9e5561 100644 --- a/Kernel/dev/devide.h +++ b/Kernel/dev/devide.h @@ -5,8 +5,11 @@ #include "platform_ide.h" /* IDE Drive Configuration (in config.h) - - Define DEVICE_IDE if IDE hardware is present on your platform. + + Define CONFIG_IDE if IDE hardware is present on your platform. + + Define IDE_DRIVE_COUNT to the number of IDE drives your hardware + supports (at most 16) - defaults to 2 if undefined. Define IDE_8BIT_ONLY if the system implements only half of the 16-bit data bus (eg n8vem-mark4). @@ -14,7 +17,7 @@ Define IDE_REG_INDIRECT if the IDE registers are not directly addressable on your platform. If you do not define IDE_REG_INDIRECT then IDE registers should be directly addressable by CPU I/O operations. - + If IDE_REG_INDIRECT is defined you will need to provide devide_readb() and devide_writeb() to access the IDE registers. You will need to define suitable values for each register (ide_reg_data, ide_reg_error etc) to be @@ -90,8 +93,8 @@ void devide_writeb(uint8_t regaddr, uint8_t value); #ifdef _IDE_PRIVATE -#ifndef DRIVE_COUNT -#define DRIVE_COUNT 2 /* at most 16 drives without adjusting DRIVE_NR_MASK */ +#ifndef IDE_DRIVE_COUNT +#define IDE_DRIVE_COUNT 2 /* at most 16 drives without adjusting DRIVE_NR_MASK */ #endif /* we use the bits in the driver_data field of blkdev_t as follows: */ diff --git a/Kernel/dev/devide_discard.c b/Kernel/dev/devide_discard.c index 271870a6..c8ad9935 100644 --- a/Kernel/dev/devide_discard.c +++ b/Kernel/dev/devide_discard.c @@ -144,6 +144,6 @@ void devide_init(void) devide_reset(); #endif - for(d=0; d < DRIVE_COUNT; d++) + for(d=0; d < IDE_DRIVE_COUNT; d++) devide_init_drive(d); } diff --git a/Kernel/dev/devsd.h b/Kernel/dev/devsd.h index f679c3f0..99970bc1 100644 --- a/Kernel/dev/devsd.h +++ b/Kernel/dev/devsd.h @@ -3,7 +3,7 @@ /* SD Configuration (in config.h) - Define DEVICE_SD if SD hardware is present on your platform. + Define CONFIG_SD if SD hardware is present on your platform. Define SD_DRIVE_COUNT to the number of SD cards your hardware supports (at most 16) diff --git a/Kernel/platform-coco3/config.h b/Kernel/platform-coco3/config.h index 52a93037..d7bd563e 100644 --- a/Kernel/platform-coco3/config.h +++ b/Kernel/platform-coco3/config.h @@ -86,5 +86,6 @@ extern unsigned char vt_map( unsigned char c ); /* Block device define */ #define MAX_BLKDEV 4 /* 2 IDE + 2 SDC */ -#define DEVICE_IDE /* enable if IDE interface present */ +#undef CONFIG_COCOSDC /* Darren Atkinson's "CoCoSDC" cartridge */ +#define CONFIG_IDE /* enable if IDE interface present */ diff --git a/Kernel/platform-coco3/devices.c b/Kernel/platform-coco3/devices.c index f0486a9a..5923b2d1 100644 --- a/Kernel/platform-coco3/devices.c +++ b/Kernel/platform-coco3/devices.c @@ -44,7 +44,7 @@ bool validdev(uint16_t dev) void device_init(void) { devide_init( ); -#ifdef CONFIG_SDC +#ifdef CONFIG_COCOSDC devsdc_init( ); #endif } diff --git a/Kernel/platform-dragon-nx32/config.h b/Kernel/platform-dragon-nx32/config.h index c8a5867c..4ddcd706 100644 --- a/Kernel/platform-dragon-nx32/config.h +++ b/Kernel/platform-dragon-nx32/config.h @@ -30,7 +30,8 @@ #define MAX_BLKDEV 3 /* 2 IDE drives + 1 SPI */ #define SD_DRIVE_COUNT 1 /* Could be higher with multiple CS used */ -#define DEVICE_IDE /* enable if IDE interface present */ +#define CONFIG_SD /* enable if SD interface present */ +#define CONFIG_IDE /* enable if IDE interface present */ /* Video terminal, not a serial tty */ #define CONFIG_VT diff --git a/Kernel/platform-msx2/config.h b/Kernel/platform-msx2/config.h index c895b9fb..48bfea40 100644 --- a/Kernel/platform-msx2/config.h +++ b/Kernel/platform-msx2/config.h @@ -43,7 +43,7 @@ #define NBUFS 10 /* Number of block buffers */ #define NMOUNTS 4 /* Number of mounts at a time */ -#define DEVICE_SD +#define CONFIG_SD #define SD_DRIVE_COUNT 1 #define MAX_BLKDEV 1 /* Single SD drive */ diff --git a/Kernel/platform-msx2/devmegasd.c b/Kernel/platform-msx2/devmegasd.c index 73858b91..e0bb3dcb 100644 --- a/Kernel/platform-msx2/devmegasd.c +++ b/Kernel/platform-msx2/devmegasd.c @@ -36,7 +36,7 @@ #define readb(x) *((volatile uint8_t *)x) #define writeb(val,x) *((volatile uint8_t *)x) = val -#ifdef DEVICE_SD +#ifdef CONFIG_SD /* slot and subslot containing the sd interface */ diff --git a/Kernel/platform-n8vem-mark4/config.h b/Kernel/platform-n8vem-mark4/config.h index d22b5bd8..ae2d3431 100644 --- a/Kernel/platform-n8vem-mark4/config.h +++ b/Kernel/platform-n8vem-mark4/config.h @@ -40,13 +40,13 @@ #define MAX_BLKDEV 3 /* 2 IDE drives, 1 SD drive */ -#define DEVICE_IDE +#define CONFIG_IDE #define IDE_REG_BASE MARK4_IO_BASE #define IDE_8BIT_ONLY #define IDE_REG_CS1_FIRST /* On-board SD on Mark IV */ -#define DEVICE_SD +#define CONFIG_SD #define SD_DRIVE_COUNT 1 /* On-board DS1302 on Mark IV, we can read the time of day from it */ diff --git a/Kernel/platform-p112/config.h b/Kernel/platform-p112/config.h index f184f43b..b3736b49 100644 --- a/Kernel/platform-p112/config.h +++ b/Kernel/platform-p112/config.h @@ -43,7 +43,7 @@ #define MAX_BLKDEV 2 /* 2 IDE drives */ -#define DEVICE_IDE /* enable if IDE interface present */ +#define CONFIG_IDE /* enable if IDE interface present */ /* We have a DS1302, we can read the time of day from it */ #define CONFIG_RTC diff --git a/Kernel/platform-zeta-v2/config.h b/Kernel/platform-zeta-v2/config.h index fe90175e..df016d75 100644 --- a/Kernel/platform-zeta-v2/config.h +++ b/Kernel/platform-zeta-v2/config.h @@ -64,7 +64,7 @@ #ifdef CONFIG_PPP /* SD card in ParPortProp */ - #define DEVICE_SD + #define CONFIG_SD #define SD_DRIVE_COUNT 1 #define NUM_DEV_TTY 2 -- 2.34.1