add directory docs

This commit is contained in:
gohigh
2024-02-19 00:23:35 -05:00
parent b50063d9b3
commit 9912ec445d
12689 changed files with 3135349 additions and 0 deletions

402
docs/MemSavers/109.diff Normal file
View File

@@ -0,0 +1,402 @@
diff -ur linux-oem-109/config.in linux/config.in
--- linux-oem-109/config.in Tue Aug 29 14:26:40 1995
+++ linux/config.in Wed Aug 30 11:10:34 1995
@@ -7,11 +7,13 @@
*
bool 'Kernel math emulation' CONFIG_MATH_EMULATION y
bool 'Normal harddisk support' CONFIG_BLK_DEV_HD y
+bool 'RAM disk support' CONFIG_BLK_DEV_RAM n
bool 'XT harddisk support' CONFIG_BLK_DEV_XD n
bool 'TCP/IP networking' CONFIG_INET y
bool 'Limit memory to low 16MB' CONFIG_MAX_16M n
bool 'System V IPC' CONFIG_SYSVIPC y
bool 'Use -m486 flag for 486-specific optimizations' CONFIG_M486 y
+bool 'Loadable Module support' CONFIG_MODULES n
*
* Program binary formats
*
diff -ur linux-oem-109/drivers/block/Makefile linux/drivers/block/Makefile
--- linux-oem-109/drivers/block/Makefile Mon Mar 7 00:08:21 1994
+++ linux/drivers/block/Makefile Wed Aug 30 10:59:41 1995
@@ -21,8 +21,8 @@
# In the future, some of these should be built conditionally.
#
-OBJS := ll_rw_blk.o floppy.o ramdisk.o genhd.o
-SRCS := ll_rw_blk.c floppy.c ramdisk.c genhd.c
+OBJS := ll_rw_blk.o floppy.o genhd.o
+SRCS := ll_rw_blk.c floppy.c genhd.c
ifdef CONFIG_CDU31A
OBJS := $(OBJS) cdu31a.o
@@ -42,6 +42,11 @@
ifdef CONFIG_BLK_DEV_HD
OBJS := $(OBJS) hd.o
SRCS := $(SRCS) hd.c
+endif
+
+ifdef CONFIG_BLK_DEV_RAM
+OBJS := $(OBJS) ramdisk.o
+SRCS := $(SRCS) ramdisk.c
endif
ifdef CONFIG_BLK_DEV_XD
diff -ur linux-oem-109/drivers/block/genhd.c linux/drivers/block/genhd.c
--- linux-oem-109/drivers/block/genhd.c Wed Dec 1 23:44:15 1993
+++ linux/drivers/block/genhd.c Wed Aug 30 10:59:41 1995
@@ -19,8 +19,10 @@
static int current_minor = 0;
extern int *blk_size[];
+#ifdef CONFIG_BLK_DEV_RAM
extern void rd_load(void);
extern int ramdisk_size;
+#endif
/*
* Create devices for each logical partition in an extended partition.
@@ -209,8 +211,10 @@
nr += p->nr_real;
}
+#ifdef CONFIG_BLK_DEV_RAM
if (ramdisk_size)
rd_load();
+#endif
mount_root();
return (0);
}
diff -ur linux-oem-109/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c
--- linux-oem-109/drivers/block/ll_rw_blk.c Tue Feb 1 18:03:51 1994
+++ linux/drivers/block/ll_rw_blk.c Wed Aug 30 10:59:40 1995
@@ -497,7 +497,9 @@
#ifdef CONFIG_SBPCD
mem_start = sbpcd_init(mem_start, mem_end);
#endif CONFIG_SBPCD
+#ifdef CONFIG_BLK_DEV_RAM
if (ramdisk_size)
mem_start += rd_init(mem_start, ramdisk_size*1024);
+#endif
return mem_start;
}
diff -ur linux-oem-109/drivers/char/serial.c linux/drivers/char/serial.c
--- linux-oem-109/drivers/char/serial.c Mon Mar 14 06:20:21 1994
+++ linux/drivers/char/serial.c Wed Aug 30 10:59:46 1995
@@ -145,56 +145,6 @@
/* UART CLK PORT IRQ FLAGS */
{ BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS }, /* ttyS0 */
{ BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS }, /* ttyS1 */
- { BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS }, /* ttyS2 */
- { BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS }, /* ttyS3 */
-
- { BASE_BAUD, 0x1A0, 9, FOURPORT_FLAGS }, /* ttyS4 */
- { BASE_BAUD, 0x1A8, 9, FOURPORT_FLAGS }, /* ttyS5 */
- { BASE_BAUD, 0x1B0, 9, FOURPORT_FLAGS }, /* ttyS6 */
- { BASE_BAUD, 0x1B8, 9, FOURPORT_FLAGS }, /* ttyS7 */
-
- { BASE_BAUD, 0x2A0, 5, FOURPORT_FLAGS }, /* ttyS8 */
- { BASE_BAUD, 0x2A8, 5, FOURPORT_FLAGS }, /* ttyS9 */
- { BASE_BAUD, 0x2B0, 5, FOURPORT_FLAGS }, /* ttyS10 */
- { BASE_BAUD, 0x2B8, 5, FOURPORT_FLAGS }, /* ttyS11 */
-
- { BASE_BAUD, 0x330, 4, ACCENT_FLAGS }, /* ttyS12 */
- { BASE_BAUD, 0x338, 4, ACCENT_FLAGS }, /* ttyS13 */
- { BASE_BAUD, 0x000, 0, 0 }, /* ttyS14 (spare; user configurable) */
- { BASE_BAUD, 0x000, 0, 0 }, /* ttyS15 (spare; user configurable) */
-
- { BASE_BAUD, 0x100, 12, BOCA_FLAGS }, /* ttyS16 */
- { BASE_BAUD, 0x108, 12, BOCA_FLAGS }, /* ttyS17 */
- { BASE_BAUD, 0x110, 12, BOCA_FLAGS }, /* ttyS18 */
- { BASE_BAUD, 0x118, 12, BOCA_FLAGS }, /* ttyS19 */
- { BASE_BAUD, 0x120, 12, BOCA_FLAGS }, /* ttyS20 */
- { BASE_BAUD, 0x128, 12, BOCA_FLAGS }, /* ttyS21 */
- { BASE_BAUD, 0x130, 12, BOCA_FLAGS }, /* ttyS22 */
- { BASE_BAUD, 0x138, 12, BOCA_FLAGS }, /* ttyS23 */
- { BASE_BAUD, 0x140, 12, BOCA_FLAGS }, /* ttyS24 */
- { BASE_BAUD, 0x148, 12, BOCA_FLAGS }, /* ttyS25 */
- { BASE_BAUD, 0x150, 12, BOCA_FLAGS }, /* ttyS26 */
- { BASE_BAUD, 0x158, 12, BOCA_FLAGS }, /* ttyS27 */
- { BASE_BAUD, 0x160, 12, BOCA_FLAGS }, /* ttyS28 */
- { BASE_BAUD, 0x168, 12, BOCA_FLAGS }, /* ttyS29 */
- { BASE_BAUD, 0x170, 12, BOCA_FLAGS }, /* ttyS30 */
- { BASE_BAUD, 0x178, 12, BOCA_FLAGS }, /* ttyS31 */
-
-/* You can have up to four HUB6's in the system, but I've only
- * included two cards here for a total of twelve ports.
- */
- { BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,0) }, /* ttyS32 */
- { BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,1) }, /* ttyS33 */
- { BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,2) }, /* ttyS34 */
- { BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,3) }, /* ttyS35 */
- { BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,4) }, /* ttyS36 */
- { BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(0,5) }, /* ttyS37 */
- { BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,0) }, /* ttyS32 */
- { BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,1) }, /* ttyS33 */
- { BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,2) }, /* ttyS34 */
- { BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,3) }, /* ttyS35 */
- { BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,4) }, /* ttyS36 */
- { BASE_BAUD, 0x302, 3, HUB6_FLAGS, C_P(1,5) }, /* ttyS37 */
};
#define NR_PORTS (sizeof(rs_table)/sizeof(struct async_struct))
diff -ur linux-oem-109/drivers/net/ne.c linux/drivers/net/ne.c
--- linux-oem-109/drivers/net/ne.c Mon Mar 7 00:12:04 1994
+++ linux/drivers/net/ne.c Wed Aug 30 10:59:36 1995
@@ -175,29 +175,15 @@
}
#endif
- neX000 = (SA_prom[14] == 0x57 && SA_prom[15] == 0x57);
- ctron = (SA_prom[0] == 0x00 && SA_prom[1] == 0x00 && SA_prom[2] == 0x1d);
- dlink = (SA_prom[0] == 0x00 && SA_prom[1] == 0xDE && SA_prom[2] == 0x01);
- dfi = (SA_prom[0] == 'D' && SA_prom[1] == 'F' && SA_prom[2] == 'I');
-
/* Set up the rest of the parameters. */
- if (neX000 || dlink || dfi) {
- if (wordlength == 2) {
- name = dlink ? "DE200" : "NE2000";
- start_page = NESM_START_PG;
- stop_page = NESM_STOP_PG;
- } else {
- name = dlink ? "DE100" : "NE1000";
- start_page = NE1SM_START_PG;
- stop_page = NE1SM_STOP_PG;
- }
- } else if (ctron) {
- name = "Cabletron";
- start_page = 0x01;
- stop_page = (wordlength == 2) ? 0x40 : 0x20;
+ if (wordlength == 2) {
+ name = "NE2000";
+ start_page = NESM_START_PG;
+ stop_page = NESM_STOP_PG;
} else {
- printk(" not found.\n");
- return 0;
+ name = "NE1000";
+ start_page = NE1SM_START_PG;
+ stop_page = NE1SM_STOP_PG;
}
if (dev->irq < 2) {
diff -ur linux-oem-109/fs/proc/array.c linux/fs/proc/array.c
--- linux-oem-109/fs/proc/array.c Wed Aug 30 10:57:42 1995
+++ linux/fs/proc/array.c Wed Aug 30 10:58:17 1995
@@ -464,7 +464,9 @@
return sz;
}
+#ifdef CONFIG_MODULES
extern int get_module_list(char *);
+#endif
static int array_read(struct inode * inode, struct file * file,char * buf, int count)
{
@@ -516,9 +518,11 @@
case 15:
length = get_maps(pid, page);
break;
+#ifdef CONFIG_MODULES
case 16:
length = get_module_list(page);
break;
+#endif
case 17:
length = get_kstat(page);
break;
diff -ur linux-oem-109/fs/proc/root.c linux/fs/proc/root.c
--- linux-oem-109/fs/proc/root.c Wed Aug 30 10:57:42 1995
+++ linux/fs/proc/root.c Wed Aug 30 10:58:16 1995
@@ -65,7 +65,9 @@
{13,6,"malloc" },
#endif
{14,5,"kcore" },
+#ifdef CONFIG_MODULES
{16,7,"modules" },
+#endif
{17,4,"stat" },
};
diff -ur linux-oem-109/init/main.c linux/init/main.c
--- linux-oem-109/init/main.c Wed Aug 30 10:57:48 1995
+++ linux/init/main.c Wed Aug 30 10:58:37 1995
@@ -63,8 +63,6 @@
return waitpid(-1,wait_stat,0);
}
-static char printbuf[1024];
-
extern int console_loglevel;
extern char empty_zero_page[PAGE_SIZE];
@@ -135,17 +133,15 @@
static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
static char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", term, NULL, };
-static char * argv_rc[] = { "/bin/sh", NULL };
-static char * envp_rc[] = { "HOME=/", term, NULL };
-
-static char * argv[] = { "-/bin/sh",NULL };
-static char * envp[] = { "HOME=/usr/root", term, NULL };
-
struct drive_info_struct { char dummy[32]; } drive_info;
struct screen_info screen_info;
unsigned char aux_device_present;
+
+#ifdef CONFIG_BLK_DEV_RAM
int ramdisk_size;
+#endif
+
int root_mountflags = 0;
static char fpu_error = 0;
@@ -369,7 +365,9 @@
aux_device_present = AUX_DEVICE_INFO;
memory_end = (1<<20) + (EXT_MEM_K<<10);
memory_end &= PAGE_MASK;
+#ifdef CONFIG_BLK_DEV_RAM
ramdisk_size = RAMDISK_SIZE;
+#endif
copy_options(command_line,COMMAND_LINE);
#ifdef CONFIG_MAX_16M
if (memory_end > 16*1024*1024)
@@ -474,20 +472,8 @@
idle();
}
-static int printf(const char *fmt, ...)
-{
- va_list args;
- int i;
-
- va_start(args, fmt);
- write(1,printbuf,i=vsprintf(printbuf, fmt, args));
- va_end(args);
- return i;
-}
-
void init(void)
{
- int pid,i;
setup((void *) &drive_info);
sprintf(term, "TERM=con%dx%d", ORIG_VIDEO_COLS, ORIG_VIDEO_LINES);
@@ -498,36 +484,4 @@
execve("/etc/init",argv_init,envp_init);
execve("/bin/init",argv_init,envp_init);
execve("/sbin/init",argv_init,envp_init);
- /* if this fails, fall through to original stuff */
-
- if (!(pid=fork())) {
- close(0);
- if (open("/etc/rc",O_RDONLY,0))
- _exit(1);
- execve("/bin/sh",argv_rc,envp_rc);
- _exit(2);
- }
- if (pid>0)
- while (pid != wait(&i))
- /* nothing */;
- while (1) {
- if ((pid = fork()) < 0) {
- printf("Fork failed in init\n\r");
- continue;
- }
- if (!pid) {
- close(0);close(1);close(2);
- setsid();
- (void) open("/dev/tty1",O_RDWR,0);
- (void) dup(0);
- (void) dup(0);
- _exit(execve("/bin/sh",argv,envp));
- }
- while (1)
- if (pid == wait(&i))
- break;
- printf("\n\rchild %d died with code %04x\n\r",pid,i);
- sync();
- }
- _exit(0);
}
diff -ur linux-oem-109/kernel/Makefile linux/kernel/Makefile
--- linux-oem-109/kernel/Makefile Wed Aug 30 10:57:48 1995
+++ linux/kernel/Makefile Wed Aug 30 10:58:38 1995
@@ -17,9 +17,13 @@
$(CC) $(CFLAGS) -c $<
OBJS = sched.o sys_call.o traps.o irq.o dma.o fork.o \
- panic.o printk.o vsprintf.o sys.o module.o ksyms.o exit.o \
+ panic.o printk.o vsprintf.o sys.o module.o exit.o \
signal.o mktime.o ptrace.o ioport.o itimer.o \
info.o ldt.o time.o
+
+ifdef CONFIG_MODULES
+OBJS := $(OBJS) ksyms.o
+endif
all: kernel.o
diff -ur linux-oem-109/kernel/module.c linux/kernel/module.c
--- linux-oem-109/kernel/module.c Wed Aug 30 10:57:50 1995
+++ linux/kernel/module.c Wed Aug 30 10:58:41 1995
@@ -7,6 +7,13 @@
#include <linux/sched.h>
#include <linux/malloc.h>
+/*
+ * Reduce kernel bloat. Use dummy syscall functions for users
+ * who disable all module support. Similar to kernel/sys.c
+ */
+
+#ifdef CONFIG_MODULES /* a *big* #ifdef block... */
+
struct module *module_list = NULL;
int freeing_modules; /* true if some modules are marked for deletion */
@@ -274,3 +281,30 @@
}
return p - buf;
}
+
+#else /* CONFIG_MODULES */
+
+/* Dummy syscalls for people who don't want modules */
+
+asmlinkage unsigned long sys_create_module(void)
+{
+ return -ENOSYS;
+}
+
+asmlinkage int sys_init_module(void)
+{
+ return -ENOSYS;
+}
+
+asmlinkage int sys_delete_module(void)
+{
+ return -ENOSYS;
+}
+
+asmlinkage int sys_get_kernel_syms(void)
+{
+ return -ENOSYS;
+}
+
+#endif /* CONFIG_MODULES */
+
diff -ur linux-oem-109/kernel/printk.c linux/kernel/printk.c
--- linux-oem-109/kernel/printk.c Wed Aug 30 10:57:49 1995
+++ linux/kernel/printk.c Wed Aug 30 10:58:39 1995
@@ -20,9 +20,9 @@
#include <linux/sched.h>
#include <linux/kernel.h>
-#define LOG_BUF_LEN 4096
+#define LOG_BUF_LEN 1024
-static char buf[1024];
+static char buf[256];
extern int vsprintf(char * buf, const char * fmt, va_list args);
extern void console_print(const char *);

198
docs/MemSavers/3c503.mem Normal file
View File

@@ -0,0 +1,198 @@
--- 3c503.c.old Sun Apr 30 17:06:31 1995
+++ 3c503.c Sun Apr 30 17:07:24 1995
@@ -12,8 +12,8 @@
Code 930.5, Goddard Space Flight Center, Greenbelt MD 20771
This driver should work with the 3c503 and 3c503/16. It should be used
- in shared memory mode for best performance, although it may also work
- in programmed-I/O mode.
+ in shared memory mode for best performance, although it can be
+ configured to work in programmed-I/O mode.
Sources:
EtherLink II Technical Reference Guide,
@@ -25,6 +25,12 @@
static char *version =
"3c503.c:v1.10 9/23/93 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n";
+/* Do we support the slower, bug-ridden PIO mode of the 8390? */
+/* #define CONFIG_EL2_PIO */
+
+/* Do we do a quick test on the card's memory at boot? */
+/* #define CONFIG_EL2_MEMTEST */
+
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/errno.h>
@@ -56,9 +62,11 @@
the other for the typical I/O probe. */
struct netdev_entry el2_drv =
{"3c503", el2_probe, EL1_IO_EXTENT, 0};
+#ifdef CONFIG_EL2_PIO
struct netdev_entry el2pio_drv =
{"3c503pio", el2_pioprobe1, EL1_IO_EXTENT, netcard_portlist};
#endif
+#endif
static int el2_open(struct device *dev);
static int el2_close(struct device *dev);
@@ -102,14 +110,14 @@
if (el2_probe1(dev, netcard_portlist[i]) == 0)
return 0;
}
-#if ! defined(no_probe_nonshared_memory) && ! defined (HAVE_DEVLIST)
+#if defined(CONFIG_EL2_PIO) && ! defined (HAVE_DEVLIST)
return el2_pio_probe(dev);
#else
return ENODEV;
#endif
}
-#ifndef HAVE_DEVLIST
+#if defined(CONFIG_EL2_PIO) && ! defined (HAVE_DEVLIST)
/* Try all of the locations that aren't obviously empty. This touches
a lot of locations, and is much riskier than the code above. */
int
@@ -172,6 +180,13 @@
return ENODEV;
}
+#ifndef CONFIG_EL2_PIO
+ if ((membase_reg & 0xf0) == 0) {
+ printk("3c503 in PIO mode ignored - rejumper for shared memory.\n");
+ return ENODEV;
+ }
+#endif
+
request_region(ioaddr, EL2_IO_EXTENT,"3c503");
if (dev == NULL)
@@ -206,14 +221,18 @@
ei_status.interface_num = dev->mem_end & 0xf;
#endif
+#ifdef CONFIG_EL2_PIO
if ((membase_reg & 0xf0) == 0) {
dev->mem_start = 0;
} else {
+#else
+ {
+#endif
dev->mem_start = ((membase_reg & 0xc0) ? 0xD8000 : 0xC8000) +
((membase_reg & 0xA0) ? 0x4000 : 0);
#define EL2_MEMSIZE (EL2SM_STOP_PG - EL2SM_START_PG)*256
-#ifdef EL2MEMTEST
+#ifdef CONFIG_EL2_MEMTEST
/* This has never found an error, but someone might care. */
{ /* Check the card's memory. */
int *mem_base = (int *)dev->mem_start;
@@ -224,14 +243,16 @@
if (mem_base[0] != 0xba5eba5e
|| mem_base[i] != memtest_value) {
printk(" memory failure or memory address conflict.\n");
+#ifdef CONFIG_EL2_PIO
dev->mem_start = 0;
+#endif
break;
}
memtest_value += 0x55555555;
mem_base[i] = 0;
}
}
-#endif /* EL2MEMTEST */
+#endif /* EL2_MEMTEST */
/* Divide the on-board memory into a single maximum-sized transmit
(double-sized for ping-pong transmit) buffer at the base, and
use the rest as a receive ring. */
@@ -262,12 +283,14 @@
dev->open = &el2_open;
dev->stop = &el2_close;
- if (dev->mem_start)
- printk("\n%s: %s with shared memory at %#6lx-%#6lx,\n",
- dev->name, ei_status.name, dev->mem_start, dev->mem_end-1);
- else
+#ifdef CONFIG_EL2_PIO
+ if (dev->mem_start == 0)
printk("\n%s: %s using programmed I/O (REJUMPER for SHARED MEMORY).\n",
dev->name, ei_status.name);
+ else
+#endif
+ printk("\n%s: %s with shared memory at %#6lx-%#6lx,\n",
+ dev->name, ei_status.name, dev->mem_start, dev->mem_end-1);
if (ei_debug > 1)
printk(version);
@@ -376,20 +399,26 @@
el2_block_output(struct device *dev, int count,
const unsigned char *buf, const start_page)
{
- int i; /* Buffer index */
+#ifdef CONFIG_EL2_PIO
+ int i; /* Buffer index */
int boguscount = 0; /* timeout counter */
+#endif
+ void *dest_addr;
/* This should really be set with during an open(). */
outb(EGACFR_NORM, E33G_GACFR); /* Enable RAM and interrupts. */
+#ifdef CONFIG_EL2_PIO
if (dev->mem_start) { /* Shared memory transfer */
- void *dest_addr = (void *)(dev->mem_start +
+#endif
+ dest_addr = (void *)(dev->mem_start +
((start_page - ei_status.tx_start_page) << 8));
memcpy(dest_addr, buf, count);
if (ei_debug > 2 && memcmp(dest_addr, buf, count))
printk("%s: 3c503 send_packet() bad memory copy @ %#5x.\n",
dev->name, (int) dest_addr);
return;
+#ifdef CONFIG_EL2_PIO
}
/* No shared memory, put the packet out the slow way. */
/* Set up then start the internal memory transfer to Tx Start Page */
@@ -413,18 +442,23 @@
}
outb_p(ei_status.interface_num==0 ? ECNTRL_THIN : ECNTRL_AUI, E33G_CNTRL);
return;
+#endif
}
/* Returns the new ring pointer. */
static int
el2_block_input(struct device *dev, int count, char *buf, int ring_offset)
{
+#ifdef CONFIG_EL2_PIO
int boguscount = 0;
- int end_of_ring = dev->rmem_end;
unsigned int i;
+#endif
+ int end_of_ring = dev->rmem_end;
/* Maybe enable shared memory just be to be safe... nahh.*/
+#ifdef CONFIG_EL2_PIO
if (dev->mem_start) { /* Use the shared memory. */
+#endif
ring_offset -= (EL2SM_START_PG<<8);
if (dev->mem_start + ring_offset + count > end_of_ring) {
/* We must wrap the input move. */
@@ -436,6 +470,7 @@
}
memcpy(buf, (char *)dev->mem_start + ring_offset, count);
return ring_offset + count;
+#ifdef CONFIG_EL2_PIO
}
/* No shared memory, use programmed I/O. */
outb(ring_offset & 0xff, E33G_DMAAL);
@@ -458,6 +493,7 @@
}
outb_p(ei_status.interface_num == 0 ? ECNTRL_THIN : ECNTRL_AUI, E33G_CNTRL);
return 0;
+#endif
}
/*

View File

@@ -0,0 +1,93 @@
--- /usr/src/linux/drivers/block/floppy.c Mon Apr 3 18:31:31 1995
+++ linux/drivers/block/floppy.c Sat Aug 5 00:21:03 1995
@@ -150,8 +150,8 @@
#define FLOPPY1_TYPE 0
#endif
-#define N_FDC 2
-#define N_DRIVE 8
+#define N_FDC 1
+#define N_DRIVE 2
#define TYPE(x) ( ((x)>>2) & 0x1f )
#define DRIVE(x) ( ((x)&0x03) | (((x)&0x80 ) >> 5))
@@ -280,11 +280,6 @@
{{4, 500, 16, 16, 4000, 4*HZ/10, 3*HZ, 10, SEL_DLY, 5, 83, 3*HZ, 20, {3,1,2,0,2}, 0,
0, { 7, 4,25,22,31,21,29,11}, 3*HZ/2, 7 }, "1.44M" }, /*3 1/2 HD*/
-{{5, 1000, 15, 8, 3000, 4*HZ/10, 3*HZ, 10, SEL_DLY, 5, 83, 3*HZ, 40, {3,1,2,0,2}, 0,
- 0, { 7, 8, 4,25,28,22,31,21}, 3*HZ/2, 8 }, "2.88M AMI BIOS" }, /*3 1/2 ED*/
-
-{{6, 1000, 15, 8, 3000, 4*HZ/10, 3*HZ, 10, SEL_DLY, 5, 83, 3*HZ, 40, {3,1,2,0,2}, 0,
- 0, { 7, 8, 4,25,28,22,31,21}, 3*HZ/2, 8 }, "2.88M" } /*3 1/2 ED*/
/* | ---autodetected formats-- | | |
read_track | | Name printed when booting
| Native format
@@ -303,7 +298,7 @@
* types (ie 360kB diskette in 1.2MB drive etc). Others should
* be self-explanatory.
*/
-static struct floppy_struct floppy_type[32] = {
+static struct floppy_struct floppy_type[8] = {
{ 0, 0,0, 0,0,0x00,0x00,0x00,0x00,NULL }, /* 0 no testing */
{ 720, 9,2,40,0,0x2A,0x02,0xDF,0x50,"d360" }, /* 1 360KB PC */
{ 2400,15,2,80,0,0x1B,0x00,0xDF,0x54,"h1200" }, /* 2 1.2MB AT */
@@ -312,33 +307,6 @@
{ 720, 9,2,40,1,0x23,0x01,0xDF,0x50,"h360" }, /* 5 360KB AT */
{ 1440, 9,2,80,0,0x23,0x01,0xDF,0x50,"h720" }, /* 6 720KB AT */
{ 2880,18,2,80,0,0x1B,0x00,0xCF,0x6C,"H1440" }, /* 7 1.44MB 3.5" */
- { 5760,36,2,80,0,0x1B,0x43,0xAF,0x54,"E2880" }, /* 8 2.88MB 3.5" */
- { 5760,36,2,80,0,0x1B,0x43,0xAF,0x54,"CompaQ"}, /* 9 2.88MB 3.5" */
-
- { 2880,18,2,80,0,0x25,0x00,0xDF,0x02,"h1440" }, /* 10 1.44MB 5.25" */
- { 3360,21,2,80,0,0x1C,0x00,0xCF,0x0C,"H1680" }, /* 11 1.68MB 3.5" */
- { 820,10,2,41,1,0x25,0x01,0xDF,0x2E,"h410" }, /* 12 410KB 5.25" */
- { 1640,10,2,82,0,0x25,0x02,0xDF,0x2E,"H820" }, /* 13 820KB 3.5" */
- { 2952,18,2,82,0,0x25,0x00,0xDF,0x02,"h1476" }, /* 14 1.48MB 5.25" */
- { 3444,21,2,82,0,0x25,0x00,0xDF,0x0C,"H1722" }, /* 15 1.72MB 3.5" */
- { 840,10,2,42,1,0x25,0x01,0xDF,0x2E,"h420" }, /* 16 420KB 5.25" */
- { 1660,10,2,83,0,0x25,0x02,0xDF,0x2E,"H830" }, /* 17 830KB 3.5" */
- { 2988,18,2,83,0,0x25,0x00,0xDF,0x02,"h1494" }, /* 18 1.49MB 5.25" */
- { 3486,21,2,83,0,0x25,0x00,0xDF,0x0C,"H1743" }, /* 19 1.74 MB 3.5" */
-
- { 1760,11,2,80,0,0x1C,0x09,0xCF,0x00,"h880" }, /* 20 880KB 5.25" */
- { 2080,13,2,80,0,0x1C,0x01,0xCF,0x00,"D1040" }, /* 21 1.04MB 3.5" */
- { 2240,14,2,80,0,0x1C,0x19,0xCF,0x00,"D1120" }, /* 22 1.12MB 3.5" */
- { 3200,20,2,80,0,0x1C,0x20,0xCF,0x2C,"h1600" }, /* 23 1.6MB 5.25" */
- { 3520,22,2,80,0,0x1C,0x08,0xCF,0x2e,"H1760" }, /* 24 1.76MB 3.5" */
- { 3840,24,2,80,0,0x1C,0x20,0xCF,0x00,"H1920" }, /* 25 1.92MB 3.5" */
- { 6400,40,2,80,0,0x25,0x5B,0xCF,0x00,"E3200" }, /* 26 3.20MB 3.5" */
- { 7040,44,2,80,0,0x25,0x5B,0xCF,0x00,"E3520" }, /* 27 3.52MB 3.5" */
- { 7680,48,2,80,0,0x25,0x63,0xCF,0x00,"E3840" }, /* 28 3.84MB 3.5" */
-
- { 3680,23,2,80,0,0x1C,0x10,0xCF,0x00,"H1840" }, /* 29 1.84MB 3.5" */
- { 1600,10,2,80,0,0x25,0x02,0xDF,0x2E,"D800" }, /* 30 800KB 3.5" */
- { 3200,20,2,80,0,0x1C,0x00,0xCF,0x2C,"H1600" }, /* 31 1.6MB 3.5" */
};
#define NUMBER(x) (sizeof(x) / sizeof(*(x)))
@@ -346,8 +314,7 @@
/* Auto-detection: Disk type used until the next media change occurs. */
struct floppy_struct *current_type[N_DRIVE] = {
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL
+ NULL, NULL
};
/*
@@ -704,13 +671,7 @@
static struct timer_list motor_off_timer[N_DRIVE] = {
{ NULL, NULL, 0, 0, motor_off_callback },
- { NULL, NULL, 0, 1, motor_off_callback },
- { NULL, NULL, 0, 2, motor_off_callback },
- { NULL, NULL, 0, 3, motor_off_callback },
- { NULL, NULL, 0, 4, motor_off_callback },
- { NULL, NULL, 0, 5, motor_off_callback },
- { NULL, NULL, 0, 6, motor_off_callback },
- { NULL, NULL, 0, 7, motor_off_callback }
+ { NULL, NULL, 0, 1, motor_off_callback }
};
/* schedules motor off */

562
docs/MemSavers/hd_diff.1212 Normal file
View File

@@ -0,0 +1,562 @@
--- linux-1212-oem/drivers/block/hd.c Wed Apr 5 19:47:54 1995
+++ linux/drivers/block/hd.c Thu Aug 3 01:27:37 1995
@@ -17,10 +17,14 @@
*
* IRQ-unmask, drive-id, multiple-mode, support for ">16 heads",
* and general streamlining by mlord@bnr.ca (Mark Lord).
+ *
+ * Remove 99% of above. Use Mark's ide.c driver for those options.
+ * This is now a lightweight ST-506 driver. (Paul Gortmaker)
+ *
*/
-#define DEFAULT_MULT_COUNT 0 /* set to 0 to disable multiple mode at boot */
-#define DEFAULT_UNMASK_INTR 0 /* set to 0 to *NOT* unmask irq's more often */
+/* Uncomment the following if you want verbose error reports. */
+/* #define VERBOSE_ERRORS */
#include <asm/irq.h>
#include <linux/errno.h>
@@ -75,16 +79,13 @@
*/
struct hd_i_struct {
unsigned int head,sect,cyl,wpcom,lzone,ctl;
- };
-static struct hd_driveid *hd_ident_info[MAX_HD] = {0, };
+};
#ifdef HD_TYPE
static struct hd_i_struct hd_info[] = { HD_TYPE };
-struct hd_i_struct bios_info[] = { HD_TYPE };
static int NR_HD = ((sizeof (hd_info))/(sizeof (struct hd_i_struct)));
#else
static struct hd_i_struct hd_info[] = { {0,0,0,0,0,0},{0,0,0,0,0,0} };
-struct hd_i_struct bios_info[] = { {0,0,0,0,0,0},{0,0,0,0,0,0} };
static int NR_HD = 0;
#endif
@@ -117,14 +118,14 @@
if (ints[0] != 3)
return;
- if (bios_info[0].head != 0)
+ if (hd_info[0].head != 0)
hdind=1;
- bios_info[hdind].head = hd_info[hdind].head = ints[2];
- bios_info[hdind].sect = hd_info[hdind].sect = ints[3];
- bios_info[hdind].cyl = hd_info[hdind].cyl = ints[1];
- bios_info[hdind].wpcom = hd_info[hdind].wpcom = 0;
- bios_info[hdind].lzone = hd_info[hdind].lzone = ints[1];
- bios_info[hdind].ctl = hd_info[hdind].ctl = (ints[2] > 8 ? 8 : 0);
+ hd_info[hdind].head = ints[2];
+ hd_info[hdind].sect = ints[3];
+ hd_info[hdind].cyl = ints[1];
+ hd_info[hdind].wpcom = 0;
+ hd_info[hdind].lzone = ints[1];
+ hd_info[hdind].ctl = (ints[2] > 8 ? 8 : 0);
NR_HD = hdind+1;
}
@@ -136,6 +137,7 @@
devc = CURRENT ? 'a' + DEVICE_NR(CURRENT->dev) : '?';
save_flags (flags);
sti();
+#ifdef VERBOSE_ERRORS
printk("hd%c: %s: status=0x%02x { ", devc, msg, stat & 0xff);
if (stat & BUSY_STAT) printk("Busy ");
if (stat & READY_STAT) printk("DriveReady ");
@@ -166,6 +168,15 @@
}
printk("\n");
}
+#else
+ printk("hd%c: %s: status=0x%02x.\n", devc, msg, stat & 0xff);
+ if ((stat & ERR_STAT) == 0) {
+ hd_error = 0;
+ } else {
+ hd_error = inb(HD_ERROR);
+ printk("hd%c: %s: error=0x%02x.\n", devc, msg, hd_error & 0xff);
+ }
+#endif /* verbose errors */
restore_flags (flags);
}
@@ -248,113 +259,6 @@
}
static void hd_request (void);
-static unsigned int identified [MAX_HD] = {0,}; /* 1 = drive ID already displayed */
-static unsigned int unmask_intr [MAX_HD] = {0,}; /* 1 = unmask IRQs during I/O */
-static unsigned int max_mult [MAX_HD] = {0,}; /* max sectors for MultMode */
-static unsigned int mult_req [MAX_HD] = {0,}; /* requested MultMode count */
-static unsigned int mult_count [MAX_HD] = {0,}; /* currently enabled MultMode count */
-static struct request WCURRENT;
-
-static void fixstring (unsigned char *s, int bytecount)
-{
- unsigned char *p, *end = &s[bytecount &= ~1]; /* bytecount must be even */
-
- /* convert from big-endian to little-endian */
- for (p = end ; p != s;) {
- unsigned short *pp = (unsigned short *) (p -= 2);
- *pp = (*pp >> 8) | (*pp << 8);
- }
-
- /* strip leading blanks */
- while (s != end && *s == ' ')
- ++s;
-
- /* compress internal blanks and strip trailing blanks */
- while (s != end && *s) {
- if (*s++ != ' ' || (s != end && *s && *s != ' '))
- *p++ = *(s-1);
- }
-
- /* wipe out trailing garbage */
- while (p != end)
- *p++ = '\0';
-}
-
-static void identify_intr(void)
-{
- unsigned int dev = DEVICE_NR(CURRENT->dev);
- unsigned short stat = inb_p(HD_STATUS);
- struct hd_driveid *id = hd_ident_info[dev];
-
- if (unmask_intr[dev])
- sti();
- if (stat & (BUSY_STAT|ERR_STAT)) {
- printk (" hd%c: non-IDE device, %dMB, CHS=%d/%d/%d\n", dev+'a',
- hd_info[dev].cyl*hd_info[dev].head*hd_info[dev].sect / 2048,
- hd_info[dev].cyl, hd_info[dev].head, hd_info[dev].sect);
- if (id != NULL) {
- hd_ident_info[dev] = NULL;
- kfree_s (id, 512);
- }
- } else {
- insw(HD_DATA, id, 256); /* get ID info */
- max_mult[dev] = id->max_multsect;
- if ((id->field_valid&1) && id->cur_cyls && id->cur_heads && (id->cur_heads <= 16) && id->cur_sectors) {
- /*
- * Extract the physical drive geometry for our use.
- * Note that we purposely do *not* update the bios_info.
- * This way, programs that use it (like fdisk) will
- * still have the same logical view as the BIOS does,
- * which keeps the partition table from being screwed.
- */
- hd_info[dev].cyl = id->cur_cyls;
- hd_info[dev].head = id->cur_heads;
- hd_info[dev].sect = id->cur_sectors;
- }
- fixstring (id->serial_no, sizeof(id->serial_no));
- fixstring (id->fw_rev, sizeof(id->fw_rev));
- fixstring (id->model, sizeof(id->model));
- printk (" hd%c: %.40s, %dMB w/%dKB Cache, CHS=%d/%d/%d, MaxMult=%d\n",
- dev+'a', id->model, id->cyls*id->heads*id->sectors/2048,
- id->buf_size/2, bios_info[dev].cyl, bios_info[dev].head,
- bios_info[dev].sect, id->max_multsect);
- /*
- * Early model Quantum drives go weird at this point,
- * but doing a recalibrate seems to "fix" them.
- * (Doing a full reset confuses some other model Quantums)
- */
- if (!strncmp(id->model, "QUANTUM", 7))
- special_op[dev] = recalibrate[dev] = 1;
- }
-#if (HD_DELAY > 0)
- last_req = read_timer();
-#endif
- hd_request();
- return;
-}
-
-static void set_multmode_intr(void)
-{
- unsigned int dev = DEVICE_NR(CURRENT->dev), stat = inb_p(HD_STATUS);
-
- if (unmask_intr[dev])
- sti();
- if (stat & (BUSY_STAT|ERR_STAT)) {
- mult_req[dev] = mult_count[dev] = 0;
- dump_status("set multmode failed", stat);
- } else {
- if ((mult_count[dev] = mult_req[dev]))
- printk (" hd%c: enabled %d-sector multiple mode\n",
- dev+'a', mult_count[dev]);
- else
- printk (" hd%c: disabled multiple mode\n", dev+'a');
- }
-#if (HD_DELAY > 0)
- last_req = read_timer();
-#endif
- hd_request();
- return;
-}
static int drive_busy(void)
{
@@ -400,17 +304,6 @@
}
if (++i < NR_HD) {
special_op[i] = recalibrate[i] = 1;
- if (unmask_intr[i]) {
- unmask_intr[i] = DEFAULT_UNMASK_INTR;
- printk("hd%c: reset irq-unmasking to %d\n",i+'a',
- DEFAULT_UNMASK_INTR);
- }
- if (mult_req[i] || mult_count[i]) {
- mult_count[i] = 0;
- mult_req[i] = DEFAULT_MULT_COUNT;
- printk("hd%c: reset multiple mode to %d\n",i+'a',
- DEFAULT_MULT_COUNT);
- }
hd_out(i,hd_info[i].sect,hd_info[i].sect,hd_info[i].head-1,
hd_info[i].cyl,WIN_SPECIFY,&reset_hd);
if (reset)
@@ -473,11 +366,8 @@
static void read_intr(void)
{
- unsigned int dev = DEVICE_NR(CURRENT->dev);
- int i, retries = 100000, msect = mult_count[dev], nsect;
+ int i, retries = 100000;
- if (unmask_intr[dev])
- sti(); /* permit other IRQs during xfer */
do {
i = (unsigned) inb_p(HD_STATUS);
if (i & BUSY_STAT)
@@ -492,28 +382,20 @@
hd_request();
return;
ok_to_read:
- if (msect) {
- if ((nsect = CURRENT->current_nr_sectors) > msect)
- nsect = msect;
- msect -= nsect;
- } else
- nsect = 1;
- insw(HD_DATA,CURRENT->buffer,nsect<<8);
- CURRENT->sector += nsect;
- CURRENT->buffer += nsect<<9;
+ insw(HD_DATA,CURRENT->buffer,256);
+ CURRENT->sector++;
+ CURRENT->buffer += 512;
CURRENT->errors = 0;
- i = (CURRENT->nr_sectors -= nsect);
-
+ i = --CURRENT->nr_sectors;
+ --CURRENT->current_nr_sectors;
#ifdef DEBUG
- printk("hd%c: read: sectors(%ld-%ld), remaining=%ld, buffer=0x%08lx\n",
- dev+'a', CURRENT->sector, CURRENT->sector+nsect,
- CURRENT->nr_sectors, (unsigned long) CURRENT->buffer+(nsect<<9));
+ printk("hd%c: read: sector %ld, remaining = %ld, buffer=0x%08lx\n",
+ dev+'a', CURRENT->sector, CURRENT->nr_sectors,
+ (unsigned long) CURRENT->buffer+512));
#endif
- if ((CURRENT->current_nr_sectors -= nsect) <= 0)
+ if (CURRENT->current_nr_sectors <= 0)
end_request(1);
if (i > 0) {
- if (msect)
- goto ok_to_read;
SET_INTR(&read_intr);
return;
}
@@ -526,66 +408,11 @@
return;
}
-static inline void multwrite (unsigned int dev)
-{
- unsigned int mcount = mult_count[dev];
-
- while (mcount--) {
- outsw(HD_DATA,WCURRENT.buffer,256);
- if (!--WCURRENT.nr_sectors)
- return;
- WCURRENT.buffer += 512;
- if (!--WCURRENT.current_nr_sectors) {
- WCURRENT.bh = WCURRENT.bh->b_reqnext;
- if (WCURRENT.bh == NULL)
- panic("buffer list corrupted\n");
- WCURRENT.current_nr_sectors = WCURRENT.bh->b_size>>9;
- WCURRENT.buffer = WCURRENT.bh->b_data;
- }
- }
-}
-
-static void multwrite_intr(void)
-{
- int i;
- unsigned int dev = DEVICE_NR(WCURRENT.dev);
-
- if (unmask_intr[dev])
- sti();
- if (OK_STATUS(i=inb_p(HD_STATUS))) {
- if (i & DRQ_STAT) {
- if (WCURRENT.nr_sectors) {
- multwrite(dev);
- SET_INTR(&multwrite_intr);
- return;
- }
- } else {
- if (!WCURRENT.nr_sectors) { /* all done? */
- for (i = CURRENT->nr_sectors; i > 0;){
- i -= CURRENT->current_nr_sectors;
- end_request(1);
- }
-#if (HD_DELAY > 0)
- last_req = read_timer();
-#endif
- if (CURRENT)
- hd_request();
- return;
- }
- }
- }
- dump_status("multwrite_intr", i);
- bad_rw_intr();
- hd_request();
-}
-
static void write_intr(void)
{
int i;
int retries = 100000;
- if (unmask_intr[DEVICE_NR(WCURRENT.dev)])
- sti();
do {
i = (unsigned) inb_p(HD_STATUS);
if (i & BUSY_STAT)
@@ -662,17 +489,6 @@
hd_out(dev,hd_info[dev].sect,0,0,0,WIN_RESTORE,&recal_intr);
return reset;
}
- if (!identified[dev]) {
- identified[dev] = 1;
- unmask_intr[dev] = DEFAULT_UNMASK_INTR;
- mult_req[dev] = DEFAULT_MULT_COUNT;
- hd_out(dev,0,0,0,0,WIN_IDENTIFY,&identify_intr);
- return reset;
- }
- if (mult_req[dev] != mult_count[dev]) {
- hd_out(dev,mult_req[dev],0,0,0,WIN_SETMULT,&set_multmode_intr);
- return reset;
- }
if (hd_info[dev].head > 16) {
printk ("hd%c: cannot handle device with more than 16 heads - giving up\n", dev+'a');
end_request(0);
@@ -688,10 +504,8 @@
*
* Interrupts are still masked (by default) whenever we are exchanging
* data/cmds with a drive, because some drives seem to have very poor
- * tolerance for latency during I/O. For devices which don't suffer from
- * that problem (most don't), the unmask_intr[] flag can be set to unmask
- * other interrupts during data/cmd transfers (by defining DEFAULT_UNMASK_INTR
- * to 1, or by using "hdparm -u1 /dev/hd?" from the shell).
+ * tolerance for latency during I/O. The IDE driver has support to unmask
+ * interrupts for non-broken hardware, so use that driver if required.
*/
static void hd_request(void)
{
@@ -739,31 +553,21 @@
dev+'a', (CURRENT->cmd == READ)?"read":"writ",
cyl, head, sec, nsect, (unsigned long) CURRENT->buffer);
#endif
- if (!unmask_intr[dev])
- cli();
if (CURRENT->cmd == READ) {
- unsigned int cmd = mult_count[dev] > 1 ? WIN_MULTREAD : WIN_READ;
- hd_out(dev,nsect,sec,head,cyl,cmd,&read_intr);
+ hd_out(dev,nsect,sec,head,cyl,WIN_READ,&read_intr);
if (reset)
goto repeat;
return;
}
if (CURRENT->cmd == WRITE) {
- if (mult_count[dev])
- hd_out(dev,nsect,sec,head,cyl,WIN_MULTWRITE,&multwrite_intr);
- else
- hd_out(dev,nsect,sec,head,cyl,WIN_WRITE,&write_intr);
+ hd_out(dev,nsect,sec,head,cyl,WIN_WRITE,&write_intr);
if (reset)
goto repeat;
if (wait_DRQ()) {
bad_rw_intr();
goto repeat;
}
- if (mult_count[dev]) {
- WCURRENT = *CURRENT;
- multwrite(dev);
- } else
- outsw(HD_DATA,CURRENT->buffer,256);
+ outsw(HD_DATA,CURRENT->buffer,256);
return;
}
panic("unknown hd-command");
@@ -781,7 +585,6 @@
{
struct hd_geometry *loc = (struct hd_geometry *) arg;
int dev, err;
- unsigned long flags;
if ((!inode) || (!inode->i_rdev))
return -EINVAL;
@@ -794,11 +597,11 @@
err = verify_area(VERIFY_WRITE, loc, sizeof(*loc));
if (err)
return err;
- put_fs_byte(bios_info[dev].head,
+ put_fs_byte(hd_info[dev].head,
(char *) &loc->heads);
- put_fs_byte(bios_info[dev].sect,
+ put_fs_byte(hd_info[dev].sect,
(char *) &loc->sectors);
- put_fs_word(bios_info[dev].cyl,
+ put_fs_word(hd_info[dev].cyl,
(short *) &loc->cylinders);
put_fs_long(hd[MINOR(inode->i_rdev)].start_sect,
(long *) &loc->start);
@@ -831,57 +634,6 @@
case BLKRRPART: /* Re-read partition tables */
return revalidate_hddisk(inode->i_rdev, 1);
- case HDIO_SET_UNMASKINTR:
- if (!suser()) return -EACCES;
- if ((arg > 1) || (MINOR(inode->i_rdev) & 0x3F))
- return -EINVAL;
- unmask_intr[dev] = arg;
- return 0;
-
- case HDIO_GET_UNMASKINTR:
- if (!arg) return -EINVAL;
- err = verify_area(VERIFY_WRITE, (long *) arg, sizeof(long));
- if (err)
- return err;
- put_fs_long(unmask_intr[dev], (long *) arg);
- return 0;
-
- case HDIO_GET_MULTCOUNT:
- if (!arg) return -EINVAL;
- err = verify_area(VERIFY_WRITE, (long *) arg, sizeof(long));
- if (err)
- return err;
- put_fs_long(mult_count[dev], (long *) arg);
- return 0;
-
- case HDIO_SET_MULTCOUNT:
- if (!suser()) return -EACCES;
- if (MINOR(inode->i_rdev) & 0x3F) return -EINVAL;
- save_flags(flags);
- cli(); /* a prior request might still be in progress */
- if (arg > max_mult[dev])
- err = -EINVAL; /* out of range for device */
- else if (mult_req[dev] != mult_count[dev]) {
- special_op[dev] = 1;
- err = -EBUSY; /* busy, try again */
- } else {
- mult_req[dev] = arg;
- special_op[dev] = 1;
- err = 0;
- }
- restore_flags(flags);
- return err;
-
- case HDIO_GET_IDENTITY:
- if (!arg) return -EINVAL;
- if (MINOR(inode->i_rdev) & 0x3F) return -EINVAL;
- if (hd_ident_info[dev] == NULL) return -ENOMSG;
- err = verify_area(VERIFY_WRITE, (char *) arg, sizeof(struct hd_driveid));
- if (err)
- return err;
- memcpy_tofs((char *)arg, (char *) hd_ident_info[dev], sizeof(struct hd_driveid));
- return 0;
-
RO_IOCTLS(inode->i_rdev,arg);
default:
return -EINVAL;
@@ -927,7 +679,7 @@
hd, /* hd struct */
hd_sizes, /* block sizes */
0, /* number */
- (void *) bios_info, /* internal */
+ NULL, /* internal use, not presently used */
NULL /* next */
};
@@ -954,19 +706,19 @@
*/
static void hd_geninit(void)
{
- int drive, i;
+ int drive;
extern struct drive_info drive_info;
unsigned char *BIOS = (unsigned char *) &drive_info;
int cmos_disks;
if (!NR_HD) {
for (drive=0 ; drive<2 ; drive++) {
- bios_info[drive].cyl = hd_info[drive].cyl = *(unsigned short *) BIOS;
- bios_info[drive].head = hd_info[drive].head = *(2+BIOS);
- bios_info[drive].wpcom = hd_info[drive].wpcom = *(unsigned short *) (5+BIOS);
- bios_info[drive].ctl = hd_info[drive].ctl = *(8+BIOS);
- bios_info[drive].lzone = hd_info[drive].lzone = *(unsigned short *) (12+BIOS);
- bios_info[drive].sect = hd_info[drive].sect = *(14+BIOS);
+ hd_info[drive].cyl = *(unsigned short *) BIOS;
+ hd_info[drive].head = *(2+BIOS);
+ hd_info[drive].wpcom = *(unsigned short *) (5+BIOS);
+ hd_info[drive].ctl = *(8+BIOS);
+ hd_info[drive].lzone = *(unsigned short *) (12+BIOS);
+ hd_info[drive].sect = *(14+BIOS);
#ifdef does_not_work_for_everybody_with_scsi_but_helps_ibm_vp
if (hd_info[drive].cyl && NR_HD == drive)
NR_HD++;
@@ -1002,20 +754,12 @@
else
NR_HD = 1;
}
- i = NR_HD;
- while (i-- > 0) {
- /*
- * The newer E-IDE BIOSs handle drives larger than 1024
- * cylinders by increasing the number of logical heads
- * to keep the number of logical cylinders below the
- * sacred INT13 limit of 1024 (10 bits). If that is
- * what's happening here, we'll find out and correct
- * it later when "identifying" the drive.
- */
- hd[i<<6].nr_sects = bios_info[i].head *
- bios_info[i].sect * bios_info[i].cyl;
- hd_ident_info[i] = (struct hd_driveid *) kmalloc(512,GFP_KERNEL);
- special_op[i] = 1;
+ for (drive=0 ; drive < NR_HD ; drive++) {
+ hd[drive<<6].nr_sects = hd_info[drive].head *
+ hd_info[drive].sect * hd_info[drive].cyl;
+ printk ("hd%c: %ldMB, CHS=%d/%d/%d\n", drive+'a',
+ hd[drive<<6].nr_sects / 2048, hd_info[drive].cyl,
+ hd_info[drive].head, hd_info[drive].sect);
}
if (NR_HD) {
if (request_irq(HD_IRQ, hd_interrupt, SA_INTERRUPT, "hd")) {
@@ -1028,7 +772,8 @@
}
hd_gendisk.nr_real = NR_HD;
- for(i=0;i<(MAX_HD << 6);i++) hd_blocksizes[i] = 1024;
+ for(drive=0; drive < (MAX_HD << 6); drive++)
+ hd_blocksizes[drive] = 1024;
blksize_size[MAJOR_NR] = hd_blocksizes;
}
@@ -1061,7 +806,7 @@
#define DEVICE_BUSY busy[target]
#define USAGE access_count[target]
-#define CAPACITY (bios_info[target].head*bios_info[target].sect*bios_info[target].cyl)
+#define CAPACITY (hd_info[target].head*hd_info[target].sect*hd_info[target].cyl)
/* We assume that the the bios parameters do not change, so the disk capacity
will not change */
#undef MAYBE_REINIT

83
docs/MemSavers/init.patch Normal file
View File

@@ -0,0 +1,83 @@
--- /linux-1213-oem/init/main.c Mon Jul 31 15:01:03 1995
+++ linux/init/main.c Fri Aug 4 17:21:40 1995
@@ -34,8 +34,6 @@
extern char etext, end;
extern char *linux_banner;
-static char printbuf[1024];
-
extern int console_loglevel;
extern void init(void);
@@ -108,12 +106,6 @@
static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
static char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", term, NULL, };
-static char * argv_rc[] = { "/bin/sh", NULL };
-static char * envp_rc[] = { "HOME=/", term, NULL };
-
-static char * argv[] = { "-/bin/sh",NULL };
-static char * envp[] = { "HOME=/usr/root", term, NULL };
-
char *get_options(char *str, int *ints)
{
char *cur = str;
@@ -412,21 +404,8 @@
idle();
}
-static int printf(const char *fmt, ...)
-{
- va_list args;
- int i;
-
- va_start(args, fmt);
- write(1,printbuf,i=vsprintf(printbuf, fmt, args));
- va_end(args);
- return i;
-}
-
void init(void)
{
- int pid,i;
-
setup();
sprintf(term, "TERM=con%dx%d", ORIG_VIDEO_COLS, ORIG_VIDEO_LINES);
@@ -452,36 +431,4 @@
execve("/etc/init",argv_init,envp_init);
execve("/bin/init",argv_init,envp_init);
execve("/sbin/init",argv_init,envp_init);
- /* if this fails, fall through to original stuff */
-
- if (!(pid=fork())) {
- close(0);
- if (open("/etc/rc",O_RDONLY,0))
- _exit(1);
- execve("/bin/sh",argv_rc,envp_rc);
- _exit(2);
- }
- if (pid>0)
- while (pid != wait(&i))
- /* nothing */;
- while (1) {
- if ((pid = fork()) < 0) {
- printf("Fork failed in init\n\r");
- continue;
- }
- if (!pid) {
- close(0);close(1);close(2);
- setsid();
- (void) open("/dev/tty1",O_RDWR,0);
- (void) dup(0);
- (void) dup(0);
- _exit(execve("/bin/sh",argv,envp));
- }
- while (1)
- if (pid == wait(&i))
- break;
- printf("\n\rchild %d died with code %04x\n\r",pid,i);
- sync();
- }
- _exit(0);
}

306
docs/MemSavers/mem.html Normal file
View File

@@ -0,0 +1,306 @@
<html>
<head>
<title>Memory Savers</title>
<h1>Memory Savers</h1>
</head>
<body>
<h3>Updated 30/08/95</h3><P>
Paul Gortmaker<br>
<a href="mailto:Paul.Gortmaker@anu.edu.au">Paul.Gortmaker@anu.edu.au</a>
<P>
<p><hr><h3>Linux Memory Savers
<p></p>
This page has various Linux memory saver patches that I have put together.
</h3><hr></p>
There are still lots of people out there running Linux on 386 boxes with
4MB ram and older/smaller hard disks. These patches implement options
that will allow these users to trim some excess (unused) functionality
from their kernels and reclaim some of that valuable memory for running
applications. Note that memory taken up by the kernel is hardwired to
RAM and can't be swapped to disk, thus reducing the amount of real
memory available to run user programs and the like.
<P>
Most of these patches are against the current 1.2.x kernel, as it is
a bit smaller than the 1.3.x kernels to begin with. If you are tight
on memory, you are best to run the latest 1.2.x kernel as opposed to
the latest 1.3.x development series.
<hr>
Here are some of the areas where you can "trim the fat".
<P>
<a href="#ram">The RAM Disk</a><br>
<a href="#hd">The "old" Disk Driver</a><br>
<a href="#mod">The Modules Code</a><br>
<a href="#ini">The Old init Code</a><br>
<a href="#ser">The Serial Driver</a><br>
<a href="#flo">The Floppy Driver</a><br>
<a href="#ne">The ne2000 Driver</a><br>
<a href="#3c">The 3c503 Driver</a><br>
<a href="#scsi">The SCSI Blacklist</a><br>
<a href="#pri">The printk() Ring Buffer</a><br>
<a href="#ksw">The Kswap Patches</a><br>
<a href="#thi">Removing IBM ThinkPad Support</a><br>
<a href="#m386">The `-m386' GCC option</a><br>
<P>
As a more drastic alternative, you can `downgrade' to a 1.0.9 kernel.
For those that can't recall, this was the last (i.e. stable) release
of the 1.0 series before starting the 1.1 development series. As a quick
test, I compiled a 1.0.9 kernel `out of the box' to see how it compared
memorywise against my trimmed 1.2.13 kernel. It beat it hands down!
For my config, the trimmed 1.2.13 kernel weighed in at 512k code and
148kB data. The stock 1.0.9 kernel with the same config weighed in
at a mere 388kB code and 168kB data. I then quickly applied by hand
some of the above list (ram / modules / init / serial / ne2k / printk)
and had it down to a lean-n-mean 384kB code and 152kB data!! That is
a 104kB saving over the <em>trimmed</em> 1.2.13 kernel. This is an
excellent kernel to run on 4MB machines. Here is a
<a href="109.diff">patch</a>
against the 1.0.9 tree that incorporates the above five from the list.
Note that some (such as the Thinkpad hack or the reduced hd driver) don't
apply to the 1.0.9 kernels, as they weren't in there yet to begin with,
so there is nothing to `fix' so to speak.
<hr>
<p><h4><a name="ram">The RAM disk</h4></p>
Patch to make the <em>ramdisk</em> a config option. Face it, you never
use it except for boot/recovery disks and the like. Available for
<a href="ramdisk.1212">v1.2.12</a>.
With this in place, the file <code>ramdisk.c</code> is not even
compiled unless you select ramdisk support.
This should be another small memory saving that will help low memory
machines.
<p><h4><a name="hd">The "old" disk driver</h4></p>
A patch to remove all IDE support from the "old" hard disk
driver. Seeing as <code>ide.c</code> now uses
all the IDE specific features in addition to the standard ST-506 hard
disk specification, the old
disk driver may as well return to its original featureless ST-506 form.
This will be a good choice for users with MFM/RLL or ESDI drives that
can use the memory savings a lot more than the IDE features. Users that
don't wish to use the extended features of their IDE drive(s) can also
use this patch as well. There should be no risk in using this patch,
as all it mainly does is remove code that is IDE specific. I have
tested it in a two drive IDE system and a one drive MFM system.
Just compare the compiled sizes of hd.c with my patch, hd.c without my
patch, and ide.c as seen below, for 1.3.14. (This also doesn't account
for the extra 1/2kB per IDE drive that was dynamically allocated to
to store the IDE drive information.)
<P>
<code>
# size drivers/block/hd.o.patched<br>
text data bss dec hex<br>
5440 2228 4 7672 1df8<br>
# size drivers/block/hd.o.orig<br>
text data bss dec hex<br>
8992 2324 48 11364 2c64<br>
# size drivers/block/ide.o<br>
text data bss dec hex<br>
17992 4488 96 22576 5830<br>
</code>
<P>
The "low-fat-diet" hard disk driver is available for
<a href="hd_diff-1212">v1.2.12</a> kernels.
<p><h4><a name="mod">The Modules Code</h4></p>
A patch to
<a href="no_modules_patch">remove all module support</a> for those that are on
low memory machines, or those that never use modules.
This is done
by using <code>``#ifdef CONFIG_MODULES''</code> and adding it as
a <em>make config</em> option. Note that this patch is for 1.2.x kernels.
I will eventually update it for the 1.3.x kernels.
<P>
For those who were complaining about the modules stuff adding bloat,
it can be pulled out quite easily.
A big win is dumping modules.c, ksyms.c and a good chunk of scsi.c
for loading and unloading host adaptors.
Also gone are (un)register_netdev, unregister_filesystem and
(un)register_binfmt. Note that you *can't* dump register_fiesystem,
(un)register_blkdev and (un)register_chrdev because these are also
used by non-modules. (However, this could be easily changed...)
Of course /proc/ksyms and /proc/modules disappear as well.
<P>
The only files that didn't include <code>&lt;linux/config.h&gt;</code>
already were scsi.c
and modules.c (ironic huh?) Of course the module syscalls are still
listed in unistd.h and entry.S, but they are just dummies that
return -ENOSYS like those in kernel/sys.c, so that running insmod on
a non-module kernel doesn't do anything silly. Hopefully this can
go into 1.3.x someday.
<p><h4><a name="ini">The Old init Code</h4></p>
Many moons ago, when more people had heard of <em>Minix</em> than
<em>Linux</em>, Linux did not have Poe's or MvS's init packages.
The kernel would look for "/etc/rc" and/or "/bin/sh" to start as
process number one. Even now that "/etc/init" and lately "/sbin/init"
have been in widespread use for a long time, this old code still
remains in the kernel. This
<a href="init.patch">patch</a> against 1.2.x kernels
removes that old code, along with a 1kB static buffer that it used.
Ideally this old code should be removed from distribution kernels
as well. (Thanks to Michael A. Griffith for reminding me of this one.)
<p><h4><a name="ser">The Serial driver</h4></p>
Almost all people have only two (or four) serial ports. Yet in
<code>drivers/char/serial.c</code> there is a large table of
possible serial devices called <code>rs_table</code>. This table
has 37 entries. You can safely delete all but the ones you are
using, that being the top two, or four if you have four serial
ports installed. (Thanks to Alan Cox for mentioning this one.)
<p><h4><a name="flo">The Floppy driver</h4></p>
The average person has at either a 1.44MB 3.5" drive, and/or a 1.2MB
5.25" drive. And they usually never use any strange floppy formats.
The usual formats are 360kB, 720kB, 1.2MB and 1.44MB, and <em>none</em>
of the others are used. This
<a href="floppy.diff">patch</a>
removes the support for 2.88MB drives, and for all the 30 or so other
formats that 99% of us never use.
<p><h4><a name="ne">The ne2000 driver</h4></p>
For ne2000 users, you can make a one line change to
<code>drivers/net/ne.c</code> that will get rid of a large table of
non-conforming cards, and its associated code. If you don't have
a "bad clone" you can just delete or comment out the line that says
<P>
<code>
#define CONFIG_NE_BAD_CLONES
</code>
<P>
<p><h4><a name="3c">The 3c503 driver</h4></p>
As you may
or may not know, the 3c503 has the ability to support PIO transfers
to the card (akin to a ne2000) instead of the standard (read faster/better)
shared memory implementation.
However, since it is slower, you shouldn't use a 3c503 in PIO mode.
If you do, the linux driver will print a message like
"REJUMPER FOR SHARED MEMORY" at boot, and then still
try and use it in the crippled PIO mode.
<P>
This
<a href="3c503.mem">patch</a> for the 1.2.x series kernels
just #ifdef's out all the PIO code based on whether you have
defined CONFIG_EL2_PIO, for a 20% reduction in the driver size, as
seen below.
<P>
With PIO support:<br>
<code>
text data bss dec hex<br>
3576 44 0 3620 e24<br>
-rw------- 1 root root 4964 Apr 13 19:50 3c503.o<br>
</code>
<P>
Without PIO support:<br>
<code>
text data bss dec hex<br>
2700 44 0 2744 ab8<br>
-rw------- 1 root root 4005 Apr 15 15:33 3c503.o<br>
</code>
<p><h4><a name="scsi">The SCSI blacklist</h4></p>
Some old (and even some new!) SCSI devices are poorly designed so that
if they are "asked" by the SCSI host adapter as to whether they contain
multiple devices such as a multiple disk CD-ROM, they will lock-up.
The kernel keeps a <em>huge</em> list of (at present 34) devices that
have this problem in <code>drivers/scsi/scsi.c</code>.
You can cut this <code>device_list</code> down to just the
NULL entry at the end if you don't have any of these devices, or if you
configured your kernel to only ask about LUN #1.
<p><h4><a name="pri">The printk() Ring Buffer</h4></p>
The <code>printk()</code> routine uses a 4kB static ring buffer to store
kernel messages in while waiting for <code>klogd()</code> to read them.
The only time this many unread messages pile up is at boot before
<code>klogd()</code> is started. But you can read those by using the
Shift+Page_Up key sequence. You can go into <code>kernel/printk.c</code>
and change the <code>#define LOG_BUF_LEN 4096</code> to a smaller value
like 512, for a saving of 3.5kB. This will still leave room for over
six full (80 character) lines of kernel messages to be buffered.
<P>
There is also a 1kB buffer ("buf") allocated to deal with the incoming
data passed in with a printk() call. No single printk() calls in the kernel
are so huge (or broken) as to dump a whole kB in a single call, and so you
can cut this back to 256 bytes, which is still the equivalent of more
than three full lines of text. (You could allocate this buffer
dynamically with kmalloc(), but things will get ugly if you run out of
memory, and then try to do allocate a buffer so you can do a
<code>printk("Out of memory\n");</code>!!!)
<p><h4><a name="ksw">The Kswap Patches</h4></p>
These are patches by
<a href="mailto:sct@dcs.ed.ac.uk">Stephen C. Tweedie</a> who has also
done a lot of work on the ext2 filesystem. These patches don't actually
save you any memory, but instead they improve the swapping performance
on low memory machines. For more details on the gains/implementations
and such, here are some of Stephen's mails that I saved. (The dates
are encoded in the URLs)
<P>
Stephen's latest version of his kswap patches can be found
<a href="ftp://ftp.presence.co.uk/pub/linux/kswap">here</a>.
<p><h4><a name="thi">Removing IBM ThinkPad Support</h4></p>
Once again IBM has made an incompatibility. They seem to have done
something funny with the last 4kB of RAM at the end of the 640kB
region. The Linux kernel won't touch this 4kB by default for fear
of upsetting the IBM ThinkPad. If you don't have an IBM ThinkPad,
you can re-claim this 4kB by simply changing the value <tt>0x9f000</tt>
to an <tt>0xA0000</tt> in <tt>linux/arch/i386/mm/init.c</tt>.
If you are real lazy, here is a <a href="thinkpad">patch</a>
for the 1.2.x kernels to do that for you. (Thanks to Thomas Graichen
for pointing this one out.)
<p><h4><a name="m386">The `-m386' GCC option</h4></p>
When you compile a kernel with the `-m486' option, GCC then alignes
internal data structures on data boundaries that will be favourable
for the cache structure on an i486 CPU. This can leave small `holes'
between the end of one data structure, and the start of another, which
accounts for the slightly larger output. So if you compile linux with
`-m386' instead, then you will end up with a slightly smaller (actually
more tightly packed) kernel. You won't be able to notice any significant
performace decrease in everyday usage either.
<P>
<hr>
If you have any other memory saver tips/patches,
<a href="mailto:Paul.Gortmaker@anu.edu.au">e-mail</a>
me, and I will add them to the list.
<P>
<a href="index.html">Back to the top...</a>
</body>
</html>

View File

@@ -0,0 +1,303 @@
diff -ur linux-stock/Makefile linux/Makefile
--- linux-stock/Makefile Wed Mar 8 02:50:24 1995
+++ linux/Makefile Wed Mar 15 15:33:19 1995
@@ -194,6 +194,7 @@
net: dummy
$(MAKE) linuxsubdirs SUBDIRS=net
+ifdef CONFIG_MODULES
ifdef CONFIG_MODVERSIONS
MODV = -DCONFIG_MODVERSIONS
endif
@@ -221,6 +222,18 @@
rm -f .misc .allmods; \
)
+else
+
+modules modules_install: dummy
+ @echo
+ @echo "The present kernel configuration has modules disabled."
+ @echo "Run 'make config' and enable loadable module support."
+ @echo "Then build a kernel with module support enabled."
+ @echo
+ @exit 1
+
+endif
+
clean: archclean
rm -f kernel/ksyms.lst
rm -f core `find . -name '*.[oas]' -print`
diff -ur linux-stock/arch/i386/config.in linux/arch/i386/config.in
--- linux-stock/arch/i386/config.in Wed Mar 8 01:25:26 1995
+++ linux/arch/i386/config.in Wed Mar 15 14:37:39 1995
@@ -36,7 +36,10 @@
#fi
comment 'Loadable module support'
-bool 'Set version information on all symbols for modules' CONFIG_MODVERSIONS n
+bool 'Enable loadable module support' CONFIG_MODULES y
+if [ "$CONFIG_MODULES" = "y" ]; then
+ bool 'Set version information on all symbols for modules' CONFIG_MODVERSIONS n
+fi
if [ "$CONFIG_NET" = "y" ]; then
comment 'Networking options'
diff -ur linux-stock/drivers/net/net_init.c linux/drivers/net/net_init.c
--- linux-stock/drivers/net/net_init.c Mon Jan 23 08:21:44 1995
+++ linux/drivers/net/net_init.c Wed Mar 15 14:37:39 1995
@@ -217,6 +217,7 @@
return 0;
}
+#ifdef CONFIG_MODULES
int register_netdev(struct device *dev)
{
struct device *d = dev_base;
@@ -303,6 +304,7 @@
}
restore_flags(flags);
}
+#endif /* CONFIG_MODULES */
diff -ur linux-stock/drivers/scsi/scsi.c linux/drivers/scsi/scsi.c
--- linux-stock/drivers/scsi/scsi.c Mon Feb 20 19:57:10 1995
+++ linux/drivers/scsi/scsi.c Wed Mar 15 14:37:39 1995
@@ -23,6 +23,7 @@
#include <linux/timer.h>
#include <linux/string.h>
#include <linux/malloc.h>
+#include <linux/config.h>
#include <asm/irq.h>
#include <asm/dma.h>
#include <linux/ioport.h>
@@ -1832,8 +1833,10 @@
static unsigned char ** dma_malloc_pages = NULL;
#define MALLOC_PAGEBITS 12
+#ifdef CONFIG_MODULES
static int scsi_register_host(Scsi_Host_Template *);
static void scsi_unregister_host(Scsi_Host_Template *);
+#endif
void *scsi_malloc(unsigned int len)
{
@@ -2145,6 +2148,8 @@
printk("\n");
}
+#ifdef CONFIG_MODULES /* a big #ifdef block... */
+
/*
* This entry point should be called by a loadable module if it is trying
* add a low level scsi driver to the system.
@@ -2482,6 +2487,7 @@
}
return;
}
+#endif /* CONFIG_MODULES */
#ifdef DEBUG_TIMEOUT
static void
diff -ur linux-stock/fs/exec.c linux/fs/exec.c
--- linux-stock/fs/exec.c Mon Jan 30 22:08:04 1995
+++ linux/fs/exec.c Wed Mar 15 14:37:39 1995
@@ -71,6 +71,7 @@
static struct linux_binfmt *formats = &aout_format;
+#ifdef CONFIG_MODULES
int register_binfmt(struct linux_binfmt * fmt)
{
struct linux_binfmt ** tmp = &formats;
@@ -101,6 +102,7 @@
}
return -EINVAL;
}
+#endif
int open_inode(struct inode * inode, int mode)
{
diff -ur linux-stock/fs/proc/array.c linux/fs/proc/array.c
--- linux-stock/fs/proc/array.c Thu Feb 23 22:31:41 1995
+++ linux/fs/proc/array.c Wed Mar 15 14:37:39 1995
@@ -744,10 +744,12 @@
return destptr-buf;
}
+#ifdef CONFIG_MODULES
extern int get_module_list(char *);
+extern int get_ksyms_list(char *);
+#endif
extern int get_device_list(char *);
extern int get_filesystem_list(char *);
-extern int get_ksyms_list(char *);
extern int get_irq_list(char *);
extern int get_dma_list(char *);
extern int get_cpuinfo(char *);
@@ -781,9 +783,14 @@
return get_malloc(page);
#endif
+#ifdef CONFIG_MODULES
case PROC_MODULES:
return get_module_list(page);
+ case PROC_KSYMS:
+ return get_ksyms_list(page);
+#endif
+
case PROC_STAT:
return get_kstat(page);
@@ -796,9 +803,6 @@
case PROC_FILESYSTEMS:
return get_filesystem_list(page);
- case PROC_KSYMS:
- return get_ksyms_list(page);
-
case PROC_DMA:
return get_dma_list(page);
diff -ur linux-stock/fs/proc/root.c linux/fs/proc/root.c
--- linux-stock/fs/proc/root.c Wed Jan 11 17:55:07 1995
+++ linux/fs/proc/root.c Wed Mar 15 14:37:39 1995
@@ -69,12 +69,14 @@
{ PROC_MALLOC, 6, "malloc" },
#endif
{ PROC_KCORE, 5, "kcore" },
+#ifdef CONFIG_MODULES
{ PROC_MODULES, 7, "modules" },
+ { PROC_KSYMS, 5, "ksyms" },
+#endif
{ PROC_STAT, 4, "stat" },
{ PROC_DEVICES, 7, "devices" },
{ PROC_INTERRUPTS, 10,"interrupts" },
{ PROC_FILESYSTEMS, 11,"filesystems" },
- { PROC_KSYMS, 5, "ksyms" },
{ PROC_DMA, 3, "dma" },
{ PROC_IOPORTS, 7, "ioports"},
#ifdef CONFIG_PROFILE
diff -ur linux-stock/fs/super.c linux/fs/super.c
--- linux-stock/fs/super.c Wed Jan 18 18:31:40 1995
+++ linux/fs/super.c Wed Mar 15 15:12:39 1995
@@ -57,6 +57,7 @@
return 0;
}
+#ifdef CONFIG_MODULES
int unregister_filesystem(struct file_system_type * fs)
{
struct file_system_type ** tmp;
@@ -72,6 +73,7 @@
}
return -EINVAL;
}
+#endif /* CONFIG_MODULES */
static int fs_index(const char * __name)
{
diff -ur linux-stock/init/main.c linux/init/main.c
--- linux-stock/init/main.c Sat Feb 25 01:41:01 1995
+++ linux/init/main.c Wed Mar 15 14:37:39 1995
@@ -40,7 +40,9 @@
extern void init(void);
extern void init_IRQ(void);
+#ifdef CONFIG_MODULES
extern void init_modules(void);
+#endif
extern long console_init(long, long);
extern long kmalloc_init(long,long);
extern long blk_dev_init(long,long);
@@ -352,7 +354,9 @@
init_IRQ();
sched_init();
parse_options(command_line);
+#ifdef CONFIG_MODULES
init_modules();
+#endif
#ifdef CONFIG_PROFILE
prof_buffer = (unsigned long *) memory_start;
/* only text is profiled */
diff -ur linux-stock/kernel/Makefile linux/kernel/Makefile
--- linux-stock/kernel/Makefile Mon Jan 23 19:38:30 1995
+++ linux/kernel/Makefile Wed Mar 15 14:37:39 1995
@@ -20,11 +20,13 @@
module.o exit.o signal.o itimer.o info.o time.o softirq.o \
resource.o
+ifdef CONFIG_MODULES
SYMTAB_OBJS = ksyms.o
+include ../versions.mk
+endif
all: kernel.o
-include ../versions.mk
kernel.o: $(SYMTAB_OBJS) $(OBJS)
$(LD) -r -o kernel.o $(SYMTAB_OBJS) $(OBJS)
diff -ur linux-stock/kernel/module.c linux/kernel/module.c
--- linux-stock/kernel/module.c Tue Jan 31 18:36:21 1995
+++ linux/kernel/module.c Wed Mar 15 14:37:39 1995
@@ -6,6 +6,7 @@
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/malloc.h>
+
/*
* Originally by Anonymous (as far as I know...)
* Linux version by Bas Laarhoven <bas@vimec.nl>
@@ -34,8 +35,15 @@
* and finally: reducing the number of entries in ksyms.c
* since every subsystem should now be able to decide and
* control exactly what symbols it wants to export, locally!
+ *
+ * 1.3.x, March 1995: (Paul Gortmaker) -- reduce kernel bloat.
+ * - use dummy syscall functions for users who disable all
+ * module support. Similar to kernel/sys.c
+ *
*/
+#ifdef CONFIG_MODULES /* a *big* #ifdef block... */
+
#ifdef DEBUG_MODULE
#define PRINTK(a) printk a
#else
@@ -759,3 +767,29 @@
return 0;
}
+
+#else /* CONFIG_MODULES */
+
+/* Dummy syscalls for people who don't want modules */
+
+asmlinkage unsigned long sys_create_module(void)
+{
+ return -ENOSYS;
+}
+
+asmlinkage int sys_init_module(void)
+{
+ return -ENOSYS;
+}
+
+asmlinkage int sys_delete_module(void)
+{
+ return -ENOSYS;
+}
+
+asmlinkage int sys_get_kernel_syms(void)
+{
+ return -ENOSYS;
+}
+
+#endif /* CONFIG_MODULES */

115
docs/MemSavers/ramdisk.1212 Normal file
View File

@@ -0,0 +1,115 @@
diff -ur linux-oem-1212/arch/i386/config.in linux/arch/i386/config.in
--- linux-oem-1212/arch/i386/config.in Mon Jul 31 16:22:13 1995
+++ linux/arch/i386/config.in Mon Jul 31 16:26:29 1995
@@ -7,6 +7,7 @@
bool 'Kernel math emulation' CONFIG_MATH_EMULATION n
bool 'Normal floppy disk support' CONFIG_BLK_DEV_FD y
+bool 'RAM disk support' CONFIG_BLK_DEV_RAM n
bool 'Normal (MFM/RLL) disk and IDE disk/cdrom support' CONFIG_ST506 y
if [ "$CONFIG_ST506" = "y" ]; then
comment 'Please see drivers/block/README.ide for help/info on IDE drives'
diff -ur linux-oem-1212/drivers/block/Makefile linux/drivers/block/Makefile
--- linux-oem-1212/drivers/block/Makefile Mon Jun 12 23:27:43 1995
+++ linux/drivers/block/Makefile Mon Jul 31 16:41:39 1995
@@ -21,9 +21,14 @@
# In the future, some of these should be built conditionally.
#
-OBJS := ll_rw_blk.o ramdisk.o genhd.o
-SRCS := ll_rw_blk.c ramdisk.c genhd.c
+OBJS := ll_rw_blk.o genhd.o
+SRCS := ll_rw_blk.c genhd.c
BLOCK_MODULE_OBJS =
+
+ifdef CONFIG_BLK_DEV_RAM
+OBJS := $(OBJS) ramdisk.o
+SRCS := $(SRCS) ramdisk.c
+endif
ifdef CONFIG_BLK_DEV_FD
OBJS := $(OBJS) floppy.o
diff -ur linux-oem-1212/drivers/block/genhd.c linux/drivers/block/genhd.c
--- linux-oem-1212/drivers/block/genhd.c Fri May 26 15:23:33 1995
+++ linux/drivers/block/genhd.c Mon Jul 31 15:24:31 1995
@@ -19,8 +19,6 @@
static int current_minor = 0;
extern int *blk_size[];
-extern void rd_load(void);
-extern int ramdisk_size;
static char minor_name (struct gendisk *hd, int minor)
{
@@ -218,7 +216,4 @@
setup_dev(p);
nr += p->nr_real;
}
-
- if (ramdisk_size)
- rd_load();
}
diff -ur linux-oem-1212/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c
--- linux-oem-1212/drivers/block/ll_rw_blk.c Mon Apr 10 18:22:45 1995
+++ linux/drivers/block/ll_rw_blk.c Mon Jul 31 15:11:34 1995
@@ -597,7 +597,9 @@
#ifdef CONFIG_SBPCD
mem_start = sbpcd_init(mem_start, mem_end);
#endif CONFIG_SBPCD
+#ifdef CONFIG_BLK_DEV_RAM
if (ramdisk_size)
mem_start += rd_init(mem_start, ramdisk_size*1024);
+#endif
return mem_start;
}
diff -ur linux-oem-1212/fs/filesystems.c linux/fs/filesystems.c
--- linux-oem-1212/fs/filesystems.c Mon Jul 25 00:39:44 1994
+++ linux/fs/filesystems.c Mon Jul 31 15:23:53 1995
@@ -22,6 +22,8 @@
#include <linux/hpfs_fs.h>
extern void device_setup(void);
+extern void rd_load(void);
+extern int ramdisk_size;
/* This may be used only once, enforced by 'static int callable' */
asmlinkage int sys_setup(void)
@@ -33,6 +35,11 @@
callable = 0;
device_setup();
+
+#ifdef CONFIG_BLK_DEV_RAM
+ if (ramdisk_size)
+ rd_load();
+#endif
#ifdef CONFIG_MINIX_FS
register_filesystem(&(struct file_system_type)
diff -ur linux-oem-1212/init/main.c linux/init/main.c
--- linux-oem-1212/init/main.c Mon Jul 31 16:22:18 1995
+++ linux/init/main.c Mon Jul 31 16:26:31 1995
@@ -131,7 +131,9 @@
void (*setup_func)(char *, int *);
} bootsetups[] = {
{ "reserve=", reserve_setup },
+#ifdef CONFIG_BLK_DEV_RAM
{ "ramdisk=", ramdisk_setup },
+#endif
#ifdef CONFIG_BUGi386
{ "no-hlt", no_halt },
{ "no387", no_387 },
@@ -209,11 +211,13 @@
{ 0, 0 }
};
+#ifdef CONFIG_BLK_DEV_RAM
void ramdisk_setup(char *str, int *ints)
{
if (ints[0] > 0 && ints[1] >= 0)
ramdisk_size = ints[1];
}
+#endif
static int checksetup(char *line)
{

16
docs/MemSavers/thinkpad Normal file
View File

@@ -0,0 +1,16 @@
--- /usr/src/linux/arch/i386/mm/init.c Wed Mar 22 22:54:33 1995
+++ linux/arch/i386/mm/init.c Thu Aug 10 18:36:06 1995
@@ -170,12 +170,7 @@
start_low_mem = PAGE_ALIGN(start_low_mem);
start_mem = PAGE_ALIGN(start_mem);
- /*
- * IBM messed up *AGAIN* in their thinkpad: 0xA0000 -> 0x9F000.
- * They seem to have done something stupid with the floppy
- * controller as well..
- */
- while (start_low_mem < 0x9f000) {
+ while (start_low_mem < 0xA0000) {
mem_map[MAP_NR(start_low_mem)] = 0;
start_low_mem += PAGE_SIZE;
}