diff options
| author | xtraeme <xtraeme@NetBSD.org> | 2007-09-09 04:24:24 +0000 |
|---|---|---|
| committer | xtraeme <xtraeme@NetBSD.org> | 2007-09-09 04:24:24 +0000 |
| commit | 2049e942667f57de10d2bceae16eb830ffecfbfe (patch) | |
| tree | ec71afc82f0eebeb2ed51241629fa8273c63d4c2 /sys/lkm/dev | |
| parent | ca1b22492abb0dc87a077f08900dbc2344727f12 (diff) | |
Add the lm(4) LKM and a common template to build ISA modules by only
setting some variables. Voodoo magic to create lkm_isa.c was required.
Diffstat (limited to 'sys/lkm/dev')
| -rw-r--r-- | sys/lkm/dev/isa/Makefile | 5 | ||||
| -rw-r--r-- | sys/lkm/dev/isa/Makefile.inc | 31 | ||||
| -rw-r--r-- | sys/lkm/dev/isa/common/lkm_isa.templ | 67 | ||||
| -rw-r--r-- | sys/lkm/dev/isa/lm/Makefile | 18 |
4 files changed, 121 insertions, 0 deletions
diff --git a/sys/lkm/dev/isa/Makefile b/sys/lkm/dev/isa/Makefile new file mode 100644 index 00000000000..3759b985a02 --- /dev/null +++ b/sys/lkm/dev/isa/Makefile @@ -0,0 +1,5 @@ +# $NetBSD: Makefile,v 1.1 2007/09/09 04:24:24 xtraeme Exp $ + +SUBDIR= lm + +.include <bsd.subdir.mk> diff --git a/sys/lkm/dev/isa/Makefile.inc b/sys/lkm/dev/isa/Makefile.inc new file mode 100644 index 00000000000..f18d1ab9d30 --- /dev/null +++ b/sys/lkm/dev/isa/Makefile.inc @@ -0,0 +1,31 @@ +# $NetBSD: Makefile.inc,v 1.1 2007/09/09 04:24:24 xtraeme Exp $ + +.include "../Makefile.inc" + +TEMPL_DIR?= ${.CURDIR}/../common +TEMPL_FILE?= lkm_isa.templ + +LKM_ISA_IO_PORT?= 0x290 +LKM_ISA_SIZE?= 0 +LKM_ISA_IOMEM?= -1 +LKM_ISA_IOSIZE?= 0 +LKM_ISA_IRQ?= -1 +LKM_ISA_DRQ?= -1 +LKM_ISA_DRQ2?= -1 + +CLEANFILES+= ${.CURDIR}/${TEMPL_FILE:S/templ/c/} + +DPSRCS+= ${TEMPL_FILE:S/templ/c/} + +${TEMPL_FILE:S/templ/c/}: + sed -e "s|@LKM_ISA_IO_PORT@|${LKM_ISA_IO_PORT}|g" \ + -e "s|@LKM_ISA_IO_PORT@|${LKM_ISA_IO_PORT}|g" \ + -e "s|@LKM_ISA_SIZE@|${LKM_ISA_SIZE}|g" \ + -e "s|@LKM_ISA_IOMEM@|${LKM_ISA_IOMEM}|g" \ + -e "s|@LKM_ISA_IOSIZE@|${LKM_ISA_IOSIZE}|g" \ + -e "s|@LKM_ISA_IRQ@|${LKM_ISA_IRQ}|g" \ + -e "s|@LKM_ISA_DRQ@|${LKM_ISA_DRQ}|g" \ + -e "s|@LKM_ISA_DRQ2@|${LKM_ISA_DRQ2}|g" \ + -e "s|@LKM_ISA_DRVNAME@|${LKM_ISA_DRVNAME}|g" \ + -e "s|@LKM_ISA_DRVNAME_CA@|${LKM_ISA_DRVNAME_CA}|g" \ + ${TEMPL_DIR}/${TEMPL_FILE} > ${.CURDIR}/${TEMPL_FILE:S/templ/c/} diff --git a/sys/lkm/dev/isa/common/lkm_isa.templ b/sys/lkm/dev/isa/common/lkm_isa.templ new file mode 100644 index 00000000000..aacfea993a4 --- /dev/null +++ b/sys/lkm/dev/isa/common/lkm_isa.templ @@ -0,0 +1,67 @@ +/* $NetBSD: lkm_isa.templ,v 1.1 2007/09/09 04:24:25 xtraeme Exp $ */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/kernel.h> +#include <sys/device.h> +#include <sys/lkm.h> + +/* + * Common template for ISA drivers. + */ + +CFDRIVER_DECL(@LKM_ISA_DRVNAME@, DV_DULL, NULL); +extern struct cfattach @LKM_ISA_DRVNAME_CA@_ca; + +/* The ISA devices use 7 locators. */ +static int isaloc[] = { + @LKM_ISA_IO_PORT@, /* port */ + @LKM_ISA_SIZE@, /* size */ + @LKM_ISA_IOMEM@, /* iomem */ + @LKM_ISA_IOSIZE@, /* iosize */ + @LKM_ISA_IRQ@, /* irq */ + @LKM_ISA_DRQ@, /* drq */ + @LKM_ISA_DRQ2@, /* drq2 */ +}; + +static struct cfparent isaparent = { + "isa", "isa", DVUNIT_ANY +}; + +static struct cfdata @LKM_ISA_DRVNAME@_cfdata[] = { + { "@LKM_ISA_DRVNAME@", + "@LKM_ISA_DRVNAME_CA@", + 0, + FSTATE_NOTFOUND, + isaloc, + 0, + &isaparent }, + { 0 } +}; + +static struct cfdriver *@LKM_ISA_DRVNAME@_cfdrivers[] = { + &@LKM_ISA_DRVNAME@_cd, + NULL +}; + +static struct cfattach *@LKM_ISA_DRVNAME@_cfattachs[] = { + &@LKM_ISA_DRVNAME_CA@_ca, + NULL +}; + +static const struct cfattachlkminit @LKM_ISA_DRVNAME@_cfattachinit[] = { + { "@LKM_ISA_DRVNAME@", @LKM_ISA_DRVNAME@_cfattachs }, + { NULL } +}; + +int @LKM_ISA_DRVNAME@_lkmentry(struct lkm_table *, int, int); + +MOD_DRV("@LKM_ISA_DRVNAME@", @LKM_ISA_DRVNAME@_cfdrivers, + @LKM_ISA_DRVNAME@_cfattachinit, @LKM_ISA_DRVNAME@_cfdata); + +int +@LKM_ISA_DRVNAME@_lkmentry(struct lkm_table *lkmtp, int cmd, int ver) +{ + + DISPATCH(lkmtp, cmd, ver, lkm_nofunc, lkm_nofunc, lkm_nofunc); +} diff --git a/sys/lkm/dev/isa/lm/Makefile b/sys/lkm/dev/isa/lm/Makefile new file mode 100644 index 00000000000..400ec195b04 --- /dev/null +++ b/sys/lkm/dev/isa/lm/Makefile @@ -0,0 +1,18 @@ +# $NetBSD: Makefile,v 1.1 2007/09/09 04:24:25 xtraeme Exp $ + +S= ${.CURDIR}/../../../.. +.PATH: $S/dev/isa $S/dev/ic + +KMOD= lm +SRCS= lm_isa.c nslm7x.c lkm_isa.c +NOMAN= # yes + +LKM_ISA_IO_PORT= 0x290 +LKM_ISA_DRVNAME= lm +LKM_ISA_DRVNAME_CA= lm_isa + +#CPPFLAGS+= -DMULTIPROCESSOR -DDEBUG -DDIAGNOSTIC -DLOCKDEBUG +CLEANFILES+= *~ ${KMOD} +WARNS= 2 + +.include <bsd.kmod.mk> |
