1 // SPDX-License-Identifier: GPL-2.0
5 static void udelay(int loops
)
8 io_delay(); /* Approximately 1 us */
11 static void beep(unsigned int hz
)
16 enable
= 0x00; /* Turn off speaker */
20 outb(0xb6, 0x43); /* Ctr 2, squarewave, load, binary */
22 outb(div
, 0x42); /* LSB of counter */
24 outb(div
>> 8, 0x42); /* MSB of counter */
27 enable
= 0x03; /* Turn on speaker */
29 inb(0x61); /* Dummy read of System Control Port B */
31 outb(enable
, 0x61); /* Enable timer 2 output to speaker */
37 #define US_PER_DOT 125000
39 /* Okay, this is totally silly, but it's kind of fun. */
40 static void send_morse(const char *pattern
)
44 while ((s
= *pattern
++)) {
54 udelay(US_PER_DOT
* 3);
58 default: /* Assume it's a space */
59 udelay(US_PER_DOT
* 3);
65 struct port_io_ops pio_ops
;
69 init_default_io_ops();
71 /* Kill machine if structures are wrong */
72 if (wakeup_header
.real_magic
!= 0x12345678)
76 if (wakeup_header
.realmode_flags
& 4)
79 if (wakeup_header
.realmode_flags
& 1)
80 asm volatile("lcallw $0xc000,$3");
82 if (wakeup_header
.realmode_flags
& 2) {
83 /* Need to call BIOS */
85 set_mode(wakeup_header
.video_mode
);