Ported ISA bus manager and PS/2 driver.
This commit is contained in:
@@ -40,7 +40,7 @@ PRIVATE_SYSTEM_LIBS = ;
|
|||||||
|
|
||||||
SYSTEM_SERVERS = ;
|
SYSTEM_SERVERS = ;
|
||||||
|
|
||||||
SYSTEM_ADD_ONS_BUS_MANAGERS = $(ATA_ONLY)ata pci scsi config_manager ;
|
SYSTEM_ADD_ONS_BUS_MANAGERS = $(ATA_ONLY)ata pci ps2 isa scsi config_manager ;
|
||||||
SYSTEM_ADD_ONS_FILE_SYSTEMS = bfs iso9660 attribute_overlay write_overlay ;
|
SYSTEM_ADD_ONS_FILE_SYSTEMS = bfs iso9660 attribute_overlay write_overlay ;
|
||||||
|
|
||||||
# modules
|
# modules
|
||||||
@@ -69,6 +69,7 @@ AddNewDriversToHaikuImage disk scsi : scsi_cd scsi_disk ;
|
|||||||
# legacy drivers
|
# legacy drivers
|
||||||
AddDriversToHaikuImage : console dprintf null
|
AddDriversToHaikuImage : console dprintf null
|
||||||
random <driver>tty zero ;
|
random <driver>tty zero ;
|
||||||
|
AddDriversToHaikuImage input : ps2_hid ;
|
||||||
|
|
||||||
# kernel
|
# kernel
|
||||||
AddFilesToHaikuImage system : kernel_$(TARGET_ARCH) ;
|
AddFilesToHaikuImage system : kernel_$(TARGET_ARCH) ;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ typedef struct isa_module_info {
|
|||||||
isa_dma_entry *table, /* -> caller-supplied scatter/gather table */
|
isa_dma_entry *table, /* -> caller-supplied scatter/gather table */
|
||||||
long num_entries /* max # entries in table */
|
long num_entries /* max # entries in table */
|
||||||
);
|
);
|
||||||
long (*start_isa_dma) (
|
status_t (*start_isa_dma) (
|
||||||
long channel, /* dma channel to use */
|
long channel, /* dma channel to use */
|
||||||
void *buf, /* buffer to transfer */
|
void *buf, /* buffer to transfer */
|
||||||
long transfer_count, /* # transfers */
|
long transfer_count, /* # transfers */
|
||||||
@@ -70,8 +70,8 @@ typedef struct isa_module_info {
|
|||||||
uchar mode, /* mode flags */
|
uchar mode, /* mode flags */
|
||||||
uchar emode /* extended mode flags */
|
uchar emode /* extended mode flags */
|
||||||
);
|
);
|
||||||
long (*lock_isa_dma_channel) (long channel);
|
status_t (*lock_isa_dma_channel) (long channel);
|
||||||
long (*unlock_isa_dma_channel) (long channel);
|
status_t (*unlock_isa_dma_channel) (long channel);
|
||||||
} isa_module_info;
|
} isa_module_info;
|
||||||
|
|
||||||
#define B_ISA_MODULE_NAME "bus_managers/isa/v1"
|
#define B_ISA_MODULE_NAME "bus_managers/isa/v1"
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ KernelAddon isa :
|
|||||||
: isa_arch_bus_manager.a
|
: isa_arch_bus_manager.a
|
||||||
;
|
;
|
||||||
|
|
||||||
SubInclude HAIKU_TOP src add-ons kernel bus_managers isa arch $(TARGET_ARCH) ;
|
SubInclude HAIKU_TOP src add-ons kernel bus_managers isa arch
|
||||||
|
$(TARGET_KERNEL_ARCH) ;
|
||||||
|
|||||||
@@ -117,7 +117,8 @@ ps2_selftest()
|
|||||||
uint8 in;
|
uint8 in;
|
||||||
res = ps2_command(PS2_CTRL_SELF_TEST, NULL, 0, &in, 1);
|
res = ps2_command(PS2_CTRL_SELF_TEST, NULL, 0, &in, 1);
|
||||||
if (res != B_OK || in != 0x55) {
|
if (res != B_OK || in != 0x55) {
|
||||||
INFO("ps2: controller self test failed, status 0x%08lx, data 0x%02x\n", res, in);
|
INFO("ps2: controller self test failed, status 0x%08" B_PRIx32 ", data "
|
||||||
|
"0x%02x\n", res, in);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -131,7 +132,8 @@ ps2_setup_command_byte(bool interruptsEnabled)
|
|||||||
uint8 cmdbyte;
|
uint8 cmdbyte;
|
||||||
|
|
||||||
res = ps2_command(PS2_CTRL_READ_CMD, NULL, 0, &cmdbyte, 1);
|
res = ps2_command(PS2_CTRL_READ_CMD, NULL, 0, &cmdbyte, 1);
|
||||||
TRACE("ps2: get command byte: res 0x%08lx, cmdbyte 0x%02x\n", res, cmdbyte);
|
TRACE("ps2: get command byte: res 0x%08" B_PRIx32 ", cmdbyte 0x%02x\n",
|
||||||
|
res, cmdbyte);
|
||||||
if (res != B_OK)
|
if (res != B_OK)
|
||||||
cmdbyte = 0x47;
|
cmdbyte = 0x47;
|
||||||
|
|
||||||
@@ -144,7 +146,8 @@ ps2_setup_command_byte(bool interruptsEnabled)
|
|||||||
cmdbyte &= ~(PS2_BITS_KEYBOARD_INTERRUPT | PS2_BITS_AUX_INTERRUPT);
|
cmdbyte &= ~(PS2_BITS_KEYBOARD_INTERRUPT | PS2_BITS_AUX_INTERRUPT);
|
||||||
|
|
||||||
res = ps2_command(PS2_CTRL_WRITE_CMD, &cmdbyte, 1, NULL, 0);
|
res = ps2_command(PS2_CTRL_WRITE_CMD, &cmdbyte, 1, NULL, 0);
|
||||||
TRACE("ps2: set command byte: res 0x%08lx, cmdbyte 0x%02x\n", res, cmdbyte);
|
TRACE("ps2: set command byte: res 0x%08" B_PRIx32 ", cmdbyte 0x%02x\n",
|
||||||
|
res, cmdbyte);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -205,7 +208,8 @@ done:
|
|||||||
// This fixes bug report #1175
|
// This fixes bug report #1175
|
||||||
res = ps2_command(0xae, NULL, 0, NULL, 0);
|
res = ps2_command(0xae, NULL, 0, NULL, 0);
|
||||||
if (res != B_OK) {
|
if (res != B_OK) {
|
||||||
INFO("ps2: active multiplexing d3 workaround failed, status 0x%08lx\n", res);
|
INFO("ps2: active multiplexing d3 workaround failed, status 0x%08"
|
||||||
|
B_PRIx32 "\n", res);
|
||||||
}
|
}
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
@@ -256,7 +260,7 @@ ps2_command(uint8 cmd, const uint8 *out, int outCount, uint8 *in, int inCount)
|
|||||||
#ifdef TRACE_PS2
|
#ifdef TRACE_PS2
|
||||||
for (i = 0; i < inCount; i++)
|
for (i = 0; i < inCount; i++)
|
||||||
TRACE("ps2: ps2_command in 0x%02x\n", in[i]);
|
TRACE("ps2: ps2_command in 0x%02x\n", in[i]);
|
||||||
TRACE("ps2: ps2_command result 0x%08lx\n", res);
|
TRACE("ps2: ps2_command result 0x%08" B_PRIx32 "\n", res);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
atomic_add(&sIgnoreInterrupts, -1);
|
atomic_add(&sIgnoreInterrupts, -1);
|
||||||
|
|||||||
@@ -203,8 +203,8 @@ ps2_dev_publish(ps2_dev *dev)
|
|||||||
}
|
}
|
||||||
snooze(timeout / 20);
|
snooze(timeout / 20);
|
||||||
}
|
}
|
||||||
TRACE("ps2: publishing %s: parent %s is %s; wait time %Ld\n",
|
TRACE("ps2: publishing %s: parent %s is %s; wait time %" B_PRId64
|
||||||
dev->name, dev->parent_dev->name,
|
"\n", dev->name, dev->parent_dev->name,
|
||||||
status == B_OK ? "enabled" : "busy", system_time() - start);
|
status == B_OK ? "enabled" : "busy", system_time() - start);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,7 +219,8 @@ ps2_dev_publish(ps2_dev *dev)
|
|||||||
|
|
||||||
dev->active = true;
|
dev->active = true;
|
||||||
|
|
||||||
INFO("ps2: devfs_publish_device %s, status = 0x%08lx\n", dev->name, status);
|
INFO("ps2: devfs_publish_device %s, status = 0x%08" B_PRIx32 "\n",
|
||||||
|
dev->name, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -239,8 +240,8 @@ ps2_dev_unpublish(ps2_dev *dev)
|
|||||||
if ((dev->flags & PS2_FLAG_ENABLED) && dev->disconnect)
|
if ((dev->flags & PS2_FLAG_ENABLED) && dev->disconnect)
|
||||||
dev->disconnect(dev);
|
dev->disconnect(dev);
|
||||||
|
|
||||||
INFO("ps2: devfs_unpublish_device %s, status = 0x%08lx\n", dev->name,
|
INFO("ps2: devfs_unpublish_device %s, status = 0x%08" B_PRIx32 "\n",
|
||||||
status);
|
dev->name, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -370,7 +371,8 @@ standard_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out,
|
|||||||
|
|
||||||
res = get_sem_count(dev->result_sem, &sem_count);
|
res = get_sem_count(dev->result_sem, &sem_count);
|
||||||
if (res == B_OK && sem_count != 0) {
|
if (res == B_OK && sem_count != 0) {
|
||||||
TRACE("ps2: ps2_dev_command: sem_count %ld, fixing!\n", sem_count);
|
TRACE("ps2: ps2_dev_command: sem_count %" B_PRId32 ", fixing!\n",
|
||||||
|
sem_count);
|
||||||
if (sem_count > 0)
|
if (sem_count > 0)
|
||||||
acquire_sem_etc(dev->result_sem, sem_count, 0, 0);
|
acquire_sem_etc(dev->result_sem, sem_count, 0, 0);
|
||||||
else
|
else
|
||||||
@@ -423,8 +425,8 @@ standard_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out,
|
|||||||
if (res != B_OK)
|
if (res != B_OK)
|
||||||
atomic_and(&dev->flags, ~PS2_FLAG_CMD);
|
atomic_and(&dev->flags, ~PS2_FLAG_CMD);
|
||||||
|
|
||||||
TRACE("ps2: ps2_dev_command wait for ack res 0x%08lx, wait-time %Ld\n",
|
TRACE("ps2: ps2_dev_command wait for ack res 0x%08" B_PRIx32 ", "
|
||||||
res, system_time() - start);
|
"wait-time %" B_PRId64 "\n", res, system_time() - start);
|
||||||
|
|
||||||
if (atomic_get(&dev->flags) & PS2_FLAG_ACK) {
|
if (atomic_get(&dev->flags) & PS2_FLAG_ACK) {
|
||||||
TRACE("ps2: ps2_dev_command got ACK\n");
|
TRACE("ps2: ps2_dev_command got ACK\n");
|
||||||
@@ -458,15 +460,15 @@ standard_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out,
|
|||||||
res = B_IO_ERROR;
|
res = B_IO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("ps2: ps2_dev_command wait for input res 0x%08lx, "
|
TRACE("ps2: ps2_dev_command wait for input res 0x%08" B_PRIx32 ", "
|
||||||
"wait-time %Ld\n", res, system_time() - start);
|
"wait-time %" B_PRId64 "\n", res, system_time() - start);
|
||||||
|
|
||||||
for (i = 0; i < in_count; i++)
|
for (i = 0; i < in_count; i++)
|
||||||
TRACE("ps2: ps2_dev_command rx: 0x%02x\n", in[i]);
|
TRACE("ps2: ps2_dev_command rx: 0x%02x\n", in[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("ps2: ps2_dev_command result 0x%08lx\n", res);
|
TRACE("ps2: ps2_dev_command result 0x%08" B_PRIx32 "\n", res);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,8 @@ set_typematic(int32 rate, bigtime_t delay)
|
|||||||
{
|
{
|
||||||
uint8 value;
|
uint8 value;
|
||||||
|
|
||||||
TRACE("ps2: set_typematic rate %ld, delay %Ld\n", rate, delay);
|
TRACE("ps2: set_typematic rate %" B_PRId32 ", delay %" B_PRId64 "\n",
|
||||||
|
rate, delay);
|
||||||
|
|
||||||
// input server and keyboard preferences *seem* to use a range of 20-300
|
// input server and keyboard preferences *seem* to use a range of 20-300
|
||||||
if (rate < 20)
|
if (rate < 20)
|
||||||
@@ -271,8 +272,8 @@ probe_keyboard(void)
|
|||||||
status = ps2_dev_command(&ps2_device[PS2_DEVICE_KEYB], PS2_CMD_RESET, NULL,
|
status = ps2_dev_command(&ps2_device[PS2_DEVICE_KEYB], PS2_CMD_RESET, NULL,
|
||||||
0, &data, 1);
|
0, &data, 1);
|
||||||
if (status != B_OK || data != 0xaa) {
|
if (status != B_OK || data != 0xaa) {
|
||||||
INFO("ps2: keyboard reset failed, status 0x%08lx, data 0x%02x\n",
|
INFO("ps2: keyboard reset failed, status 0x%08" B_PRIx32 ", data 0x%02x"
|
||||||
status, data);
|
"\n", status, data);
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,14 +298,15 @@ probe_keyboard(void)
|
|||||||
status = ps2_command(PS2_CTRL_READ_CMD, NULL, 0, &cmdbyte, 1);
|
status = ps2_command(PS2_CTRL_READ_CMD, NULL, 0, &cmdbyte, 1);
|
||||||
|
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
INFO("ps2: cannot read CMD byte on kbd probe:0x%#08lx\n", status);
|
INFO("ps2: cannot read CMD byte on kbd probe:%#08" B_PRIx32 "\n",
|
||||||
|
status);
|
||||||
} else
|
} else
|
||||||
if ((cmdbyte & PS2_BITS_KEYBOARD_DISABLED) == PS2_BITS_KEYBOARD_DISABLED) {
|
if ((cmdbyte & PS2_BITS_KEYBOARD_DISABLED) == PS2_BITS_KEYBOARD_DISABLED) {
|
||||||
cmdbyte &= ~PS2_BITS_KEYBOARD_DISABLED;
|
cmdbyte &= ~PS2_BITS_KEYBOARD_DISABLED;
|
||||||
status = ps2_command(PS2_CTRL_WRITE_CMD, &cmdbyte, 1, NULL, 0);
|
status = ps2_command(PS2_CTRL_WRITE_CMD, &cmdbyte, 1, NULL, 0);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
INFO("ps2: cannot write 0x%02x to CMD byte on kbd probe:0x%08lx\n",
|
INFO("ps2: cannot write 0x%02x to CMD byte on kbd probe:%#08"
|
||||||
cmdbyte, status);
|
B_PRIx32 "\n", cmdbyte, status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,7 +314,7 @@ probe_keyboard(void)
|
|||||||
PS2_CMD_GET_DEVICE_ID, NULL, 0, sKeyboardIds, sizeof(sKeyboardIds));
|
PS2_CMD_GET_DEVICE_ID, NULL, 0, sKeyboardIds, sizeof(sKeyboardIds));
|
||||||
|
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
INFO("ps2: cannot read keyboard device id:0x%#08lx\n", status);
|
INFO("ps2: cannot read keyboard device id:%#08" B_PRIx32 "\n", status);
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -529,7 +531,8 @@ keyboard_ioctl(void *_cookie, uint32 op, void *buffer, size_t length)
|
|||||||
case KB_SET_CONTROL_ALT_DEL_TIMEOUT:
|
case KB_SET_CONTROL_ALT_DEL_TIMEOUT:
|
||||||
case KB_CANCEL_CONTROL_ALT_DEL:
|
case KB_CANCEL_CONTROL_ALT_DEL:
|
||||||
case KB_DELAY_CONTROL_ALT_DEL:
|
case KB_DELAY_CONTROL_ALT_DEL:
|
||||||
INFO("ps2: ioctl 0x%lx not implemented yet, returning B_OK\n", op);
|
INFO("ps2: ioctl 0x%" B_PRIx32 " not implemented yet, returning "
|
||||||
|
"B_OK\n", op);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
case KB_SET_DEBUG_READER:
|
case KB_SET_DEBUG_READER:
|
||||||
@@ -541,7 +544,7 @@ keyboard_ioctl(void *_cookie, uint32 op, void *buffer, size_t length)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
INFO("ps2: invalid ioctl 0x%lx\n", op);
|
INFO("ps2: invalid ioctl 0x%" B_PRIx32 "\n", op);
|
||||||
return B_DEV_INVALID_IOCTL;
|
return B_DEV_INVALID_IOCTL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,8 @@ ps2_service_thread(void *arg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
INFO("ps2: ps2_service_thread: Error, status 0x%08lx, terminating\n", status);
|
INFO("ps2: ps2_service_thread: Error, status 0x%08" B_PRIx32 ", "
|
||||||
|
"terminating\n", status);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user