1995-04-23 08:55:43 +00:00
|
|
|
/*
|
1995-11-05 04:42:50 +00:00
|
|
|
* EISA bus probe and attach routines
|
1995-04-23 08:55:43 +00:00
|
|
|
*
|
1995-11-05 04:42:50 +00:00
|
|
|
* Copyright (c) 1995 Justin T. Gibbs.
|
|
|
|
* All rights reserved.
|
1995-04-23 08:55:43 +00:00
|
|
|
*
|
1995-11-05 04:42:50 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice immediately at the beginning of the file, without modification,
|
|
|
|
* this list of conditions, and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Absolutely no warranty of function or purpose is made by the author
|
|
|
|
* Justin T. Gibbs.
|
|
|
|
* 4. Modifications may be freely made to this file if the above conditions
|
|
|
|
* are met.
|
1995-04-23 08:55:43 +00:00
|
|
|
*
|
1996-01-03 06:28:01 +00:00
|
|
|
* $Id: eisaconf.c,v 1.11 1995/12/10 13:33:49 phk Exp $
|
1995-04-23 08:55:43 +00:00
|
|
|
*/
|
|
|
|
#include <sys/param.h>
|
1995-11-05 04:42:50 +00:00
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/kernel.h>
|
1995-11-20 12:42:39 +00:00
|
|
|
#include <sys/sysctl.h>
|
1995-04-23 08:55:43 +00:00
|
|
|
#include <sys/conf.h>
|
1995-11-05 04:42:50 +00:00
|
|
|
#include <sys/malloc.h>
|
1995-11-09 07:14:11 +00:00
|
|
|
#include <sys/devconf.h>
|
1995-04-23 08:55:43 +00:00
|
|
|
|
1995-11-29 17:40:47 +00:00
|
|
|
#include <i386/eisa/eisaconf.h>
|
|
|
|
|
|
|
|
#include <i386/isa/icu.h> /* Hmmm. Interrupt stuff? */
|
1995-04-23 08:55:43 +00:00
|
|
|
|
1995-11-05 04:42:50 +00:00
|
|
|
struct eisa_device_node{
|
1995-11-09 07:14:11 +00:00
|
|
|
struct eisa_device dev;
|
|
|
|
struct eisa_device_node *next;
|
1995-11-05 04:42:50 +00:00
|
|
|
};
|
1995-04-23 08:55:43 +00:00
|
|
|
|
1995-11-05 04:42:50 +00:00
|
|
|
extern struct kern_devconf kdc_cpu0;
|
|
|
|
extern int bootverbose;
|
|
|
|
|
|
|
|
struct kern_devconf kdc_eisa0 = {
|
|
|
|
0, 0, 0, /* filled in by dev_attach */
|
|
|
|
"eisa", 0, { MDDT_BUS, 0 },
|
|
|
|
0, 0, 0, BUS_EXTERNALLEN,
|
|
|
|
&kdc_cpu0, /* parent is the CPU */
|
|
|
|
0, /* no parentdata */
|
|
|
|
DC_BUSY, /* busses are always busy */
|
1995-11-10 01:32:12 +00:00
|
|
|
NULL,
|
1995-11-05 04:42:50 +00:00
|
|
|
DC_CLS_BUS /* class */
|
|
|
|
};
|
1995-04-23 08:55:43 +00:00
|
|
|
|
1995-11-05 04:42:50 +00:00
|
|
|
/*
|
|
|
|
* This should probably be a list of "struct device" once it exists.
|
|
|
|
* A struct device will incorperate ioconf and driver entry point data
|
|
|
|
* regardless of how its attached to the system (via unions) as well
|
|
|
|
* as more generic information that all device types should support (unit
|
|
|
|
* number, if its installed, etc).
|
|
|
|
*/
|
|
|
|
static struct eisa_device_node *eisa_dev_list;
|
|
|
|
static struct eisa_device_node **eisa_dev_list_tail = &eisa_dev_list;
|
|
|
|
static u_long eisa_unit;
|
|
|
|
|
1995-11-29 17:40:47 +00:00
|
|
|
static struct eisa_driver mainboard_drv = {
|
1995-11-05 04:42:50 +00:00
|
|
|
"eisa",
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
&eisa_unit
|
|
|
|
};
|
1995-11-10 01:32:12 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Add the mainboard_drv to the eisa driver linkerset so that it is
|
|
|
|
* defined even if no EISA drivers are linked into the kernel.
|
|
|
|
*/
|
|
|
|
DATA_SET (eisadriver_set, mainboard_drv);
|
|
|
|
|
1995-04-23 08:55:43 +00:00
|
|
|
/*
|
|
|
|
** probe for EISA devices
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
eisa_configure()
|
|
|
|
{
|
1995-11-09 07:14:11 +00:00
|
|
|
int i,slot;
|
|
|
|
char *id_string;
|
|
|
|
struct eisa_device_node *dev_node;
|
|
|
|
struct eisa_driver **e_drvp;
|
|
|
|
struct eisa_driver *e_drv;
|
|
|
|
struct eisa_device *e_dev;
|
|
|
|
int eisaBase = 0xc80;
|
|
|
|
eisa_id_t eisa_id;
|
|
|
|
|
|
|
|
e_drvp = (struct eisa_driver**)eisadriver_set.ls_items;
|
|
|
|
|
|
|
|
for (slot = 0; slot < EISA_SLOTS; eisaBase+=0x1000, slot++) {
|
|
|
|
int id_size = sizeof(eisa_id);
|
|
|
|
eisa_id = 0;
|
|
|
|
for( i = 0; i < id_size; i++ ) {
|
1996-01-03 06:28:01 +00:00
|
|
|
outb(eisaBase,0x80 + i); /*Some cards require priming*/
|
1995-11-09 07:14:11 +00:00
|
|
|
eisa_id |= inb(eisaBase+i) << ((id_size-i-1)*CHAR_BIT);
|
|
|
|
}
|
|
|
|
if (eisa_id & 0x80000000)
|
|
|
|
continue; /* no EISA card in slot */
|
|
|
|
|
|
|
|
/* Prepare an eisa_device_node for this slot */
|
|
|
|
dev_node = (struct eisa_device_node *)malloc(sizeof(*dev_node),
|
|
|
|
M_DEVBUF, M_NOWAIT);
|
|
|
|
if (!dev_node) {
|
|
|
|
printf("eisa0: cannot malloc eisa_device_node");
|
|
|
|
break; /* Try to attach what we have already */
|
|
|
|
}
|
|
|
|
bzero(dev_node, sizeof(*dev_node));
|
|
|
|
e_dev = &(dev_node->dev);
|
|
|
|
e_dev->id = eisa_id;
|
|
|
|
/*
|
|
|
|
* Add an EISA ID based descriptive name incase we don't
|
|
|
|
* have a driver for it. We do this now instead of after all
|
|
|
|
* probes because in the future, the eisa module will only
|
|
|
|
* be responsible for creating the list of devices in the system
|
|
|
|
* for the configuration manager to use.
|
|
|
|
*/
|
1995-11-09 22:43:25 +00:00
|
|
|
e_dev->full_name = (char *)malloc(10*sizeof(char),
|
1995-11-09 07:14:11 +00:00
|
|
|
M_DEVBUF, M_NOWAIT);
|
|
|
|
if (!e_dev->full_name) {
|
|
|
|
panic("Eisa probe unable to malloc");
|
|
|
|
}
|
1995-11-09 22:43:25 +00:00
|
|
|
sprintf(e_dev->full_name, "%c%c%c%x%x",
|
1995-11-09 07:14:11 +00:00
|
|
|
EISA_MFCTR_CHAR0(e_dev->id),
|
|
|
|
EISA_MFCTR_CHAR1(e_dev->id),
|
|
|
|
EISA_MFCTR_CHAR2(e_dev->id),
|
|
|
|
EISA_PRODUCT_ID(e_dev->id),
|
|
|
|
EISA_REVISION_ID(e_dev->id));
|
|
|
|
e_dev->ioconf.slot = slot;
|
|
|
|
/* Is iobase defined in any EISA specs? */
|
|
|
|
e_dev->ioconf.iobase = eisaBase & 0xff00;
|
|
|
|
*eisa_dev_list_tail = dev_node;
|
|
|
|
eisa_dev_list_tail = &dev_node->next;
|
1995-11-06 05:21:01 +00:00
|
|
|
}
|
|
|
|
|
1995-11-09 07:14:11 +00:00
|
|
|
dev_node = eisa_dev_list;
|
1995-11-06 05:21:01 +00:00
|
|
|
|
1995-11-09 07:14:11 +00:00
|
|
|
/*
|
|
|
|
* "Attach" the system board
|
|
|
|
*/
|
1995-11-06 05:21:01 +00:00
|
|
|
|
1995-11-09 07:14:11 +00:00
|
|
|
/* The first will be the motherboard in a true EISA system */
|
|
|
|
if (dev_node && (dev_node->dev.ioconf.slot == 0)) {
|
|
|
|
e_dev = &dev_node->dev;
|
|
|
|
e_dev->driver = &mainboard_drv;
|
|
|
|
e_dev->unit = (*e_dev->driver->unit)++;
|
|
|
|
id_string = e_dev->full_name;
|
|
|
|
e_dev->full_name = (char *)malloc(strlen(e_dev->full_name)
|
|
|
|
+ sizeof(" (System Board)")
|
|
|
|
+ 1, M_DEVBUF, M_NOWAIT);
|
|
|
|
if (!e_dev->full_name) {
|
|
|
|
panic("Eisa probe unable to malloc");
|
|
|
|
}
|
|
|
|
sprintf(e_dev->full_name, "%s (System Board)", id_string);
|
|
|
|
free(id_string, M_DEVBUF);
|
|
|
|
|
|
|
|
printf("%s%ld: <%s>\n",
|
|
|
|
e_dev->driver->name,
|
|
|
|
e_dev->unit,
|
|
|
|
e_dev->full_name);
|
|
|
|
|
|
|
|
/* Should set the iosize, but I don't have a spec handy */
|
1995-11-10 01:32:12 +00:00
|
|
|
kdc_eisa0.kdc_description =
|
|
|
|
(char *)malloc(strlen(e_dev->full_name)
|
|
|
|
+ sizeof("EISA bus <>")
|
|
|
|
+ 1, M_DEVBUF, M_NOWAIT);
|
|
|
|
if (!kdc_eisa0.kdc_description) {
|
|
|
|
panic("Eisa probe unable to malloc");
|
|
|
|
}
|
|
|
|
sprintf((char *)kdc_eisa0.kdc_description, "EISA bus <%s>",
|
|
|
|
e_dev->full_name);
|
1995-11-09 07:14:11 +00:00
|
|
|
dev_attach(&kdc_eisa0);
|
|
|
|
printf("Probing for devices on the EISA bus\n");
|
|
|
|
dev_node = dev_node->next;
|
|
|
|
}
|
1995-11-05 04:42:50 +00:00
|
|
|
|
1995-11-09 07:14:11 +00:00
|
|
|
if (!eisa_dev_list) {
|
|
|
|
/*
|
|
|
|
* No devices.
|
|
|
|
*/
|
|
|
|
return;
|
|
|
|
}
|
1995-11-06 05:21:01 +00:00
|
|
|
/*
|
1995-11-09 07:14:11 +00:00
|
|
|
* See what devices we recognize.
|
1995-11-06 05:21:01 +00:00
|
|
|
*/
|
1995-11-09 07:14:11 +00:00
|
|
|
while((e_drv = *e_drvp++)) {
|
1995-11-10 01:32:12 +00:00
|
|
|
if (e_drv->probe)
|
|
|
|
(*e_drv->probe)();
|
1995-11-05 04:42:50 +00:00
|
|
|
}
|
1995-11-09 07:14:11 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Attach the devices we found in slot order
|
|
|
|
*/
|
|
|
|
for (; dev_node; dev_node=dev_node->next) {
|
|
|
|
e_dev = &dev_node->dev;
|
|
|
|
e_drv = e_dev->driver;
|
|
|
|
if (e_drv) {
|
|
|
|
/*
|
|
|
|
* Determine the proper unit number for this device.
|
|
|
|
* Here we should look in the device table generated
|
|
|
|
* by config to see if this type of device is enabled
|
|
|
|
* either generically or for this particular address
|
|
|
|
* as well as determine if a reserved unit number
|
|
|
|
* should be used. We should also ensure that the
|
|
|
|
* "next availible unit number" skips over "wired" unit
|
|
|
|
* numbers. This will be done after config is fixed or
|
|
|
|
* some other configuration method is chosen.
|
|
|
|
*/
|
|
|
|
e_dev->unit = (*e_drv->unit)++;
|
|
|
|
if ((*e_drv->attach)(e_dev) < 0) {
|
|
|
|
printf("%s0:%d <%s> attach failed\n",
|
|
|
|
mainboard_drv.name,
|
|
|
|
e_dev->ioconf.slot,
|
|
|
|
e_dev->full_name);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
e_dev->kdc->kdc_unit = e_dev->unit;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Announce unattached device */
|
|
|
|
printf("%s0:%d <%s> unknown device\n",
|
|
|
|
mainboard_drv.name,
|
|
|
|
e_dev->ioconf.slot,
|
|
|
|
e_dev->full_name);
|
|
|
|
}
|
1995-11-05 04:42:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct eisa_device *
|
|
|
|
eisa_match_dev(e_dev, match_func)
|
|
|
|
struct eisa_device *e_dev;
|
|
|
|
char* (*match_func)(eisa_id_t);
|
|
|
|
{
|
1995-11-09 07:14:11 +00:00
|
|
|
struct eisa_device_node *e_node = eisa_dev_list;
|
|
|
|
|
|
|
|
if (e_dev) {
|
|
|
|
/* Start our search from the last successful match */
|
|
|
|
e_node = ((struct eisa_device_node *)e_dev)->next;
|
1995-11-06 05:21:01 +00:00
|
|
|
}
|
1995-11-09 07:14:11 +00:00
|
|
|
|
|
|
|
for(; e_node; e_node = e_node->next) {
|
|
|
|
char *result;
|
|
|
|
if (e_node->dev.driver) {
|
|
|
|
/* Already claimed */
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
result = (*match_func)(e_node->dev.id);
|
|
|
|
if (result) {
|
|
|
|
free(e_node->dev.full_name, M_DEVBUF);
|
|
|
|
e_node->dev.full_name = result;
|
|
|
|
return (&(e_node->dev));
|
|
|
|
}
|
1995-11-05 04:42:50 +00:00
|
|
|
}
|
1995-11-09 07:14:11 +00:00
|
|
|
return NULL;
|
1995-11-05 04:42:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Interrupt and I/O space registration facitlities */
|
|
|
|
void
|
|
|
|
eisa_reg_start(e_dev)
|
|
|
|
struct eisa_device *e_dev;
|
|
|
|
{
|
1995-11-09 07:14:11 +00:00
|
|
|
/*
|
|
|
|
* Announce the device.
|
|
|
|
*/
|
|
|
|
printf("%s%ld: <%s>",
|
|
|
|
e_dev->driver->name,
|
|
|
|
e_dev->unit,
|
|
|
|
e_dev->full_name);
|
1995-11-05 04:42:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Interrupt and I/O space registration facitlities */
|
|
|
|
void
|
|
|
|
eisa_reg_end(e_dev)
|
|
|
|
struct eisa_device *e_dev;
|
|
|
|
{
|
1995-11-09 07:14:11 +00:00
|
|
|
/*
|
|
|
|
* The device should have called eisa_registerdev()
|
|
|
|
* during its probe. So hopefully we can use the kdc
|
|
|
|
* to weed out ISA/VL devices that use EISA id registers.
|
|
|
|
*/
|
|
|
|
if (e_dev->kdc && (e_dev->kdc->kdc_parent == &kdc_isa0)) {
|
|
|
|
printf(" on isa\n");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
printf(" on %s0 slot %d\n",
|
|
|
|
mainboard_drv.name,
|
|
|
|
e_dev->ioconf.slot);
|
|
|
|
}
|
1995-11-05 04:42:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
eisa_add_intr(e_dev, irq)
|
|
|
|
struct eisa_device *e_dev;
|
|
|
|
int irq;
|
|
|
|
{
|
1995-11-09 07:14:11 +00:00
|
|
|
e_dev->ioconf.irq |= 1ul << irq;
|
|
|
|
return 0;
|
1995-11-05 04:42:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
eisa_reg_intr(e_dev, irq, func, arg, maskptr, shared)
|
|
|
|
struct eisa_device *e_dev;
|
|
|
|
int irq;
|
|
|
|
void (*func)(void *);
|
|
|
|
void *arg;
|
|
|
|
u_int *maskptr;
|
|
|
|
int shared;
|
|
|
|
{
|
1995-11-09 07:14:11 +00:00
|
|
|
int result;
|
|
|
|
int s;
|
1995-04-23 08:55:43 +00:00
|
|
|
|
1995-11-05 04:42:50 +00:00
|
|
|
#if NOT_YET
|
1995-11-09 07:14:11 +00:00
|
|
|
/*
|
|
|
|
* Punt on conflict detection for the moment.
|
|
|
|
* I want to develop a generic routine to do
|
|
|
|
* this for all device types.
|
|
|
|
*/
|
|
|
|
int checkthese = CC_IRQ;
|
|
|
|
if (haveseen_dev(dev, checkthese))
|
|
|
|
return 1;
|
1995-11-05 04:42:50 +00:00
|
|
|
#endif
|
1995-11-09 07:14:11 +00:00
|
|
|
s = splhigh();
|
|
|
|
/*
|
|
|
|
* This should really go to a routine that can optionally
|
|
|
|
* handle shared interrupts.
|
|
|
|
*/
|
|
|
|
result = register_intr(irq, /* isa irq */
|
|
|
|
0, /* deviced?? */
|
|
|
|
0, /* flags? */
|
|
|
|
(inthand2_t*) func, /* handler */
|
|
|
|
maskptr, /* mask pointer */
|
|
|
|
(int)arg); /* handler arg */
|
|
|
|
|
|
|
|
if (result) {
|
|
|
|
printf ("eisa_reg_int: result=%d\n", result);
|
|
|
|
splx(s);
|
|
|
|
return (result);
|
|
|
|
};
|
|
|
|
update_intr_masks();
|
1995-11-05 04:42:50 +00:00
|
|
|
splx(s);
|
1995-11-09 07:14:11 +00:00
|
|
|
|
|
|
|
e_dev->ioconf.irq |= 1ul << irq;
|
|
|
|
printf(" irq %d", irq);
|
|
|
|
return (0);
|
1995-11-05 04:42:50 +00:00
|
|
|
}
|
1995-04-23 08:55:43 +00:00
|
|
|
|
1995-11-05 04:42:50 +00:00
|
|
|
int
|
|
|
|
eisa_release_intr(e_dev, irq, func)
|
|
|
|
struct eisa_device *e_dev;
|
|
|
|
int irq;
|
|
|
|
void (*func)(void *);
|
|
|
|
{
|
1995-11-09 07:14:11 +00:00
|
|
|
int result;
|
|
|
|
int s;
|
|
|
|
|
|
|
|
if (!(e_dev->ioconf.irq & (1ul << irq))) {
|
|
|
|
printf("%s%ld: Attempted to release an interrupt (%d) "
|
|
|
|
"it doesn't own\n", e_dev->driver->name,
|
|
|
|
e_dev->unit, irq);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
s = splhigh();
|
|
|
|
INTRDIS ((1ul<<irq));
|
|
|
|
|
|
|
|
result = unregister_intr (irq, (inthand2_t*)func);
|
1995-11-05 04:42:50 +00:00
|
|
|
|
1995-11-09 07:14:11 +00:00
|
|
|
if (result)
|
|
|
|
printf ("eisa_release_intr: result=%d\n", result);
|
1995-11-05 04:42:50 +00:00
|
|
|
|
1995-11-09 07:14:11 +00:00
|
|
|
update_intr_masks();
|
1995-11-05 04:42:50 +00:00
|
|
|
|
1995-11-09 07:14:11 +00:00
|
|
|
splx(s);
|
|
|
|
return (result);
|
1995-11-05 04:42:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
eisa_enable_intr(e_dev, irq)
|
|
|
|
struct eisa_device *e_dev;
|
|
|
|
int irq;
|
|
|
|
{
|
1995-11-09 07:14:11 +00:00
|
|
|
int s;
|
|
|
|
|
|
|
|
if (!(e_dev->ioconf.irq & (1ul << irq))) {
|
|
|
|
printf("%s%ld: Attempted to enable an interrupt (%d) "
|
|
|
|
"it doesn't own\n", e_dev->driver->name,
|
|
|
|
e_dev->unit, irq);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
s = splhigh();
|
|
|
|
INTREN((1ul << irq));
|
|
|
|
splx(s);
|
|
|
|
return 0;
|
1995-11-05 04:42:50 +00:00
|
|
|
}
|
1995-04-23 08:55:43 +00:00
|
|
|
|
1995-11-05 04:42:50 +00:00
|
|
|
int
|
|
|
|
eisa_add_iospace(e_dev, iobase, iosize)
|
|
|
|
struct eisa_device *e_dev;
|
|
|
|
u_long iobase;
|
|
|
|
int iosize;
|
|
|
|
{
|
1995-11-09 07:14:11 +00:00
|
|
|
/*
|
|
|
|
* We should develop a scheme for storing the results of
|
|
|
|
* multiple calls to this function.
|
|
|
|
*/
|
|
|
|
e_dev->ioconf.iobase = iobase;
|
|
|
|
e_dev->ioconf.iosize = iosize;
|
|
|
|
return 0;
|
1995-11-05 04:42:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
eisa_reg_iospace(e_dev, iobase, iosize)
|
|
|
|
struct eisa_device *e_dev;
|
|
|
|
u_long iobase;
|
|
|
|
int iosize;
|
|
|
|
{
|
1995-11-09 07:14:11 +00:00
|
|
|
/*
|
|
|
|
* We should develop a scheme for storing the results of
|
|
|
|
* multiple calls to this function.
|
|
|
|
*/
|
1995-11-05 04:42:50 +00:00
|
|
|
#ifdef NOT_YET
|
1995-11-09 07:14:11 +00:00
|
|
|
/*
|
|
|
|
* Punt on conflict detection for the moment.
|
|
|
|
* I want to develop a generic routine to do
|
|
|
|
* this for all device types.
|
|
|
|
*/
|
|
|
|
int checkthese = CC_IOADDR;
|
|
|
|
if (haveseen_dev(dev, checkthese))
|
|
|
|
return -1;
|
1995-11-05 04:42:50 +00:00
|
|
|
#endif
|
1995-11-09 07:14:11 +00:00
|
|
|
e_dev->ioconf.iobase = iobase;
|
|
|
|
e_dev->ioconf.iosize = iosize;
|
1995-11-05 04:42:50 +00:00
|
|
|
|
1995-11-09 07:14:11 +00:00
|
|
|
printf(" at 0x%lx-0x%lx", iobase, iobase + iosize - 1);
|
|
|
|
return (0);
|
1995-11-05 04:42:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
eisa_registerdev(e_dev, driver, kdc_template)
|
|
|
|
struct eisa_device *e_dev;
|
|
|
|
struct eisa_driver *driver;
|
|
|
|
struct kern_devconf *kdc_template;
|
|
|
|
{
|
1995-11-09 07:14:11 +00:00
|
|
|
e_dev->driver = driver; /* Driver now owns this device */
|
|
|
|
e_dev->kdc = (struct kern_devconf *)malloc(sizeof(struct kern_devconf),
|
1995-11-05 04:42:50 +00:00
|
|
|
M_DEVBUF, M_NOWAIT);
|
1995-11-09 07:14:11 +00:00
|
|
|
if (!e_dev->kdc) {
|
|
|
|
printf("WARNING: eisa_registerdev unable to malloc! "
|
|
|
|
"Device kdc will not be registerd\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
bcopy(kdc_template, e_dev->kdc, sizeof(*kdc_template));
|
|
|
|
e_dev->kdc->kdc_description = e_dev->full_name;
|
|
|
|
e_dev->kdc->kdc_parentdata = e_dev;
|
|
|
|
dev_attach(e_dev->kdc);
|
|
|
|
return (0);
|
1995-11-05 04:42:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1995-11-20 12:42:39 +00:00
|
|
|
eisa_generic_externalize(struct kern_devconf *kdc, struct sysctl_req *req)
|
1995-11-05 04:42:50 +00:00
|
|
|
{
|
1995-12-10 13:33:49 +00:00
|
|
|
return (SYSCTL_OUT(req, kdc->kdc_eisa, sizeof(struct eisa_device)));
|
1995-11-05 04:42:50 +00:00
|
|
|
}
|