autoconf.c revision 1.74
11.74Smatt/*	$NetBSD: autoconf.c,v 1.74 2000/06/01 00:49:51 matt 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.9Schopps#include <sys/param.h>
331.9Schopps#include <sys/systm.h>
341.17Schopps#include <sys/reboot.h>
351.9Schopps#include <sys/conf.h>
361.46Sthorpej#include <sys/buf.h>
371.17Schopps#include <sys/device.h>
381.17Schopps#include <sys/disklabel.h>
391.46Sthorpej#include <sys/disk.h>
401.19Schopps#include <machine/cpu.h>
411.17Schopps#include <amiga/amiga/cfdev.h>
421.17Schopps#include <amiga/amiga/device.h>
431.9Schopps#include <amiga/amiga/custom.h>
441.1Smw
451.46Sthorpejvoid findroot __P((struct device **, int *));
461.17Schoppsvoid mbattach __P((struct device *, struct device *, void *));
471.40Scgdint mbprint __P((void *, const char *));
481.45Sveegoint mbmatch __P((struct device *, struct cfdata *, void *));
491.11Schopps
501.17Schopps#include <sys/kernel.h>
511.46Sthorpej
521.47Smhitchu_long boot_partition;
531.74Smattstruct device *booted_device;
541.74Smattint booted_partition;
551.46Sthorpej
561.1Smw/*
571.17Schopps * called at boot time, configure all devices on system
581.1Smw */
591.11Schoppsvoid
601.65Sthorpejcpu_configure()
611.1Smw{
621.44Sis	int s;
631.62Sis#ifdef DEBUG_KERNEL_START
641.62Sis	int i;
651.62Sis#endif
661.49Sgwr
671.17Schopps	/*
681.17Schopps	 * this is the real thing baby (i.e. not console init)
691.17Schopps	 */
701.17Schopps	amiga_realconfig = 1;
711.36Sis#ifdef DRACO
721.36Sis	if (is_draco()) {
731.36Sis		*draco_intena &= ~DRIRQ_GLOBAL;
741.36Sis	} else
751.36Sis#endif
761.3Smw	custom.intena = INTF_INTEN;
771.44Sis	s = splhigh();
781.1Smw
791.31Scgd	if (config_rootfound("mainbus", "mainbus") == NULL)
801.17Schopps		panic("no mainbus found");
811.36Sis
821.39Sis#ifdef DEBUG_KERNEL_START
831.43Schristos	printf("survived autoconf, going to enable interrupts\n");
841.39Sis#endif
851.11Schopps
861.36Sis#ifdef DRACO
871.36Sis	if (is_draco()) {
881.36Sis		*draco_intena |= DRIRQ_GLOBAL;
891.36Sis		/* softints always enabled */
901.36Sis	} else
911.36Sis#endif
921.36Sis	{
931.36Sis		custom.intena = INTF_SETCLR | INTF_INTEN;
941.28Schopps
951.36Sis		/* also enable hardware aided software interrupts */
961.36Sis		custom.intena = INTF_SETCLR | INTF_SOFTINT;
971.36Sis	}
981.39Sis#ifdef DEBUG_KERNEL_START
991.62Sis	for (i=splhigh(); i>=s ;i-=0x100) {
1001.62Sis		splx(i);
1011.62Sis		printf("%d...", (i>>8) & 7);
1021.62Sis	}
1031.43Schristos	printf("survived interrupt enable\n");
1041.62Sis#else
1051.62Sis	splx(s);
1061.39Sis#endif
1071.63Sthorpej#ifdef DEBUG_KERNEL_START
1081.63Sthorpej	printf("survived configure...\n");
1091.63Sthorpej#endif
1101.49Sgwr}
1111.49Sgwr
1121.49Sgwrvoid
1131.49Sgwrcpu_rootconf()
1141.49Sgwr{
1151.46Sthorpej	findroot(&booted_device, &booted_partition);
1161.39Sis#ifdef DEBUG_KERNEL_START
1171.46Sthorpej	printf("survived findroot()\n");
1181.39Sis#endif
1191.64Sthorpej	setroot(booted_device, booted_partition);
1201.39Sis#ifdef DEBUG_KERNEL_START
1211.43Schristos	printf("survived setroot()\n");
1221.1Smw#endif
1231.17Schopps}
1241.3Smw
1251.17Schopps/*ARGSUSED*/
1261.17Schoppsint
1271.17Schoppssimple_devprint(auxp, pnp)
1281.17Schopps	void *auxp;
1291.42Smhitch	const char *pnp;
1301.17Schopps{
1311.17Schopps	return(QUIET);
1321.1Smw}
1331.1Smw
1341.17Schoppsint
1351.17Schoppsmatchname(fp, sp)
1361.17Schopps	char *fp, *sp;
1371.17Schopps{
1381.17Schopps	int len;
1391.1Smw
1401.17Schopps	len = strlen(fp);
1411.17Schopps	if (strlen(sp) != len)
1421.17Schopps		return(0);
1431.17Schopps	if (bcmp(fp, sp, len) == 0)
1441.17Schopps		return(1);
1451.17Schopps	return(0);
1461.17Schopps}
1471.1Smw
1481.17Schopps/*
1491.17Schopps * use config_search to find appropriate device, then call that device
1501.17Schopps * directly with NULL device variable storage.  A device can then
1511.17Schopps * always tell the difference betwean the real and console init
1521.17Schopps * by checking for NULL.
1531.17Schopps */
1541.11Schoppsint
1551.17Schoppsamiga_config_found(pcfp, pdp, auxp, pfn)
1561.17Schopps	struct cfdata *pcfp;
1571.17Schopps	struct device *pdp;
1581.17Schopps	void *auxp;
1591.17Schopps	cfprint_t pfn;
1601.1Smw{
1611.17Schopps	struct device temp;
1621.17Schopps	struct cfdata *cf;
1631.17Schopps
1641.17Schopps	if (amiga_realconfig)
1651.31Scgd		return(config_found(pdp, auxp, pfn) != NULL);
1661.17Schopps
1671.17Schopps	if (pdp == NULL)
1681.17Schopps		pdp = &temp;
1691.17Schopps
1701.17Schopps	pdp->dv_cfdata = pcfp;
1711.17Schopps	if ((cf = config_search((cfmatch_t)NULL, pdp, auxp)) != NULL) {
1721.30Sthorpej		cf->cf_attach->ca_attach(pdp, NULL, auxp);
1731.17Schopps		pdp->dv_cfdata = NULL;
1741.17Schopps		return(1);
1751.1Smw	}
1761.17Schopps	pdp->dv_cfdata = NULL;
1771.17Schopps	return(0);
1781.17Schopps}
1791.17Schopps
1801.17Schopps/*
1811.17Schopps * this function needs to get enough configured to do a console
1821.17Schopps * basically this means start attaching the grfxx's that support
1831.17Schopps * the console. Kinda hacky but it works.
1841.17Schopps */
1851.32Sveegovoid
1861.17Schoppsconfig_console()
1871.17Schopps{
1881.17Schopps	struct cfdata *cf;
1891.36Sis
1901.17Schopps	/*
1911.17Schopps	 * we need mainbus' cfdata.
1921.17Schopps	 */
1931.17Schopps	cf = config_rootsearch(NULL, "mainbus", "mainbus");
1941.36Sis	if (cf == NULL) {
1951.17Schopps		panic("no mainbus");
1961.36Sis	}
1971.1Smw	/*
1981.44Sis	 * delay clock calibration.
1991.44Sis	 */
2001.44Sis	amiga_config_found(cf, NULL, "clock", NULL);
2011.44Sis
2021.44Sis	/*
2031.17Schopps	 * internal grf.
2041.1Smw	 */
2051.36Sis#ifdef DRACO
2061.36Sis	if (!(is_draco()))
2071.36Sis#endif
2081.36Sis		amiga_config_found(cf, NULL, "grfcc", NULL);
2091.67Saymeric
2101.1Smw	/*
2111.27Schopps	 * zbus knows when its not for real and will
2121.21Schopps	 * only configure the appropriate hardware
2131.1Smw	 */
2141.27Schopps	amiga_config_found(cf, NULL, "zbus", NULL);
2151.1Smw}
2161.1Smw
2171.17Schopps/*
2181.17Schopps * mainbus driver
2191.17Schopps */
2201.30Sthorpejstruct cfattach mainbus_ca = {
2211.30Sthorpej	sizeof(struct device), mbmatch, mbattach
2221.17Schopps};
2231.17Schopps
2241.11Schoppsint
2251.45Sveegombmatch(pdp, cfp, auxp)
2261.45Sveego	struct device	*pdp;
2271.45Sveego	struct cfdata	*cfp;
2281.45Sveego	void		*auxp;
2291.1Smw{
2301.72Sis#if 0	/*
2311.72Sis	 * XXX is this right? but we need to be found twice
2321.72Sis	 * (early console init hack)
2331.72Sis	 */
2341.71Skleink	static int mainbus_matched = 0;
2351.30Sthorpej
2361.71Skleink	/* Allow only one instance. */
2371.71Skleink	if (mainbus_matched)
2381.71Skleink		return (0);
2391.71Skleink
2401.71Skleink	mainbus_matched = 1;
2411.72Sis#endif
2421.71Skleink	return (1);
2431.1Smw}
2441.1Smw
2451.1Smw/*
2461.17Schopps * "find" all the things that should be there.
2471.1Smw */
2481.11Schoppsvoid
2491.17Schoppsmbattach(pdp, dp, auxp)
2501.17Schopps	struct device *pdp, *dp;
2511.17Schopps	void *auxp;
2521.1Smw{
2531.43Schristos	printf("\n");
2541.17Schopps	config_found(dp, "clock", simple_devprint);
2551.52Sis	if (is_a3000() || is_a4000()) {
2561.52Sis		config_found(dp, "a34kbbc", simple_devprint);
2571.58Sis	} else
2581.53Sis#ifdef DRACO
2591.58Sis	if (!is_draco())
2601.53Sis#endif
2611.58Sis	{
2621.52Sis		config_found(dp, "a2kbbc", simple_devprint);
2631.52Sis	}
2641.36Sis#ifdef DRACO
2651.36Sis	if (is_draco()) {
2661.52Sis		config_found(dp, "drbbc", simple_devprint);
2671.36Sis		config_found(dp, "kbd", simple_devprint);
2681.36Sis		config_found(dp, "drsc", simple_devprint);
2691.55Sis		config_found(dp, "drsupio", simple_devprint);
2701.36Sis	} else
2711.36Sis#endif
2721.36Sis	{
2731.36Sis		config_found(dp, "ser", simple_devprint);
2741.36Sis		config_found(dp, "par", simple_devprint);
2751.36Sis		config_found(dp, "kbd", simple_devprint);
2761.36Sis		config_found(dp, "ms", simple_devprint);
2771.36Sis		config_found(dp, "grfcc", simple_devprint);
2781.36Sis		config_found(dp, "fdc", simple_devprint);
2791.36Sis	}
2801.69Smhitch	if (is_a4000() || is_a1200()) {
2811.69Smhitch		config_found(dp, "wdc", simple_devprint);
2821.23Schopps		config_found(dp, "idesc", simple_devprint);
2831.69Smhitch	}
2841.29Schopps	if (is_a4000())			/* Try to configure A4000T SCSI */
2851.29Schopps		config_found(dp, "afsc", simple_devprint);
2861.17Schopps	if (is_a3000())
2871.17Schopps		config_found(dp, "ahsc", simple_devprint);
2881.67Saymeric	if (/*is_a600() || */is_a1200())
2891.67Saymeric		config_found(dp, "pccard", simple_devprint);
2901.54Sis#ifdef DRACO
2911.54Sis	if (!is_draco())
2921.54Sis#endif
2931.54Sis		config_found(dp, "aucc", simple_devprint);
2941.54Sis
2951.57Sis	config_found(dp, "zbus", simple_devprint);
2961.1Smw}
2971.1Smw
2981.11Schoppsint
2991.17Schoppsmbprint(auxp, pnp)
3001.17Schopps	void *auxp;
3011.40Scgd	const char *pnp;
3021.1Smw{
3031.17Schopps	if (pnp)
3041.43Schristos		printf("%s at %s", (char *)auxp, pnp);
3051.17Schopps	return(UNCONF);
3061.1Smw}
3071.1Smw
3081.46Sthorpej/*
3091.46Sthorpej * The system will assign the "booted device" indicator (and thus
3101.46Sthorpej * rootdev if rootspec is wildcarded) to the first partition 'a'
3111.46Sthorpej * in preference of boot.  However, it does walk unit backwards
3121.46Sthorpej * to remain compatible with the old Amiga method of picking the
3131.46Sthorpej * last root found.
3141.46Sthorpej */
3151.46Sthorpej#include <sys/fcntl.h>		/* XXXX and all that uses it */
3161.46Sthorpej#include <sys/proc.h>		/* XXXX and all that uses it */
3171.17Schopps
3181.46Sthorpej#include "fd.h"
3191.46Sthorpej#include "sd.h"
3201.46Sthorpej#include "cd.h"
3211.67Saymeric#include "wd.h"
3221.1Smw
3231.46Sthorpej#if NFD > 0
3241.46Sthorpejextern  struct cfdriver fd_cd;
3251.46Sthorpej#endif
3261.46Sthorpej#if NSD > 0
3271.69Smhitchextern  struct cfdriver sd_cd;
3281.46Sthorpej#endif
3291.46Sthorpej#if NCD > 0
3301.46Sthorpejextern  struct cfdriver cd_cd;
3311.46Sthorpej#endif
3321.67Saymeric#if NWD > 0
3331.69Smhitchextern  struct cfdriver wd_cd;
3341.67Saymeric#endif
3351.1Smw
3361.46Sthorpejstruct cfdriver *genericconf[] = {
3371.46Sthorpej#if NFD > 0
3381.46Sthorpej	&fd_cd,
3391.46Sthorpej#endif
3401.46Sthorpej#if NSD > 0
3411.46Sthorpej	&sd_cd,
3421.46Sthorpej#endif
3431.69Smhitch#if NWD > 0
3441.69Smhitch	&wd_cd,
3451.69Smhitch#endif
3461.46Sthorpej#if NCD > 0
3471.46Sthorpej	&cd_cd,
3481.46Sthorpej#endif
3491.46Sthorpej	NULL,
3501.1Smw};
3511.1Smw
3521.11Schoppsvoid
3531.46Sthorpejfindroot(devpp, partp)
3541.46Sthorpej	struct device **devpp;
3551.46Sthorpej	int *partp;
3561.1Smw{
3571.46Sthorpej	struct disk *dkp;
3581.46Sthorpej	struct partition *pp;
3591.46Sthorpej	struct device **devs;
3601.46Sthorpej	int i, maj, unit;
3611.46Sthorpej
3621.1Smw	/*
3631.46Sthorpej	 * Default to "not found".
3641.1Smw	 */
3651.46Sthorpej	*devpp = NULL;
3661.46Sthorpej
3671.46Sthorpej	/* always partition 'a' */
3681.46Sthorpej	*partp = 0;
3691.47Smhitch
3701.47Smhitch#if NSD > 0
3711.47Smhitch	/*
3721.47Smhitch	 * If we have the boot partition offset (boot_partition), try
3731.47Smhitch	 * to locate the device corresponding to that partition.
3741.47Smhitch	 */
3751.56Sis#ifdef DEBUG_KERNEL_START
3761.56Sis	printf("Boot partition offset is %ld\n", boot_partition);
3771.56Sis#endif
3781.47Smhitch	if (boot_partition != 0) {
3791.47Smhitch	 	struct bdevsw *bdp;
3801.54Sis		int i;
3811.47Smhitch
3821.47Smhitch		for (unit = 0; unit < sd_cd.cd_ndevs; ++unit) {
3831.56Sis#ifdef DEBUG_KERNEL_START
3841.56Sis			printf("probing for sd%d\n", unit);
3851.56Sis#endif
3861.47Smhitch			if (sd_cd.cd_devs[unit] == NULL)
3871.47Smhitch				continue;
3881.47Smhitch
3891.47Smhitch			/*
3901.47Smhitch			 * Find the disk corresponding to the current
3911.47Smhitch			 * device.
3921.47Smhitch			 */
3931.47Smhitch			devs = (struct device **)sd_cd.cd_devs;
3941.47Smhitch			if ((dkp = disk_find(devs[unit]->dv_xname)) == NULL)
3951.47Smhitch				continue;
3961.47Smhitch
3971.47Smhitch			if (dkp->dk_driver == NULL ||
3981.47Smhitch			    dkp->dk_driver->d_strategy == NULL)
3991.47Smhitch				continue;
4001.47Smhitch			for (bdp = bdevsw; bdp < (bdevsw + nblkdev); bdp++)
4011.47Smhitch				if (bdp->d_strategy ==
4021.47Smhitch				    dkp->dk_driver->d_strategy)
4031.47Smhitch					break;
4041.56Sis			if (bdp->d_open(MAKEDISKDEV(4, unit, RAW_PART),
4051.47Smhitch			    FREAD | FNONBLOCK, 0, curproc))
4061.47Smhitch				continue;
4071.56Sis			bdp->d_close(MAKEDISKDEV(4, unit, RAW_PART),
4081.47Smhitch			    FREAD | FNONBLOCK, 0, curproc);
4091.47Smhitch			pp = &dkp->dk_label->d_partitions[0];
4101.54Sis			for (i = 0; i < dkp->dk_label->d_npartitions;
4111.54Sis			    i++, pp++) {
4121.56Sis#ifdef DEBUG_KERNEL_START
4131.56Sis				printf("sd%d%c type %d offset %d size %d\n",
4141.56Sis					unit, i+'a', pp->p_fstype,
4151.56Sis					pp->p_offset, pp->p_size);
4161.56Sis#endif
4171.54Sis				if (pp->p_size == 0 ||
4181.54Sis				    (pp->p_fstype != FS_BSDFFS &&
4191.54Sis				    pp->p_fstype != FS_SWAP))
4201.54Sis					continue;
4211.54Sis				if (pp->p_offset == boot_partition) {
4221.54Sis					if (*devpp == NULL) {
4231.54Sis						*devpp = devs[unit];
4241.54Sis						*partp = i;
4251.54Sis					} else
4261.54Sis						printf("Ambiguous boot device\n");
4271.54Sis				}
4281.47Smhitch			}
4291.47Smhitch		}
4301.47Smhitch	}
4311.47Smhitch	if (*devpp != NULL)
4321.47Smhitch		return;		/* we found the boot device */
4331.47Smhitch#endif
4341.46Sthorpej
4351.46Sthorpej	for (i = 0; genericconf[i] != NULL; i++) {
4361.46Sthorpej		for (unit = genericconf[i]->cd_ndevs - 1; unit >= 0; unit--) {
4371.46Sthorpej			if (genericconf[i]->cd_devs[unit] == NULL)
4381.46Sthorpej				continue;
4391.46Sthorpej
4401.46Sthorpej			/*
4411.46Sthorpej			 * Find the disk structure corresponding to the
4421.46Sthorpej			 * current device.
4431.46Sthorpej			 */
4441.46Sthorpej			devs = (struct device **)genericconf[i]->cd_devs;
4451.46Sthorpej			if ((dkp = disk_find(devs[unit]->dv_xname)) == NULL)
4461.46Sthorpej				continue;
4471.46Sthorpej
4481.46Sthorpej			if (dkp->dk_driver == NULL ||
4491.46Sthorpej			    dkp->dk_driver->d_strategy == NULL)
4501.46Sthorpej				continue;
4511.46Sthorpej
4521.46Sthorpej			for (maj = 0; maj < nblkdev; maj++)
4531.46Sthorpej				if (bdevsw[maj].d_strategy ==
4541.46Sthorpej				    dkp->dk_driver->d_strategy)
4551.46Sthorpej					break;
4561.46Sthorpej#ifdef DIAGNOSTIC
4571.46Sthorpej			if (maj >= nblkdev)
4581.46Sthorpej				panic("findroot: impossible");
4591.46Sthorpej#endif
4601.46Sthorpej
4611.46Sthorpej			/* Open disk; forces read of disklabel. */
4621.46Sthorpej			if ((*bdevsw[maj].d_open)(MAKEDISKDEV(maj,
4631.46Sthorpej			    unit, 0), FREAD|FNONBLOCK, 0, &proc0))
4641.46Sthorpej				continue;
4651.48Smhitch			(void)(*bdevsw[maj].d_close)(MAKEDISKDEV(maj,
4661.46Sthorpej			    unit, 0), FREAD|FNONBLOCK, 0, &proc0);
4671.46Sthorpej
4681.46Sthorpej			pp = &dkp->dk_label->d_partitions[0];
4691.46Sthorpej			if (pp->p_size != 0 && pp->p_fstype == FS_BSDFFS) {
4701.46Sthorpej				*devpp = devs[unit];
4711.46Sthorpej				*partp = 0;
4721.46Sthorpej				return;
4731.46Sthorpej			}
4741.1Smw		}
4751.1Smw	}
4761.3Smw}
4771.17Schopps
4781.11Schopps/*
4791.11Schopps * Try to determine, of this machine is an A3000, which has a builtin
4801.11Schopps * realtime clock and scsi controller, so that this hardware is only
4811.11Schopps * included as "configured" if this IS an A3000
4821.11Schopps */
4831.5Smw
4841.5Smwint a3000_flag = 1;		/* patchable */
4851.5Smw#ifdef A4000
4861.5Smwint a4000_flag = 1;		/* patchable - default to A4000 */
4871.5Smw#else
4881.5Smwint a4000_flag = 0;		/* patchable */
4891.5Smw#endif
4901.5Smw
4911.3Smwint
4921.11Schoppsis_a3000()
4931.3Smw{
4941.11Schopps	/* this is a dirty kludge.. but how do you do this RIGHT ? :-) */
4951.22Schopps	extern long boot_fphystart;
4961.11Schopps	short sc;
4971.11Schopps
4981.19Schopps	if ((machineid >> 16) == 3000)
4991.19Schopps		return (1);			/* It's an A3000 */
5001.19Schopps	if (machineid >> 16)
5011.19Schopps		return (0);			/* It's not an A3000 */
5021.19Schopps	/* Machine type is unknown, so try to guess it */
5031.11Schopps	/* where is fastram on the A4000 ?? */
5041.11Schopps	/* if fastram is below 0x07000000, assume it's not an A3000 */
5051.22Schopps	if (boot_fphystart < 0x07000000)
5061.17Schopps		return(0);
5071.11Schopps	/*
5081.11Schopps	 * OK, fastram starts at or above 0x07000000, check specific
5091.11Schopps	 * machines
5101.11Schopps	 */
5111.17Schopps	for (sc = 0; sc < ncfdev; sc++) {
5121.17Schopps		switch (cfdev[sc].rom.manid) {
5131.17Schopps		case 2026:		/* Progressive Peripherals, Inc */
5141.17Schopps			switch (cfdev[sc].rom.prodid) {
5151.17Schopps			case 0:		/* PPI Mercury - A3000 */
5161.17Schopps			case 1:		/* PP&S A3000 '040 */
5171.17Schopps				return(1);
5181.17Schopps			case 150:	/* PPI Zeus - it's an A2000 */
5191.17Schopps			case 105:	/* PP&S A2000 '040 */
5201.17Schopps			case 187:	/* PP&S A500 '040 */
5211.17Schopps				return(0);
5221.11Schopps			}
5231.11Schopps			break;
5241.3Smw
5251.17Schopps		case 2112:			/* IVS */
5261.17Schopps			switch (cfdev[sc].rom.prodid) {
5271.17Schopps			case 242:
5281.17Schopps				return(0);	/* A2000 accelerator? */
5291.11Schopps			}
5301.11Schopps			break;
5311.11Schopps		}
5321.11Schopps	}
5331.17Schopps	return (a3000_flag);		/* XXX let flag tell now */
5341.5Smw}
5351.5Smw
5361.5Smwint
5371.11Schoppsis_a4000()
5381.5Smw{
5391.19Schopps	if ((machineid >> 16) == 4000)
5401.19Schopps		return (1);		/* It's an A4000 */
5411.24Schopps	if ((machineid >> 16) == 1200)
5421.24Schopps		return (0);		/* It's an A1200, so not A4000 */
5431.36Sis#ifdef DRACO
5441.36Sis	if (is_draco())
5451.36Sis		return (0);
5461.36Sis#endif
5471.24Schopps	/* Do I need this any more? */
5481.19Schopps	if ((custom.deniseid & 0xff) == 0xf8)
5491.19Schopps		return (1);
5501.19Schopps#ifdef DEBUG
5511.19Schopps	if (a4000_flag)
5521.43Schristos		printf("Denise ID = %04x\n", (unsigned short)custom.deniseid);
5531.19Schopps#endif
5541.19Schopps	if (machineid >> 16)
5551.19Schopps		return (0);		/* It's not an A4000 */
5561.19Schopps	return (a4000_flag);		/* Machine type not set */
5571.24Schopps}
5581.24Schopps
5591.24Schoppsint
5601.24Schoppsis_a1200()
5611.24Schopps{
5621.24Schopps	if ((machineid >> 16) == 1200)
5631.24Schopps		return (1);		/* It's an A1200 */
5641.24Schopps	return (0);			/* Machine type not set */
5651.1Smw}
566