autoconf.c revision 1.85
11.85Sthorpej/* $NetBSD: autoconf.c,v 1.85 2002/10/02 04:55:47 thorpej 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.85Sthorpej__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.85 2002/10/02 04:55:47 thorpej 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.81Saymeric 601.81Saymericint amiga_realconfig; 611.46Sthorpej 621.1Smw/* 631.17Schopps * called at boot time, configure all devices on system 641.1Smw */ 651.11Schoppsvoid 661.65Sthorpejcpu_configure() 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.79Saymeric 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.63Sthorpej#ifdef DEBUG_KERNEL_START 1141.63Sthorpej printf("survived configure...\n"); 1151.63Sthorpej#endif 1161.49Sgwr} 1171.49Sgwr 1181.49Sgwrvoid 1191.49Sgwrcpu_rootconf() 1201.49Sgwr{ 1211.77Sfrueauf findroot(); 1221.39Sis#ifdef DEBUG_KERNEL_START 1231.46Sthorpej printf("survived findroot()\n"); 1241.39Sis#endif 1251.64Sthorpej setroot(booted_device, booted_partition); 1261.39Sis#ifdef DEBUG_KERNEL_START 1271.43Schristos printf("survived setroot()\n"); 1281.1Smw#endif 1291.17Schopps} 1301.3Smw 1311.17Schopps/*ARGSUSED*/ 1321.17Schoppsint 1331.17Schoppssimple_devprint(auxp, pnp) 1341.17Schopps void *auxp; 1351.42Smhitch const char *pnp; 1361.17Schopps{ 1371.17Schopps return(QUIET); 1381.1Smw} 1391.1Smw 1401.17Schoppsint 1411.17Schoppsmatchname(fp, sp) 1421.17Schopps char *fp, *sp; 1431.17Schopps{ 1441.17Schopps int len; 1451.1Smw 1461.17Schopps len = strlen(fp); 1471.17Schopps if (strlen(sp) != len) 1481.17Schopps return(0); 1491.17Schopps if (bcmp(fp, sp, len) == 0) 1501.17Schopps return(1); 1511.17Schopps return(0); 1521.17Schopps} 1531.1Smw 1541.17Schopps/* 1551.17Schopps * use config_search to find appropriate device, then call that device 1561.79Saymeric * directly with NULL device variable storage. A device can then 1571.79Saymeric * always tell the difference betwean the real and console init 1581.17Schopps * by checking for NULL. 1591.17Schopps */ 1601.11Schoppsint 1611.17Schoppsamiga_config_found(pcfp, pdp, auxp, pfn) 1621.17Schopps struct cfdata *pcfp; 1631.17Schopps struct device *pdp; 1641.17Schopps void *auxp; 1651.17Schopps cfprint_t pfn; 1661.1Smw{ 1671.17Schopps struct device temp; 1681.17Schopps struct cfdata *cf; 1691.17Schopps 1701.17Schopps if (amiga_realconfig) 1711.31Scgd return(config_found(pdp, auxp, pfn) != NULL); 1721.17Schopps 1731.17Schopps if (pdp == NULL) 1741.17Schopps pdp = &temp; 1751.17Schopps 1761.17Schopps pdp->dv_cfdata = pcfp; 1771.17Schopps if ((cf = config_search((cfmatch_t)NULL, pdp, auxp)) != NULL) { 1781.30Sthorpej cf->cf_attach->ca_attach(pdp, NULL, auxp); 1791.17Schopps pdp->dv_cfdata = NULL; 1801.17Schopps return(1); 1811.1Smw } 1821.17Schopps pdp->dv_cfdata = NULL; 1831.17Schopps return(0); 1841.17Schopps} 1851.17Schopps 1861.17Schopps/* 1871.17Schopps * this function needs to get enough configured to do a console 1881.79Saymeric * basically this means start attaching the grfxx's that support 1891.17Schopps * the console. Kinda hacky but it works. 1901.17Schopps */ 1911.32Sveegovoid 1921.17Schoppsconfig_console() 1931.79Saymeric{ 1941.17Schopps struct cfdata *cf; 1951.84Sthorpej 1961.84Sthorpej config_init(); 1971.36Sis 1981.17Schopps /* 1991.17Schopps * we need mainbus' cfdata. 2001.17Schopps */ 2011.17Schopps cf = config_rootsearch(NULL, "mainbus", "mainbus"); 2021.36Sis if (cf == NULL) { 2031.17Schopps panic("no mainbus"); 2041.36Sis } 2051.1Smw /* 2061.44Sis * delay clock calibration. 2071.44Sis */ 2081.44Sis amiga_config_found(cf, NULL, "clock", NULL); 2091.44Sis 2101.44Sis /* 2111.17Schopps * internal grf. 2121.1Smw */ 2131.36Sis#ifdef DRACO 2141.36Sis if (!(is_draco())) 2151.36Sis#endif 2161.36Sis amiga_config_found(cf, NULL, "grfcc", NULL); 2171.67Saymeric 2181.1Smw /* 2191.27Schopps * zbus knows when its not for real and will 2201.21Schopps * only configure the appropriate hardware 2211.1Smw */ 2221.27Schopps amiga_config_found(cf, NULL, "zbus", NULL); 2231.1Smw} 2241.1Smw 2251.79Saymeric/* 2261.79Saymeric * mainbus driver 2271.17Schopps */ 2281.85SthorpejCFATTACH_DECL(mainbus, sizeof(struct device), 2291.85Sthorpej mbmatch, mbattach, NULL, NULL); 2301.17Schopps 2311.11Schoppsint 2321.45Sveegombmatch(pdp, cfp, auxp) 2331.45Sveego struct device *pdp; 2341.45Sveego struct cfdata *cfp; 2351.45Sveego void *auxp; 2361.1Smw{ 2371.72Sis#if 0 /* 2381.72Sis * XXX is this right? but we need to be found twice 2391.72Sis * (early console init hack) 2401.72Sis */ 2411.71Skleink static int mainbus_matched = 0; 2421.30Sthorpej 2431.71Skleink /* Allow only one instance. */ 2441.71Skleink if (mainbus_matched) 2451.71Skleink return (0); 2461.71Skleink 2471.71Skleink mainbus_matched = 1; 2481.72Sis#endif 2491.71Skleink return (1); 2501.1Smw} 2511.1Smw 2521.1Smw/* 2531.17Schopps * "find" all the things that should be there. 2541.1Smw */ 2551.11Schoppsvoid 2561.17Schoppsmbattach(pdp, dp, auxp) 2571.17Schopps struct device *pdp, *dp; 2581.17Schopps void *auxp; 2591.1Smw{ 2601.43Schristos printf("\n"); 2611.17Schopps config_found(dp, "clock", simple_devprint); 2621.52Sis if (is_a3000() || is_a4000()) { 2631.52Sis config_found(dp, "a34kbbc", simple_devprint); 2641.58Sis } else 2651.53Sis#ifdef DRACO 2661.58Sis if (!is_draco()) 2671.53Sis#endif 2681.58Sis { 2691.52Sis config_found(dp, "a2kbbc", simple_devprint); 2701.52Sis } 2711.36Sis#ifdef DRACO 2721.36Sis if (is_draco()) { 2731.52Sis config_found(dp, "drbbc", simple_devprint); 2741.36Sis config_found(dp, "kbd", simple_devprint); 2751.36Sis config_found(dp, "drsc", simple_devprint); 2761.55Sis config_found(dp, "drsupio", simple_devprint); 2771.79Saymeric } else 2781.36Sis#endif 2791.36Sis { 2801.36Sis config_found(dp, "ser", simple_devprint); 2811.36Sis config_found(dp, "par", simple_devprint); 2821.36Sis config_found(dp, "kbd", simple_devprint); 2831.36Sis config_found(dp, "ms", simple_devprint); 2841.36Sis config_found(dp, "grfcc", simple_devprint); 2851.78Sis config_found(dp, "amidisplaycc", simple_devprint); 2861.36Sis config_found(dp, "fdc", simple_devprint); 2871.36Sis } 2881.69Smhitch if (is_a4000() || is_a1200()) { 2891.69Smhitch config_found(dp, "wdc", simple_devprint); 2901.23Schopps config_found(dp, "idesc", simple_devprint); 2911.69Smhitch } 2921.29Schopps if (is_a4000()) /* Try to configure A4000T SCSI */ 2931.29Schopps config_found(dp, "afsc", simple_devprint); 2941.17Schopps if (is_a3000()) 2951.17Schopps config_found(dp, "ahsc", simple_devprint); 2961.67Saymeric if (/*is_a600() || */is_a1200()) 2971.67Saymeric config_found(dp, "pccard", simple_devprint); 2981.54Sis#ifdef DRACO 2991.54Sis if (!is_draco()) 3001.54Sis#endif 3011.54Sis config_found(dp, "aucc", simple_devprint); 3021.54Sis 3031.57Sis config_found(dp, "zbus", simple_devprint); 3041.1Smw} 3051.1Smw 3061.11Schoppsint 3071.17Schoppsmbprint(auxp, pnp) 3081.17Schopps void *auxp; 3091.40Scgd const char *pnp; 3101.1Smw{ 3111.17Schopps if (pnp) 3121.43Schristos printf("%s at %s", (char *)auxp, pnp); 3131.17Schopps return(UNCONF); 3141.1Smw} 3151.1Smw 3161.46Sthorpej/* 3171.46Sthorpej * The system will assign the "booted device" indicator (and thus 3181.46Sthorpej * rootdev if rootspec is wildcarded) to the first partition 'a' 3191.46Sthorpej * in preference of boot. However, it does walk unit backwards 3201.46Sthorpej * to remain compatible with the old Amiga method of picking the 3211.46Sthorpej * last root found. 3221.46Sthorpej */ 3231.46Sthorpej#include <sys/fcntl.h> /* XXXX and all that uses it */ 3241.46Sthorpej#include <sys/proc.h> /* XXXX and all that uses it */ 3251.17Schopps 3261.46Sthorpej#include "fd.h" 3271.46Sthorpej#include "sd.h" 3281.46Sthorpej#include "cd.h" 3291.67Saymeric#include "wd.h" 3301.1Smw 3311.46Sthorpej#if NFD > 0 3321.46Sthorpejextern struct cfdriver fd_cd; 3331.82Sgehennaextern const struct bdevsw fd_bdevsw; 3341.46Sthorpej#endif 3351.46Sthorpej#if NSD > 0 3361.69Smhitchextern struct cfdriver sd_cd; 3371.82Sgehennaextern const struct bdevsw sd_bdevsw; 3381.46Sthorpej#endif 3391.46Sthorpej#if NCD > 0 3401.46Sthorpejextern struct cfdriver cd_cd; 3411.82Sgehennaextern const struct bdevsw cd_bdevsw; 3421.46Sthorpej#endif 3431.67Saymeric#if NWD > 0 3441.69Smhitchextern struct cfdriver wd_cd; 3451.82Sgehennaextern const struct bdevsw wd_bdevsw; 3461.67Saymeric#endif 3471.1Smw 3481.46Sthorpejstruct cfdriver *genericconf[] = { 3491.46Sthorpej#if NFD > 0 3501.46Sthorpej &fd_cd, 3511.46Sthorpej#endif 3521.46Sthorpej#if NSD > 0 3531.46Sthorpej &sd_cd, 3541.46Sthorpej#endif 3551.69Smhitch#if NWD > 0 3561.69Smhitch &wd_cd, 3571.69Smhitch#endif 3581.46Sthorpej#if NCD > 0 3591.46Sthorpej &cd_cd, 3601.46Sthorpej#endif 3611.46Sthorpej NULL, 3621.1Smw}; 3631.1Smw 3641.11Schoppsvoid 3651.76Smattfindroot(void) 3661.1Smw{ 3671.46Sthorpej struct disk *dkp; 3681.46Sthorpej struct partition *pp; 3691.46Sthorpej struct device **devs; 3701.46Sthorpej int i, maj, unit; 3711.82Sgehenna const struct bdevsw *bdp; 3721.47Smhitch 3731.47Smhitch#if NSD > 0 3741.47Smhitch /* 3751.47Smhitch * If we have the boot partition offset (boot_partition), try 3761.47Smhitch * to locate the device corresponding to that partition. 3771.47Smhitch */ 3781.56Sis#ifdef DEBUG_KERNEL_START 3791.56Sis printf("Boot partition offset is %ld\n", boot_partition); 3801.56Sis#endif 3811.47Smhitch if (boot_partition != 0) { 3821.54Sis int i; 3831.47Smhitch 3841.47Smhitch for (unit = 0; unit < sd_cd.cd_ndevs; ++unit) { 3851.56Sis#ifdef DEBUG_KERNEL_START 3861.56Sis printf("probing for sd%d\n", unit); 3871.56Sis#endif 3881.47Smhitch if (sd_cd.cd_devs[unit] == NULL) 3891.47Smhitch continue; 3901.47Smhitch 3911.47Smhitch /* 3921.47Smhitch * Find the disk corresponding to the current 3931.47Smhitch * device. 3941.47Smhitch */ 3951.47Smhitch devs = (struct device **)sd_cd.cd_devs; 3961.47Smhitch if ((dkp = disk_find(devs[unit]->dv_xname)) == NULL) 3971.47Smhitch continue; 3981.47Smhitch 3991.47Smhitch if (dkp->dk_driver == NULL || 4001.47Smhitch dkp->dk_driver->d_strategy == NULL) 4011.47Smhitch continue; 4021.82Sgehenna bdp = &sd_bdevsw; 4031.82Sgehenna maj = bdevsw_lookup_major(bdp); 4041.82Sgehenna if ((*bdp->d_open)(MAKEDISKDEV(maj, unit, RAW_PART), 4051.47Smhitch FREAD | FNONBLOCK, 0, curproc)) 4061.47Smhitch continue; 4071.82Sgehenna (*bdp->d_close)(MAKEDISKDEV(maj, 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.76Smatt if (booted_device == NULL) { 4231.76Smatt booted_device = devs[unit]; 4241.76Smatt booted_partition = i; 4251.54Sis } else 4261.54Sis printf("Ambiguous boot device\n"); 4271.54Sis } 4281.47Smhitch } 4291.47Smhitch } 4301.47Smhitch } 4311.76Smatt if (booted_device != 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.82Sgehenna#if NFD > 0 4531.82Sgehenna if (fd_bdevsw.d_strategy == dkp->dk_driver->d_strategy) 4541.82Sgehenna bdp = &fd_bdevsw; 4551.82Sgehenna#endif 4561.82Sgehenna#if NSD > 0 4571.82Sgehenna if (sd_bdevsw.d_strategy == dkp->dk_driver->d_strategy) 4581.82Sgehenna bdp = &sd_bdevsw; 4591.82Sgehenna#endif 4601.82Sgehenna#if NWD > 0 4611.82Sgehenna if (wd_bdevsw.d_strategy == dkp->dk_driver->d_strategy) 4621.82Sgehenna bdp = &wd_bdevsw; 4631.82Sgehenna#endif 4641.82Sgehenna#if NCD > 0 4651.82Sgehenna if (cd_bdevsw.d_strategy == dkp->dk_driver->d_strategy) 4661.82Sgehenna bdp = &cd_bdevsw; 4671.82Sgehenna#endif 4681.46Sthorpej#ifdef DIAGNOSTIC 4691.82Sgehenna if (bdp == NULL) 4701.46Sthorpej panic("findroot: impossible"); 4711.46Sthorpej#endif 4721.82Sgehenna maj = bdevsw_lookup_major(bdp); 4731.46Sthorpej 4741.46Sthorpej /* Open disk; forces read of disklabel. */ 4751.82Sgehenna if ((*bdp->d_open)(MAKEDISKDEV(maj, 4761.46Sthorpej unit, 0), FREAD|FNONBLOCK, 0, &proc0)) 4771.46Sthorpej continue; 4781.82Sgehenna (void)(*bdp->d_close)(MAKEDISKDEV(maj, 4791.46Sthorpej unit, 0), FREAD|FNONBLOCK, 0, &proc0); 4801.46Sthorpej 4811.46Sthorpej pp = &dkp->dk_label->d_partitions[0]; 4821.46Sthorpej if (pp->p_size != 0 && pp->p_fstype == FS_BSDFFS) { 4831.76Smatt booted_device = devs[unit]; 4841.76Smatt booted_partition = 0; 4851.46Sthorpej return; 4861.46Sthorpej } 4871.1Smw } 4881.1Smw } 4891.3Smw} 4901.17Schopps 4911.11Schopps/* 4921.11Schopps * Try to determine, of this machine is an A3000, which has a builtin 4931.11Schopps * realtime clock and scsi controller, so that this hardware is only 4941.11Schopps * included as "configured" if this IS an A3000 4951.11Schopps */ 4961.5Smw 4971.5Smwint a3000_flag = 1; /* patchable */ 4981.5Smw#ifdef A4000 4991.5Smwint a4000_flag = 1; /* patchable - default to A4000 */ 5001.5Smw#else 5011.5Smwint a4000_flag = 0; /* patchable */ 5021.5Smw#endif 5031.5Smw 5041.3Smwint 5051.11Schoppsis_a3000() 5061.3Smw{ 5071.11Schopps /* this is a dirty kludge.. but how do you do this RIGHT ? :-) */ 5081.22Schopps extern long boot_fphystart; 5091.11Schopps short sc; 5101.11Schopps 5111.19Schopps if ((machineid >> 16) == 3000) 5121.19Schopps return (1); /* It's an A3000 */ 5131.19Schopps if (machineid >> 16) 5141.19Schopps return (0); /* It's not an A3000 */ 5151.19Schopps /* Machine type is unknown, so try to guess it */ 5161.11Schopps /* where is fastram on the A4000 ?? */ 5171.11Schopps /* if fastram is below 0x07000000, assume it's not an A3000 */ 5181.22Schopps if (boot_fphystart < 0x07000000) 5191.17Schopps return(0); 5201.11Schopps /* 5211.11Schopps * OK, fastram starts at or above 0x07000000, check specific 5221.11Schopps * machines 5231.11Schopps */ 5241.17Schopps for (sc = 0; sc < ncfdev; sc++) { 5251.17Schopps switch (cfdev[sc].rom.manid) { 5261.17Schopps case 2026: /* Progressive Peripherals, Inc */ 5271.17Schopps switch (cfdev[sc].rom.prodid) { 5281.17Schopps case 0: /* PPI Mercury - A3000 */ 5291.17Schopps case 1: /* PP&S A3000 '040 */ 5301.17Schopps return(1); 5311.17Schopps case 150: /* PPI Zeus - it's an A2000 */ 5321.17Schopps case 105: /* PP&S A2000 '040 */ 5331.17Schopps case 187: /* PP&S A500 '040 */ 5341.17Schopps return(0); 5351.11Schopps } 5361.11Schopps break; 5371.3Smw 5381.17Schopps case 2112: /* IVS */ 5391.17Schopps switch (cfdev[sc].rom.prodid) { 5401.17Schopps case 242: 5411.17Schopps return(0); /* A2000 accelerator? */ 5421.11Schopps } 5431.11Schopps break; 5441.11Schopps } 5451.11Schopps } 5461.17Schopps return (a3000_flag); /* XXX let flag tell now */ 5471.5Smw} 5481.5Smw 5491.5Smwint 5501.11Schoppsis_a4000() 5511.5Smw{ 5521.19Schopps if ((machineid >> 16) == 4000) 5531.19Schopps return (1); /* It's an A4000 */ 5541.24Schopps if ((machineid >> 16) == 1200) 5551.24Schopps return (0); /* It's an A1200, so not A4000 */ 5561.36Sis#ifdef DRACO 5571.36Sis if (is_draco()) 5581.36Sis return (0); 5591.36Sis#endif 5601.24Schopps /* Do I need this any more? */ 5611.19Schopps if ((custom.deniseid & 0xff) == 0xf8) 5621.19Schopps return (1); 5631.19Schopps#ifdef DEBUG 5641.19Schopps if (a4000_flag) 5651.43Schristos printf("Denise ID = %04x\n", (unsigned short)custom.deniseid); 5661.19Schopps#endif 5671.19Schopps if (machineid >> 16) 5681.19Schopps return (0); /* It's not an A4000 */ 5691.19Schopps return (a4000_flag); /* Machine type not set */ 5701.24Schopps} 5711.24Schopps 5721.24Schoppsint 5731.24Schoppsis_a1200() 5741.24Schopps{ 5751.24Schopps if ((machineid >> 16) == 1200) 5761.24Schopps return (1); /* It's an A1200 */ 5771.24Schopps return (0); /* Machine type not set */ 5781.1Smw} 579