|
From: <ls...@us...> - 2008-07-20 15:00:55
|
Revision: 4329
http://jnode.svn.sourceforge.net/jnode/?rev=4329&view=rev
Author: lsantha
Date: 2008-07-20 14:59:22 +0000 (Sun, 20 Jul 2008)
Log Message:
-----------
Fixed VESA driver discovery and initialization.
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/DeviceToDriverMapper.java
trunk/gui/descriptors/org.jnode.driver.video.vesa.xml
Added Paths:
-----------
trunk/gui/src/driver/org/jnode/driver/video/vesa/VESADeviceToDriverMapper.java
Removed Paths:
-------------
trunk/gui/src/driver/org/jnode/driver/video/vesa/VESAFinder.java
Modified: trunk/core/src/driver/org/jnode/driver/DeviceToDriverMapper.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/DeviceToDriverMapper.java 2008-07-20 14:01:41 UTC (rev 4328)
+++ trunk/core/src/driver/org/jnode/driver/DeviceToDriverMapper.java 2008-07-20 14:59:22 UTC (rev 4329)
@@ -32,6 +32,11 @@
public interface DeviceToDriverMapper {
/**
+ * Match devices in a custom predefined way by the mapper.
+ */
+ public static final int MATCH_DEVICE_PREDEFINED = -1;
+
+ /**
* Match on exact device and exact revision, best possible match.
*/
public static final int MATCH_DEVICE_REVISION = 0;
Modified: trunk/gui/descriptors/org.jnode.driver.video.vesa.xml
===================================================================
--- trunk/gui/descriptors/org.jnode.driver.video.vesa.xml 2008-07-20 14:01:41 UTC (rev 4328)
+++ trunk/gui/descriptors/org.jnode.driver.video.vesa.xml 2008-07-20 14:59:22 UTC (rev 4329)
@@ -23,8 +23,7 @@
</runtime>
<extension point="org.jnode.driver.mappers">
- <!-- laptop Ideo Technologies -->
- <mapper id="03:00:00" driver-class="org.jnode.driver.video.vesa.VESADriver" class="org.jnode.driver.bus.pci.PCIClassToDriverMapper"/>
+ <mapper class="org.jnode.driver.video.vesa.VESADeviceToDriverMapper"/>
</extension>
<extension point="org.jnode.security.permissions">
Added: trunk/gui/src/driver/org/jnode/driver/video/vesa/VESADeviceToDriverMapper.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/video/vesa/VESADeviceToDriverMapper.java (rev 0)
+++ trunk/gui/src/driver/org/jnode/driver/video/vesa/VESADeviceToDriverMapper.java 2008-07-20 14:59:22 UTC (rev 4329)
@@ -0,0 +1,47 @@
+package org.jnode.driver.video.vesa;
+
+import org.jnode.driver.bus.pci.PCIDevice;
+import org.jnode.driver.bus.pci.PCIDeviceConfig;
+import org.jnode.driver.DeviceToDriverMapper;
+import org.jnode.driver.Driver;
+import org.jnode.driver.Device;
+import org.jnode.vm.x86.UnsafeX86;
+import org.vmmagic.unboxed.Address;
+
+/**
+ * Custom device Mapper for the VESA driver.
+ *
+ * @author Levente S\u00e1ntha
+ */
+public class VESADeviceToDriverMapper implements DeviceToDriverMapper {
+
+ public Driver findDriver(Device device) {
+ //PCI device needed
+ if (!(device instanceof PCIDevice))
+ return null;
+
+ //checking display controller device class
+ final PCIDevice pciDev = (PCIDevice) device;
+ final PCIDeviceConfig cfg = pciDev.getConfig();
+ if ((cfg.getBaseClass() & 0xFFFFFF) != 0x03)
+ return null;
+
+ //checking the VESA mode set up by GRUB
+ Address vbeControlInfo = UnsafeX86.getVbeControlInfos();
+ VbeInfoBlock vbeInfoBlock = new VbeInfoBlock(vbeControlInfo);
+ if (vbeInfoBlock.isEmpty())
+ return null;
+
+ Address vbeModeInfo = UnsafeX86.getVbeModeInfos();
+ ModeInfoBlock modeInfoBlock = new ModeInfoBlock(vbeModeInfo);
+ if (modeInfoBlock.isEmpty())
+ return null;
+
+ //OK
+ return new VESADriver();
+ }
+
+ public int getMatchLevel() {
+ return DeviceToDriverMapper.MATCH_DEVICE_PREDEFINED;
+ }
+}
Deleted: trunk/gui/src/driver/org/jnode/driver/video/vesa/VESAFinder.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/video/vesa/VESAFinder.java 2008-07-20 14:01:41 UTC (rev 4328)
+++ trunk/gui/src/driver/org/jnode/driver/video/vesa/VESAFinder.java 2008-07-20 14:59:22 UTC (rev 4329)
@@ -1,66 +0,0 @@
-/*
- * $Id: VGAFinder.java,v 1.6 2006/01/01 12:40:42 epr Exp $
- *
- * JNode.org
- * Copyright (C) 2003-2006 JNode.org
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
- * License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; If not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-package org.jnode.driver.video.vesa;
-
-import org.jnode.driver.Bus;
-import org.jnode.driver.Device;
-import org.jnode.driver.DeviceException;
-import org.jnode.driver.DeviceFinder;
-import org.jnode.driver.DeviceManager;
-import org.jnode.driver.DriverException;
-import org.jnode.vm.Unsafe;
-
-/**
- *
- * @author Fabien DUMINY (fduminy at jnode.org)
- *
- */
-public class VESAFinder implements DeviceFinder {
-
- public VESAFinder() {
- Unsafe.debug("created VESAFinder");
- }
-
- /**
- * @see org.jnode.driver.DeviceFinder#findDevices(org.jnode.driver.DeviceManager,
- * org.jnode.driver.Bus)
- */
- public void findDevices(DeviceManager devMan, Bus bus) throws DeviceException {
- try {
- devMan.register(new VESADevice(bus));
- } catch (DriverException ex) {
- Unsafe.debugStackTrace("error in findDevices", ex);
- throw new DeviceException(ex);
- }
- }
-
- public static class VESADevice extends Device {
-
- /**
- * @param bus
- */
- public VESADevice(Bus bus) throws DriverException {
- super(bus, "VESA");
- this.setDriver(new VESADriver());
- }
- }
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|