Cleaned up the network and SCSI thread stuff.
This commit is contained in:
@@ -78,7 +78,7 @@ poll_thread(void *arg)
|
|||||||
|
|
||||||
/* As long as the channel is open.. */
|
/* As long as the channel is open.. */
|
||||||
while (pcap != NULL) {
|
while (pcap != NULL) {
|
||||||
startnet();
|
network_mutex_wait(1);
|
||||||
|
|
||||||
network_wait_for_poll();
|
network_wait_for_poll();
|
||||||
|
|
||||||
@@ -106,14 +106,12 @@ poll_thread(void *arg)
|
|||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
thread_wait_event(evt, 10);
|
thread_wait_event(evt, 10);
|
||||||
|
|
||||||
endnet();
|
network_mutex_wait(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_destroy_event(evt);
|
thread_destroy_event(evt);
|
||||||
poll_tid = NULL;
|
poll_tid = NULL;
|
||||||
|
|
||||||
network_mutex_close();
|
|
||||||
|
|
||||||
pclog("PCAP: polling stopped.\n");
|
pclog("PCAP: polling stopped.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,8 +271,6 @@ network_pcap_close(void)
|
|||||||
;
|
;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
network_mutex_close();
|
|
||||||
|
|
||||||
/* OK, now shut down WinPcap itself. */
|
/* OK, now shut down WinPcap itself. */
|
||||||
f_pcap_close(pc);
|
f_pcap_close(pc);
|
||||||
pc = pcap = NULL;
|
pc = pcap = NULL;
|
||||||
@@ -403,10 +399,10 @@ void
|
|||||||
network_pcap_in(uint8_t *bufp, int len)
|
network_pcap_in(uint8_t *bufp, int len)
|
||||||
{
|
{
|
||||||
if (pcap != NULL) {
|
if (pcap != NULL) {
|
||||||
network_busy_set();
|
network_busy(1);
|
||||||
|
|
||||||
f_pcap_sendpacket(pcap, bufp, len);
|
f_pcap_sendpacket(pcap, bufp, len);
|
||||||
|
|
||||||
network_busy_clear();
|
network_busy(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ poll_thread(void *arg)
|
|||||||
evt = thread_create_event();
|
evt = thread_create_event();
|
||||||
|
|
||||||
while (slirpq != NULL) {
|
while (slirpq != NULL) {
|
||||||
startnet();
|
network_mutex_wait(1);
|
||||||
|
|
||||||
network_wait_for_poll();
|
network_wait_for_poll();
|
||||||
|
|
||||||
@@ -107,14 +107,12 @@ poll_thread(void *arg)
|
|||||||
/* Done with this one. */
|
/* Done with this one. */
|
||||||
free(qp);
|
free(qp);
|
||||||
|
|
||||||
endnet();
|
network_mutex_wait(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_destroy_event(evt);
|
thread_destroy_event(evt);
|
||||||
evt = poll_tid = NULL;
|
evt = poll_tid = NULL;
|
||||||
|
|
||||||
network_mutex_close();
|
|
||||||
|
|
||||||
pclog("SLiRP: polling stopped.\n");
|
pclog("SLiRP: polling stopped.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,8 +166,6 @@ network_slirp_close(void)
|
|||||||
;
|
;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
network_mutex_close();
|
|
||||||
|
|
||||||
/* OK, now shut down SLiRP itself. */
|
/* OK, now shut down SLiRP itself. */
|
||||||
QueueDestroy(sl);
|
QueueDestroy(sl);
|
||||||
slirp_exit(0);
|
slirp_exit(0);
|
||||||
@@ -201,11 +197,11 @@ void
|
|||||||
network_slirp_in(uint8_t *pkt, int pkt_len)
|
network_slirp_in(uint8_t *pkt, int pkt_len)
|
||||||
{
|
{
|
||||||
if (slirpq != NULL) {
|
if (slirpq != NULL) {
|
||||||
network_busy_set();
|
network_busy(1);
|
||||||
|
|
||||||
slirp_input((const uint8_t *)pkt, pkt_len);
|
slirp_input((const uint8_t *)pkt, pkt_len);
|
||||||
|
|
||||||
network_busy_clear();
|
network_busy(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,31 +54,30 @@ int network_card;
|
|||||||
netdev_t network_devs[32];
|
netdev_t network_devs[32];
|
||||||
char network_pcap[512];
|
char network_pcap[512];
|
||||||
int nic_do_log;
|
int nic_do_log;
|
||||||
static mutex_t *netMutex;
|
static volatile
|
||||||
|
mutex_t *netMutex;
|
||||||
|
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
int busy;
|
volatile int
|
||||||
int queue_in_use;
|
busy,
|
||||||
|
queue_in_use;
|
||||||
|
|
||||||
event_t *wake_poll_thread;
|
volatile event_t
|
||||||
event_t *poll_complete;
|
*wake_poll_thread,
|
||||||
event_t *queue_not_in_use;
|
*poll_complete,
|
||||||
|
*queue_not_in_use;
|
||||||
} poll_data;
|
} poll_data;
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
startnet(void)
|
network_mutex_wait(uint8_t wait)
|
||||||
{
|
{
|
||||||
thread_wait_mutex(netMutex);
|
if (wait)
|
||||||
}
|
thread_wait_mutex((mutex_t *) netMutex);
|
||||||
|
else
|
||||||
|
thread_release_mutex((mutex_t *) netMutex);
|
||||||
void
|
|
||||||
endnet(void)
|
|
||||||
{
|
|
||||||
thread_release_mutex(netMutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -86,46 +85,24 @@ void
|
|||||||
network_wait_for_poll()
|
network_wait_for_poll()
|
||||||
{
|
{
|
||||||
while (poll_data.busy)
|
while (poll_data.busy)
|
||||||
thread_wait_event(poll_data.poll_complete, -1);
|
thread_wait_event((event_t *) poll_data.poll_complete, -1);
|
||||||
thread_reset_event(poll_data.poll_complete);
|
thread_reset_event((event_t *) poll_data.poll_complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
network_mutex_init()
|
network_thread_init(void)
|
||||||
{
|
{
|
||||||
netMutex = thread_create_mutex(L"86Box.NetMutex");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
network_mutex_close()
|
|
||||||
{
|
|
||||||
thread_close_mutex(netMutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
network_thread_init()
|
|
||||||
{
|
|
||||||
network_mutex_init();
|
|
||||||
|
|
||||||
poll_data.wake_poll_thread = thread_create_event();
|
poll_data.wake_poll_thread = thread_create_event();
|
||||||
poll_data.poll_complete = thread_create_event();
|
poll_data.poll_complete = thread_create_event();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
network_busy_set()
|
network_busy(uint8_t set)
|
||||||
{
|
{
|
||||||
poll_data.busy = 1;
|
poll_data.busy = !!set;
|
||||||
}
|
if (!set)
|
||||||
|
thread_set_event((event_t *) poll_data.poll_complete);
|
||||||
|
|
||||||
void
|
|
||||||
network_busy_clear()
|
|
||||||
{
|
|
||||||
poll_data.busy = 0;
|
|
||||||
thread_set_event(poll_data.poll_complete);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -184,6 +161,8 @@ network_attach(void *dev, uint8_t *mac, NETRXCB rx)
|
|||||||
net_cards[network_card].priv = dev;
|
net_cards[network_card].priv = dev;
|
||||||
net_cards[network_card].rx = rx;
|
net_cards[network_card].rx = rx;
|
||||||
|
|
||||||
|
netMutex = thread_create_mutex(L"86Box.NetMutex");
|
||||||
|
|
||||||
/* Start the platform module. */
|
/* Start the platform module. */
|
||||||
switch(network_type) {
|
switch(network_type) {
|
||||||
case NET_TYPE_PCAP:
|
case NET_TYPE_PCAP:
|
||||||
@@ -216,6 +195,8 @@ network_close(void)
|
|||||||
network_slirp_close();
|
network_slirp_close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thread_close_mutex((event_t *) netMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -56,14 +56,12 @@ extern char network_pcap[512];
|
|||||||
|
|
||||||
|
|
||||||
/* Function prototypes. */
|
/* Function prototypes. */
|
||||||
extern void startnet(void);
|
extern void network_mutex_wait(uint8_t wait);
|
||||||
extern void endnet(void);
|
extern void network_wait_for_poll(void);
|
||||||
extern void network_wait_for_poll();
|
extern void network_mutex_init(void);
|
||||||
extern void network_mutex_init();
|
extern void network_mutex_close(void);
|
||||||
extern void network_mutex_close();
|
extern void network_thread_init(void);
|
||||||
extern void network_thread_init();
|
extern void network_busy(uint8_t set);
|
||||||
extern void network_busy_set();
|
|
||||||
extern void network_busy_clear();
|
|
||||||
|
|
||||||
extern void network_init(void);
|
extern void network_init(void);
|
||||||
extern int network_attach(void *, uint8_t *, NETRXCB);
|
extern int network_attach(void *, uint8_t *, NETRXCB);
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ int scsi_card_current = 0;
|
|||||||
int scsi_card_last = 0;
|
int scsi_card_last = 0;
|
||||||
|
|
||||||
uint32_t SCSI_BufferLength;
|
uint32_t SCSI_BufferLength;
|
||||||
|
static volatile
|
||||||
mutex_t *scsiMutex;
|
mutex_t *scsiMutex;
|
||||||
|
|
||||||
|
|
||||||
@@ -127,15 +128,12 @@ int scsi_card_get_from_internal_name(char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void scsi_mutex_init(void)
|
void scsi_mutex(uint8_t start)
|
||||||
{
|
{
|
||||||
scsiMutex = thread_create_mutex(L"86Box.SCSIMutex");
|
if (start)
|
||||||
}
|
scsiMutex = thread_create_mutex(L"86Box.SCSIMutex");
|
||||||
|
else
|
||||||
|
thread_close_mutex((mutex_t *) scsiMutex);
|
||||||
void scsi_mutex_close(void)
|
|
||||||
{
|
|
||||||
thread_close_mutex(scsiMutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -209,14 +207,10 @@ void SCSIReset(uint8_t id, uint8_t lun)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
startscsi(void)
|
scsi_mutex_wait(uint8_t wait)
|
||||||
{
|
{
|
||||||
thread_wait_mutex(scsiMutex);
|
if (wait)
|
||||||
}
|
thread_wait_mutex((mutex_t *) scsiMutex);
|
||||||
|
else
|
||||||
|
thread_release_mutex((mutex_t *) scsiMutex);
|
||||||
void
|
|
||||||
endscsi(void)
|
|
||||||
{
|
|
||||||
thread_release_mutex(scsiMutex);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -294,8 +294,7 @@ extern device_t *scsi_card_getdevice(int card);
|
|||||||
extern int scsi_card_has_config(int card);
|
extern int scsi_card_has_config(int card);
|
||||||
extern char *scsi_card_get_internal_name(int card);
|
extern char *scsi_card_get_internal_name(int card);
|
||||||
extern int scsi_card_get_from_internal_name(char *s);
|
extern int scsi_card_get_from_internal_name(char *s);
|
||||||
extern void scsi_mutex_init(void);
|
extern void scsi_mutex(uint8_t start);
|
||||||
extern void scsi_mutex_close(void);
|
|
||||||
extern void scsi_card_init(void);
|
extern void scsi_card_init(void);
|
||||||
extern void scsi_card_reset(void);
|
extern void scsi_card_reset(void);
|
||||||
|
|
||||||
@@ -354,5 +353,4 @@ typedef struct {
|
|||||||
|
|
||||||
#endif /*EMU_SCSI_H*/
|
#endif /*EMU_SCSI_H*/
|
||||||
|
|
||||||
extern void startscsi(void);
|
extern void scsi_mutex_wait(uint8_t wait);
|
||||||
extern void endscsi(void);
|
|
||||||
|
|||||||
@@ -265,11 +265,11 @@ aha_fast_cmds(void *p, uint8_t cmd)
|
|||||||
x54x_t *dev = (x54x_t *)p;
|
x54x_t *dev = (x54x_t *)p;
|
||||||
|
|
||||||
if (cmd == CMD_BIOS_SCSI) {
|
if (cmd == CMD_BIOS_SCSI) {
|
||||||
x54x_busy_set();
|
x54x_busy(1);
|
||||||
dev->BIOSMailboxReq++;
|
dev->BIOSMailboxReq++;
|
||||||
|
|
||||||
x54x_thread_start(dev);
|
x54x_thread_start(dev);
|
||||||
x54x_busy_clear();
|
x54x_busy(0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,7 +361,7 @@ aha_cmds(void *p)
|
|||||||
|
|
||||||
case CMD_BIOS_MBINIT: /* BIOS Mailbox Initialization */
|
case CMD_BIOS_MBINIT: /* BIOS Mailbox Initialization */
|
||||||
/* Sent by CF BIOS. */
|
/* Sent by CF BIOS. */
|
||||||
x54x_busy_set();
|
x54x_busy(1);
|
||||||
dev->Mbx24bit = 1;
|
dev->Mbx24bit = 1;
|
||||||
|
|
||||||
mbi = (MailboxInit_t *)dev->CmdBuf;
|
mbi = (MailboxInit_t *)dev->CmdBuf;
|
||||||
@@ -377,7 +377,7 @@ aha_cmds(void *p)
|
|||||||
|
|
||||||
dev->Status &= ~STAT_INIT;
|
dev->Status &= ~STAT_INIT;
|
||||||
dev->DataReplyLeft = 0;
|
dev->DataReplyLeft = 0;
|
||||||
x54x_busy_clear();
|
x54x_busy(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_MEMORY_MAP_1: /* AHA memory mapper */
|
case CMD_MEMORY_MAP_1: /* AHA memory mapper */
|
||||||
|
|||||||
@@ -692,7 +692,7 @@ buslogic_cmds(void *p)
|
|||||||
dev->IrqEnabled = 1;
|
dev->IrqEnabled = 1;
|
||||||
return 1;
|
return 1;
|
||||||
case 0x81:
|
case 0x81:
|
||||||
x54x_busy_set();
|
x54x_busy(1);
|
||||||
dev->Mbx24bit = 0;
|
dev->Mbx24bit = 0;
|
||||||
|
|
||||||
MailboxInitE = (MailboxInitExtended_t *)dev->CmdBuf;
|
MailboxInitE = (MailboxInitExtended_t *)dev->CmdBuf;
|
||||||
@@ -709,7 +709,7 @@ buslogic_cmds(void *p)
|
|||||||
|
|
||||||
dev->Status &= ~STAT_INIT;
|
dev->Status &= ~STAT_INIT;
|
||||||
dev->DataReplyLeft = 0;
|
dev->DataReplyLeft = 0;
|
||||||
x54x_busy_clear();
|
x54x_busy(0);
|
||||||
break;
|
break;
|
||||||
case 0x83:
|
case 0x83:
|
||||||
if (dev->CmdParam == 12) {
|
if (dev->CmdParam == 12) {
|
||||||
|
|||||||
@@ -50,12 +50,16 @@
|
|||||||
|
|
||||||
static void x54x_cmd_thread(void *priv);
|
static void x54x_cmd_thread(void *priv);
|
||||||
|
|
||||||
static thread_t *poll_tid;
|
static volatile
|
||||||
static int busy;
|
thread_t *poll_tid;
|
||||||
|
static volatile
|
||||||
|
int busy;
|
||||||
|
|
||||||
static event_t *evt;
|
static volatile
|
||||||
|
event_t *evt;
|
||||||
|
|
||||||
static event_t *poll_complete;
|
static volatile
|
||||||
|
event_t *poll_complete;
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_X54X_LOG
|
#ifdef ENABLE_X54X_LOG
|
||||||
@@ -1053,7 +1057,7 @@ x54x_scsi_cmd(x54x_t *dev)
|
|||||||
x54x_log("SCSIStatus = %02X\n", SCSIStatus);
|
x54x_log("SCSIStatus = %02X\n", SCSIStatus);
|
||||||
|
|
||||||
if (temp_cdb[0] == 0x42) {
|
if (temp_cdb[0] == 0x42) {
|
||||||
thread_wait_event(evt, 10);
|
thread_wait_event((event_t *) evt, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1287,10 +1291,10 @@ x54x_cmd_done(x54x_t *dev, int suppress);
|
|||||||
void
|
void
|
||||||
x54x_wait_for_poll(void)
|
x54x_wait_for_poll(void)
|
||||||
{
|
{
|
||||||
if (x54x_busy()) {
|
if (x54x_is_busy()) {
|
||||||
thread_wait_event(poll_complete, -1);
|
thread_wait_event((event_t *) poll_complete, -1);
|
||||||
}
|
}
|
||||||
thread_reset_event(poll_complete);
|
thread_reset_event((event_t *) poll_complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1305,11 +1309,11 @@ x54x_cmd_thread(void *priv)
|
|||||||
{
|
{
|
||||||
if ((dev->Status & STAT_INIT) || (!dev->MailboxInit && !dev->BIOSMailboxInit) || (!dev->MailboxReq && !dev->BIOSMailboxReq)) {
|
if ((dev->Status & STAT_INIT) || (!dev->MailboxInit && !dev->BIOSMailboxInit) || (!dev->MailboxReq && !dev->BIOSMailboxReq)) {
|
||||||
/* If we did not get anything, wait a while. */
|
/* If we did not get anything, wait a while. */
|
||||||
thread_wait_event(evt, 10);
|
thread_wait_event((event_t *) evt, 10);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
startscsi();
|
scsi_mutex_wait(1);
|
||||||
|
|
||||||
if (!(dev->Status & STAT_INIT) && dev->MailboxInit && dev->MailboxReq)
|
if (!(dev->Status & STAT_INIT) && dev->MailboxInit && dev->MailboxReq)
|
||||||
{
|
{
|
||||||
@@ -1322,34 +1326,36 @@ x54x_cmd_thread(void *priv)
|
|||||||
dev->ven_thread(dev);
|
dev->ven_thread(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
endscsi();
|
scsi_mutex_wait(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (poll_tid) {
|
if (poll_tid) {
|
||||||
thread_kill(poll_tid);
|
thread_kill((thread_t *) poll_tid);
|
||||||
poll_tid = NULL;
|
poll_tid = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (poll_complete) {
|
if (poll_complete) {
|
||||||
thread_destroy_event(poll_complete);
|
thread_destroy_event((event_t *) poll_complete);
|
||||||
poll_complete = NULL;
|
poll_complete = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evt) {
|
if (evt) {
|
||||||
thread_destroy_event(evt);
|
thread_destroy_event((event_t *) evt);
|
||||||
evt = NULL;
|
evt = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
scsi_mutex_close();
|
scsi_mutex(0);
|
||||||
|
|
||||||
x54x_log("%s: Callback: polling stopped.\n", dev->name);
|
x54x_log("%s: Callback: polling stopped.\n", dev->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
x54x_busy_set(void)
|
x54x_busy(uint8_t set)
|
||||||
{
|
{
|
||||||
busy = 1;
|
busy = !!set;
|
||||||
|
if (!set)
|
||||||
|
thread_set_event((event_t *) poll_complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1363,16 +1369,8 @@ x54x_thread_start(x54x_t *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
x54x_busy_clear(void)
|
|
||||||
{
|
|
||||||
busy = 0;
|
|
||||||
x54x_log("Thread set event - poll complete\n");
|
|
||||||
thread_set_event(poll_complete);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t
|
uint8_t
|
||||||
x54x_busy(void)
|
x54x_is_busy(void)
|
||||||
{
|
{
|
||||||
return !!busy;
|
return !!busy;
|
||||||
}
|
}
|
||||||
@@ -1525,32 +1523,32 @@ x54x_out(uint16_t port, uint8_t val, void *priv)
|
|||||||
switch (port & 3) {
|
switch (port & 3) {
|
||||||
case 0:
|
case 0:
|
||||||
if ((val & CTRL_HRST) || (val & CTRL_SRST)) {
|
if ((val & CTRL_HRST) || (val & CTRL_SRST)) {
|
||||||
x54x_busy_set();
|
x54x_busy(1);
|
||||||
reset = (val & CTRL_HRST);
|
reset = (val & CTRL_HRST);
|
||||||
x54x_log("Reset completed = %x\n", reset);
|
x54x_log("Reset completed = %x\n", reset);
|
||||||
x54x_reset_ctrl(dev, reset);
|
x54x_reset_ctrl(dev, reset);
|
||||||
x54x_log("Controller reset: ");
|
x54x_log("Controller reset: ");
|
||||||
x54x_busy_clear();
|
x54x_busy(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val & CTRL_IRST) {
|
if (val & CTRL_IRST) {
|
||||||
x54x_busy_set();
|
x54x_busy(1);
|
||||||
clear_irq(dev);
|
clear_irq(dev);
|
||||||
x54x_log("Interrupt reset: ");
|
x54x_log("Interrupt reset: ");
|
||||||
x54x_busy_clear();
|
x54x_busy(0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
/* Fast path for the mailbox execution command. */
|
/* Fast path for the mailbox execution command. */
|
||||||
if ((val == CMD_START_SCSI) && (dev->Command == 0xff)) {
|
if ((val == CMD_START_SCSI) && (dev->Command == 0xff)) {
|
||||||
x54x_busy_set();
|
x54x_busy(1);
|
||||||
dev->MailboxReq++;
|
dev->MailboxReq++;
|
||||||
|
|
||||||
x54x_thread_start(dev);
|
x54x_thread_start(dev);
|
||||||
x54x_log("Start SCSI command: ");
|
x54x_log("Start SCSI command: ");
|
||||||
x54x_busy_clear();
|
x54x_busy(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (dev->ven_fast_cmds) {
|
if (dev->ven_fast_cmds) {
|
||||||
@@ -1617,7 +1615,7 @@ x54x_out(uint16_t port, uint8_t val, void *priv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_MBINIT: /* mailbox initialization */
|
case CMD_MBINIT: /* mailbox initialization */
|
||||||
x54x_busy_set();
|
x54x_busy(1);
|
||||||
dev->Mbx24bit = 1;
|
dev->Mbx24bit = 1;
|
||||||
|
|
||||||
mbi = (MailboxInit_t *)dev->CmdBuf;
|
mbi = (MailboxInit_t *)dev->CmdBuf;
|
||||||
@@ -1636,7 +1634,7 @@ x54x_out(uint16_t port, uint8_t val, void *priv)
|
|||||||
dev->Status &= ~STAT_INIT;
|
dev->Status &= ~STAT_INIT;
|
||||||
dev->DataReplyLeft = 0;
|
dev->DataReplyLeft = 0;
|
||||||
x54x_log("Mailbox init: ");
|
x54x_log("Mailbox init: ");
|
||||||
x54x_busy_clear();
|
x54x_busy(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_BIOSCMD: /* execute BIOS */
|
case CMD_BIOSCMD: /* execute BIOS */
|
||||||
@@ -1972,7 +1970,7 @@ x54x_init(device_t *info)
|
|||||||
|
|
||||||
timer_add(x54x_reset_poll, &dev->ResetCB, &dev->ResetCB, dev);
|
timer_add(x54x_reset_poll, &dev->ResetCB, &dev->ResetCB, dev);
|
||||||
|
|
||||||
scsi_mutex_init();
|
scsi_mutex(1);
|
||||||
|
|
||||||
poll_complete = thread_create_event();
|
poll_complete = thread_create_event();
|
||||||
|
|
||||||
@@ -1998,21 +1996,21 @@ x54x_close(void *priv)
|
|||||||
free(dev->ven_data);
|
free(dev->ven_data);
|
||||||
|
|
||||||
if (poll_tid) {
|
if (poll_tid) {
|
||||||
thread_kill(poll_tid);
|
thread_kill((thread_t *) poll_tid);
|
||||||
poll_tid = NULL;
|
poll_tid = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (poll_complete) {
|
if (poll_complete) {
|
||||||
thread_destroy_event(poll_complete);
|
thread_destroy_event((event_t *) poll_complete);
|
||||||
poll_complete = NULL;
|
poll_complete = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evt) {
|
if (evt) {
|
||||||
thread_destroy_event(evt);
|
thread_destroy_event((event_t *) evt);
|
||||||
evt = NULL;
|
evt = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
scsi_mutex_close();
|
scsi_mutex(0);
|
||||||
|
|
||||||
if (dev->nvr != NULL)
|
if (dev->nvr != NULL)
|
||||||
free(dev->nvr);
|
free(dev->nvr);
|
||||||
|
|||||||
@@ -492,10 +492,9 @@ typedef struct
|
|||||||
|
|
||||||
|
|
||||||
extern void x54x_reset_ctrl(x54x_t *dev, uint8_t Reset);
|
extern void x54x_reset_ctrl(x54x_t *dev, uint8_t Reset);
|
||||||
extern void x54x_busy_set(void);
|
extern void x54x_busy(uint8_t set);
|
||||||
extern void x54x_thread_start(x54x_t *dev);
|
extern void x54x_thread_start(x54x_t *dev);
|
||||||
extern void x54x_busy_clear(void);
|
extern uint8_t x54x_is_busy(void);
|
||||||
extern uint8_t x54x_busy(void);
|
|
||||||
extern void x54x_buf_alloc(uint8_t id, uint8_t lun, int length);
|
extern void x54x_buf_alloc(uint8_t id, uint8_t lun, int length);
|
||||||
extern void x54x_buf_free(uint8_t id, uint8_t lun);
|
extern void x54x_buf_free(uint8_t id, uint8_t lun);
|
||||||
extern uint8_t x54x_mbo_process(x54x_t *dev);
|
extern uint8_t x54x_mbo_process(x54x_t *dev);
|
||||||
|
|||||||
Reference in New Issue
Block a user