diff options
author | nyan <nyan@FreeBSD.org> | 2003-08-02 09:25:25 +0000 |
---|---|---|
committer | nyan <nyan@FreeBSD.org> | 2003-08-02 09:25:25 +0000 |
commit | 10c63974c23f170bf3422429833e73da578a446c (patch) | |
tree | e7c71c791324a25c7f1716fec4b7def1875d02dd /sys/pc98 | |
parent | 8c736a53544abebc3ab944bd04386a7acdc6a056 (diff) | |
download | FreeBSD-src-10c63974c23f170bf3422429833e73da578a446c.zip FreeBSD-src-10c63974c23f170bf3422429833e73da578a446c.tar.gz |
Merged from sys/dev/ppc/ppc.c revision 1.42.
Diffstat (limited to 'sys/pc98')
-rw-r--r-- | sys/pc98/cbus/ppc.c | 81 | ||||
-rw-r--r-- | sys/pc98/pc98/ppc.c | 81 |
2 files changed, 74 insertions, 88 deletions
diff --git a/sys/pc98/cbus/ppc.c b/sys/pc98/cbus/ppc.c index c3fe93d..af78af8 100644 --- a/sys/pc98/cbus/ppc.c +++ b/sys/pc98/cbus/ppc.c @@ -51,45 +51,30 @@ #include <dev/ppbus/ppbconf.h> #include <dev/ppbus/ppb_msq.h> +#include <dev/ppc/ppcvar.h> #ifdef PC98 #include <pc98/pc98/ppcreg.h> #else -#include <isa/ppcreg.h> +#include <dev/ppc/ppcreg.h> #endif #include "ppbus_if.h" -#define LOG_PPC(function, ppc, string) \ - if (bootverbose) printf("%s: %s\n", function, string) - - -#define DEVTOSOFTC(dev) ((struct ppc_data *)device_get_softc(dev)) - -devclass_t ppc_devclass; - -static int ppc_probe(device_t dev); -static int ppc_attach(device_t dev); -static int ppc_read_ivar(device_t bus, device_t dev, int index, uintptr_t *val); +static int ppc_cbus_probe(device_t dev); -static void ppc_reset_epp(device_t); -static void ppc_ecp_sync(device_t); static void ppcintr(void *arg); -static int ppc_exec_microseq(device_t, struct ppb_microseq **); -static int ppc_setmode(device_t, int); +#define LOG_PPC(function, ppc, string) \ + if (bootverbose) printf("%s: %s\n", function, string) -static int ppc_read(device_t, char *, int, int); -static int ppc_write(device_t, char *, int, int); -static u_char ppc_io(device_t, int, u_char *, int, u_char); +#define DEVTOSOFTC(dev) ((struct ppc_data *)device_get_softc(dev)) -static int ppc_setup_intr(device_t, device_t, struct resource *, int, - void (*)(void *), void *, void **); -static int ppc_teardown_intr(device_t, device_t, struct resource *, void *); +devclass_t ppc_devclass; static device_method_t ppc_methods[] = { /* device interface */ - DEVMETHOD(device_probe, ppc_probe), + DEVMETHOD(device_probe, ppc_cbus_probe), DEVMETHOD(device_attach, ppc_attach), /* bus interface */ @@ -115,7 +100,7 @@ static driver_t ppc_driver = { ppc_methods, sizeof(struct ppc_data), }; - + static char *ppc_models[] = { "SMC-like", "SMC FDC37C665GT", "SMC FDC37C666GT", "PC87332", "PC87306", "82091AA", "Generic", "W83877F", "W83877AF", "Winbond", "PC87334", @@ -154,7 +139,7 @@ static char *ppc_epp_protocol[] = { " (EPP 1.9)", " (EPP 1.7)", 0 }; /* * ppc_ecp_sync() XXX */ -static void +void ppc_ecp_sync(device_t dev) { int i, r; @@ -1344,7 +1329,7 @@ ppc_detect(struct ppc_data *ppc, int chipset_mode) { * Execute a microsequence. * Microsequence mechanism is supposed to handle fast I/O operations. */ -static int +int ppc_exec_microseq(device_t dev, struct ppb_microseq **p_msq) { struct ppc_data *ppc = DEVTOSOFTC(dev); @@ -1631,7 +1616,7 @@ ppcintr(void *arg) return; } -static int +int ppc_read(device_t dev, char *buf, int len, int mode) { return (EINVAL); @@ -1644,7 +1629,7 @@ ppc_read(device_t dev, char *buf, int len, int mode) * If what you want is not possible (no ECP, no DMA...), * EINVAL is returned */ -static int +int ppc_write(device_t dev, char *buf, int len, int how) { struct ppc_data *ppc = DEVTOSOFTC(dev); @@ -1796,7 +1781,7 @@ error: return (error); } -static void +void ppc_reset_epp(device_t dev) { struct ppc_data *ppc = DEVTOSOFTC(dev); @@ -1806,7 +1791,7 @@ ppc_reset_epp(device_t dev) return; } -static int +int ppc_setmode(device_t dev, int mode) { struct ppc_data *ppc = DEVTOSOFTC(dev); @@ -1833,13 +1818,29 @@ static struct isa_pnp_id lpc_ids[] = { }; static int +ppc_cbus_probe(device_t dev) +{ + device_t parent; + int error; + + parent = device_get_parent(dev); + + error = ISA_PNP_PROBE(parent, dev, lpc_ids); + if (error == ENXIO) + return (ENXIO); + else if (error != 0) /* XXX shall be set after detection */ + device_set_desc(dev, "Parallel port"); + + return(ppc_probe(dev)); +} + +int ppc_probe(device_t dev) { #ifdef __i386__ static short next_bios_ppc = 0; #endif struct ppc_data *ppc; - device_t parent; int error; u_long port; #ifdef PC98 @@ -1850,14 +1851,6 @@ ppc_probe(device_t dev) unsigned int tmp; #endif - parent = device_get_parent(dev); - - error = ISA_PNP_PROBE(parent, dev, lpc_ids); - if (error == ENXIO) - return (ENXIO); - else if (error != 0) /* XXX shall be set after detection */ - device_set_desc(dev, "Parallel port"); - /* * Allocate the ppc_data structure. */ @@ -2021,7 +2014,7 @@ error: return (ENXIO); } -static int +int ppc_attach(device_t dev) { struct ppc_data *ppc = DEVTOSOFTC(dev); @@ -2066,7 +2059,7 @@ ppc_attach(device_t dev) return (0); } -static u_char +u_char ppc_io(device_t ppcdev, int iop, u_char *addr, int cnt, u_char byte) { struct ppc_data *ppc = DEVTOSOFTC(ppcdev); @@ -2132,7 +2125,7 @@ ppc_io(device_t ppcdev, int iop, u_char *addr, int cnt, u_char byte) return (0); /* not significative */ } -static int +int ppc_read_ivar(device_t bus, device_t dev, int index, uintptr_t *val) { struct ppc_data *ppc = (struct ppc_data *)device_get_softc(bus); @@ -2155,7 +2148,7 @@ ppc_read_ivar(device_t bus, device_t dev, int index, uintptr_t *val) * Resource is useless here since ppbus devices' interrupt handlers are * multiplexed to the same resource initially allocated by ppc */ -static int +int ppc_setup_intr(device_t bus, device_t child, struct resource *r, int flags, void (*ihand)(void *), void *arg, void **cookiep) { @@ -2186,7 +2179,7 @@ ppc_setup_intr(device_t bus, device_t child, struct resource *r, int flags, * When no underlying device has a registered interrupt, register the ppc * layer one */ -static int +int ppc_teardown_intr(device_t bus, device_t child, struct resource *r, void *ih) { int error; diff --git a/sys/pc98/pc98/ppc.c b/sys/pc98/pc98/ppc.c index c3fe93d..af78af8 100644 --- a/sys/pc98/pc98/ppc.c +++ b/sys/pc98/pc98/ppc.c @@ -51,45 +51,30 @@ #include <dev/ppbus/ppbconf.h> #include <dev/ppbus/ppb_msq.h> +#include <dev/ppc/ppcvar.h> #ifdef PC98 #include <pc98/pc98/ppcreg.h> #else -#include <isa/ppcreg.h> +#include <dev/ppc/ppcreg.h> #endif #include "ppbus_if.h" -#define LOG_PPC(function, ppc, string) \ - if (bootverbose) printf("%s: %s\n", function, string) - - -#define DEVTOSOFTC(dev) ((struct ppc_data *)device_get_softc(dev)) - -devclass_t ppc_devclass; - -static int ppc_probe(device_t dev); -static int ppc_attach(device_t dev); -static int ppc_read_ivar(device_t bus, device_t dev, int index, uintptr_t *val); +static int ppc_cbus_probe(device_t dev); -static void ppc_reset_epp(device_t); -static void ppc_ecp_sync(device_t); static void ppcintr(void *arg); -static int ppc_exec_microseq(device_t, struct ppb_microseq **); -static int ppc_setmode(device_t, int); +#define LOG_PPC(function, ppc, string) \ + if (bootverbose) printf("%s: %s\n", function, string) -static int ppc_read(device_t, char *, int, int); -static int ppc_write(device_t, char *, int, int); -static u_char ppc_io(device_t, int, u_char *, int, u_char); +#define DEVTOSOFTC(dev) ((struct ppc_data *)device_get_softc(dev)) -static int ppc_setup_intr(device_t, device_t, struct resource *, int, - void (*)(void *), void *, void **); -static int ppc_teardown_intr(device_t, device_t, struct resource *, void *); +devclass_t ppc_devclass; static device_method_t ppc_methods[] = { /* device interface */ - DEVMETHOD(device_probe, ppc_probe), + DEVMETHOD(device_probe, ppc_cbus_probe), DEVMETHOD(device_attach, ppc_attach), /* bus interface */ @@ -115,7 +100,7 @@ static driver_t ppc_driver = { ppc_methods, sizeof(struct ppc_data), }; - + static char *ppc_models[] = { "SMC-like", "SMC FDC37C665GT", "SMC FDC37C666GT", "PC87332", "PC87306", "82091AA", "Generic", "W83877F", "W83877AF", "Winbond", "PC87334", @@ -154,7 +139,7 @@ static char *ppc_epp_protocol[] = { " (EPP 1.9)", " (EPP 1.7)", 0 }; /* * ppc_ecp_sync() XXX */ -static void +void ppc_ecp_sync(device_t dev) { int i, r; @@ -1344,7 +1329,7 @@ ppc_detect(struct ppc_data *ppc, int chipset_mode) { * Execute a microsequence. * Microsequence mechanism is supposed to handle fast I/O operations. */ -static int +int ppc_exec_microseq(device_t dev, struct ppb_microseq **p_msq) { struct ppc_data *ppc = DEVTOSOFTC(dev); @@ -1631,7 +1616,7 @@ ppcintr(void *arg) return; } -static int +int ppc_read(device_t dev, char *buf, int len, int mode) { return (EINVAL); @@ -1644,7 +1629,7 @@ ppc_read(device_t dev, char *buf, int len, int mode) * If what you want is not possible (no ECP, no DMA...), * EINVAL is returned */ -static int +int ppc_write(device_t dev, char *buf, int len, int how) { struct ppc_data *ppc = DEVTOSOFTC(dev); @@ -1796,7 +1781,7 @@ error: return (error); } -static void +void ppc_reset_epp(device_t dev) { struct ppc_data *ppc = DEVTOSOFTC(dev); @@ -1806,7 +1791,7 @@ ppc_reset_epp(device_t dev) return; } -static int +int ppc_setmode(device_t dev, int mode) { struct ppc_data *ppc = DEVTOSOFTC(dev); @@ -1833,13 +1818,29 @@ static struct isa_pnp_id lpc_ids[] = { }; static int +ppc_cbus_probe(device_t dev) +{ + device_t parent; + int error; + + parent = device_get_parent(dev); + + error = ISA_PNP_PROBE(parent, dev, lpc_ids); + if (error == ENXIO) + return (ENXIO); + else if (error != 0) /* XXX shall be set after detection */ + device_set_desc(dev, "Parallel port"); + + return(ppc_probe(dev)); +} + +int ppc_probe(device_t dev) { #ifdef __i386__ static short next_bios_ppc = 0; #endif struct ppc_data *ppc; - device_t parent; int error; u_long port; #ifdef PC98 @@ -1850,14 +1851,6 @@ ppc_probe(device_t dev) unsigned int tmp; #endif - parent = device_get_parent(dev); - - error = ISA_PNP_PROBE(parent, dev, lpc_ids); - if (error == ENXIO) - return (ENXIO); - else if (error != 0) /* XXX shall be set after detection */ - device_set_desc(dev, "Parallel port"); - /* * Allocate the ppc_data structure. */ @@ -2021,7 +2014,7 @@ error: return (ENXIO); } -static int +int ppc_attach(device_t dev) { struct ppc_data *ppc = DEVTOSOFTC(dev); @@ -2066,7 +2059,7 @@ ppc_attach(device_t dev) return (0); } -static u_char +u_char ppc_io(device_t ppcdev, int iop, u_char *addr, int cnt, u_char byte) { struct ppc_data *ppc = DEVTOSOFTC(ppcdev); @@ -2132,7 +2125,7 @@ ppc_io(device_t ppcdev, int iop, u_char *addr, int cnt, u_char byte) return (0); /* not significative */ } -static int +int ppc_read_ivar(device_t bus, device_t dev, int index, uintptr_t *val) { struct ppc_data *ppc = (struct ppc_data *)device_get_softc(bus); @@ -2155,7 +2148,7 @@ ppc_read_ivar(device_t bus, device_t dev, int index, uintptr_t *val) * Resource is useless here since ppbus devices' interrupt handlers are * multiplexed to the same resource initially allocated by ppc */ -static int +int ppc_setup_intr(device_t bus, device_t child, struct resource *r, int flags, void (*ihand)(void *), void *arg, void **cookiep) { @@ -2186,7 +2179,7 @@ ppc_setup_intr(device_t bus, device_t child, struct resource *r, int flags, * When no underlying device has a registered interrupt, register the ppc * layer one */ -static int +int ppc_teardown_intr(device_t bus, device_t child, struct resource *r, void *ih) { int error; |