* sys & legacy buses plus interrupt controller and IDE support
@ 2002-02-12 8:59 Pavel Machek
2002-02-14 8:06 ` Andrey Panin
0 siblings, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2002-02-12 8:59 UTC (permalink / raw)
To: Patrick Mochel, kernel list
Hi!
Here it goes. For now I only put one device on each bus (sys &
legacy), but I'll quickly expand it once merged. Please apply,
Pavel
--- linux/arch/i386/kernel/i8259.c Thu Jan 31 23:39:28 2002
+++ linux-dm/arch/i386/kernel/i8259.c Tue Feb 12 09:48:48 2002
@@ -11,6 +11,7 @@
#include <linux/smp_lock.h>
#include <linux/init.h>
#include <linux/kernel_stat.h>
+#include <linux/device.h>
#include <asm/atomic.h>
#include <asm/system.h>
@@ -333,6 +334,19 @@
goto handle_real_irq;
}
}
+
+static struct device device_i8259A = {
+ name: "i8259A",
+ bus_id: "0020",
+ parent: &device_sys,
+};
+
+static void __init init_8259A_devicefs(void)
+{
+ device_register(&device_i8259A);
+}
+
+__initcall(init_8259A_devicefs);
void __init init_8259A(int auto_eoi)
{
--- linux/drivers/base/core.c Mon Feb 11 20:51:46 2002
+++ linux-dm/drivers/base/core.c Mon Feb 11 23:35:55 2002
@@ -24,6 +24,18 @@
name: "System Root",
};
+struct device device_sys = {
+ bus_id: "sys",
+ name: "Bus for motherboard devices",
+ parent: &device_root,
+};
+
+struct device device_legacy = {
+ bus_id: "legacy",
+ name: "Bus for devices on southbridge/X-BUS/ISA",
+ parent: &device_root,
+};
+
int (*platform_notify)(struct device * dev) = NULL;
int (*platform_notify_remove)(struct device * dev) = NULL;
@@ -121,7 +133,13 @@
static int __init device_init_root(void)
{
- return device_register(&device_root);
+ int res;
+ res = device_register(&device_root);
+ if (res) return res;
+ res = device_register(&device_sys);
+ if (res) return res;
+ res = device_register(&device_legacy);
+ if (res) return res;
}
static int __init device_init(void)
--- linux/drivers/ide/ide-disk.c Mon Feb 11 20:51:47 2002
+++ linux-dm/drivers/ide/ide-disk.c Mon Feb 11 23:35:09 2002
@@ -925,12 +925,16 @@
ide_add_setting(drive, "max_failures", SETTING_RW, -1, -1, TYPE_INT, 0, 65535, 1, 1, &drive->max_failures, NULL);
}
+static struct device_driver idedisk_device_driver = {
+};
+
static void idedisk_setup (ide_drive_t *drive)
{
int i;
struct hd_driveid *id = drive->id;
unsigned long capacity;
+ int myid = -1;
idedisk_add_settings(drive);
@@ -953,11 +957,20 @@
ide_hwif_t *hwif = HWIF(drive);
if (drive != &hwif->drives[i]) continue;
+ myid = i;
hwif->gd->de_arr[i] = drive->de;
if (drive->removable)
hwif->gd->flags[i] |= GENHD_FL_REMOVABLE;
break;
}
+ {
+ ide_hwif_t *hwif = HWIF(drive);
+ sprintf(drive->device.bus_id, "%d", myid);
+ sprintf(drive->device.name, "ide-disk");
+ drive->device.driver = &idedisk_device_driver;
+ drive->device.parent = &hwif->device;
+ device_register(&drive->device);
+ }
/* Extract geometry if we did not already have one for the drive */
if (!drive->cyl || !drive->head || !drive->sect) {
@@ -1033,6 +1046,7 @@
static int idedisk_cleanup (ide_drive_t *drive)
{
+ put_device(&drive->device);
if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache)
if (do_idedisk_flushcache(drive))
printk (KERN_INFO "%s: Write Cache FAILED Flushing!\n",
--- linux/drivers/ide/ide-probe.c Thu Jan 31 23:39:35 2002
+++ linux-dm/drivers/ide/ide-probe.c Mon Feb 11 23:36:41 2002
@@ -469,6 +469,11 @@
static void hwif_register (ide_hwif_t *hwif)
{
+ sprintf(hwif->device.bus_id, "%04x", hwif->io_ports[IDE_DATA_OFFSET]);
+ sprintf(hwif->device.name, "ide");
+ hwif->device.driver_data = hwif;
+ hwif->device.parent = &device_legacy;
+ device_register(&hwif->device);
if (((unsigned long)hwif->io_ports[IDE_DATA_OFFSET] | 7) ==
((unsigned long)hwif->io_ports[IDE_STATUS_OFFSET])) {
ide_request_region(hwif->io_ports[IDE_DATA_OFFSET], 8, hwif->name);
--- linux/drivers/ide/ide.c Mon Feb 11 20:51:47 2002
+++ linux-dm/drivers/ide/ide.c Mon Feb 11 23:35:09 2002
@@ -2027,6 +2024,7 @@
hwif = &ide_hwifs[index];
if (!hwif->present)
goto abort;
+ put_device(&hwif->device);
for (unit = 0; unit < MAX_DRIVES; ++unit) {
drive = &hwif->drives[unit];
if (!drive->present)
--- linux/include/linux/device.h Mon Feb 11 21:10:52 2002
+++ linux-dm/include/linux/device.h Mon Feb 11 23:35:09 2002
@@ -162,5 +142,7 @@
}
extern void put_device(struct device * dev);
+extern struct device device_legacy;
+extern struct device device_sys;
#endif /* _DEVICE_H_ */
--- linux/include/linux/ide.h Mon Feb 11 21:15:04 2002
+++ linux-dm/include/linux/ide.h Mon Feb 11 23:35:09 2002
@@ -14,6 +14,7 @@
#include <linux/blkdev.h>
#include <linux/proc_fs.h>
#include <linux/devfs_fs_kernel.h>
+#include <linux/device.h>
#include <asm/hdreg.h>
/*
@@ -448,6 +449,7 @@
byte acoustic; /* acoustic management */
unsigned int failures; /* current failure count */
unsigned int max_failures; /* maximum allowed failure count */
+ struct device device;
} ide_drive_t;
/*
@@ -580,6 +582,7 @@
void *hwif_data; /* extra hwif data */
ide_busproc_t *busproc; /* driver soft-power interface */
byte bus_state; /* power state of the IDE bus */
+ struct device device;
} ide_hwif_t;
/*
--
(about SSSCA) "I don't say this lightly. However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: sys & legacy buses plus interrupt controller and IDE support
2002-02-12 8:59 sys & legacy buses plus interrupt controller and IDE support Pavel Machek
@ 2002-02-14 8:06 ` Andrey Panin
2002-02-14 9:35 ` Pavel Machek
2002-02-14 21:47 ` Pavel Machek
0 siblings, 2 replies; 5+ messages in thread
From: Andrey Panin @ 2002-02-14 8:06 UTC (permalink / raw)
To: Pavel Machek; +Cc: linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 573 bytes --]
Hi Pavel,
On Tue, Feb 12, 2002 at 09:59:55AM +0100, Pavel Machek wrote:
> Here it goes. For now I only put one device on each bus (sys &
> legacy), but I'll quickly expand it once merged. Please apply,
please take a quick look at attached patch. It's your patch with
minor modification, hwif->pci_dev used as parent for ide interface.
I made it because it was strange to see HPT370 IDE interface
under legacy bus :))
Best regards.
--
Andrey Panin | Embedded systems software engineer
pazke@orbita1.ru | PGP key: wwwkeys.eu.pgp.net
[-- Attachment #1.2: patch-ide-driverfs --]
[-- Type: text/plain, Size: 3676 bytes --]
diff -urN -X /usr/dontdiff /linux.vanilla/drivers/ide/ide-disk.c /linux/drivers/ide/ide-disk.c
--- /linux.vanilla/drivers/ide/ide-disk.c Wed Feb 13 21:47:39 2002
+++ /linux/drivers/ide/ide-disk.c Wed Feb 13 21:49:20 2002
@@ -925,12 +925,16 @@
ide_add_setting(drive, "max_failures", SETTING_RW, -1, -1, TYPE_INT, 0, 65535, 1, 1, &drive->max_failures, NULL);
}
+static struct device_driver idedisk_device_driver = {
+};
+
static void idedisk_setup (ide_drive_t *drive)
{
int i;
struct hd_driveid *id = drive->id;
unsigned long capacity;
+ int myid = -1;
idedisk_add_settings(drive);
@@ -953,11 +957,20 @@
ide_hwif_t *hwif = HWIF(drive);
if (drive != &hwif->drives[i]) continue;
+ myid = i;
hwif->gd->de_arr[i] = drive->de;
if (drive->removable)
hwif->gd->flags[i] |= GENHD_FL_REMOVABLE;
break;
}
+ {
+ ide_hwif_t *hwif = HWIF(drive);
+ sprintf(drive->device.bus_id, "%d", myid);
+ sprintf(drive->device.name, "ide-disk");
+ drive->device.driver = &idedisk_device_driver;
+ drive->device.parent = &hwif->device;
+ device_register(&drive->device);
+ }
/* Extract geometry if we did not already have one for the drive */
if (!drive->cyl || !drive->head || !drive->sect) {
@@ -1033,6 +1046,7 @@
static int idedisk_cleanup (ide_drive_t *drive)
{
+ put_device(&drive->device);
if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache)
if (do_idedisk_flushcache(drive))
printk (KERN_INFO "%s: Write Cache FAILED Flushing!\n",
diff -urN -X /usr/dontdiff /linux.vanilla/drivers/ide/ide-pnp.c /linux/drivers/ide/ide-pnp.c
--- /linux.vanilla/drivers/ide/ide-pnp.c Wed Feb 13 21:47:39 2002
+++ /linux/drivers/ide/ide-pnp.c Wed Feb 13 23:04:24 2002
@@ -57,6 +57,7 @@
static int __init pnpide_generic_init(struct pci_dev *dev, int enable)
{
hw_regs_t hw;
+ ide_hwif_t *hwif;
int index;
if (!enable)
@@ -69,9 +70,10 @@
generic_ide_offsets, (ide_ioreg_t) DEV_IO(dev, 1),
0, NULL, DEV_IRQ(dev, 0));
- index = ide_register_hw(&hw, NULL);
+ index = ide_register_hw(&hw, &hwif);
if (index != -1) {
+ hwif->pci_dev = dev;
printk("ide%d: %s IDE interface\n", index, DEV_NAME(dev));
return 0;
}
diff -urN -X /usr/dontdiff /linux.vanilla/drivers/ide/ide-probe.c /linux/drivers/ide/ide-probe.c
--- /linux.vanilla/drivers/ide/ide-probe.c Wed Feb 13 21:47:39 2002
+++ /linux/drivers/ide/ide-probe.c Wed Feb 13 23:21:59 2002
@@ -46,6 +46,7 @@
#include <linux/delay.h>
#include <linux/ide.h>
#include <linux/spinlock.h>
+#include <linux/pci.h>
#include <asm/byteorder.h>
#include <asm/irq.h>
@@ -469,6 +470,14 @@
static void hwif_register (ide_hwif_t *hwif)
{
+ sprintf(hwif->device.bus_id, "%04x", hwif->io_ports[IDE_DATA_OFFSET]);
+ sprintf(hwif->device.name, "ide");
+ hwif->device.driver_data = hwif;
+ if (hwif->pci_dev)
+ hwif->device.parent = &hwif->pci_dev->dev;
+ else
+ hwif->device.parent = &device_legacy;
+ device_register(&hwif->device);
if (((unsigned long)hwif->io_ports[IDE_DATA_OFFSET] | 7) ==
((unsigned long)hwif->io_ports[IDE_STATUS_OFFSET])) {
ide_request_region(hwif->io_ports[IDE_DATA_OFFSET], 8, hwif->name);
diff -urN -X /usr/dontdiff /linux.vanilla/drivers/ide/ide.c /linux/drivers/ide/ide.c
--- /linux.vanilla/drivers/ide/ide.c Wed Feb 13 21:47:39 2002
+++ /linux/drivers/ide/ide.c Wed Feb 13 21:49:20 2002
@@ -2027,6 +2027,7 @@
hwif = &ide_hwifs[index];
if (!hwif->present)
goto abort;
+ put_device(&hwif->device);
for (unit = 0; unit < MAX_DRIVES; ++unit) {
drive = &hwif->drives[unit];
if (!drive->present)
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: sys & legacy buses plus interrupt controller and IDE support
2002-02-14 8:06 ` Andrey Panin
@ 2002-02-14 9:35 ` Pavel Machek
2002-02-14 10:01 ` Andrey Panin
2002-02-14 21:47 ` Pavel Machek
1 sibling, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2002-02-14 9:35 UTC (permalink / raw)
To: linux-kernel; +Cc: pazke
Hi!
> > Here it goes. For now I only put one device on each bus (sys &
> > legacy), but I'll quickly expand it once merged. Please apply,
>
> please take a quick look at attached patch. It's your patch with
> minor modification, hwif->pci_dev used as parent for ide interface.
Looks good...
> I made it because it was strange to see HPT370 IDE interface
> under legacy bus :))
Are you sure? I mean, that device is southbridge-integrated? Are you
sure it is really on PCI? Does it use PCI interrupt?
Anyway, it is probably less confusing to put the device onto PCI,
because people expect it there, and it was simple enough change. I'll
merge in into my local tree.
Thanx,
Pavel
--
Casualities in World Trade Center: ~3k dead inside the building,
cryptography in U.S.A. and free speech in Czech Republic.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: sys & legacy buses plus interrupt controller and IDE support
2002-02-14 9:35 ` Pavel Machek
@ 2002-02-14 10:01 ` Andrey Panin
0 siblings, 0 replies; 5+ messages in thread
From: Andrey Panin @ 2002-02-14 10:01 UTC (permalink / raw)
To: Pavel Machek; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1082 bytes --]
On Чтв, Фев 14, 2002 at 10:35:47 +0100, Pavel Machek wrote:
> Hi!
>
> > > Here it goes. For now I only put one device on each bus (sys &
> > > legacy), but I'll quickly expand it once merged. Please apply,
> >
> > please take a quick look at attached patch. It's your patch with
> > minor modification, hwif->pci_dev used as parent for ide interface.
>
> Looks good...
>
> > I made it because it was strange to see HPT370 IDE interface
> > under legacy bus :))
>
> Are you sure? I mean, that device is southbridge-integrated?
> Are you sure it is really on PCI? Does it use PCI interrupt?
I'm absolutely sure. HPT370 is a separate IDE controller chip
connected to PCI bus. Can't provide /proc/pci right now,
it's my home machine.
> Anyway, it is probably less confusing to put the device onto PCI,
> because people expect it there, and it was simple enough change. I'll
> merge in into my local tree.
>
Best regards.
--
Andrey Panin | Embedded systems software engineer
pazke@orbita1.ru | PGP key: wwwkeys.eu.pgp.net
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: sys & legacy buses plus interrupt controller and IDE support
2002-02-14 8:06 ` Andrey Panin
2002-02-14 9:35 ` Pavel Machek
@ 2002-02-14 21:47 ` Pavel Machek
1 sibling, 0 replies; 5+ messages in thread
From: Pavel Machek @ 2002-02-14 21:47 UTC (permalink / raw)
To: Andrey Panin; +Cc: kernel list
Hi!
> On Tue, Feb 12, 2002 at 09:59:55AM +0100, Pavel Machek wrote:
> > Here it goes. For now I only put one device on each bus (sys &
> > legacy), but I'll quickly expand it once merged. Please apply,
>
> please take a quick look at attached patch. It's your patch with
> minor modification, hwif->pci_dev used as parent for ide interface.
>
> I made it because it was strange to see HPT370 IDE interface
> under legacy bus :))
Thanx, applied. [Dunno when/if I'm able to push this to linus. I'll
certainly try.]
Pavel
--
(about SSSCA) "I don't say this lightly. However, I really think that the U.S.
no longer is classifiable as a democracy, but rather as a plutocracy." --hpa
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-02-16 21:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-12 8:59 sys & legacy buses plus interrupt controller and IDE support Pavel Machek
2002-02-14 8:06 ` Andrey Panin
2002-02-14 9:35 ` Pavel Machek
2002-02-14 10:01 ` Andrey Panin
2002-02-14 21:47 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox