20 */
21 /*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #include <sys/types.h>
27 #include <sys/param.h>
28 #include <sys/controlregs.h>
29 #include <sys/bootconf.h>
30 #include <sys/bootvfs.h>
31 #include <sys/bootregs.h>
32 #include <sys/bootconf.h>
33 #include <sys/conf.h>
34 #include <sys/promif.h>
35 #include <sys/ddi.h>
36 #include <sys/sunddi.h>
37 #include <sys/sunndi.h>
38 #include <sys/biosdisk.h>
39 #include <sys/psw.h>
40 #if defined(__xpv)
41 #include <sys/hypervisor.h>
42 #endif
43
44 extern int prom_debug;
45
46 /* hard code realmode memory address for now */
47 #define BIOS_RES_BUFFER_ADDR 0x7000
48
49 #define BIOSDEV_NUM 8
50 #define STARTING_DRVNUM 0x80
51 #define FP_OFF(fp) (((uintptr_t)(fp)) & 0xFFFF)
52 #define FP_SEG(fp) ((((uintptr_t)(fp)) >> 16) & 0xFFFF)
53
54 #ifdef DEBUG
55 int biosdebug = 0;
56 #define dprintf(fmt) \
57 if (biosdebug) \
58 prom_printf fmt
59 #else
65
66
67 static int bios_check_extension_present(uchar_t);
68 static int get_dev_params(uchar_t);
69 static int read_firstblock(uchar_t drivenum);
70 static int drive_present(uchar_t drivenum);
71 static void reset_disk(uchar_t drivenum);
72 static int is_eltorito(uchar_t drivenum);
73
74 #if !defined(__xpv)
75 void
76 startup_bios_disk()
77 {
78 uchar_t drivenum;
79 int got_devparams = 0;
80 int got_first_block = 0;
81 uchar_t name[20];
82 dev_info_t *devi;
83 int extensions;
84
85 if (dobiosdev == 0)
86 return;
87
88 for (drivenum = 0x80; drivenum < (0x80 + BIOSDEV_NUM); drivenum++) {
89
90 if (!drive_present(drivenum))
91 continue;
92
93 extensions = bios_check_extension_present(drivenum);
94
95 /*
96 * If we're booting from an Eltorito CD/DVD image, there's
97 * no need to get the device parameters or read the first block
98 * because we'll never install onto this device.
99 */
100 if (extensions && is_eltorito(drivenum))
101 continue;
102
103 if (extensions && get_dev_params(drivenum))
104 got_devparams = 1;
105 else
106 got_devparams = 0;
|
20 */
21 /*
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #include <sys/types.h>
27 #include <sys/param.h>
28 #include <sys/controlregs.h>
29 #include <sys/bootconf.h>
30 #include <sys/bootvfs.h>
31 #include <sys/bootregs.h>
32 #include <sys/bootconf.h>
33 #include <sys/conf.h>
34 #include <sys/promif.h>
35 #include <sys/ddi.h>
36 #include <sys/sunddi.h>
37 #include <sys/sunndi.h>
38 #include <sys/biosdisk.h>
39 #include <sys/psw.h>
40 #include <sys/machsystm.h>
41 #if defined(__xpv)
42 #include <sys/hypervisor.h>
43 #endif
44
45 extern int prom_debug;
46
47 /* hard code realmode memory address for now */
48 #define BIOS_RES_BUFFER_ADDR 0x7000
49
50 #define BIOSDEV_NUM 8
51 #define STARTING_DRVNUM 0x80
52 #define FP_OFF(fp) (((uintptr_t)(fp)) & 0xFFFF)
53 #define FP_SEG(fp) ((((uintptr_t)(fp)) >> 16) & 0xFFFF)
54
55 #ifdef DEBUG
56 int biosdebug = 0;
57 #define dprintf(fmt) \
58 if (biosdebug) \
59 prom_printf fmt
60 #else
66
67
68 static int bios_check_extension_present(uchar_t);
69 static int get_dev_params(uchar_t);
70 static int read_firstblock(uchar_t drivenum);
71 static int drive_present(uchar_t drivenum);
72 static void reset_disk(uchar_t drivenum);
73 static int is_eltorito(uchar_t drivenum);
74
75 #if !defined(__xpv)
76 void
77 startup_bios_disk()
78 {
79 uchar_t drivenum;
80 int got_devparams = 0;
81 int got_first_block = 0;
82 uchar_t name[20];
83 dev_info_t *devi;
84 int extensions;
85
86 if (dobiosdev == 0 || !bios_calls_available) {
87 /*
88 * If BIOS calls have been disabled, or are not supported on
89 * this system, we cannot probe for the startup disk.
90 */
91 return;
92 }
93
94 for (drivenum = 0x80; drivenum < (0x80 + BIOSDEV_NUM); drivenum++) {
95
96 if (!drive_present(drivenum))
97 continue;
98
99 extensions = bios_check_extension_present(drivenum);
100
101 /*
102 * If we're booting from an Eltorito CD/DVD image, there's
103 * no need to get the device parameters or read the first block
104 * because we'll never install onto this device.
105 */
106 if (extensions && is_eltorito(drivenum))
107 continue;
108
109 if (extensions && get_dev_params(drivenum))
110 got_devparams = 1;
111 else
112 got_devparams = 0;
|