ppc.c (af5487872e13a303aacabc5ec31b4821f7b15c32) ppc.c (f1d19042b082d95f07a0027e596ba2405aa8a9a5)
1/*-
2 * Copyright (c) 1997, 1998 Nicolas Souchu
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1997, 1998 Nicolas Souchu
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id: ppc.c,v 1.10 1998/10/22 05:58:40 bde Exp $
26 * $Id: ppc.c,v 1.11 1998/10/31 11:37:09 nsouch Exp $
27 *
28 */
29#include "ppc.h"
30
31#if NPPC > 0
32
33#include <sys/param.h>
34#include <sys/systm.h>

--- 200 unchanged lines hidden (view full) ---

235 "PMC", "TUP", "SID", "PNP0", "PNP1",
236 "LPTBA", NULL
237};
238
239static int
240ppc_pc873xx_detect(struct ppc_data *ppc, int chipset_mode) /* XXX mode never forced */
241{
242 static int index = 0;
27 *
28 */
29#include "ppc.h"
30
31#if NPPC > 0
32
33#include <sys/param.h>
34#include <sys/systm.h>

--- 200 unchanged lines hidden (view full) ---

235 "PMC", "TUP", "SID", "PNP0", "PNP1",
236 "LPTBA", NULL
237};
238
239static int
240ppc_pc873xx_detect(struct ppc_data *ppc, int chipset_mode) /* XXX mode never forced */
241{
242 static int index = 0;
243 int base, idport, irq;
243 int idport, irq;
244 int ptr, pcr, val, i;
245
246 while ((idport = pc873xx_basetab[index++])) {
247
248 /* XXX should check first to see if this location is already claimed */
249
250 /*
251 * Pull the 873xx through the power-on ID cycle (2.2,1.).

--- 444 unchanged lines hidden (view full) ---

696static int w83877f_efers[] = { 0x250, 0x3f0, 0x3f0, 0x250 };
697static int w83877f_keys[] = { 0x89, 0x86, 0x87, 0x88 };
698static int w83877f_keyiter[] = { 1, 2, 2, 1 };
699static int w83877f_hefs[] = { WINB_HEFERE, WINB_HEFRAS, WINB_HEFERE | WINB_HEFRAS, 0 };
700
701static int
702ppc_w83877f_detect(struct ppc_data *ppc, int chipset_mode)
703{
244 int ptr, pcr, val, i;
245
246 while ((idport = pc873xx_basetab[index++])) {
247
248 /* XXX should check first to see if this location is already claimed */
249
250 /*
251 * Pull the 873xx through the power-on ID cycle (2.2,1.).

--- 444 unchanged lines hidden (view full) ---

696static int w83877f_efers[] = { 0x250, 0x3f0, 0x3f0, 0x250 };
697static int w83877f_keys[] = { 0x89, 0x86, 0x87, 0x88 };
698static int w83877f_keyiter[] = { 1, 2, 2, 1 };
699static int w83877f_hefs[] = { WINB_HEFERE, WINB_HEFRAS, WINB_HEFERE | WINB_HEFRAS, 0 };
700
701static int
702ppc_w83877f_detect(struct ppc_data *ppc, int chipset_mode)
703{
704 int i, j, efer, base;
704 int i, j, efer;
705 unsigned char r, hefere, hefras;
706
707 for (i = 0; i < 4; i ++) {
708 /* first try to enable configuration registers */
709 efer = w83877f_efers[i];
710
711 /* write the key to the EFER */
712 for (j = 0; j < w83877f_keyiter[i]; j ++)

--- 158 unchanged lines hidden (view full) ---

871}
872
873/*
874 * ppc_generic_detect
875 */
876static int
877ppc_generic_detect(struct ppc_data *ppc, int chipset_mode)
878{
705 unsigned char r, hefere, hefras;
706
707 for (i = 0; i < 4; i ++) {
708 /* first try to enable configuration registers */
709 efer = w83877f_efers[i];
710
711 /* write the key to the EFER */
712 for (j = 0; j < w83877f_keyiter[i]; j ++)

--- 158 unchanged lines hidden (view full) ---

871}
872
873/*
874 * ppc_generic_detect
875 */
876static int
877ppc_generic_detect(struct ppc_data *ppc, int chipset_mode)
878{
879 char save_control;
880
881 /* default to generic */
882 ppc->ppc_link.adapter = &ppc_generic_adapter;
883
884 if (bootverbose)
885 printf("ppc%d:", ppc->ppc_unit);
886
887 if (!chipset_mode) {
888 /* first, check for ECP */

--- 414 unchanged lines hidden (view full) ---

1303 return;
1304}
1305
1306static int
1307ppcprobe(struct isa_device *dvp)
1308{
1309 static short next_bios_ppc = 0;
1310 struct ppc_data *ppc;
879 /* default to generic */
880 ppc->ppc_link.adapter = &ppc_generic_adapter;
881
882 if (bootverbose)
883 printf("ppc%d:", ppc->ppc_unit);
884
885 if (!chipset_mode) {
886 /* first, check for ECP */

--- 414 unchanged lines hidden (view full) ---

1301 return;
1302}
1303
1304static int
1305ppcprobe(struct isa_device *dvp)
1306{
1307 static short next_bios_ppc = 0;
1308 struct ppc_data *ppc;
1311 int error;
1312
1313 /*
1314 * If port not specified, use bios list.
1315 */
1316 if(dvp->id_iobase < 0) {
1317 if((next_bios_ppc < BIOS_MAX_PPC) &&
1318 (*(BIOS_PORTS+next_bios_ppc) != 0) ) {
1319 dvp->id_iobase = *(BIOS_PORTS+next_bios_ppc++);

--- 45 unchanged lines hidden (view full) ---

1365 ppc->ppc_link.adapter = &ppc_generic_adapter;
1366
1367 /*
1368 * Try to detect the chipset and its mode.
1369 */
1370 if (ppc_detect(ppc, dvp->id_flags & 0xf))
1371 goto error;
1372
1309
1310 /*
1311 * If port not specified, use bios list.
1312 */
1313 if(dvp->id_iobase < 0) {
1314 if((next_bios_ppc < BIOS_MAX_PPC) &&
1315 (*(BIOS_PORTS+next_bios_ppc) != 0) ) {
1316 dvp->id_iobase = *(BIOS_PORTS+next_bios_ppc++);

--- 45 unchanged lines hidden (view full) ---

1362 ppc->ppc_link.adapter = &ppc_generic_adapter;
1363
1364 /*
1365 * Try to detect the chipset and its mode.
1366 */
1367 if (ppc_detect(ppc, dvp->id_flags & 0xf))
1368 goto error;
1369
1373end_probe:
1374
1375 return (1);
1376
1377error:
1378 return (0);
1379}
1380
1381static int
1382ppcattach(struct isa_device *isdp)
1383{
1384 struct ppc_data *ppc = ppcdata[isdp->id_unit];
1385 struct ppb_data *ppbus;
1370 return (1);
1371
1372error:
1373 return (0);
1374}
1375
1376static int
1377ppcattach(struct isa_device *isdp)
1378{
1379 struct ppc_data *ppc = ppcdata[isdp->id_unit];
1380 struct ppb_data *ppbus;
1386 char * mode;
1387
1388 printf("ppc%d: %s chipset (%s) in %s mode%s\n", ppc->ppc_unit,
1389 ppc_types[ppc->ppc_type], ppc_avms[ppc->ppc_avm],
1390 ppc_modes[ppc->ppc_mode], (PPB_IS_EPP(ppc->ppc_mode)) ?
1391 ppc_epp_protocol[ppc->ppc_epp] : "");
1392
1393 isdp->id_ointr = ppcintr;
1394

--- 19 unchanged lines hidden ---
1381
1382 printf("ppc%d: %s chipset (%s) in %s mode%s\n", ppc->ppc_unit,
1383 ppc_types[ppc->ppc_type], ppc_avms[ppc->ppc_avm],
1384 ppc_modes[ppc->ppc_mode], (PPB_IS_EPP(ppc->ppc_mode)) ?
1385 ppc_epp_protocol[ppc->ppc_epp] : "");
1386
1387 isdp->id_ointr = ppcintr;
1388

--- 19 unchanged lines hidden ---