Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Feb 1997 02:47:34 +0100 (MET)
From:      Wolfgang Helbig <helbig@MX.BA-Stuttgart.De>
To:        se@freebsd.org (Stefan Esser)
Cc:        hackers@freebsd.org
Subject:   Re: CMD640b workaround - final(?) version
Message-ID:  <199702250147.CAA00172@helbig.informatik.ba-stuttgart.de>
In-Reply-To: <19970213004131.DV50639@x14.mi.uni-koeln.de> from Stefan Esser at "Feb 13, 97 00:41:31 am"

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Stefan,

I changed the code as you suggested. Now pci.c is clean again.
I added a new source pci/wdc_p.c. It is telling wd.c, which
pci-devices are probed, so wd.c can adapt to different devices.
Up to now only to CMD640b. If there are other IDE-PCI-Chips that
need special treatment, they can be easily detected in wd.c now and
treated accordingly.

I had to add a line in conf/files:

pci/wdc_p.c		optional wdc device-driver

For review, I include the source of wdc_p.c.
If you think it's okay now, I will post a diff-file for wd.c,
so kern/2305 can be closed.


Here is the source of /sys/pci/wdc_p.c
/*
 *
 * Copyright (c) 1996 Wolfgang Helbig <helbig@ba-stuttgart.de>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice immediately at the beginning of the file, without modification,
 *    this list of conditions, and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Absolutely no warranty of function or purpose is made by the author.
 * 4. Modifications may be freely made to this file if the above conditions
 *    are met.
 *
 *	$ID$
 */

#include "pci.h"
#if NPCI > 0

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <pci/pcireg.h>
#include <pci/pcivar.h>

#include "wdc.h"

extern char *wdc_pci __P((pcidi_t type));

static char* wdc_pci_probe __P((pcici_t tag, pcidi_t type));
static void wdc_pci_attach __P((pcici_t config_id, int unit));

static u_long wdc_pci_count = 0;

static struct pci_device wdc_pci_driver = {
	"wdc",
	wdc_pci_probe,
	wdc_pci_attach,
	&wdc_pci_count,
	NULL
};

DATA_SET (pcidevice_set, wdc_pci_driver);

static char*
wdc_pci_probe (pcici_t tag, pcidi_t type)
{
	char   *name;
	 
	if (name = wdc_pci(type))
		wdc_pci_count++;
	return name;
}

static void
wdc_pci_attach(config_id, unit)
	pcici_t config_id;
	int	unit;
{
	return;
}

#endif /* NPCI > 0 */



TIA
Wolfgang



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702250147.CAA00172>