autoconf.c revision 1.80
11.80Saymeric/*	$NetBSD: autoconf.c,v 1.80 2002/01/28 09:56:45 aymeric Exp $	*/
21.25Scgd
31.1Smw/*
41.17Schopps * Copyright (c) 1994 Christian E. Hopps
51.1Smw * All rights reserved.
61.1Smw *
71.1Smw * Redistribution and use in source and binary forms, with or without
81.1Smw * modification, are permitted provided that the following conditions
91.1Smw * are met:
101.1Smw * 1. Redistributions of source code must retain the above copyright
111.1Smw *    notice, this list of conditions and the following disclaimer.
121.1Smw * 2. Redistributions in binary form must reproduce the above copyright
131.1Smw *    notice, this list of conditions and the following disclaimer in the
141.1Smw *    documentation and/or other materials provided with the distribution.
151.1Smw * 3. All advertising materials mentioning features or use of this software
161.1Smw *    must display the following acknowledgement:
171.17Schopps *      This product includes software developed by Christian E. Hopps.
181.17Schopps * 4. The name of the author may not be used to endorse or promote products
191.17Schopps *    derived from this software without specific prior written permission
201.4Smw *
211.17Schopps * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
221.17Schopps * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
231.17Schopps * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
241.17Schopps * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
251.17Schopps * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
261.17Schopps * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
271.17Schopps * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
281.17Schopps * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
291.17Schopps * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
301.17Schopps * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
311.1Smw */
321.80Saymeric
331.80Saymeric#include <sys/cdefs.h>
341.80Saymeric__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.80 2002/01/28 09:56:45 aymeric Exp $");
351.80Saymeric
361.9Schopps#include <sys/param.h>
371.9Schopps#include <sys/systm.h>
381.17Schopps#include <sys/reboot.h>
391.9Schopps#include <sys/conf.h>
401.46Sthorpej#include <sys/buf.h>
411.17Schopps#include <sys/device.h>
421.17Schopps#include <sys/disklabel.h>
431.46Sthorpej#include <sys/disk.h>
441.19Schopps#include <machine/cpu.h>
451.17Schopps#include <amiga/amiga/cfdev.h>
461.17Schopps#include <amiga/amiga/device.h>
471.9Schopps#include <amiga/amiga/custom.h>
481.1Smw
491.79Saymericstatic void findroot(void);
501.79Saymericvoid mbattach(struct device *, struct device *, void *);
511.79Saymericint mbprint(void *, const char *);
521.79Saymericint mbmatch(struct device *, struct cfdata *, void *);
531.11Schopps
541.17Schopps#include <sys/kernel.h>
551.46Sthorpej
561.47Smhitchu_long boot_partition;
571.74Smattstruct device *booted_device;
581.74Smattint booted_partition;
591.46Sthorpej
601.1Smw/*
611.17Schopps * called at boot time, configure all devices on system
621.1Smw */
631.11Schoppsvoid
641.65Sthorpejcpu_configure()
651.1Smw{
661.44Sis	int s;
671.62Sis#ifdef DEBUG_KERNEL_START
681.62Sis	int i;
691.62Sis#endif
701.49Sgwr
711.17Schopps	/*
721.17Schopps	 * this is the real thing baby (i.e. not console init)
731.17Schopps	 */
741.17Schopps	amiga_realconfig = 1;
751.36Sis#ifdef DRACO
761.36Sis	if (is_draco()) {
771.36Sis		*draco_intena &= ~DRIRQ_GLOBAL;
781.36Sis	} else
791.36Sis#endif
801.3Smw	custom.intena = INTF_INTEN;
811.44Sis	s = splhigh();
821.1Smw
831.31Scgd	if (config_rootfound("mainbus", "mainbus") == NULL)
841.17Schopps		panic("no mainbus found");
851.36Sis
861.39Sis#ifdef DEBUG_KERNEL_START
871.43Schristos	printf("survived autoconf, going to enable interrupts\n");
881.39Sis#endif
891.79Saymeric
901.36Sis#ifdef DRACO
911.36Sis	if (is_draco()) {
921.36Sis		*draco_intena |= DRIRQ_GLOBAL;
931.36Sis		/* softints always enabled */
941.36Sis	} else
951.36Sis#endif
961.36Sis	{
971.36Sis		custom.intena = INTF_SETCLR | INTF_INTEN;
981.28Schopps
991.36Sis		/* also enable hardware aided software interrupts */
1001.36Sis		custom.intena = INTF_SETCLR | INTF_SOFTINT;
1011.36Sis	}
1021.39Sis#ifdef DEBUG_KERNEL_START
1031.62Sis	for (i=splhigh(); i>=s ;i-=0x100) {
1041.62Sis		splx(i);
1051.62Sis		printf("%d...", (i>>8) & 7);
1061.62Sis	}
1071.43Schristos	printf("survived interrupt enable\n");
1081.62Sis#else
1091.62Sis	splx(s);
1101.39Sis#endif
1111.63Sthorpej#ifdef DEBUG_KERNEL_START
1121.63Sthorpej	printf("survived configure...\n");
1131.63Sthorpej#endif
1141.49Sgwr}
1151.49Sgwr
1161.49Sgwrvoid
1171.49Sgwrcpu_rootconf()
1181.49Sgwr{
1191.77Sfrueauf	findroot();
1201.39Sis#ifdef DEBUG_KERNEL_START
1211.46Sthorpej	printf("survived findroot()\n");
1221.39Sis#endif
1231.64Sthorpej	setroot(booted_device, booted_partition);
1241.39Sis#ifdef DEBUG_KERNEL_START
1251.43Schristos	printf("survived setroot()\n");
1261.1Smw#endif
1271.17Schopps}
1281.3Smw
1291.17Schopps/*ARGSUSED*/
1301.17Schoppsint
1311.17Schoppssimple_devprint(auxp, pnp)
1321.17Schopps	void *auxp;
1331.42Smhitch	const char *pnp;
1341.17Schopps{
1351.17Schopps	return(QUIET);
1361.1Smw}
1371.1Smw
1381.17Schoppsint
1391.17Schoppsmatchname(fp, sp)
1401.17Schopps	char *fp, *sp;
1411.17Schopps{
1421.17Schopps	int len;
1431.1Smw
1441.17Schopps	len = strlen(fp);
1451.17Schopps	if (strlen(sp) != len)
1461.17Schopps		return(0);
1471.17Schopps	if (bcmp(fp, sp, len) == 0)
1481.17Schopps		return(1);
1491.17Schopps	return(0);
1501.17Schopps}
1511.1Smw
1521.17Schopps/*
1531.17Schopps * use config_search to find appropriate device, then call that device
1541.79Saymeric * directly with NULL device variable storage.  A device can then
1551.79Saymeric * always tell the difference betwean the real and console init
1561.17Schopps * by checking for NULL.
1571.17Schopps */
1581.11Schoppsint
1591.17Schoppsamiga_config_found(pcfp, pdp, auxp, pfn)
1601.17Schopps	struct cfdata *pcfp;
1611.17Schopps	struct device *pdp;
1621.17Schopps	void *auxp;
1631.17Schopps	cfprint_t pfn;
1641.1Smw{
1651.17Schopps	struct device temp;
1661.17Schopps	struct cfdata *cf;
1671.17Schopps
1681.17Schopps	if (amiga_realconfig)
1691.31Scgd		return(config_found(pdp, auxp, pfn) != NULL);
1701.17Schopps
1711.17Schopps	if (pdp == NULL)
1721.17Schopps		pdp = &temp;
1731.17Schopps
1741.17Schopps	pdp->dv_cfdata = pcfp;
1751.17Schopps	if ((cf = config_search((cfmatch_t)NULL, pdp, auxp)) != NULL) {
1761.30Sthorpej		cf->cf_attach->ca_attach(pdp, NULL, auxp);
1771.17Schopps		pdp->dv_cfdata = NULL;
1781.17Schopps		return(1);
1791.1Smw	}
1801.17Schopps	pdp->dv_cfdata = NULL;
1811.17Schopps	return(0);
1821.17Schopps}
1831.17Schopps
1841.17Schopps/*
1851.17Schopps * this function needs to get enough configured to do a console
1861.79Saymeric * basically this means start attaching the grfxx's that support
1871.17Schopps * the console. Kinda hacky but it works.
1881.17Schopps */
1891.32Sveegovoid
1901.17Schoppsconfig_console()
1911.79Saymeric{
1921.17Schopps	struct cfdata *cf;
1931.36Sis
1941.17Schopps	/*
1951.17Schopps	 * we need mainbus' cfdata.
1961.17Schopps	 */
1971.17Schopps	cf = config_rootsearch(NULL, "mainbus", "mainbus");
1981.36Sis	if (cf == NULL) {
1991.17Schopps		panic("no mainbus");
2001.36Sis	}
2011.1Smw	/*
2021.44Sis	 * delay clock calibration.
2031.44Sis	 */
2041.44Sis	amiga_config_found(cf, NULL, "clock", NULL);
2051.44Sis
2061.44Sis	/*
2071.17Schopps	 * internal grf.
2081.1Smw	 */
2091.36Sis#ifdef DRACO
2101.36Sis	if (!(is_draco()))
2111.36Sis#endif
2121.36Sis		amiga_config_found(cf, NULL, "grfcc", NULL);
2131.67Saymeric
2141.1Smw	/*
2151.27Schopps	 * zbus knows when its not for real and will
2161.21Schopps	 * only configure the appropriate hardware
2171.1Smw	 */
2181.27Schopps	amiga_config_found(cf, NULL, "zbus", NULL);
2191.1Smw}
2201.1Smw
2211.79Saymeric/*
2221.79Saymeric * mainbus driver
2231.17Schopps */
2241.30Sthorpejstruct cfattach mainbus_ca = {
2251.30Sthorpej	sizeof(struct device), mbmatch, mbattach
2261.17Schopps};
2271.17Schopps
2281.11Schoppsint
2291.45Sveegombmatch(pdp, cfp, auxp)
2301.45Sveego	struct device	*pdp;
2311.45Sveego	struct cfdata	*cfp;
2321.45Sveego	void		*auxp;
2331.1Smw{
2341.72Sis#if 0	/*
2351.72Sis	 * XXX is this right? but we need to be found twice
2361.72Sis	 * (early console init hack)
2371.72Sis	 */
2381.71Skleink	static int mainbus_matched = 0;
2391.30Sthorpej
2401.71Skleink	/* Allow only one instance. */
2411.71Skleink	if (mainbus_matched)
2421.71Skleink		return (0);
2431.71Skleink
2441.71Skleink	mainbus_matched = 1;
2451.72Sis#endif
2461.71Skleink	return (1);
2471.1Smw}
2481.1Smw
2491.1Smw/*
2501.17Schopps * "find" all the things that should be there.
2511.1Smw */
2521.11Schoppsvoid
2531.17Schoppsmbattach(pdp, dp, auxp)
2541.17Schopps	struct device *pdp, *dp;
2551.17Schopps	void *auxp;
2561.1Smw{
2571.43Schristos	printf("\n");
2581.17Schopps	config_found(dp, "clock", simple_devprint);
2591.52Sis	if (is_a3000() || is_a4000()) {
2601.52Sis		config_found(dp, "a34kbbc", simple_devprint);
2611.58Sis	} else
2621.53Sis#ifdef DRACO
2631.58Sis	if (!is_draco())
2641.53Sis#endif
2651.58Sis	{
2661.52Sis		config_found(dp, "a2kbbc", simple_devprint);
2671.52Sis	}
2681.36Sis#ifdef DRACO
2691.36Sis	if (is_draco()) {
2701.52Sis		config_found(dp, "drbbc", simple_devprint);
2711.36Sis		config_found(dp, "kbd", simple_devprint);
2721.36Sis		config_found(dp, "drsc", simple_devprint);
2731.55Sis		config_found(dp, "drsupio", simple_devprint);
2741.79Saymeric	} else
2751.36Sis#endif
2761.36Sis	{
2771.36Sis		config_found(dp, "ser", simple_devprint);
2781.36Sis		config_found(dp, "par", simple_devprint);
2791.36Sis		config_found(dp, "kbd", simple_devprint);
2801.36Sis		config_found(dp, "ms", simple_devprint);
2811.36Sis		config_found(dp, "grfcc", simple_devprint);
2821.78Sis		config_found(dp, "amidisplaycc", simple_devprint);
2831.36Sis		config_found(dp, "fdc", simple_devprint);
2841.36Sis	}
2851.69Smhitch	if (is_a4000() || is_a1200()) {
2861.69Smhitch		config_found(dp, "wdc", simple_devprint);
2871.23Schopps		config_found(dp, "idesc", simple_devprint);
2881.69Smhitch	}
2891.29Schopps	if (is_a4000())			/* Try to configure A4000T SCSI */
2901.29Schopps		config_found(dp, "afsc", simple_devprint);
2911.17Schopps	if (is_a3000())
2921.17Schopps		config_found(dp, "ahsc", simple_devprint);
2931.67Saymeric	if (/*is_a600() || */is_a1200())
2941.67Saymeric		config_found(dp, "pccard", simple_devprint);
2951.54Sis#ifdef DRACO
2961.54Sis	if (!is_draco())
2971.54Sis#endif
2981.54Sis		config_found(dp, "aucc", simple_devprint);
2991.54Sis
3001.57Sis	config_found(dp, "zbus", simple_devprint);
3011.1Smw}
3021.1Smw
3031.11Schoppsint
3041.17Schoppsmbprint(auxp, pnp)
3051.17Schopps	void *auxp;
3061.40Scgd	const char *pnp;
3071.1Smw{
3081.17Schopps	if (pnp)
3091.43Schristos		printf("%s at %s", (char *)auxp, pnp);
3101.17Schopps	return(UNCONF);
3111.1Smw}
3121.1Smw
3131.46Sthorpej/*
3141.46Sthorpej * The system will assign the "booted device" indicator (and thus
3151.46Sthorpej * rootdev if rootspec is wildcarded) to the first partition 'a'
3161.46Sthorpej * in preference of boot.  However, it does walk unit backwards
3171.46Sthorpej * to remain compatible with the old Amiga method of picking the
3181.46Sthorpej * last root found.
3191.46Sthorpej */
3201.46Sthorpej#include <sys/fcntl.h>		/* XXXX and all that uses it */
3211.46Sthorpej#include <sys/proc.h>		/* XXXX and all that uses it */
3221.17Schopps
3231.46Sthorpej#include "fd.h"
3241.46Sthorpej#include "sd.h"
3251.46Sthorpej#include "cd.h"
3261.67Saymeric#include "wd.h"
3271.1Smw
3281.46Sthorpej#if NFD > 0
3291.46Sthorpejextern  struct cfdriver fd_cd;
3301.46Sthorpej#endif
3311.46Sthorpej#if NSD > 0
3321.69Smhitchextern  struct cfdriver sd_cd;
3331.46Sthorpej#endif
3341.46Sthorpej#if NCD > 0
3351.46Sthorpejextern  struct cfdriver cd_cd;
3361.46Sthorpej#endif
3371.67Saymeric#if NWD > 0
3381.69Smhitchextern  struct cfdriver wd_cd;
3391.67Saymeric#endif
3401.1Smw
3411.46Sthorpejstruct cfdriver *genericconf[] = {
3421.46Sthorpej#if NFD > 0
3431.46Sthorpej	&fd_cd,
3441.46Sthorpej#endif
3451.46Sthorpej#if NSD > 0
3461.46Sthorpej	&sd_cd,
3471.46Sthorpej#endif
3481.69Smhitch#if NWD > 0
3491.69Smhitch	&wd_cd,
3501.69Smhitch#endif
3511.46Sthorpej#if NCD > 0
3521.46Sthorpej	&cd_cd,
3531.46Sthorpej#endif
3541.46Sthorpej	NULL,
3551.1Smw};
3561.1Smw
3571.11Schoppsvoid
3581.76Smattfindroot(void)
3591.1Smw{
3601.46Sthorpej	struct disk *dkp;
3611.46Sthorpej	struct partition *pp;
3621.46Sthorpej	struct device **devs;
3631.46Sthorpej	int i, maj, unit;
3641.47Smhitch
3651.47Smhitch#if NSD > 0
3661.47Smhitch	/*
3671.47Smhitch	 * If we have the boot partition offset (boot_partition), try
3681.47Smhitch	 * to locate the device corresponding to that partition.
3691.47Smhitch	 */
3701.56Sis#ifdef DEBUG_KERNEL_START
3711.56Sis	printf("Boot partition offset is %ld\n", boot_partition);
3721.56Sis#endif
3731.47Smhitch	if (boot_partition != 0) {
3741.47Smhitch	 	struct bdevsw *bdp;
3751.54Sis		int i;
3761.47Smhitch
3771.47Smhitch		for (unit = 0; unit < sd_cd.cd_ndevs; ++unit) {
3781.56Sis#ifdef DEBUG_KERNEL_START
3791.56Sis			printf("probing for sd%d\n", unit);
3801.56Sis#endif
3811.47Smhitch			if (sd_cd.cd_devs[unit] == NULL)
3821.47Smhitch				continue;
3831.47Smhitch
3841.47Smhitch			/*
3851.47Smhitch			 * Find the disk corresponding to the current
3861.47Smhitch			 * device.
3871.47Smhitch			 */
3881.47Smhitch			devs = (struct device **)sd_cd.cd_devs;
3891.47Smhitch			if ((dkp = disk_find(devs[unit]->dv_xname)) == NULL)
3901.47Smhitch				continue;
3911.47Smhitch
3921.47Smhitch			if (dkp->dk_driver == NULL ||
3931.47Smhitch			    dkp->dk_driver->d_strategy == NULL)
3941.47Smhitch				continue;
3951.47Smhitch			for (bdp = bdevsw; bdp < (bdevsw + nblkdev); bdp++)
3961.47Smhitch				if (bdp->d_strategy ==
3971.47Smhitch				    dkp->dk_driver->d_strategy)
3981.47Smhitch					break;
3991.56Sis			if (bdp->d_open(MAKEDISKDEV(4, unit, RAW_PART),
4001.47Smhitch			    FREAD | FNONBLOCK, 0, curproc))
4011.47Smhitch				continue;
4021.56Sis			bdp->d_close(MAKEDISKDEV(4, unit, RAW_PART),
4031.47Smhitch			    FREAD | FNONBLOCK, 0, curproc);
4041.47Smhitch			pp = &dkp->dk_label->d_partitions[0];
4051.54Sis			for (i = 0; i < dkp->dk_label->d_npartitions;
4061.54Sis			    i++, pp++) {
4071.56Sis#ifdef DEBUG_KERNEL_START
4081.56Sis				printf("sd%d%c type %d offset %d size %d\n",
4091.56Sis					unit, i+'a', pp->p_fstype,
4101.56Sis					pp->p_offset, pp->p_size);
4111.56Sis#endif
4121.54Sis				if (pp->p_size == 0 ||
4131.54Sis				    (pp->p_fstype != FS_BSDFFS &&
4141.54Sis				    pp->p_fstype != FS_SWAP))
4151.54Sis					continue;
4161.54Sis				if (pp->p_offset == boot_partition) {
4171.76Smatt					if (booted_device == NULL) {
4181.76Smatt						booted_device = devs[unit];
4191.76Smatt						booted_partition = i;
4201.54Sis					} else
4211.54Sis						printf("Ambiguous boot device\n");
4221.54Sis				}
4231.47Smhitch			}
4241.47Smhitch		}
4251.47Smhitch	}
4261.76Smatt	if (booted_device != NULL)
4271.47Smhitch		return;		/* we found the boot device */
4281.47Smhitch#endif
4291.46Sthorpej
4301.46Sthorpej	for (i = 0; genericconf[i] != NULL; i++) {
4311.46Sthorpej		for (unit = genericconf[i]->cd_ndevs - 1; unit >= 0; unit--) {
4321.46Sthorpej			if (genericconf[i]->cd_devs[unit] == NULL)
4331.46Sthorpej				continue;
4341.46Sthorpej
4351.46Sthorpej			/*
4361.46Sthorpej			 * Find the disk structure corresponding to the
4371.46Sthorpej			 * current device.
4381.46Sthorpej			 */
4391.46Sthorpej			devs = (struct device **)genericconf[i]->cd_devs;
4401.46Sthorpej			if ((dkp = disk_find(devs[unit]->dv_xname)) == NULL)
4411.46Sthorpej				continue;
4421.46Sthorpej
4431.46Sthorpej			if (dkp->dk_driver == NULL ||
4441.46Sthorpej			    dkp->dk_driver->d_strategy == NULL)
4451.46Sthorpej				continue;
4461.46Sthorpej
4471.46Sthorpej			for (maj = 0; maj < nblkdev; maj++)
4481.46Sthorpej				if (bdevsw[maj].d_strategy ==
4491.46Sthorpej				    dkp->dk_driver->d_strategy)
4501.46Sthorpej					break;
4511.46Sthorpej#ifdef DIAGNOSTIC
4521.46Sthorpej			if (maj >= nblkdev)
4531.46Sthorpej				panic("findroot: impossible");
4541.46Sthorpej#endif
4551.46Sthorpej
4561.46Sthorpej			/* Open disk; forces read of disklabel. */
4571.46Sthorpej			if ((*bdevsw[maj].d_open)(MAKEDISKDEV(maj,
4581.46Sthorpej			    unit, 0), FREAD|FNONBLOCK, 0, &proc0))
4591.46Sthorpej				continue;
4601.48Smhitch			(void)(*bdevsw[maj].d_close)(MAKEDISKDEV(maj,
4611.46Sthorpej			    unit, 0), FREAD|FNONBLOCK, 0, &proc0);
4621.46Sthorpej
4631.46Sthorpej			pp = &dkp->dk_label->d_partitions[0];
4641.46Sthorpej			if (pp->p_size != 0 && pp->p_fstype == FS_BSDFFS) {
4651.76Smatt				booted_device = devs[unit];
4661.76Smatt				booted_partition = 0;
4671.46Sthorpej				return;
4681.46Sthorpej			}
4691.1Smw		}
4701.1Smw	}
4711.3Smw}
4721.17Schopps
4731.11Schopps/*
4741.11Schopps * Try to determine, of this machine is an A3000, which has a builtin
4751.11Schopps * realtime clock and scsi controller, so that this hardware is only
4761.11Schopps * included as "configured" if this IS an A3000
4771.11Schopps */
4781.5Smw
4791.5Smwint a3000_flag = 1;		/* patchable */
4801.5Smw#ifdef A4000
4811.5Smwint a4000_flag = 1;		/* patchable - default to A4000 */
4821.5Smw#else
4831.5Smwint a4000_flag = 0;		/* patchable */
4841.5Smw#endif
4851.5Smw
4861.3Smwint
4871.11Schoppsis_a3000()
4881.3Smw{
4891.11Schopps	/* this is a dirty kludge.. but how do you do this RIGHT ? :-) */
4901.22Schopps	extern long boot_fphystart;
4911.11Schopps	short sc;
4921.11Schopps
4931.19Schopps	if ((machineid >> 16) == 3000)
4941.19Schopps		return (1);			/* It's an A3000 */
4951.19Schopps	if (machineid >> 16)
4961.19Schopps		return (0);			/* It's not an A3000 */
4971.19Schopps	/* Machine type is unknown, so try to guess it */
4981.11Schopps	/* where is fastram on the A4000 ?? */
4991.11Schopps	/* if fastram is below 0x07000000, assume it's not an A3000 */
5001.22Schopps	if (boot_fphystart < 0x07000000)
5011.17Schopps		return(0);
5021.11Schopps	/*
5031.11Schopps	 * OK, fastram starts at or above 0x07000000, check specific
5041.11Schopps	 * machines
5051.11Schopps	 */
5061.17Schopps	for (sc = 0; sc < ncfdev; sc++) {
5071.17Schopps		switch (cfdev[sc].rom.manid) {
5081.17Schopps		case 2026:		/* Progressive Peripherals, Inc */
5091.17Schopps			switch (cfdev[sc].rom.prodid) {
5101.17Schopps			case 0:		/* PPI Mercury - A3000 */
5111.17Schopps			case 1:		/* PP&S A3000 '040 */
5121.17Schopps				return(1);
5131.17Schopps			case 150:	/* PPI Zeus - it's an A2000 */
5141.17Schopps			case 105:	/* PP&S A2000 '040 */
5151.17Schopps			case 187:	/* PP&S A500 '040 */
5161.17Schopps				return(0);
5171.11Schopps			}
5181.11Schopps			break;
5191.3Smw
5201.17Schopps		case 2112:			/* IVS */
5211.17Schopps			switch (cfdev[sc].rom.prodid) {
5221.17Schopps			case 242:
5231.17Schopps				return(0);	/* A2000 accelerator? */
5241.11Schopps			}
5251.11Schopps			break;
5261.11Schopps		}
5271.11Schopps	}
5281.17Schopps	return (a3000_flag);		/* XXX let flag tell now */
5291.5Smw}
5301.5Smw
5311.5Smwint
5321.11Schoppsis_a4000()
5331.5Smw{
5341.19Schopps	if ((machineid >> 16) == 4000)
5351.19Schopps		return (1);		/* It's an A4000 */
5361.24Schopps	if ((machineid >> 16) == 1200)
5371.24Schopps		return (0);		/* It's an A1200, so not A4000 */
5381.36Sis#ifdef DRACO
5391.36Sis	if (is_draco())
5401.36Sis		return (0);
5411.36Sis#endif
5421.24Schopps	/* Do I need this any more? */
5431.19Schopps	if ((custom.deniseid & 0xff) == 0xf8)
5441.19Schopps		return (1);
5451.19Schopps#ifdef DEBUG
5461.19Schopps	if (a4000_flag)
5471.43Schristos		printf("Denise ID = %04x\n", (unsigned short)custom.deniseid);
5481.19Schopps#endif
5491.19Schopps	if (machineid >> 16)
5501.19Schopps		return (0);		/* It's not an A4000 */
5511.19Schopps	return (a4000_flag);		/* Machine type not set */
5521.24Schopps}
5531.24Schopps
5541.24Schoppsint
5551.24Schoppsis_a1200()
5561.24Schopps{
5571.24Schopps	if ((machineid >> 16) == 1200)
5581.24Schopps		return (1);		/* It's an A1200 */
5591.24Schopps	return (0);			/* Machine type not set */
5601.1Smw}
561