瀏覽代碼

[init] Show startup and shutdown function names in debug messages

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 5 年之前
父節點
當前提交
36a4c85f91

+ 1
- 0
src/arch/x86/core/cachedhcp.c 查看文件

@@ -127,6 +127,7 @@ struct init_fn cachedhcp_init_fn __init_fn ( INIT_NORMAL ) = {
127 127
 
128 128
 /** Cached DHCPACK startup function */
129 129
 struct startup_fn cachedhcp_startup_fn __startup_fn ( STARTUP_LATE ) = {
130
+	.name = "cachedhcp",
130 131
 	.startup = cachedhcp_startup,
131 132
 };
132 133
 

+ 1
- 0
src/arch/x86/core/runtime.c 查看文件

@@ -265,5 +265,6 @@ static void runtime_init ( void ) {
265 265
 
266 266
 /** Command line and initrd initialisation function */
267 267
 struct startup_fn runtime_startup_fn __startup_fn ( STARTUP_NORMAL ) = {
268
+	.name = "runtime",
268 269
 	.startup = runtime_init,
269 270
 };

+ 1
- 0
src/arch/x86/drivers/net/undionly.c 查看文件

@@ -141,5 +141,6 @@ static void undionly_shutdown ( int booting ) {
141 141
 }
142 142
 
143 143
 struct startup_fn startup_undionly __startup_fn ( STARTUP_LATE ) = {
144
+	.name = "undionly",
144 145
 	.shutdown = undionly_shutdown,
145 146
 };

+ 1
- 0
src/arch/x86/image/initrd.c 查看文件

@@ -300,5 +300,6 @@ static void initrd_startup ( void ) {
300 300
 
301 301
 /** initrd startup function */
302 302
 struct startup_fn startup_initrd __startup_fn ( STARTUP_LATE ) = {
303
+	.name = "initrd",
303 304
 	.startup = initrd_startup,
304 305
 };

+ 1
- 0
src/arch/x86/interface/pcbios/bios_console.c 查看文件

@@ -547,6 +547,7 @@ static void bios_inject_shutdown ( int booting __unused ) {
547 547
 
548 548
 /** Keypress injection startup function */
549 549
 struct startup_fn bios_inject_startup_fn __startup_fn ( STARTUP_NORMAL ) = {
550
+	.name = "bios_inject",
550 551
 	.startup = bios_inject_startup,
551 552
 	.shutdown = bios_inject_shutdown,
552 553
 };

+ 1
- 0
src/arch/x86/interface/pcbios/hidemem.c 查看文件

@@ -229,6 +229,7 @@ static void unhide_etherboot ( int flags __unused ) {
229 229
 
230 230
 /** Hide Etherboot startup function */
231 231
 struct startup_fn hide_etherboot_startup_fn __startup_fn ( STARTUP_EARLY ) = {
232
+	.name = "hidemem",
232 233
 	.startup = hide_etherboot,
233 234
 	.shutdown = unhide_etherboot,
234 235
 };

+ 1
- 0
src/core/device.c 查看文件

@@ -111,6 +111,7 @@ static void remove_devices ( int booting __unused ) {
111 111
 }
112 112
 
113 113
 struct startup_fn startup_devices __startup_fn ( STARTUP_NORMAL ) = {
114
+	.name = "devices",
114 115
 	.startup = probe_devices,
115 116
 	.shutdown = remove_devices,
116 117
 };

+ 13
- 2
src/core/init.c 查看文件

@@ -36,6 +36,9 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
36 36
 /** "startup() has been called" flag */
37 37
 static int started = 0;
38 38
 
39
+/** Colour for debug messages */
40
+#define colour table_start ( INIT_FNS )
41
+
39 42
 /**
40 43
  * Initialise iPXE
41 44
  *
@@ -69,11 +72,15 @@ void startup ( void ) {
69 72
 
70 73
 	/* Call registered startup functions */
71 74
 	for_each_table_entry ( startup_fn, STARTUP_FNS ) {
72
-		if ( startup_fn->startup )
75
+		if ( startup_fn->startup ) {
76
+			DBGC ( colour, "INIT startup %s...\n",
77
+			       startup_fn->name );
73 78
 			startup_fn->startup();
79
+		}
74 80
 	}
75 81
 
76 82
 	started = 1;
83
+	DBGC ( colour, "INIT startup complete\n" );
77 84
 }
78 85
 
79 86
 /**
@@ -96,12 +103,16 @@ void shutdown ( int flags ) {
96 103
 
97 104
 	/* Call registered shutdown functions (in reverse order) */
98 105
 	for_each_table_entry_reverse ( startup_fn, STARTUP_FNS ) {
99
-		if ( startup_fn->shutdown )
106
+		if ( startup_fn->shutdown ) {
107
+			DBGC ( colour, "INIT shutdown %s...\n",
108
+			       startup_fn->name );
100 109
 			startup_fn->shutdown ( flags );
110
+		}
101 111
 	}
102 112
 
103 113
 	/* Reset console */
104 114
 	console_reset();
105 115
 
106 116
 	started = 0;
117
+	DBGC ( colour, "INIT shutdown complete\n" );
107 118
 }

+ 1
- 0
src/core/malloc.c 查看文件

@@ -685,6 +685,7 @@ static void shutdown_cache ( int booting __unused ) {
685 685
 
686 686
 /** Memory allocator shutdown function */
687 687
 struct startup_fn heap_startup_fn __startup_fn ( STARTUP_EARLY ) = {
688
+	.name = "heap",
688 689
 	.shutdown = shutdown_cache,
689 690
 };
690 691
 

+ 1
- 0
src/core/serial.c 查看文件

@@ -181,5 +181,6 @@ struct init_fn serial_console_init_fn __init_fn ( INIT_CONSOLE ) = {
181 181
 
182 182
 /** Serial console startup function */
183 183
 struct startup_fn serial_startup_fn __startup_fn ( STARTUP_EARLY ) = {
184
+	.name = "serial",
184 185
 	.shutdown = serial_shutdown,
185 186
 };

+ 1
- 0
src/crypto/rbg.c 查看文件

@@ -126,6 +126,7 @@ static void rbg_shutdown_fn ( int booting __unused ) {
126 126
 
127 127
 /** RBG startup table entry */
128 128
 struct startup_fn startup_rbg __startup_fn ( STARTUP_NORMAL ) = {
129
+	.name = "rbg",
129 130
 	.startup = rbg_startup_fn,
130 131
 	.shutdown = rbg_shutdown_fn,
131 132
 };

+ 1
- 0
src/crypto/rootcert.c 查看文件

@@ -123,5 +123,6 @@ static void rootcert_init ( void ) {
123 123
 
124 124
 /** Root certificate initialiser */
125 125
 struct startup_fn rootcert_startup_fn __startup_fn ( STARTUP_LATE ) = {
126
+	.name = "rootcert",
126 127
 	.startup = rootcert_init,
127 128
 };

+ 1
- 0
src/drivers/usb/ehci.c 查看文件

@@ -2098,5 +2098,6 @@ static void ehci_shutdown ( int booting ) {
2098 2098
 
2099 2099
 /** Startup/shutdown function */
2100 2100
 struct startup_fn ehci_startup __startup_fn ( STARTUP_LATE ) = {
2101
+	.name = "ehci",
2101 2102
 	.shutdown = ehci_shutdown,
2102 2103
 };

+ 1
- 0
src/drivers/usb/xhci.c 查看文件

@@ -3363,5 +3363,6 @@ static void xhci_shutdown ( int booting ) {
3363 3363
 
3364 3364
 /** Startup/shutdown function */
3365 3365
 struct startup_fn xhci_startup __startup_fn ( STARTUP_LATE ) = {
3366
+	.name = "xhci",
3366 3367
 	.shutdown = xhci_shutdown,
3367 3368
 };

+ 1
- 0
src/hci/linux_args.c 查看文件

@@ -185,6 +185,7 @@ void linux_args_cleanup(int flags __unused)
185 185
 }
186 186
 
187 187
 struct startup_fn startup_linux_args __startup_fn(STARTUP_EARLY) = {
188
+	.name = "linux_args",
188 189
 	.startup = linux_args_parse,
189 190
 	.shutdown = linux_args_cleanup,
190 191
 };

+ 1
- 0
src/include/ipxe/init.h 查看文件

@@ -39,6 +39,7 @@ struct init_fn {
39 39
  * part of the calls to startup() and shutdown().
40 40
  */
41 41
 struct startup_fn {
42
+	const char *name;
42 43
 	void ( * startup ) ( void );
43 44
 	void ( * shutdown ) ( int booting );
44 45
 };

+ 1
- 0
src/interface/efi/efi_timer.c 查看文件

@@ -212,6 +212,7 @@ static void efi_tick_shutdown ( int booting __unused ) {
212 212
 
213 213
 /** Timer tick startup function */
214 214
 struct startup_fn efi_tick_startup_fn __startup_fn ( STARTUP_EARLY ) = {
215
+	.name = "efi_tick",
215 216
 	.startup = efi_tick_startup,
216 217
 	.shutdown = efi_tick_shutdown,
217 218
 };

+ 1
- 0
src/interface/linux/linux_console.c 查看文件

@@ -150,6 +150,7 @@ static void linux_console_shutdown(int flags __unused)
150 150
 }
151 151
 
152 152
 struct startup_fn linux_console_startup_fn __startup_fn(STARTUP_EARLY) = {
153
+	.name = "linux_console",
153 154
 	.startup = linux_console_startup,
154 155
 	.shutdown = linux_console_shutdown,
155 156
 };

+ 1
- 0
src/net/tcp.c 查看文件

@@ -1654,6 +1654,7 @@ static void tcp_shutdown ( int booting __unused ) {
1654 1654
 
1655 1655
 /** TCP shutdown function */
1656 1656
 struct startup_fn tcp_startup_fn __startup_fn ( STARTUP_LATE ) = {
1657
+	.name = "tcp",
1657 1658
 	.shutdown = tcp_shutdown,
1658 1659
 };
1659 1660
 

Loading…
取消
儲存