Converge towards i386. I originally resisted creating <machine/pc/bios.h>

because it was mostly irrelevant - except for the silly BIOS_PADDRTOVADDR
etc macros.  Along the way of working around this, I missed a few things.

* Make syscons properly inherit the bios capslock/shiftlock/etc state like
  i386 does.  Note that we cannot inherit the bios key repeat rate because
  that requires a bios call (which is impossible for us).
* Give syscons the ability to beep on amd64.  Oops.

While here, make bios.c compile and add it to files.amd64.
This commit is contained in:
Peter Wemm 2004-09-24 01:08:34 +00:00
parent c3277f936c
commit 2169193596
4 changed files with 13 additions and 14 deletions

View File

@ -37,6 +37,9 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <machine/vmparam.h>
#include <machine/pc/bios.h>
#define BIOS_START 0xe0000
@ -84,7 +87,7 @@ bios_sigsearch(u_int32_t start, u_char *sig, int siglen, int paralen, int sigofs
/* compare here */
if (!bcmp(sp + sigofs, sig, siglen)) {
/* convert back to physical address */
return((u_int32_t)BIOS_VADDRTOPADDR(sp));
return((u_int32_t)(uintptr_t)BIOS_VADDRTOPADDR(sp));
}
sp += paralen;
}

View File

@ -56,6 +56,7 @@ amd64/amd64/amd64_mem.c standard
#amd64/amd64/apic_vector.S standard
amd64/amd64/atomic.c standard
amd64/amd64/autoconf.c standard
amd64/amd64/bios.c standard
amd64/amd64/busdma_machdep.c standard
amd64/amd64/cpu_switch.S standard
amd64/amd64/critical.c standard

View File

@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$");
#include <vm/pmap.h>
#include <machine/md_var.h>
#ifdef __i386__
#if defined(__i386__) || defined(__amd64__)
#include <machine/pc/bios.h>
#endif
#include <machine/bus.h>
@ -64,11 +64,7 @@ __FBSDID("$FreeBSD$");
/* XXX machine/pc/bios.h has got too much i386-specific stuff in it */
#ifndef BIOS_PADDRTOVADDR
#if !defined(__amd64__)
#define BIOS_PADDRTOVADDR(x) (x)
#else
#define BIOS_PADDRTOVADDR(x) ((x) + KERNBASE)
#endif
#endif
int

View File

@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/consio.h>
#include <sys/sysctl.h>
#ifdef __i386__
#if defined(__i386__) || defined(__amd64__)
#include <machine/clock.h>
#include <machine/md_var.h>
@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$");
#define BIOS_SLKED (1 << 4)
#define BIOS_ALKED 0
#endif /* __i386__ */
#endif
#include <dev/syscons/syscons.h>
@ -234,7 +234,7 @@ sc_get_cons_priority(int *unit, int *flags)
void
sc_get_bios_values(bios_values_t *values)
{
#ifdef __i386__
#if defined(__i386__) || defined(__amd64__)
u_int8_t shift;
values->cursor_start = *(u_int8_t *)BIOS_PADDRTOVADDR(0x461);
@ -244,19 +244,18 @@ sc_get_bios_values(bios_values_t *values)
| ((shift & BIOS_NLKED) ? NLKED : 0)
| ((shift & BIOS_SLKED) ? SLKED : 0)
| ((shift & BIOS_ALKED) ? ALKED : 0);
values->bell_pitch = BELL_PITCH;
#else /* !__i386__ */
#else
values->cursor_start = 0;
values->cursor_end = 32;
values->shift_state = 0;
#endif
values->bell_pitch = BELL_PITCH;
#endif /* __i386__ */
}
int
sc_tone(int herz)
{
#ifdef __i386__
#if defined(__i386__) || defined(__amd64__)
int pitch;
if (herz) {
@ -274,7 +273,7 @@ sc_tone(int herz)
outb(IO_PPI, inb(IO_PPI) & 0xFC);
release_timer2();
}
#endif /* __i386__ */
#endif
return 0;
}