龙芯pmon快速启动方法

龙芯pmon快速启动方法

以ls2k1000 pmon为例

一、去掉没有用的外设

  1. 去掉GPU
    vim Targets/LS2K/conf/ls2k里添加
    option NOGPU

    原理:
    龙芯pmon快速启动方法_第1张图片
    备注:必须使用pmon下的设备树,此方法才能去掉GPU

  2. 去掉Nand
    vim Targets/LS2K/conf/ls2k里注释掉如下内容
    #select nand
    #select spinand_lld
    #option CONFIG_LS2K_NAND

    原理:
    龙芯pmon快速启动方法_第2张图片

  3. bootdelay 环境变量设为0
    龙芯pmon快速启动方法_第3张图片

  4. 其他设备
    ls2k配置文件在vim Targets/LS2K/conf/ls2k,想掉某个未用设备,直接在这个文件里注释掉,编译能正常通过即可!

二、去掉pmon启动时打印信息

参考下边补丁文件进行修改…

From 6955e716f9490cc5550b8d2d2cec37e5f4dfcc15 Mon Sep 17 00:00:00 2001
From: xupengjun <xupengjun@loongson.cn>
Date: Wed, 28 Oct 2020 15:56:29 +0800
Subject: [PATCH] pmon quick start, config file ls2k add FASTUP

---
 Targets/LS2K/conf/ls2k                        | 48 +++++++++++--------
 Targets/LS2K/dev/localbus.c                   |  3 +-
 Targets/LS2K/include/pmon_target.h            |  8 ++++
 .../LS2K/ls2k/ddr_dir/loongson3_ddr2_config.S |  4 +-
 Targets/LS2K/ls2k/loongson3_clksetting.S      | 15 ++++--
 Targets/LS2K/ls2k/start.S                     | 23 +++++++--
 Targets/LS2K/ls2k/tgt_machdep.c               |  4 ++
 pmon/cmds/cmd_main/cmd_main.c                 |  3 +-
 pmon/common/main.c                            |  8 +++-
 pmon/dev/mainbus.c                            |  2 +
 pmon/dev/pcibr.c                              |  3 +-
 sys/dev/gmac/if_gmac.c                        |  2 +
 sys/dev/gmac/synopGMAC_network_interface.c    |  4 +-
 sys/dev/gmac/synopGMAC_plat.h                 |  4 ++
 sys/dev/pci/ahci.c                            |  9 +++-
 sys/dev/pci/pci.c                             |  3 +-
 sys/dev/pci/pciconf.c                         | 13 ++++-
 sys/dev/pci/ppb.c                             |  3 +-
 sys/kern/init_main.c                          |  6 +++
 sys/kern/subr_autoconf.c                      |  9 ++++
 sys/net/if.c                                  |  2 +
 sys/scsi/scsiconf.c                           |  2 +
 22 files changed, 134 insertions(+), 44 deletions(-)

diff --git a/Targets/LS2K/conf/ls2k b/Targets/LS2K/conf/ls2k
index 03852d45..91b68e18 100644
--- a/Targets/LS2K/conf/ls2k
+++ b/Targets/LS2K/conf/ls2k
@@ -37,7 +37,7 @@ option		LS3_HT              # Enable the IO cache coherent for ls2k
 
 option      loongson3A3
 option      LSMC_2
-#option      ARB_LEVEL
+option      ARB_LEVEL
 option      DDR3_DIMM
 
 
@@ -115,7 +115,7 @@ select		mod_vgacon
 option		VGA_NO_ROM       # display card has no rom
 #select		mod_sisfb
 option		NOPCINAMES		# Save some space for x86emu
-#option		FASTBOOT
+option		FASTBOOT
 #select		vt82c686        #via686a/b code
 
 select		mod_framebuffer
@@ -137,7 +137,7 @@ option		HAVE_TOD		# Time-Of-Day clock
 option		INTERNAL_RTC		# chip internal RTC
 #option		EXTERNAL_RTC		# external RTC
 option		HAVE_NVENV		#  Platform has non-volatile env mem
-option		HAVE_LOGO		# Output splash logo
+#option		HAVE_LOGO		# Output splash logo
 option		USE_SUPERIO_UART
 #option      	VESAFB
 #option		USE_LEGACY_RTC
@@ -180,15 +180,15 @@ ahci_cdrom*  	at ahci?
 pcinvme*	at pci? dev ? function ?
 nvme*		at pcinvme?
 
-ohci*   	at pci? dev ? function ?	# OHCI
-usb*      	at ohci?
+#ohci*   	at pci? dev ? function ?	# OHCI
+##usb*      	at ohci?
 #lehci*   	at pci? dev ? function ?	# EHCI
 #usb*      	at lehci?
 
-lxhci0    	at localbus0 base 0xbfe38000	# xHCI
-xhci0		at lxhci0
-usb*		at xhci0
-select 	 	mod_usb_xhci
+##lxhci0    	at localbus0 base 0xbfe38000	# xHCI
+##xhci0		at lxhci0
+##usb*		at xhci0
+##select 	 	mod_usb_xhci
 
 #lohci0    	at localbus0 base 0xbfe38000	# OHCI
 #usb*      	at lohci0
@@ -223,12 +223,12 @@ select igb1
 #usb*		at usbbus ? 
 #ohci1		at pci? dev ? function ?
 
-select		mod_usb
-select  	mod_usb_storage
+###select		mod_usb
+###select  	mod_usb_storage
 #select		mod_usb_uhci
-select 	 	mod_usb_ohci
+###select 	 	mod_usb_ohci
 #select 	 	mod_usb_ehci
-select		mod_usb_kbd
+##select		mod_usb_kbd
 
 
 #### IDE controllers
@@ -269,7 +269,7 @@ select		gzip
 option		INPUT_FROM_BOTH
 option		OUTPUT_TO_BOTH
 option		KBD_CHECK_FAST
-option		TEST_USB_HOST
+#option		TEST_USB_HOST
 option		CONFIG_SLOW_PCI_FOR_BROKENDEV
 option 		CONFIG_VIDEO_SW_CURSOR
 #option		CONFIG_USB_HOTPLUG
@@ -277,18 +277,18 @@ option 		CONFIG_VIDEO_SW_CURSOR
 select		http
 select		tcp
 select		inet
-select		nand
+#select		nand
 select cmd_xyzmodem
 option HPET_RTC
 #select		spinand_mt29f
-select		m25p80
+#select		m25p80
 
 select	can
 select yaffsfs
 #option LS2H_SPI_HIGHSPEED
 #option DISABLE_HARD_LEVELING
-select		spinand_lld
+#select		spinand_lld
 #option DDR_PARAM_018="0x3030303016100000"
 ##option DDR_PARAM_1e8="0x0f0f0f0f0f0f0f0f"
 ##option DDR_PARAM_1e0="0x0f0f0f0f0f0f0f0f"
@@ -347,9 +347,14 @@ option BEEP_GPIO=0
 #option  HS0636
 #select sii9022a
-select nand_bch
+#select nand_bch
+#option DDR_PARAM_018="0x2020202016100000"
+#option DDR_S1=0xc0a18404
+
 #option CONFIG_LS2K_NAND
 #select nand_bch
@@ -410,6 +415,7 @@ select i2c
 #option CONFIG_VIDEO_LOGO
 #option CONFIG_VIDEO_BMP_LOGO
 option DDR_FREQ=400
-option CORE_FREQ=800
-option LOWPOWER
+option CORE_FREQ=1000
+#option LOWPOWER
 select raw_ether
+option FASTUP
diff --git a/Targets/LS2K/dev/localbus.c b/Targets/LS2K/dev/localbus.c
index 08c99dd5..dac296f4 100644
--- a/Targets/LS2K/dev/localbus.c
+++ b/Targets/LS2K/dev/localbus.c
@@ -129,8 +129,9 @@ localbusattach(parent, self, aux)
 	struct device *self;
 	void *aux;
 {
+#ifndef FASTUP
 	printf("\n");
-
+#endif
 	config_scan(localbusscan, self);
 }
 
diff --git a/Targets/LS2K/include/pmon_target.h b/Targets/LS2K/include/pmon_target.h
index 89c90901..8b294695 100644
--- a/Targets/LS2K/include/pmon_target.h
+++ b/Targets/LS2K/include/pmon_target.h
@@ -33,6 +33,9 @@
 
 #include 
 
+#ifdef FASTUP
+#define SBD_DEBUG
+#endif
 #ifdef SBD_DEBUG
 #define SBD_DISPLAY(text, code)		/* No display function */
 #else
@@ -40,6 +43,7 @@ void hexserial __P((int));
 #define SBD_DISPLAY(text, code)	tgt_display(text, code)
 #endif
 
+
 /*
  *  Name of envvar that has to be set to enable expert mode.
  */
@@ -69,5 +73,9 @@ extern int mtd_rescan(char *,char *);
 #define TGT_DEFENV  {"mtdparts","nand-flash:30M@0(kernel),-(rootfs);spinand_flash:30M@0(kernel),-(rootfs)",0,&mtd_rescan},   \
                     {"bootdelay","3",0,0}
 #else
+#ifndef FASTUP
 #define TGT_DEFENV  {"bootdelay","3",0,0}
+#else
+#define TGT_DEFENV  {"bootdelay","0",0,0}
+#endif
 #endif
diff --git a/Targets/LS2K/ls2k/ddr_dir/loongson3_ddr2_config.S b/Targets/LS2K/ls2k/ddr_dir/loongson3_ddr2_config.S
index 031cb92b..4123cc8d 100644
--- a/Targets/LS2K/ls2k/ddr_dir/loongson3_ddr2_config.S
+++ b/Targets/LS2K/ls2k/ddr_dir/loongson3_ddr2_config.S
@@ -177,7 +177,7 @@
     and     s1, s1, a1
     or      s1, s1, t1
 1:
-#if 1
+#if PRINT_MSG
     /* show value of s1 */
     PRINTSTR("\r\nnew s1 = 0x");
     dsrl    a0, s1, 32
@@ -247,7 +247,7 @@
     dli     a1, 0xffffffff00000000
     and     t1, t1, a1
     or      s1, s1, t1
-#if 1
+#if PRINT_MSG
     /* show value of s1 */
     PRINTSTR("\r\nnew s1 = 0x");
     dsrl    a0, s1, 32
diff --git a/Targets/LS2K/ls2k/loongson3_clksetting.S b/Targets/LS2K/ls2k/loongson3_clksetting.S
index 0e69363d..face0763 100644
--- a/Targets/LS2K/ls2k/loongson3_clksetting.S
+++ b/Targets/LS2K/ls2k/loongson3_clksetting.S
@@ -141,11 +141,12 @@ ATTENTION:
 	ori     a0, a0, PLL_CHANG_COMMIT
 	sd      a0, 0x0(t0)
 
+#ifndef FASTUP
 	bal     hexserial
 	nop
 
 	TTYDBG ("\r\nMEM        :")
-
+#endif
 
 	li      t0, 0xbfe10490
 	li	t1, (0x1 << 19) 	//power down pll  first
@@ -193,11 +194,12 @@ ATTENTION:
 	ori     a0, a0, 0x3
 	sw      a0, 0x0(t0)
 
+#ifndef FASTUP
 	bal     hexserial
 	nop
 
 	TTYDBG ("\r\nDC        :")
-
+#endif
 	li      t0, 0xbfe104a0
 	li	t1, (0x1 << 19) 	//power down pll  first
 	sd	t1, 0x0(t0)
@@ -219,11 +221,12 @@ ATTENTION:
 	ori     a0, a0, 0x3
 	sw      a0, 0x0(t0)
 
+#ifndef FASTUP
 	bal     hexserial
 	nop
 
 	TTYDBG ("\r\nPIX0        :")
-
+#endif
 	li      t0, 0xbfe104b0		//pll_pix0
 	li	t1, (0x1 << 19) 	//power down pll  first
 	sd	t1, 0x0(t0)
@@ -245,11 +248,12 @@ ATTENTION:
 	ori     a0, a0, 0x1
 	sw      a0, 0x0(t0)
 
+#ifndef FASTUP
 	bal     hexserial
 	nop
 
 	TTYDBG ("\r\nPIX1        :")
-
+#endif
 	li      t0, 0xbfe104c0		//pll_pix1
 	li	t1, (0x1 << 19) 	//power down pll  first
 	sd	t1, 0x0(t0)
@@ -271,8 +275,9 @@ ATTENTION:
 	ori     a0, a0, 0x1
 	sw      a0, 0x0(t0)
 
+#ifndef FASTUP
 	bal     hexserial
 	nop
-
+#endif
 
 #endif
diff --git a/Targets/LS2K/ls2k/start.S b/Targets/LS2K/ls2k/start.S
index 18c699d6..009765c2 100644
--- a/Targets/LS2K/ls2k/start.S
+++ b/Targets/LS2K/ls2k/start.S
@@ -46,7 +46,7 @@
 
 #include "target/cacheops.h"	//mtf
 
-#define TTYDEBUG
+//#define TTYDEBUG
 #ifdef TTYDEBUG
 #define	TTYDBG(x) \
 	.rdata;98: .asciz x; .text; la a0, 98b; bal stringserial; nop
@@ -54,8 +54,13 @@
 #define TTYDBG(x)
 #endif
 #define HAVE_TARGET_GETCHAR
+
+#ifndef FASTUP
 #define	PRINTSTR(x) \
 	.rdata;98: .asciz x; .text; la a0, 98b; bal stringserial; nop
+#else
+#define	PRINTSTR(x) 
+#endif
 
 #define CONFIG_CACHE_64K_4WAY 1 
 
@@ -1133,9 +1138,11 @@ pcie_cfg_done:
 	sync
 
 	ld	a0, 0x0(t1)
+#ifndef FASTUP
 	bal	hexserial64
 	nop
 #endif
+#endif
 
 #if 0
     li      t0, 0xbfe10000
@@ -1308,7 +1315,7 @@ start_now:
 #include "ddr_dir/ddr_config_define.h"
 //#define DDR_DLL_BYPASS
 #define DISABLE_DIMM_ECC
-#define PRINT_MSG
+//#define PRINT_MSG
 #ifdef  ARB_LEVEL
 #define AUTO_ARB_LEVEL
 #endif
@@ -1366,8 +1373,9 @@ start_now:
 	and     a0, a0, 0xfd
 	sb      a0, 0x1(t0)
 	sync
-
-	li      t0, 0xbfe10420
+	
+#ifndef FASTUP
+    li      t0, 0xbfe10420
 	ld      a0, 0x0(t0)
 	move    t6, a0
 	dsrl    a0, t6, 32
@@ -1443,7 +1451,7 @@ start_now:
 	daddiu  t5, t5, 8
 	bnez    t1, 1b
 	nop
-
+#endif
 ##########################################
 #ifdef  DEBUG_DDR
 #ifdef DEBUG_DDR_PARAM
@@ -1500,6 +1508,7 @@ start_now:
 
 bootnow:
 
+#ifndef FASTUP
 	TTYDBG("  start = 0x")
 	la	a0, start
 	bal	hexserial
@@ -1516,6 +1525,8 @@ bootnow:
 	la	a0, _end
 	bal	hexserial
 	nop
+#endif
+
 #if 0 //ls2h old code
 	TTYDBG("\r\n")
         bal  spd_info_store
@@ -1534,12 +1545,14 @@ bootnow:
 1:	and	t3, t0, 0x0000ffff
 	bnez	t3, 2f
 	nop
+#ifndef FASTUP
 	move	a0, t0
 	bal	hexserial
 	nop
 	li	a0, '\r'
 	bal 	tgt_putchar
 	nop
+#endif
 
 2:	lw	t3, 0(t1)
 	sw	t3, 0(t0)
diff --git a/Targets/LS2K/ls2k/tgt_machdep.c b/Targets/LS2K/ls2k/tgt_machdep.c
index 47990e5e..0d31bfc9 100644
--- a/Targets/LS2K/ls2k/tgt_machdep.c
+++ b/Targets/LS2K/ls2k/tgt_machdep.c
@@ -375,7 +375,9 @@ void initmips(unsigned long long  raw_memsz)
 	bcopy(MipsException, (char *)GEN_EXC_VEC,
 			MipsExceptionEnd - MipsException);
 	SBD_DISPLAY("BEV0", 0);
+#ifndef FASTUP
 	printf("BEV in SR set to zero.\n");
+#endif
 	/*disable spi instruct fetch before enter spi io mode*/
 #ifdef DEBUG_BY_EJTAG
 	*(volatile int *)0xbfe10080 = 0x001000f0;
@@ -1217,8 +1219,10 @@ void tgt_memprint()
 
 void tgt_machprint()
 {
+#ifndef FASTUP
 	printf("Copyright 2000-2002, Opsycon AB, Sweden.\n");
 	printf("Copyright 2005, ICT CAS.\n");
+#endif
 	printf("CPU %s @", md_cpuname());
 }
 
diff --git a/pmon/cmds/cmd_main/cmd_main.c b/pmon/cmds/cmd_main/cmd_main.c
index d9fc6fc8..519916f0 100644
--- a/pmon/cmds/cmd_main/cmd_main.c
+++ b/pmon/cmds/cmd_main/cmd_main.c
@@ -1670,11 +1670,12 @@ int check_password(int page)
                                 spl0();
                                 tgt_poll();
                         }
-
+#if NMODE_USB_KBD
                         if (bios_available && usb_kbd_code == 0x8)
                         {
                                kbd_code = 0x7f;
                         }
+#endif
 #endif
 		switch(tag)
 		{
diff --git a/pmon/common/main.c b/pmon/common/main.c
index bedf9fde..130bdb81 100644
--- a/pmon/common/main.c
+++ b/pmon/common/main.c
@@ -620,9 +620,11 @@ static int autoload(char *s)
 			dly = 8;
 		}
 
+#ifndef FASTUP
 		SBD_DISPLAY ("AUTO", CHKPNT_AUTO);
 		printf("Press  to execute loading image:%s\n",s);
 		printf("Press any other key to abort.\n");
+#endif
 		ioctl (STDIN, CBREAK, &sav);
 		lastt = 0;
 		if (!dly) ioctl (STDIN, FIONREAD, &cnt);
@@ -881,6 +883,7 @@ dbginit (char *adr)
 	/* Set up initial console terminal state */
 	ioctl(STDIN, TCGETA, &consterm);
 
+#ifndef FASTUP
 #ifdef HAVE_LOGO
 	tgt_logo();
 #else
@@ -888,6 +891,7 @@ dbginit (char *adr)
 #endif
 	printf ("\nConfiguration [%s,%s", TARGETNAME,
 			BYTE_ORDER == BIG_ENDIAN ? "EB" : "EL");
+
 #ifdef INET
 	printf (",NET");
 #endif
@@ -901,14 +905,16 @@ dbginit (char *adr)
 	printf ("Supported loaders [%s]\n", getExecString());
 	printf ("Supported filesystems [%s]\n", getFSString());
 	printf ("This software may be redistributed under the BSD copyright.\n");
-
+#endif
 		
 	print_cpu_info();
 	print_mem_freq();
 
 	printf ("Memory size %lld MB .\n", memorysize_total);
 
+#ifndef FASTUP
 	tgt_memprint();
+#endif
 #if defined(SMP)
 	tgt_smpstartup();
 #endif
diff --git a/pmon/dev/mainbus.c b/pmon/dev/mainbus.c
index 924c8f83..59059f6f 100644
--- a/pmon/dev/mainbus.c
+++ b/pmon/dev/mainbus.c
@@ -78,7 +78,9 @@ mainbus_attach(parent, self, aux)
 	struct confargs nca;
 	int i;
 
+#ifndef FASTUP
 	printf("\n");
+#endif
 	sc->sc_bus.bh_dv = (struct device *)sc;
 	sc->sc_bus.bh_type = BUS_MAIN;
 	sc->sc_bus.bh_intr_establish = NULL;
diff --git a/pmon/dev/pcibr.c b/pmon/dev/pcibr.c
index d6dfd544..ea45f06c 100644
--- a/pmon/dev/pcibr.c
+++ b/pmon/dev/pcibr.c
@@ -111,8 +111,9 @@ pcibrattach(parent, self, aux)
         /*	struct pcibr_config *lcp; */
 	struct pcibus_attach_args pba;
 
+#ifndef FASTUP
         printf("\n");
-
+#endif
 	/*
 	 *  Generic.
 	 */
diff --git a/sys/dev/gmac/if_gmac.c b/sys/dev/gmac/if_gmac.c
index b0871eec..aa54a49f 100644
--- a/sys/dev/gmac/if_gmac.c
+++ b/sys/dev/gmac/if_gmac.c
@@ -106,7 +106,9 @@ pcisyn_attach(parent, self, aux)
 		return;
 	}
 
+#ifndef FASTUP
 	printf("membasep=0x%x\n",(int)membasep);
+#endif
 
 #if defined(LS7A) || defined(LOONGSON_2K)
 	synopGMAC_init_network_interface(sc->dv_xname, (int)(membasep|0x80000000));
diff --git a/sys/dev/gmac/synopGMAC_network_interface.c b/sys/dev/gmac/synopGMAC_network_interface.c
index 066d141d..77d66fc9 100755
--- a/sys/dev/gmac/synopGMAC_network_interface.c
+++ b/sys/dev/gmac/synopGMAC_network_interface.c
@@ -2053,10 +2053,10 @@ int init_phy(struct synopGMACdevice *gmacdev)
             //printf("==== Warning: reset gmac phy 88E151X!\n");
 	        alaska88e151x_config_init(gmacdev);
         } else{
-            printf("==== Warning: unrecoganized marvel gmac phy!\n");
+            TR("==== Warning: unrecoganized marvel gmac phy!\n");
         }
     } else{
-        printf("==== Warning: unrecoganized gmac phy!\n");
+        TR("==== Warning: unrecoganized gmac phy!\n");
     };
 	return 0;
 #else
diff --git a/sys/dev/gmac/synopGMAC_plat.h b/sys/dev/gmac/synopGMAC_plat.h
index 0e27c105..e6316de1 100755
--- a/sys/dev/gmac/synopGMAC_plat.h
+++ b/sys/dev/gmac/synopGMAC_plat.h
@@ -94,7 +94,11 @@ typedef unsigned long dma_addr_t;
 #else
 #define TR0(fmt, args...)   printf(fmt, ##args)	
 #endif
+#ifndef FASTUP
 #define TR(fmt, args...)   printf(fmt, ##args)	
+#else
+#define TR(fmt, args...)
+#endif
 
 //typedef int bool;
 enum synopGMAC_boolean
diff --git a/sys/dev/pci/ahci.c b/sys/dev/pci/ahci.c
index 1f99a132..743b0e11 100755
--- a/sys/dev/pci/ahci.c
+++ b/sys/dev/pci/ahci.c
@@ -82,7 +82,11 @@
 #define WAIT_MS_DATAIO	10000
 #define WAIT_MS_FLUSH	5000
 #define WAIT_MS_LINKUP	200
+#ifndef FASTUP
 #define debug printf
+#else
+#define debug
+#endif
 
 int ahci_host_init(struct ahci_probe_ent *probe_ent);
 static void *ahci_init_one(u32 regbase);
@@ -147,10 +151,11 @@ static void ahci_attach(struct device *parent, struct device *self, void *aux)
 		printf(" Can't find mem space\n");
 		return;
 	}
+#ifndef FASTUP
 	printf("Found memory space: memt->bus_base=0x%x, baseaddr=0x%x"
 	       "size=0x%x\n", memt->bus_base, (u32) (membasep),
 	       (u32) (memsizep));
-
+#endif
 #if 0 /* set 1.0 mode */
 	int temp = *(int *)((membasep + 0x12c) | memt->bus_base);
 	printf("0x12C =%x\n", temp);
@@ -165,7 +170,9 @@ static void ahci_attach(struct device *parent, struct device *self, void *aux)
 	}
 
 	linkmap = probe_ent->link_port_map;
+#ifndef FASTUP
 	printf("ahci: linkmap=%x\n", linkmap);
+#endif
 	for (i = 0; i < probe_ent->n_ports; i++) {
 		if (((linkmap >> i) & 0x01)) {
 			info.sata_reg_base =
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index c9be8592..a865dbda 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -119,8 +119,9 @@ pciattach(parent, self, aux)
 	int bus, device, maxndevs, function, nfunctions;
 
 	pci_attach_hook(parent, self, pba);
+#ifndef FASTUP
 	printf("\n");
-
+#endif
 	iot = pba->pba_iot;
 	memt = pba->pba_memt;
 	pc = pba->pba_pc;
diff --git a/sys/dev/pci/pciconf.c b/sys/dev/pci/pciconf.c
index 9a4cda9e..9d589c7f 100644
--- a/sys/dev/pci/pciconf.c
+++ b/sys/dev/pci/pciconf.c
@@ -58,6 +58,10 @@
 #include "pcivar.h"
 #include "pcireg.h"
 
+#ifdef FASTUP
+#define PCIVERBOSE 0
+#endif
+
 #ifndef PCIVERBOSE
 #if defined(LOONGSON_2K) || defined(LS7A)
 #define PCIVERBOSE 5
@@ -389,7 +393,6 @@ static void pcie_write_mrrs(struct pci_device *dev)
 			printf("Failed attempting to set the MPS\n");
 	}
 }
-
 static void
 print_bdf (int bus, int device, int function)
 {
@@ -910,6 +913,7 @@ _pci_query_dev (struct pci_device *dev, int bus, int device, int initialise)
 	if (_pciverbose >= 2) {
 		PRINTF ("completed\n");
 	}
+
 #else
 	
 	id = _pci_conf_read(tag, PCI_ID_REG);
@@ -1377,14 +1381,19 @@ _pci_businit (int init)
 {
 	char *v;
 
+#ifndef FASTUP
 	tgt_putchar('P');
+#endif
 	v = getenv("pciverbose");
+#ifndef FASTUP
     tgt_putchar('1');
+#endif
 	if (v) {
 	    _pciverbose = atol(v);
 	}
+#ifndef FASTUP
     tgt_putchar('2');
-
+#endif
 	/* intialise the PCI bridge */
 	if (/*init*/ 1) {
 		SBD_DISPLAY ("PCIH", CHKPNT_PCIH);
diff --git a/sys/dev/pci/ppb.c b/sys/dev/pci/ppb.c
index fcc7c047..bf7bdee4 100644
--- a/sys/dev/pci/ppb.c
+++ b/sys/dev/pci/ppb.c
@@ -97,8 +97,9 @@ ppbattach(parent, self, aux)
 	struct pcibus_attach_args pba;
 	pcireg_t busdata;
 
+#ifndef FASTUP
 	printf("\n");
-
+#endif
 	busdata = pci_conf_read(pc, pa->pa_tag, PPB_REG_BUSINFO);
 
 	if (PPB_BUSINFO_SECONDARY(busdata) == 0) {
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index d8fe36a3..4b5e48f7 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -161,16 +161,22 @@ extern vm_map_t mb_map, kernel_map;
 		}
 		
 		ifinit();
+#ifndef FASTUP
 		printf("ifinit done.\n");
+#endif
 		domaininit();
+#ifndef FASTUP
 		printf("domaininit done.\n");
+#endif
 		splx(s);
 	}
 
 	/* 
 	 * Initialise process table, we become first "process" 
 	 */
+#ifndef FASTUP
 	printf("init_proc....\n");
+#endif
 	init_proc ();
 
 	/* enable realtime clock interrupts */
diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c
index fbb43dc6..bcf772f7 100644
--- a/sys/kern/subr_autoconf.c
+++ b/sys/kern/subr_autoconf.c
@@ -354,8 +354,10 @@ config_found_sm(parent, aux, print, submatch)
                  return dev;
 
 	}
+#ifndef FASTUP
 	if (print)
 		printf(msgs[(*print)(aux, parent->dv_xname)]);
+#endif
 
 #if NMOD_USB_OHCI
 	if(ohci_index)  
@@ -450,7 +452,11 @@ config_attach(parent, match, aux, print)
 	device_ref(dev);
 
 	if (parent == ROOT)
+    {
+#ifndef FASTUP
 		printf("%s (root)", dev->dv_xname);
+#endif
+    }
 	else {
 
 #ifdef INTERFACE_3A780E
@@ -468,9 +474,12 @@ if (strstr(dev->dv_xname, "wd") != NULL || strstr(dev->dv_xname, "cd") != NULL |
 			b_name[i] = NULL;
 		}
 #endif	
+
+#ifndef FASTUP
 	printf("%s at %s", dev->dv_xname, parent->dv_xname);
 		if (print)
 			(void) (*print)(aux, (char *)0);
+#endif
 
 #if NMOD_USB_OHCI
 		if(ohci_index)
diff --git a/sys/net/if.c b/sys/net/if.c
index 65fd998e..154f2947 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -183,7 +183,9 @@ void
 if_attach(ifp)
 	struct ifnet *ifp;
 {
+#ifndef FASTUP
 	printf("in if attach\n");
+#endif
 	if (if_index == 0) {
 		TAILQ_INIT(&ifnet);
 	}
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c
index fa775979..2877f86f 100644
--- a/sys/scsi/scsiconf.c
+++ b/sys/scsi/scsiconf.c
@@ -1080,7 +1080,9 @@ scsi_probedev(struct scsibus_softc *scsi, int target, int lun)//wan: scsi=sb in
 	if ((cf = config_search(scsibussubmatch, (struct device *)scsi,
 	    &sa)) == 0) {//wan: cf=cfdata[19]"sd"
 		scsibusprint(&sa, scsi->sc_dev.dv_xname);
+#ifndef FASTUP
 		printf(" not configured\n");
+#endif
 		goto free_devid;
 	}
 
-- 
2.25.1

三、修改后预期效果

如果外设使用的不多,通过以上修改pmon启动时间大致在4s以内

你可能感兴趣的:(龙芯,pmon快速启动,pmon快启)