autoconf.c revision 1.62
11.62Sis/*	$NetBSD: autoconf.c,v 1.62 1999/03/19 21:40:24 is 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.17Schoppsint cold;	/* 1 if still booting */
511.17Schopps#include <sys/kernel.h>
521.46Sthorpej
531.46Sthorpejstruct devnametobdevmaj amiga_nam2blk[] = {
541.46Sthorpej	{ "fd",		2 },
551.46Sthorpej	{ "sd",		4 },
561.46Sthorpej	{ "cd",		7 },
571.60Smhitch	{ "md",		15 },
581.46Sthorpej	{ NULL,		0 },
591.46Sthorpej};
601.47Smhitchu_long boot_partition;
611.46Sthorpej
621.1Smw/*
631.17Schopps * called at boot time, configure all devices on system
641.1Smw */
651.11Schoppsvoid
661.1Smwconfigure()
671.1Smw{
681.44Sis	int s;
691.62Sis#ifdef DEBUG_KERNEL_START
701.62Sis	int i;
711.62Sis#endif
721.49Sgwr
731.17Schopps	/*
741.17Schopps	 * this is the real thing baby (i.e. not console init)
751.17Schopps	 */
761.17Schopps	amiga_realconfig = 1;
771.36Sis#ifdef DRACO
781.36Sis	if (is_draco()) {
791.36Sis		*draco_intena &= ~DRIRQ_GLOBAL;
801.36Sis	} else
811.36Sis#endif
821.3Smw	custom.intena = INTF_INTEN;
831.44Sis	s = splhigh();
841.1Smw
851.31Scgd	if (config_rootfound("mainbus", "mainbus") == NULL)
861.17Schopps		panic("no mainbus found");
871.36Sis
881.39Sis#ifdef DEBUG_KERNEL_START
891.43Schristos	printf("survived autoconf, going to enable interrupts\n");
901.39Sis#endif
911.11Schopps
921.36Sis#ifdef DRACO
931.36Sis	if (is_draco()) {
941.36Sis		*draco_intena |= DRIRQ_GLOBAL;
951.36Sis		/* softints always enabled */
961.36Sis	} else
971.36Sis#endif
981.36Sis	{
991.36Sis		custom.intena = INTF_SETCLR | INTF_INTEN;
1001.28Schopps
1011.36Sis		/* also enable hardware aided software interrupts */
1021.36Sis		custom.intena = INTF_SETCLR | INTF_SOFTINT;
1031.36Sis	}
1041.39Sis#ifdef DEBUG_KERNEL_START
1051.62Sis	for (i=splhigh(); i>=s ;i-=0x100) {
1061.62Sis		splx(i);
1071.62Sis		printf("%d...", (i>>8) & 7);
1081.62Sis	}
1091.43Schristos	printf("survived interrupt enable\n");
1101.62Sis#else
1111.62Sis	splx(s);
1121.39Sis#endif
1131.49Sgwr	cold = 0;
1141.49Sgwr}
1151.49Sgwr
1161.49Sgwrvoid
1171.49Sgwrcpu_rootconf()
1181.49Sgwr{
1191.49Sgwr	struct device *booted_device;
1201.49Sgwr	int booted_partition;
1211.28Schopps
1221.46Sthorpej	findroot(&booted_device, &booted_partition);
1231.39Sis#ifdef DEBUG_KERNEL_START
1241.46Sthorpej	printf("survived findroot()\n");
1251.39Sis#endif
1261.46Sthorpej	setroot(booted_device, booted_partition, amiga_nam2blk);
1271.39Sis#ifdef DEBUG_KERNEL_START
1281.43Schristos	printf("survived setroot()\n");
1291.1Smw#endif
1301.17Schopps}
1311.3Smw
1321.17Schopps/*ARGSUSED*/
1331.17Schoppsint
1341.17Schoppssimple_devprint(auxp, pnp)
1351.17Schopps	void *auxp;
1361.42Smhitch	const char *pnp;
1371.17Schopps{
1381.17Schopps	return(QUIET);
1391.1Smw}
1401.1Smw
1411.17Schoppsint
1421.17Schoppsmatchname(fp, sp)
1431.17Schopps	char *fp, *sp;
1441.17Schopps{
1451.17Schopps	int len;
1461.1Smw
1471.17Schopps	len = strlen(fp);
1481.17Schopps	if (strlen(sp) != len)
1491.17Schopps		return(0);
1501.17Schopps	if (bcmp(fp, sp, len) == 0)
1511.17Schopps		return(1);
1521.17Schopps	return(0);
1531.17Schopps}
1541.1Smw
1551.17Schopps/*
1561.17Schopps * use config_search to find appropriate device, then call that device
1571.17Schopps * directly with NULL device variable storage.  A device can then
1581.17Schopps * always tell the difference betwean the real and console init
1591.17Schopps * by checking for NULL.
1601.17Schopps */
1611.11Schoppsint
1621.17Schoppsamiga_config_found(pcfp, pdp, auxp, pfn)
1631.17Schopps	struct cfdata *pcfp;
1641.17Schopps	struct device *pdp;
1651.17Schopps	void *auxp;
1661.17Schopps	cfprint_t pfn;
1671.1Smw{
1681.17Schopps	struct device temp;
1691.17Schopps	struct cfdata *cf;
1701.17Schopps
1711.17Schopps	if (amiga_realconfig)
1721.31Scgd		return(config_found(pdp, auxp, pfn) != NULL);
1731.17Schopps
1741.17Schopps	if (pdp == NULL)
1751.17Schopps		pdp = &temp;
1761.17Schopps
1771.17Schopps	pdp->dv_cfdata = pcfp;
1781.17Schopps	if ((cf = config_search((cfmatch_t)NULL, pdp, auxp)) != NULL) {
1791.30Sthorpej		cf->cf_attach->ca_attach(pdp, NULL, auxp);
1801.17Schopps		pdp->dv_cfdata = NULL;
1811.17Schopps		return(1);
1821.1Smw	}
1831.17Schopps	pdp->dv_cfdata = NULL;
1841.17Schopps	return(0);
1851.17Schopps}
1861.17Schopps
1871.17Schopps/*
1881.17Schopps * this function needs to get enough configured to do a console
1891.17Schopps * basically this means start attaching the grfxx's that support
1901.17Schopps * the console. Kinda hacky but it works.
1911.17Schopps */
1921.32Sveegovoid
1931.17Schoppsconfig_console()
1941.17Schopps{
1951.17Schopps	struct cfdata *cf;
1961.36Sis
1971.17Schopps	/*
1981.17Schopps	 * we need mainbus' cfdata.
1991.17Schopps	 */
2001.17Schopps	cf = config_rootsearch(NULL, "mainbus", "mainbus");
2011.36Sis	if (cf == NULL) {
2021.17Schopps		panic("no mainbus");
2031.36Sis	}
2041.1Smw	/*
2051.44Sis	 * delay clock calibration.
2061.44Sis	 */
2071.44Sis	amiga_config_found(cf, NULL, "clock", NULL);
2081.44Sis
2091.44Sis	/*
2101.17Schopps	 * internal grf.
2111.1Smw	 */
2121.36Sis#ifdef DRACO
2131.36Sis	if (!(is_draco()))
2141.36Sis#endif
2151.36Sis		amiga_config_found(cf, NULL, "grfcc", NULL);
2161.1Smw	/*
2171.27Schopps	 * zbus knows when its not for real and will
2181.21Schopps	 * only configure the appropriate hardware
2191.1Smw	 */
2201.27Schopps	amiga_config_found(cf, NULL, "zbus", NULL);
2211.1Smw}
2221.1Smw
2231.17Schopps/*
2241.17Schopps * mainbus driver
2251.17Schopps */
2261.30Sthorpejstruct cfattach mainbus_ca = {
2271.30Sthorpej	sizeof(struct device), mbmatch, mbattach
2281.17Schopps};
2291.17Schopps
2301.11Schoppsint
2311.45Sveegombmatch(pdp, cfp, auxp)
2321.45Sveego	struct device	*pdp;
2331.45Sveego	struct cfdata	*cfp;
2341.45Sveego	void		*auxp;
2351.1Smw{
2361.30Sthorpej
2371.17Schopps	if (cfp->cf_unit > 0)
2381.1Smw		return(0);
2391.1Smw	/*
2401.17Schopps	 * We are always here
2411.1Smw	 */
2421.1Smw	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, "ms", simple_devprint);
2781.36Sis		config_found(dp, "grfcc", simple_devprint);
2791.36Sis		config_found(dp, "fdc", simple_devprint);
2801.36Sis	}
2811.24Schopps	if (is_a4000() || is_a1200())
2821.23Schopps		config_found(dp, "idesc", simple_devprint);
2831.29Schopps	if (is_a4000())			/* Try to configure A4000T SCSI */
2841.29Schopps		config_found(dp, "afsc", simple_devprint);
2851.17Schopps	if (is_a3000())
2861.17Schopps		config_found(dp, "ahsc", simple_devprint);
2871.54Sis#ifdef DRACO
2881.54Sis	if (!is_draco())
2891.54Sis#endif
2901.54Sis		config_found(dp, "aucc", simple_devprint);
2911.54Sis
2921.57Sis	config_found(dp, "zbus", simple_devprint);
2931.1Smw}
2941.1Smw
2951.11Schoppsint
2961.17Schoppsmbprint(auxp, pnp)
2971.17Schopps	void *auxp;
2981.40Scgd	const char *pnp;
2991.1Smw{
3001.17Schopps	if (pnp)
3011.43Schristos		printf("%s at %s", (char *)auxp, pnp);
3021.17Schopps	return(UNCONF);
3031.1Smw}
3041.1Smw
3051.46Sthorpej/*
3061.46Sthorpej * The system will assign the "booted device" indicator (and thus
3071.46Sthorpej * rootdev if rootspec is wildcarded) to the first partition 'a'
3081.46Sthorpej * in preference of boot.  However, it does walk unit backwards
3091.46Sthorpej * to remain compatible with the old Amiga method of picking the
3101.46Sthorpej * last root found.
3111.46Sthorpej */
3121.46Sthorpej#include <sys/fcntl.h>		/* XXXX and all that uses it */
3131.46Sthorpej#include <sys/proc.h>		/* XXXX and all that uses it */
3141.17Schopps
3151.46Sthorpej#include "fd.h"
3161.46Sthorpej#include "sd.h"
3171.46Sthorpej#include "cd.h"
3181.1Smw
3191.46Sthorpej#if NFD > 0
3201.46Sthorpejextern  struct cfdriver fd_cd;
3211.46Sthorpej#endif
3221.46Sthorpej#if NSD > 0
3231.46Sthorpejextern  struct cfdriver sd_cd;
3241.46Sthorpej#endif
3251.46Sthorpej#if NCD > 0
3261.46Sthorpejextern  struct cfdriver cd_cd;
3271.46Sthorpej#endif
3281.1Smw
3291.46Sthorpejstruct cfdriver *genericconf[] = {
3301.46Sthorpej#if NFD > 0
3311.46Sthorpej	&fd_cd,
3321.46Sthorpej#endif
3331.46Sthorpej#if NSD > 0
3341.46Sthorpej	&sd_cd,
3351.46Sthorpej#endif
3361.46Sthorpej#if NCD > 0
3371.46Sthorpej	&cd_cd,
3381.46Sthorpej#endif
3391.46Sthorpej	NULL,
3401.1Smw};
3411.1Smw
3421.11Schoppsvoid
3431.46Sthorpejfindroot(devpp, partp)
3441.46Sthorpej	struct device **devpp;
3451.46Sthorpej	int *partp;
3461.1Smw{
3471.46Sthorpej	struct disk *dkp;
3481.46Sthorpej	struct partition *pp;
3491.46Sthorpej	struct device **devs;
3501.46Sthorpej	int i, maj, unit;
3511.46Sthorpej
3521.1Smw	/*
3531.46Sthorpej	 * Default to "not found".
3541.1Smw	 */
3551.46Sthorpej	*devpp = NULL;
3561.46Sthorpej
3571.46Sthorpej	/* always partition 'a' */
3581.46Sthorpej	*partp = 0;
3591.47Smhitch
3601.47Smhitch#if NSD > 0
3611.47Smhitch	/*
3621.47Smhitch	 * If we have the boot partition offset (boot_partition), try
3631.47Smhitch	 * to locate the device corresponding to that partition.
3641.47Smhitch	 */
3651.56Sis#ifdef DEBUG_KERNEL_START
3661.56Sis	printf("Boot partition offset is %ld\n", boot_partition);
3671.56Sis#endif
3681.47Smhitch	if (boot_partition != 0) {
3691.47Smhitch	 	struct bdevsw *bdp;
3701.54Sis		int i;
3711.47Smhitch
3721.47Smhitch		for (unit = 0; unit < sd_cd.cd_ndevs; ++unit) {
3731.56Sis#ifdef DEBUG_KERNEL_START
3741.56Sis			printf("probing for sd%d\n", unit);
3751.56Sis#endif
3761.47Smhitch			if (sd_cd.cd_devs[unit] == NULL)
3771.47Smhitch				continue;
3781.47Smhitch
3791.47Smhitch			/*
3801.47Smhitch			 * Find the disk corresponding to the current
3811.47Smhitch			 * device.
3821.47Smhitch			 */
3831.47Smhitch			devs = (struct device **)sd_cd.cd_devs;
3841.47Smhitch			if ((dkp = disk_find(devs[unit]->dv_xname)) == NULL)
3851.47Smhitch				continue;
3861.47Smhitch
3871.47Smhitch			if (dkp->dk_driver == NULL ||
3881.47Smhitch			    dkp->dk_driver->d_strategy == NULL)
3891.47Smhitch				continue;
3901.47Smhitch			for (bdp = bdevsw; bdp < (bdevsw + nblkdev); bdp++)
3911.47Smhitch				if (bdp->d_strategy ==
3921.47Smhitch				    dkp->dk_driver->d_strategy)
3931.47Smhitch					break;
3941.56Sis			if (bdp->d_open(MAKEDISKDEV(4, unit, RAW_PART),
3951.47Smhitch			    FREAD | FNONBLOCK, 0, curproc))
3961.47Smhitch				continue;
3971.56Sis			bdp->d_close(MAKEDISKDEV(4, unit, RAW_PART),
3981.47Smhitch			    FREAD | FNONBLOCK, 0, curproc);
3991.47Smhitch			pp = &dkp->dk_label->d_partitions[0];
4001.54Sis			for (i = 0; i < dkp->dk_label->d_npartitions;
4011.54Sis			    i++, pp++) {
4021.56Sis#ifdef DEBUG_KERNEL_START
4031.56Sis				printf("sd%d%c type %d offset %d size %d\n",
4041.56Sis					unit, i+'a', pp->p_fstype,
4051.56Sis					pp->p_offset, pp->p_size);
4061.56Sis#endif
4071.54Sis				if (pp->p_size == 0 ||
4081.54Sis				    (pp->p_fstype != FS_BSDFFS &&
4091.54Sis				    pp->p_fstype != FS_SWAP))
4101.54Sis					continue;
4111.54Sis				if (pp->p_offset == boot_partition) {
4121.54Sis					if (*devpp == NULL) {
4131.54Sis						*devpp = devs[unit];
4141.54Sis						*partp = i;
4151.54Sis					} else
4161.54Sis						printf("Ambiguous boot device\n");
4171.54Sis				}
4181.47Smhitch			}
4191.47Smhitch		}
4201.47Smhitch	}
4211.47Smhitch	if (*devpp != NULL)
4221.47Smhitch		return;		/* we found the boot device */
4231.47Smhitch#endif
4241.46Sthorpej
4251.46Sthorpej	for (i = 0; genericconf[i] != NULL; i++) {
4261.46Sthorpej		for (unit = genericconf[i]->cd_ndevs - 1; unit >= 0; unit--) {
4271.46Sthorpej			if (genericconf[i]->cd_devs[unit] == NULL)
4281.46Sthorpej				continue;
4291.46Sthorpej
4301.46Sthorpej			/*
4311.46Sthorpej			 * Find the disk structure corresponding to the
4321.46Sthorpej			 * current device.
4331.46Sthorpej			 */
4341.46Sthorpej			devs = (struct device **)genericconf[i]->cd_devs;
4351.46Sthorpej			if ((dkp = disk_find(devs[unit]->dv_xname)) == NULL)
4361.46Sthorpej				continue;
4371.46Sthorpej
4381.46Sthorpej			if (dkp->dk_driver == NULL ||
4391.46Sthorpej			    dkp->dk_driver->d_strategy == NULL)
4401.46Sthorpej				continue;
4411.46Sthorpej
4421.46Sthorpej			for (maj = 0; maj < nblkdev; maj++)
4431.46Sthorpej				if (bdevsw[maj].d_strategy ==
4441.46Sthorpej				    dkp->dk_driver->d_strategy)
4451.46Sthorpej					break;
4461.46Sthorpej#ifdef DIAGNOSTIC
4471.46Sthorpej			if (maj >= nblkdev)
4481.46Sthorpej				panic("findroot: impossible");
4491.46Sthorpej#endif
4501.46Sthorpej
4511.46Sthorpej			/* Open disk; forces read of disklabel. */
4521.46Sthorpej			if ((*bdevsw[maj].d_open)(MAKEDISKDEV(maj,
4531.46Sthorpej			    unit, 0), FREAD|FNONBLOCK, 0, &proc0))
4541.46Sthorpej				continue;
4551.48Smhitch			(void)(*bdevsw[maj].d_close)(MAKEDISKDEV(maj,
4561.46Sthorpej			    unit, 0), FREAD|FNONBLOCK, 0, &proc0);
4571.46Sthorpej
4581.46Sthorpej			pp = &dkp->dk_label->d_partitions[0];
4591.46Sthorpej			if (pp->p_size != 0 && pp->p_fstype == FS_BSDFFS) {
4601.46Sthorpej				*devpp = devs[unit];
4611.46Sthorpej				*partp = 0;
4621.46Sthorpej				return;
4631.46Sthorpej			}
4641.1Smw		}
4651.1Smw	}
4661.3Smw}
4671.17Schopps
4681.11Schopps/*
4691.11Schopps * Try to determine, of this machine is an A3000, which has a builtin
4701.11Schopps * realtime clock and scsi controller, so that this hardware is only
4711.11Schopps * included as "configured" if this IS an A3000
4721.11Schopps */
4731.5Smw
4741.5Smwint a3000_flag = 1;		/* patchable */
4751.5Smw#ifdef A4000
4761.5Smwint a4000_flag = 1;		/* patchable - default to A4000 */
4771.5Smw#else
4781.5Smwint a4000_flag = 0;		/* patchable */
4791.5Smw#endif
4801.5Smw
4811.3Smwint
4821.11Schoppsis_a3000()
4831.3Smw{
4841.11Schopps	/* this is a dirty kludge.. but how do you do this RIGHT ? :-) */
4851.22Schopps	extern long boot_fphystart;
4861.11Schopps	short sc;
4871.11Schopps
4881.19Schopps	if ((machineid >> 16) == 3000)
4891.19Schopps		return (1);			/* It's an A3000 */
4901.19Schopps	if (machineid >> 16)
4911.19Schopps		return (0);			/* It's not an A3000 */
4921.19Schopps	/* Machine type is unknown, so try to guess it */
4931.11Schopps	/* where is fastram on the A4000 ?? */
4941.11Schopps	/* if fastram is below 0x07000000, assume it's not an A3000 */
4951.22Schopps	if (boot_fphystart < 0x07000000)
4961.17Schopps		return(0);
4971.11Schopps	/*
4981.11Schopps	 * OK, fastram starts at or above 0x07000000, check specific
4991.11Schopps	 * machines
5001.11Schopps	 */
5011.17Schopps	for (sc = 0; sc < ncfdev; sc++) {
5021.17Schopps		switch (cfdev[sc].rom.manid) {
5031.17Schopps		case 2026:		/* Progressive Peripherals, Inc */
5041.17Schopps			switch (cfdev[sc].rom.prodid) {
5051.17Schopps			case 0:		/* PPI Mercury - A3000 */
5061.17Schopps			case 1:		/* PP&S A3000 '040 */
5071.17Schopps				return(1);
5081.17Schopps			case 150:	/* PPI Zeus - it's an A2000 */
5091.17Schopps			case 105:	/* PP&S A2000 '040 */
5101.17Schopps			case 187:	/* PP&S A500 '040 */
5111.17Schopps				return(0);
5121.11Schopps			}
5131.11Schopps			break;
5141.3Smw
5151.17Schopps		case 2112:			/* IVS */
5161.17Schopps			switch (cfdev[sc].rom.prodid) {
5171.17Schopps			case 242:
5181.17Schopps				return(0);	/* A2000 accelerator? */
5191.11Schopps			}
5201.11Schopps			break;
5211.11Schopps		}
5221.11Schopps	}
5231.17Schopps	return (a3000_flag);		/* XXX let flag tell now */
5241.5Smw}
5251.5Smw
5261.5Smwint
5271.11Schoppsis_a4000()
5281.5Smw{
5291.19Schopps	if ((machineid >> 16) == 4000)
5301.19Schopps		return (1);		/* It's an A4000 */
5311.24Schopps	if ((machineid >> 16) == 1200)
5321.24Schopps		return (0);		/* It's an A1200, so not A4000 */
5331.36Sis#ifdef DRACO
5341.36Sis	if (is_draco())
5351.36Sis		return (0);
5361.36Sis#endif
5371.24Schopps	/* Do I need this any more? */
5381.19Schopps	if ((custom.deniseid & 0xff) == 0xf8)
5391.19Schopps		return (1);
5401.19Schopps#ifdef DEBUG
5411.19Schopps	if (a4000_flag)
5421.43Schristos		printf("Denise ID = %04x\n", (unsigned short)custom.deniseid);
5431.19Schopps#endif
5441.19Schopps	if (machineid >> 16)
5451.19Schopps		return (0);		/* It's not an A4000 */
5461.19Schopps	return (a4000_flag);		/* Machine type not set */
5471.24Schopps}
5481.24Schopps
5491.24Schoppsint
5501.24Schoppsis_a1200()
5511.24Schopps{
5521.24Schopps	if ((machineid >> 16) == 1200)
5531.24Schopps		return (1);		/* It's an A1200 */
5541.24Schopps	return (0);			/* Machine type not set */
5551.1Smw}
556