Display warning when a PCI device can not be initialised due to insufficient available PCI slots.

This commit is contained in:
SarahW 2018-02-24 15:52:28 +00:00
commit f7384bf085
3 changed files with 10 additions and 0 deletions

View file

@ -9,6 +9,7 @@ static void *device_priv[256];
static device_t *devices[256];
static device_t *current_device;
char *current_device_name = NULL;
void device_init()
{
@ -27,6 +28,7 @@ void device_add(device_t *d)
fatal("device_add : too many devices\n");
current_device = d;
current_device_name = d->name;
if (d->init != NULL)
{
@ -37,6 +39,7 @@ void device_add(device_t *d)
devices[c] = d;
device_priv[c] = priv;
current_device_name = NULL;
}
void device_close_all()

View file

@ -44,6 +44,8 @@ void device_speed_changed();
void device_force_redraw();
void device_add_status_info(char *s, int max_len);
extern char *current_device_name;
int device_get_config_int(char *name);
char *device_get_config_string(char *name);

View file

@ -1,4 +1,5 @@
#include "ibm.h"
#include "device.h"
#include "io.h"
#include "mem.h"
#include "pic.h"
@ -218,5 +219,9 @@ int pci_add(uint8_t (*read)(int func, int addr, void *priv), void (*write)(int f
}
}
if (current_device_name)
warning("Failed to initialise PCI device '%s' due to insufficient available slots", current_device_name);
else
warning("Failed to initialise PCI device due to insufficient available slots");
return -1;
}