Browse Source

Store device's names and add more startup messages

Aaron Lindsay 6 years ago
parent
commit
a64668b239
6 changed files with 19 additions and 3 deletions
  1. 1 0
      drivers/bcm2835_videocore.c
  2. 1 0
      drivers/pi_mini_uart.c
  3. 1 0
      drivers/pl011.c
  4. 1 0
      drivers/pl111.c
  5. 6 0
      include/drivers/serial.h
  6. 9 3
      kernel/start_kernel.c

+ 1 - 0
drivers/bcm2835_videocore.c

@@ -113,6 +113,7 @@ int bcm2835_videocore_init_dev(struct fb *f, unsigned int color_depth) {
113 113
 }
114 114
 
115 115
 struct fb_dev videocore_dev = {
116
+	.name ="bcm2835_videocore",
116 117
 	.init = &bcm2835_videocore_init_dev
117 118
 };
118 119
 

+ 1 - 0
drivers/pi_mini_uart.c

@@ -110,6 +110,7 @@ int mini_uart_putc(char c) {
110 110
 }
111 111
 
112 112
 struct serial_dev mini_uart_dev = {
113
+	.name = "pi_mini_uart",
113 114
 	.putc = &mini_uart_putc
114 115
 };
115 116
 

+ 1 - 0
drivers/pl011.c

@@ -38,6 +38,7 @@ int pl011_putc(char c)
38 38
 }
39 39
 
40 40
 struct serial_dev pl011_dev = {
41
+	.name = "pl011",
41 42
 	.putc = &pl011_putc
42 43
 };
43 44
 

+ 1 - 0
drivers/pl111.c

@@ -92,6 +92,7 @@ int pl111_init_dev(struct fb *f, unsigned int color_depth) {
92 92
 }
93 93
 
94 94
 struct fb_dev pl111_dev = {
95
+	.name = "pl111",
95 96
 	.init = &pl111_init_dev
96 97
 };
97 98
 

+ 6 - 0
include/drivers/serial.h

@@ -20,11 +20,17 @@
20 20
 
21 21
 #include <list.h>
22 22
 
23
+#ifndef SERIAL_H
24
+#define SERIAL_H
25
+
23 26
 struct serial_dev {
24 27
 	//TODO add more functions and attributes here
28
+	char *name;
25 29
 	int (*putc)(char);
26 30
 	struct dlist_node list;
27 31
 };
28 32
 
29 33
 int serial_register_device(struct serial_dev *sdev);
30 34
 struct serial_dev *serial_first_device();
35
+
36
+#endif /* SERIAL_H */

+ 9 - 3
kernel/start_kernel.c

@@ -38,7 +38,7 @@ void print_console_logo() {
38 38
 	print_func(&console_putc, "                          / _ \\ / _ \\/ _` | '__| \\ \\/ /\n");
39 39
 	print_func(&console_putc, "                         / ___ \\  __/ (_| | |  | |>  <\n");
40 40
 	print_func(&console_putc, "                        /_/   \\_\\___|\\__,_|_|  |_/_/\\_\\\n\n");
41
-	print_func(&console_putc, "                        Copyright (C) 2012 - Aaron Lindsay\n");
41
+	print_func(&console_putc, "                        Copyright (C) 2012 - Aaron Lindsay\n\n\n");
42 42
 }
43 43
 
44 44
 void video_console_init(void) {
@@ -60,13 +60,18 @@ void video_console_init(void) {
60 60
 		return;
61 61
 
62 62
 	print_console_logo();
63
+
64
+	print_func(&console_putc, "Successfully initialized video console on %s.\n", fbdev->name);
63 65
 }
64 66
 
65 67
 void serial_console_init() {
66 68
 	struct serial_dev *sdev = serial_first_device();
67 69
 
68
-	if (sdev)
69
-		print_init(sdev->putc);
70
+	if (!sdev)
71
+		return;
72
+
73
+	print_init(sdev->putc);
74
+	print("Successfully initialized serial console on %s\n", sdev->name);
70 75
 }
71 76
 
72 77
 void serial_init();
@@ -100,6 +105,7 @@ int main(void) {
100 105
 	do {
101 106
 		lower = (char *)atags->data.mem.start;
102 107
 		upper = lower + atags->data.mem.size - 1;
108
+		print("atags: physical memory at %x-%x\n", lower, upper);
103 109
 		declare_memory_region(lower, upper);
104 110
 	} while (!atags_next_mem_region(&atags));
105 111