#include <realmode.h>
#include <biosint.h>
#include <bootsector.h>
+#include <ipxe/console.h>
/** Vector for storing original INT 18 handler
*
unsigned int drive ) {
int discard_b, discard_D, discard_d;
+ /* Reset console, since boot sector will probably use it */
+ console_reset();
+
DBG ( "Booting from boot sector at %04x:%04x\n", segment, offset );
/* Hook INTs 18 and 19 to capture failure paths */
#include <ipxe/segment.h>
#include <ipxe/netdevice.h>
#include <ipxe/features.h>
+#include <ipxe/console.h>
FEATURE ( FEATURE_IMAGE, "PXE", DHCP_EB_FEATURE_PXE, 1 );
/* Set PXE command line */
pxe_cmdline = image->cmdline;
+ /* Reset console since PXE NBP will probably use it */
+ console_reset();
+
/* Start PXE NBP */
rc = pxe_start_nbp();
int iskey ( void ) {
return has_input() ? 1 : 0;
}
+
+/**
+ * Configure console
+ *
+ * @v config Console configuration
+ * @ret rc Return status code
+ *
+ * The configuration is passed to all configurable consoles, including
+ * those which are currently disabled. Consoles may choose to enable
+ * or disable themselves depending upon the configuration.
+ *
+ * If configuration fails, then all consoles will be reset.
+ */
+int console_configure ( struct console_configuration *config ) {
+ struct console_driver *console;
+ int rc;
+
+ /* Try to configure each console */
+ for_each_table_entry ( console, CONSOLES ) {
+ if ( ( console->configure ) &&
+ ( ( rc = console->configure ( config ) ) != 0 ) )
+ goto err;
+ }
+
+ return 0;
+
+ err:
+ /* Reset all consoles, avoiding a potential infinite loop */
+ if ( config )
+ console_reset();
+ return rc;
+}
FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/device.h>
+#include <ipxe/console.h>
#include <ipxe/init.h>
/** @file
startup_fn->shutdown ( flags );
}
+ /* Reset console */
+ console_reset();
+
started = 0;
}
* will not block.
*/
int ( * iskey ) ( void );
+ /**
+ * Configure console
+ *
+ * @v config Console configuration, or NULL to reset
+ * @ret rc Return status code
+ */
+ int ( * configure ) ( struct console_configuration *config );
/**
* Console usage bitmask
*
extern int iskey ( void );
extern int getkey ( unsigned long timeout );
+extern int console_configure ( struct console_configuration *config );
+
+/**
+ * Reset console
+ *
+ */
+static inline __attribute__ (( always_inline )) void console_reset ( void ) {
+
+ console_configure ( NULL );
+}
#endif /* _IPXE_CONSOLE_H */