Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion share/man/man4/atkbdc.4
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd February 26, 2023
.Dd August 29, 2025
.Dt ATKBDC 4
.Os
.Sh NAME
Expand All @@ -36,12 +36,17 @@
.Cd "options KBD_DELAY1=N"
.Cd "options KBD_DELAY2=N"
.Cd "options KBDIO_DEBUG=N"
.Cd "options RESET_DELAY_DIVISION_FACTOR=N"
.Cd "device atkbdc"
.Pp
In
.Pa /boot/device.hints :
.Cd hint.atkbdc.0.at="isa"
.Cd hint.atkbdc.0.port="0x060"
.Pp
In
.Pa /boot/loader.conf :
.Cd hw.atkbd.short_delay
.Sh DESCRIPTION
The keyboard controller
.Nm
Expand Down Expand Up @@ -101,6 +106,21 @@ The default value is 100ms.
Sets the debug level to
.Fa N .
The default value is zero, which suppresses all debugging output.
.It Em RESET_DELAY_DIVISION_FACTOR=N
The default value is 40. It is suppose to divide original 200ms delay by 40 and result 5ms delay for modern hardware.
.El
.Ss Tunables
The following tunable can be set at the
.Xr loader 8
prompt or in
.Pa /boot/loader.conf :
.Bl -tag -width indent
.It Va hw.atkbd.short_delay
The default value is one, which enables shorter delays during controller
initialization. Setting this to zero restores the original, longer delays.
Using shorter delays can significantly improve boot time on modern
systems, but may cause problems on some legacy hardware that requires
longer timing for reliable operation.
.El
.\".Ss Driver Flags
.\".Sh FILES
Expand All @@ -124,3 +144,5 @@ The kbdio module, the
.Nm
driver and this manual page were written by
.An Kazutaka Yokota Aq Mt [email protected] .
Then updated by
.An Lahiru Gunathilake Aq Mt [email protected] .
5 changes: 5 additions & 0 deletions stand/libsa/zfs/zfsimpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include <sys/stdint.h>
#include <sys/list.h>
#include <sys/zfs_bootenv.h>
#include <sys/tslog.h>

#include <machine/_inttypes.h>

#include "zfsimpl.h"
Expand Down Expand Up @@ -162,11 +164,14 @@ vdev_indirect_mapping_entry_phys_t *
static void
zfs_init(void)
{
TSENTER();
STAILQ_INIT(&zfs_pools);

dnode_cache_buf = malloc(SPA_MAXBLOCKSIZE);

zfs_init_crc();
TSEXIT();

#ifdef HAS_ZSTD_ZFS
zstd_init();
#endif
Expand Down
5 changes: 5 additions & 0 deletions sys/dev/acpica/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include <sys/smp.h>
#include <sys/timetc.h>
#include <sys/uuid.h>
#include <sys/tslog.h>

#if defined(__i386__) || defined(__amd64__)
#include <machine/clock.h>
Expand Down Expand Up @@ -493,6 +494,7 @@ acpi_attach(device_t dev)
char *env;
enum power_stype stype;

TSENTER();
ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);

sc = device_get_softc(dev);
Expand Down Expand Up @@ -769,7 +771,10 @@ acpi_attach(device_t dev)

error = 0;

TSEXIT();

out:
TSEXIT();
return_VALUE (error);
}

Expand Down
38 changes: 35 additions & 3 deletions sys/dev/atkbdc/atkbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,14 @@ atkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags)
char phys_loc[8];
#endif

TSENTER();
/* XXX */
if (unit == ATKBD_DEFAULT) {
*kbdp = kbd = &default_kbd;
if (KBD_IS_INITIALIZED(kbd) && KBD_IS_CONFIGURED(kbd))
if (KBD_IS_INITIALIZED(kbd) && KBD_IS_CONFIGURED(kbd)) {
TSEXIT();
return 0;
}
state = &default_kbd_state;
keymap = &default_keymap;
accmap = &default_accentmap;
Expand All @@ -410,6 +413,7 @@ atkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags)
goto bad;
}
} else if (KBD_IS_INITIALIZED(*kbdp) && KBD_IS_CONFIGURED(*kbdp)) {
TSEXIT();
return 0;
} else {
kbd = *kbdp;
Expand Down Expand Up @@ -505,6 +509,7 @@ atkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags)
KBD_CONFIG_DONE(kbd);
}

TSEXIT();
return 0;
bad:
if (needfree) {
Expand All @@ -521,6 +526,8 @@ atkbd_init(int unit, keyboard_t **kbdp, void *arg, int flags)
*kbdp = NULL; /* insure ref doesn't leak to caller */
}
}

TSEXIT();
return error;
}

Expand Down Expand Up @@ -948,6 +955,7 @@ atkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
int ival;
#endif

TSENTER();
s = spltty();
switch (cmd) {
case KDGKBMODE: /* get keyboard mode */
Expand Down Expand Up @@ -978,6 +986,7 @@ atkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
break;
default:
splx(s);
TSEXIT();
return EINVAL;
}
break;
Expand All @@ -996,6 +1005,7 @@ atkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
/* NOTE: lock key state in ks_state won't be changed */
if (*(int *)arg & ~LOCK_MASK) {
splx(s);
TSEXIT();
return EINVAL;
}
i = *(int *)arg;
Expand All @@ -1012,6 +1022,7 @@ atkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
ledmap[i & LED_MASK]);
if (error) {
splx(s);
TSEXIT();
return error;
}
}
Expand All @@ -1037,18 +1048,23 @@ atkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
case KDSKBSTATE: /* set lock key state */
if (*(int *)arg & ~LOCK_MASK) {
splx(s);
TSEXIT();
return EINVAL;
}
state->ks_state &= ~LOCK_MASK;
state->ks_state |= *(int *)arg;
splx(s);

TSEXIT();
/* set LEDs and quit */
return atkbd_ioctl(kbd, KDSETLED, arg);

case KDSETREPEAT: /* set keyboard repeat rate (new interface) */
splx(s);
if (!KBD_HAS_DEVICE(kbd))
if (!KBD_HAS_DEVICE(kbd)) {
TSEXIT();
return 0;
}
i = typematic(((int *)arg)[0], ((int *)arg)[1]);
error = write_kbd(state->kbdc, KBDC_SET_TYPEMATIC, i);
if (error == 0) {
Expand All @@ -1060,6 +1076,7 @@ atkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
evdev_push_repeats(state->ks_evdev, kbd);
#endif
}
TSEXIT();
return error;

#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
Expand All @@ -1071,8 +1088,10 @@ atkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
#endif
case KDSETRAD: /* set keyboard repeat rate (old interface) */
splx(s);
if (!KBD_HAS_DEVICE(kbd))
if (!KBD_HAS_DEVICE(kbd)) {
TSEXIT();
return 0;
}
error = write_kbd(state->kbdc, KBDC_SET_TYPEMATIC, *(int *)arg);
if (error == 0) {
kbd->kb_delay1 = typematic_delay(*(int *)arg);
Expand All @@ -1083,6 +1102,7 @@ atkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
evdev_push_repeats(state->ks_evdev, kbd);
#endif
}
TSEXIT();
return error;

case PIO_KEYMAP: /* set keyboard translation table */
Expand All @@ -1096,10 +1116,13 @@ atkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
/* FALLTHROUGH */
default:
splx(s);
TSEXIT();
return genkbd_commonioctl(kbd, cmd, arg);
}

splx(s);
TSEXIT();

return 0;
}

Expand Down Expand Up @@ -1363,8 +1386,10 @@ init_keyboard(KBDC kbdc, int *type, int flags)
int id;
int c;

TSENTER();
if (!kbdc_lock(kbdc, TRUE)) {
/* driver error? */
TSEXIT();
return EIO;
}

Expand All @@ -1378,6 +1403,7 @@ init_keyboard(KBDC kbdc, int *type, int flags)
/* CONTROLLER ERROR */
kbdc_lock(kbdc, FALSE);
printf("atkbd: unable to get the current command byte value.\n");
TSEXIT();
return EIO;
}
if (bootverbose)
Expand All @@ -1393,12 +1419,14 @@ init_keyboard(KBDC kbdc, int *type, int flags)
/* CONTROLLER ERROR: there is very little we can do... */
printf("atkbd: unable to set the command byte.\n");
kbdc_lock(kbdc, FALSE);
TSEXIT();
return EIO;
}

if (HAS_QUIRK(kbdc, KBDC_QUIRK_RESET_AFTER_PROBE) &&
atkbd_reset(kbdc, flags, c)) {
kbdc_lock(kbdc, FALSE);
TSEXIT();
return EIO;
}

Expand Down Expand Up @@ -1449,6 +1477,7 @@ init_keyboard(KBDC kbdc, int *type, int flags)
if (!HAS_QUIRK(kbdc, KBDC_QUIRK_RESET_AFTER_PROBE) &&
atkbd_reset(kbdc, flags, c)) {
kbdc_lock(kbdc, FALSE);
TSEXIT();
return EIO;
}

Expand All @@ -1472,6 +1501,7 @@ init_keyboard(KBDC kbdc, int *type, int flags)
? 0xff : KBD_KBD_CONTROL_BITS, c);
kbdc_lock(kbdc, FALSE);
printf("atkbd: unable to set the XT keyboard mode.\n");
TSEXIT();
return EIO;
}
}
Expand Down Expand Up @@ -1502,10 +1532,12 @@ init_keyboard(KBDC kbdc, int *type, int flags)
KBD_OVERRIDE_KBD_LOCK), c);
kbdc_lock(kbdc, FALSE);
printf("atkbd: unable to enable the keyboard port and intr.\n");
TSEXIT();
return EIO;
}

kbdc_lock(kbdc, FALSE);
TSEXIT();
return 0;
}

Expand Down
10 changes: 8 additions & 2 deletions sys/dev/atkbdc/atkbd_atkbdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,30 @@ atkbdattach(device_t dev)
int rid;
int error;

TSENTER();
sc = device_get_softc(dev);

rid = KBDC_RID_KBD;
irq = bus_get_resource_start(dev, SYS_RES_IRQ, rid);
flags = device_get_flags(dev);
error = atkbd_attach_unit(dev, &kbd, irq, flags);
if (error)
if (error) {
TSEXIT();
return error;
}

/* declare our interrupt handler */
sc->intr = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE);
if (sc->intr == NULL)
if (sc->intr == NULL) {
TSEXIT();
return ENXIO;
}
error = bus_setup_intr(dev, sc->intr, INTR_TYPE_TTY, NULL, atkbdintr,
kbd, &sc->ih);
if (error)
bus_release_resource(dev, SYS_RES_IRQ, rid, sc->intr);

TSEXIT();
return error;
}

Expand Down
Loading