Skip to contentSkip to conversation

kill drive_info

PATCH In review Adrian Bunk 3 participants 5 messages Jul 14, 2004 – Jul 15, 2004 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kill drive_info

The only user of drive_info in 2.6 seems to be drivers/ide/legacy/hd.c .

What about the patch below to kill drive_info?

Please double-check this patch, all I checked was a test of compilation on i386.

diffstat output:

 arch/cris/kernel/setup.c         |    1 -
 arch/i386/kernel/i386_ksyms.c    |    5 -----
 arch/i386/kernel/setup.c         |    2 --
 arch/ia64/dig/setup.c            |   10 ----------
 arch/ia64/sn/kernel/setup.c      |   14 --------------
 arch/ppc/platforms/pmac_setup.c  |    2 --
 arch/sh64/kernel/sh_ksyms.c      |    8 --------
 arch/x86_64/kernel/setup.c       |    2 --
 arch/x86_64/kernel/x8664_ksyms.c |    5 -----
 drivers/ide/legacy/hd.c          |    7 +++++--
 10 files changed, 5 insertions(+), 51 deletions(-)
arch/x86_64/kernel/setup.c renamed from arch/x86_64/kernel/setup.c.old +0 -2
@@ -85,7 +85,6 @@
 /*
  * Setup options
  */
-struct drive_info_struct { char dummy[32]; } drive_info;
 struct screen_info screen_info;
 struct sys_desc_table_struct {
 	unsigned short length;
@@ -429,7 +428,6 @@
 	unsigned long kernel_end;
 
  	ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
- 	drive_info = DRIVE_INFO;
  	screen_info = SCREEN_INFO;
 	edid_info = EDID_INFO;
 	aux_device_present = AUX_DEVICE_INFO;
arch/x86_64/kernel/x8664_ksyms.c renamed from arch/x86_64/kernel/x8664_ksyms.c.old +0 -5
@@ -41,11 +41,6 @@
 extern void __read_lock_failed(rwlock_t *rw);
 #endif
 
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)
-extern struct drive_info_struct drive_info;
-EXPORT_SYMBOL(drive_info);
-#endif
-
 extern unsigned long get_cmos_time(void);
 
 /* platform dependent support */
arch/i386/kernel/i386_ksyms.c renamed from arch/i386/kernel/i386_ksyms.c.old +0 -5
@@ -51,11 +51,6 @@
 extern void FASTCALL( __read_lock_failed(rwlock_t *rw));
 #endif
 
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)
-extern struct drive_info_struct drive_info;
-EXPORT_SYMBOL(drive_info);
-#endif
-
 extern unsigned long cpu_khz;
 extern unsigned long get_cmos_time(void);
 
arch/ia64/sn/kernel/setup.c renamed from arch/ia64/sn/kernel/setup.c.old +0 -14
@@ -109,20 +109,6 @@
 };
 
 /*
- * This is here so we can use the CMOS detection in ide-probe.c to
- * determine what drives are present.  In theory, we don't need this
- * as the auto-detection could be done via ide-probe.c:do_probe() but
- * in practice that would be much slower, which is painful when
- * running in the simulator.  Note that passing zeroes in DRIVE_INFO
- * is sufficient (the IDE driver will autodetect the drive geometry).
- */
-#ifdef CONFIG_IA64_GENERIC
-extern char drive_info[4*16];
-#else
-char drive_info[4*16];
-#endif
-
-/*
  * This routine can only be used during init, since
  * smp_boot_data is an init data structure.
  * We have to use smp_boot_data.cpu_phys_id to find
arch/ia64/dig/setup.c renamed from arch/ia64/dig/setup.c.old +0 -10
@@ -25,16 +25,6 @@
 #include <asm/machvec.h>
 #include <asm/system.h>
 
-/*
- * This is here so we can use the CMOS detection in ide-probe.c to
- * determine what drives are present.  In theory, we don't need this
- * as the auto-detection could be done via ide-probe.c:do_probe() but
- * in practice that would be much slower, which is painful when
- * running in the simulator.  Note that passing zeroes in DRIVE_INFO
- * is sufficient (the IDE driver will autodetect the drive geometry).
- */
-char drive_info[4*16];
-
 void __init
 dig_setup (char **cmdline_p)
 {
arch/ppc/platforms/pmac_setup.c renamed from arch/ppc/platforms/pmac_setup.c.old +0 -2
@@ -95,8 +95,6 @@
 
 struct device_node *memory_node;
 
-unsigned char drive_info;
-
 int ppc_override_l2cr = 0;
 int ppc_override_l2cr_value;
 int has_l2cache = 0;
arch/cris/kernel/setup.c renamed from arch/cris/kernel/setup.c.old +0 -1
@@ -23,7 +23,6 @@
 /*
  * Setup options
  */
-struct drive_info_struct { char dummy[32]; } drive_info;
 struct screen_info screen_info;
 
 unsigned char aux_device_present;
arch/sh64/kernel/sh_ksyms.c renamed from arch/sh64/kernel/sh_ksyms.c.old +0 -8
@@ -32,14 +32,6 @@
 extern void dump_thread(struct pt_regs *, struct user *);
 extern int dump_fpu(struct pt_regs *, elf_fpregset_t *);
 
-#if 0
-/* Not yet - there's no declaration of drive_info anywhere. */
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)
-extern struct drive_info_struct drive_info;
-EXPORT_SYMBOL(drive_info);
-#endif
-#endif
-
 /* platform dependent support */
 EXPORT_SYMBOL(dump_thread);
 EXPORT_SYMBOL(dump_fpu);
drivers/ide/legacy/hd.c renamed from drivers/ide/legacy/hd.c.old +5 -2
@@ -47,6 +47,10 @@
 #include <asm/io.h>
 #include <asm/uaccess.h>
 
+#ifdef __i386__
+#include <asm/setup.h>
+#endif
+
 #ifdef __arm__
 #undef  HD_IRQ
 #endif
@@ -726,8 +730,7 @@
 
 #ifdef __i386__
 	if (!NR_HD) {
-		extern struct drive_info drive_info;
-		unsigned char *BIOS = (unsigned char *) &drive_info;
+		unsigned char *BIOS = &boot_params[0x80];
 		unsigned long flags;
 		int cmos_disks;
 
arch/i386/kernel/setup.c renamed from arch/i386/kernel/setup.c.old +0 -2
@@ -102,7 +102,6 @@
 /*
  * Setup options
  */
-struct drive_info_struct { char dummy[32]; } drive_info;
 struct screen_info screen_info;
 struct apm_info apm_info;
 struct sys_desc_table_struct {
@@ -1288,7 +1287,6 @@
 #endif
 
  	ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
- 	drive_info = DRIVE_INFO;
  	screen_info = SCREEN_INFO;
 	edid_info = EDID_INFO;
 	apm_info.bios = APM_BIOS_INFO;
#1 lore raw

drivers/ide/legacy/hd.c line 733

Quoted 7 lines · Adrian Bunk

What about the patch below to kill drive_info?

Please double-check this patch, all I checked was a test of compilation on i386.

drivers/ide/legacy/hd.c renamed from drivers/ide/legacy/hd.c.old +1 -1
-		unsigned char *BIOS = (unsigned char *) &drive_info;
+		unsigned char *BIOS = &boot_params[0x80];

Ugly. There is already a define DRIVE_INFO for this right hand side:

setup.h:#define PARAM (boot_params)
setup.h:#define DRIVE_INFO (*(struct drive_info_struct *) (PARAM+0x80))

Review

Quoted 1 line
(quoted diff) +0 -1
- 	drive_info = DRIVE_INFO;

Hmm. setup.c copies this info from where it was left after booting to some safe place. You seem to think that this saving is not required. Is it not?

Andries

#2 lore raw
Quoted 6 lines · Andries Brouwer

...

Review

Quoted 1 line
(quoted diff) +0 -1
- 	drive_info = DRIVE_INFO;

Hmm. setup.c copies this info from where it was left after booting to some safe place. You seem to think that this saving is not required. Is it not?

- boot_params is __initdata
- hd_init in legacy/hd.c is __init
- legacy/hd.c can't be built modular

Did I miss something?

The situation is different in 2.4 where the new (possibly modular) IDE driver also uses drive_info .

Quoted 1 line

Andries

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#3 lore raw

cannot ping from a usb-serial device

Hi all,
I am developing a portable device that I must connect to Internet via usb.
I connect to my linux box with pppd on ttyUSB0 and the link layer is working ok. I can ping my device from all the machines connected, but when the device pings some address known reacheable my linux box sees the packets ("ifconfig ppp0" returns the correct number of packets exchanged and "netstat -i" reports the correct number of bytes on the interface), but no echo replies come back to my device. I understand that my question may be silly for this forum, but I am really out of resources.
Can someone out there point me to some info to understand why this is happening?

many tnx

pietro canevarolo

#4 lore raw
In reply to Adrian Bunk
Quoted 8 lines · Adrian Bunk
Quoted 6 lines · Andries Brouwer

...

Review

Quoted 1 line
(quoted diff) +0 -1
- 	drive_info = DRIVE_INFO;

Hmm. setup.c copies this info from where it was left after booting to some safe place. You seem to think that this saving is not required. Is it not?

Quoted 6 lines

- boot_params is __initdata
- hd_init in legacy/hd.c is __init
- legacy/hd.c can't be built modular

The situation is different in 2.4 where the new (possibly modular) IDE driver also uses drive_info .

Yes, I see that this area (which used to be empty_zero_page) is independent since 2.6.5.

So, maybe your patch is correct.

[Still, the patch brings knowledge about boot_params that earlier was concentrated in head.S, setup.c, setup.h to elsewhere in the kernel. Ach.]

The doc file is still called zero-page.txt. One might add

0x228 4 bytes command line buffer

and possibly rename it.

Andries